Using stacked area series with a transparent series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
PvdE
Newbie
Newbie
Posts: 13
Joined: Tue Aug 16, 2005 4:00 am
Location: Washington, DC

Using stacked area series with a transparent series

Post by PvdE » Thu Sep 01, 2005 4:57 am

When I use the code below, I have two problems:

1. The right hand side of the transparent series is not transparent (it shows in 3D)

2. When I save the chart as an EMF file, the first series is no longer transparent; it is visible. PNG format and BMP format save the image as shown.

I'm not sure if my approach to a floating area chart is correct, but this is what almost works :)

--Paul

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
   S,V: integer;
   Series: TAreaSeries;
begin
for S := 1 to 3
do begin
   Series := TAreaSeries.Create(Chart1);
   Series.MultiArea := maStacked;
   Series.AreaLinesPen.Visible := false;
   Series.LinePen.Visible := false;
   if S = 1
   then
      Series.Transparency := 100;
   Chart1.AddSeries(Series);
   for V := 1 to 6
   do begin
      if S = 1
      then
         Series.AddY(10 * s + Sqr(v), IntToStr(V))
      else
         Series.AddY(Sqr(S + v), IntToStr(V))
      end;
   end
end;

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Sep 02, 2005 7:43 am

Hi Paul,

Please find below the answers to your questions:

1. Yes, you are right. This is a bug and I have added this issue to our defect list to be fixed for future releases. Some workarounds you can use are commented in the code below. First one is setting series brush to bsClear, the other one is setting chart to 2D view.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
   S,V: integer;
   Series: TAreaSeries;
begin
  for S := 1 to 3
  do begin
     Series := TAreaSeries.Create(Chart1);
     Series.MultiArea := maStacked;
     Series.AreaLinesPen.Visible := false;
     Series.LinePen.Visible := false;
     if S = 1
     then
        Series.Transparency := 100;
     Chart1.AddSeries(Series);
     for V := 1 to 6
     do begin
        if S = 1
        then
        begin
           Series.AddY(10 * s + Sqr(v), IntToStr(V));
           //Series.AreaBrush:=bsClear; //Workaround 1
        end
        else
           Series.AddY(Sqr(S + v), IntToStr(V))
        end;
     end;
  //Chart1.View3D:=false; //Workaround 2
  Chart1.SaveToMetafile('C:\TestApps\Delphi7\emftest.emf');
end;
2. Yes, transparency is not supported in metafiles and printing.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

PvdE
Newbie
Newbie
Posts: 13
Joined: Tue Aug 16, 2005 4:00 am
Location: Washington, DC

Post by PvdE » Fri Sep 02, 2005 10:32 pm

Narcis,

Thanks! works like a charm.

This was important to get my printing routines working.

--Paul

Post Reply