Hi,
I found the reason of this misbehaviour:
The transparency of the color bands have been set to 80% by program code, but this setting is ignored by the export function TeeSaveToPDFFile.
Here is an example code to comprehend this effect:
Code: Select all
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VclTee.TeeGDIPlus, VCLTee.TeEngine,
Vcl.ExtCtrls, VCLTee.TeeProcs, VCLTee.Chart, VCLTee.TeeTools, VCLTee.Series,
Vcl.StdCtrls, VCLTee.TeePDFCanvas;
type
TForm1 = class(TForm)
Chart1: TChart;
Button1: TButton;
Button2: TButton;
SaveDialog1: TSaveDialog;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
FName: string;
begin
SaveDialog1.Filter := 'PDF file (*.pdf)|*.pdf';
if not SaveDialog1.Execute then Exit;
FName := SaveDialog1.FileName;
if ExtractFileExt(FName) = '' then FName := FName + '.pdf';
try
TeeSaveToPDFFile(Chart1,FName);
except
on E:exception do ShowMessage(E.Message);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
I,Bands: integer;
W,X: double;
begin
Chart1.Tools.Clear;
Bands := 3 + Random(20);
with Chart1.BottomAxis do W := Maximum - Minimum;
for I := 0 to Bands-1 do
begin
with Chart1.Tools.Add(TColorBandTool) as TColorBandTool do
begin
Axis := Chart1.BottomAxis;
StartValue := Axis.Minimum + I*W/Bands;
EndValue := StartValue + W/Bands;
DrawBehindAxes := true;
AllowDrag := false;
if Odd(I) then Color := clLime else Color := clYellow;
ResizeStart := false;
ResizeEnd := false;
Pen.Visible := false;
StartLinePen.Visible := false;
EndLinePen.Visible := false;
Transparency := 80;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
aLineSeries: TLineSeries;
begin
aLineSeries := TLineSeries.Create(self);
Chart1.AddSeries(aLineSeries);
aLineSeries.FillSampleValues(100);
end;
end.
The results are shown in the attached pictures.
Is there a solution to solve the problem?