Page 1 of 1

Using stacked area series with a transparent series

Posted: Thu Sep 01, 2005 4:57 am
by 9343038
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;

Posted: Fri Sep 02, 2005 7:43 am
by narcis
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.

Posted: Fri Sep 02, 2005 10:32 pm
by 9343038
Narcis,

Thanks! works like a charm.

This was important to get my printing routines working.

--Paul