ValueColor

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Al1
Newbie
Newbie
Posts: 14
Joined: Tue Jan 20, 2009 12:00 am

ValueColor

Post by Al1 » Tue May 12, 2009 5:15 pm

Hey,
Since TeeSaveToPDFFile is not valid with Delphi 2009 (and TeeChart Pro 8.04), I try to export my graphs from QuickReport 5 with Gnostice Technologies...
I have installed QRChart (which is a little hard)! After that, I have created a form containing a QuickRep component and a QRChart. Her is my code:

Code: Select all

procedure TForm1.SpeedButtonPDFClick(Sender: TObject);
begin
  if SaveDialog1.Execute
  then
  begin
//    TeeSaveToPDFFile(Chart1, SaveDialog1.FileName, Chart1.Width, Chart1.Height);
    Screen.Cursor := crHourGlass;
    Form2 := TForm2.Create(nil);
    try
      Form2.QRChart1.SetChart(Chart1);
//      Form2.QuickRep1.PreviewModal;
      Form2.gtPDFEngine1.FileName := SaveDialog1.FileName;
      Form2.gtQRExportInterface1.RenderDocument(Form2.QuickRep1, False);
    finally
      Form2.Release;
      Screen.Cursor := crDefault;
    end;
  end;
end;
Chart1 has only a PieSeries. Everything is perfectly working with this code, excepted a strange problem with the value colors.
The values are inserted with the AddPie method and only AValue and ALabel parameters (not AColor in order to use the default color).
Graphs with 1 or 2 values are ok, but another with 9 values is not correctly copied: colors became (yellow, blue, white, gray, ...) instead of (red, green, yellow, blue, ...)!
This issue is not coming from the PDF export because it occurs also in a preview of the report!
Is it a bug?
--
Alain

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Wed May 13, 2009 7:52 am

Hi Alain,

I've tested it and I see the preview with the good colors (dark blue, orange, red, soft blue, marine blue, dark green,...) of the opera palette.
I used this code and a teecommander to see the export preview.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.AddSeries(TPieSeries.Create(self));

  with (Chart1[0] as TPieSeries) do
  begin
    AddPie(10,'one');
    AddPie(19,'two');
    AddPie(20,'three');
    AddPie(18,'four');
    AddPie(16,'five');
    AddPie(25,'six');
  end;
end;
Please, could you send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Al1
Newbie
Newbie
Posts: 14
Joined: Tue Jan 20, 2009 12:00 am

ValueColor

Post by Al1 » Wed May 13, 2009 10:11 am

I have uploaded a simple project which reproduce the problem...
A Form with a Chart having a PieSeries and a SpeedButton to clone the graph in another Chart to anaother Form.
ValueColors are modified!
--
Alain

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Wed May 13, 2009 11:33 am

Hi

It seems that having pie series with OtherSlice.Style := poBelowPercent and you clone the series, the colors seem to be copied in different indexes.

Easy to reproduce with this:

Code: Select all

uses series;

var Series1: TPieSeries;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1 := TPieSeries.Create(self);
  Chart1.AddSeries(Series1);

  with Series1 do
  begin
    AddPie(30, 'Part1');
    AddPie(30, 'Part2');
    AddPie(20, 'Part3');
    AddPie(10, 'Part4');

    OtherSlice.Style := poBelowPercent;
    OtherSlice.Value := 20;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var Series2: TPieSeries;
begin
  Series2 := TPieSEries(CloneChartSeries(Series1, Chart2));
  Chart2.AddSeries(Series2);

  with Series2 do
  begin
    OtherSlice.Style := Series1.OtherSlice.Style;
    OtherSlice.Value := Series1.OtherSlice.Value;
  end;
end;
I've added this to the wish list to be fixed in future releases (TV52014152)
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Al1
Newbie
Newbie
Posts: 14
Joined: Tue Jan 20, 2009 12:00 am

Post by Al1 » Wed May 13, 2009 1:16 pm

Thank you for your help!
This code is ok:

Code: Select all

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  Form2 := TForm2.Create(nil);
  try
    Series1.OtherSlice.Style := poNone;
    CloneChartSeries(Series1, Chart1).ParentChart := Form2.Chart1;
    Series1.OtherSlice.Style := poBelowPercent;
    TPieSeries(Form2.Chart1[0]).OtherSlice.Style := poBelowPercent;
    Form2.ShowModal;
  finally
    Form2.Release;
  end;
end;
Best regards,
--
Alain

Post Reply