Series Chart color and Legend Chart color.
Series Chart color and Legend Chart color.
If I set the series color manually, how do I set the associated color in the little box in the legend to the same color?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Series Chart color and Legend Chart color.
Hello,
I'm not sure about which is your exact problem. If I run the code snippet below bar's legend symbol becomes red. Can you please attach a simple example project we can run "as-is" to reproduce the problem here?
Thanks in advance.
I'm not sure about which is your exact problem. If I run the code snippet below bar's legend symbol becomes red. Can you please attach a simple example project we can run "as-is" to reproduce the problem here?
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.AddSeries(TBarSeries.Create(Self)).FillSampleValues;
Chart1[0].Color:=clRed;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Series Chart color and Legend Chart color.
Enclosed is a simple project. DelphiXE7 Win7Pro64Bit
In your FormCreate, the chart hasn't displayed yet.
In my project - the chart and legend with legend colors are visible and when you click Button1, the 3 series are loaded, their colors set and displayed and the legend colors remain as they were on startup!
How do I reset the legend colors?
In your FormCreate, the chart hasn't displayed yet.
In my project - the chart and legend with legend colors are visible and when you click Button1, the 3 series are loaded, their colors set and displayed and the legend colors remain as they were on startup!
How do I reset the legend colors?
- Attachments
-
- SeriesLegend.zip
- (100.22 KiB) Downloaded 891 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Series Chart color and Legend Chart color.
Hello,
Your code is setting specific point color but not the general color for the series. You should use TChartSeries.Color property instead:
Actually, you could even remove color setting for each point:
Your code is setting specific point color but not the general color for the series. You should use TChartSeries.Color property instead:
Code: Select all
procedure TForm2.Button1Click(Sender: TObject);
var
clrBar1, clrBar2, clrBar3: TColor;
begin
clrBar1 := clWebLightCyan;
clrBar2 := clWebLightSteelBlue;
clrBar3 := clWebLemonChiffon;
Chart[0].Color:=clrBar1;
Chart[0].Add(7, '01/04/2004', clrBar1);
Chart[0].Add(17,'01/11/2004', clrBar1);
Chart[0].Add(6, '01/18/2004', clrBar1);
Chart[0].Add(12,'01/25/2004', clrBar1);
Chart[0].Add(5, '02/01/2004', clrBar1);
Chart[0].Add(7, '02/08/2004', clrBar1);
Chart[0].Add(14,'02/15/2004', clrBar1);
Chart[0].Add(4, '02/22/2004', clrBar1);
Chart[0].Add(12,'03/01/2004', clrBar1);
Chart[0].Add(9, '03/08/2004', clrBar1);
Chart[0].Add(17,'03/15/2004', clrBar1);
Chart[0].Add(2, '03/22/2004', clrBar1);
Chart[0].Add(5, '03/29/2004', clrBar1);
Chart[0].Add(10,'04/06/2004', clrBar1);
Chart[0].Add(6, '04/13/2004', clrBar1);
Chart[1].Color:=clrBar2;
Chart[1].Add(17, '01/04/2004', clrBar2);
Chart[1].Add(27,'01/11/2004', clrBar2);
Chart[1].Add(16, '01/18/2004', clrBar2);
Chart[1].Add(22,'01/25/2004', clrBar2);
Chart[1].Add(15, '02/01/2004', clrBar2);
Chart[1].Add(17, '02/08/2004', clrBar2);
Chart[1].Add(24,'02/15/2004', clrBar2);
Chart[1].Add(14, '02/22/2004', clrBar2);
Chart[1].Add(22,'03/01/2004', clrBar2);
Chart[1].Add(19, '03/08/2004', clrBar2);
Chart[1].Add(27,'03/15/2004', clrBar2);
Chart[1].Add(12, '03/22/2004', clrBar2);
Chart[1].Add(15, '03/29/2004', clrBar2);
Chart[1].Add(20,'04/06/2004', clrBar2);
Chart[1].Add(16, '04/13/2004', clrBar2);
Chart[2].Color:=clrBar3;
Chart[2].Add(27, '01/04/2004', clrBar3);
Chart[2].Add(37,'01/11/2004', clrBar3);
Chart[2].Add(26, '01/18/2004', clrBar3);
Chart[2].Add(32,'01/25/2004', clrBar3);
Chart[2].Add(25, '02/01/2004', clrBar3);
Chart[2].Add(27, '02/08/2004', clrBar3);
Chart[2].Add(34,'02/15/2004', clrBar3);
Chart[2].Add(24, '02/22/2004', clrBar3);
Chart[2].Add(32,'03/01/2004', clrBar3);
Chart[2].Add(29, '03/08/2004', clrBar3);
Chart[2].Add(37,'03/15/2004', clrBar3);
Chart[2].Add(22, '03/22/2004', clrBar3);
Chart[2].Add(25, '03/29/2004', clrBar3);
Chart[2].Add(30,'04/06/2004', clrBar3);
Chart[2].Add(26, '04/13/2004', clrBar3);
end;
Code: Select all
procedure TForm2.Button1Click(Sender: TObject);
begin
Chart[0].Color := clWebLightCyan;
Chart[1].Color := clWebLightSteelBlue;
Chart[2].Color := clWebLemonChiffon;
Chart[0].Add(7, '01/04/2004');
Chart[0].Add(17,'01/11/2004');
Chart[0].Add(6, '01/18/2004');
Chart[0].Add(12,'01/25/2004');
Chart[0].Add(5, '02/01/2004');
Chart[0].Add(7, '02/08/2004');
Chart[0].Add(14,'02/15/2004');
Chart[0].Add(4, '02/22/2004');
Chart[0].Add(12,'03/01/2004');
Chart[0].Add(9, '03/08/2004');
Chart[0].Add(17,'03/15/2004');
Chart[0].Add(2, '03/22/2004');
Chart[0].Add(5, '03/29/2004');
Chart[0].Add(10,'04/06/2004');
Chart[0].Add(6, '04/13/2004');
Chart[1].Add(17, '01/04/2004');
Chart[1].Add(27,'01/11/2004');
Chart[1].Add(16, '01/18/2004');
Chart[1].Add(22,'01/25/2004');
Chart[1].Add(15, '02/01/2004');
Chart[1].Add(17, '02/08/2004');
Chart[1].Add(24,'02/15/2004');
Chart[1].Add(14, '02/22/2004');
Chart[1].Add(22,'03/01/2004');
Chart[1].Add(19, '03/08/2004');
Chart[1].Add(27,'03/15/2004');
Chart[1].Add(12, '03/22/2004');
Chart[1].Add(15, '03/29/2004');
Chart[1].Add(20,'04/06/2004');
Chart[1].Add(16, '04/13/2004');
Chart[2].Add(27, '01/04/2004');
Chart[2].Add(37,'01/11/2004');
Chart[2].Add(26, '01/18/2004');
Chart[2].Add(32,'01/25/2004');
Chart[2].Add(25, '02/01/2004');
Chart[2].Add(27, '02/08/2004');
Chart[2].Add(34,'02/15/2004');
Chart[2].Add(24, '02/22/2004');
Chart[2].Add(32,'03/01/2004');
Chart[2].Add(29, '03/08/2004');
Chart[2].Add(37,'03/15/2004');
Chart[2].Add(22, '03/22/2004');
Chart[2].Add(25, '03/29/2004');
Chart[2].Add(30,'04/06/2004');
Chart[2].Add(26, '04/13/2004');
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Series Chart color and Legend Chart color.
Excellent!
Thank you.
Thank you.
Re: Series Chart color and Legend Chart color.
Hi
This solution does not work for me. Not only that the legend does not have correct text color, it is not possible to change it with the Toolbox. I am using ErrorBar serie.
I am using Tee Chart Pro v2015.14.150120. I have to add that this error introduced in the latest release. I have not changes my coding after updating the Tee Chart.
Here are the images from the previous version and the new version of Tee chart:
As you can see "Early" and "Late" do not have the same color as the bars.
Please adivise how to solve this issue.
BR
emwamin
This solution does not work for me. Not only that the legend does not have correct text color, it is not possible to change it with the Toolbox. I am using ErrorBar serie.
I am using Tee Chart Pro v2015.14.150120. I have to add that this error introduced in the latest release. I have not changes my coding after updating the Tee Chart.
Code: Select all
Procedure myProcedure;
var
MySeries: TErrorBarSeries;
CL: TColor;
Begin
...
...
CL := clRed;
...
Chart1.FreeAllSeries(nil);
Chart1.Legend.Visible := true;
Chart1.Legend.FontSeriesColor := true;
Chart1.Legend.LegendStyle := LsSeries;
...
MySeries := TErrorBarSeries.Create( Self );
Chart1.AddSeries( MySeries );
MySeries.ParentChart := Chart1;
MySeries.Title := 'myTitle';
MySeries.Color := CL;
MySeries.ErrorStyle := essTopBottom;
...
MySeries.AddErrorBar(indx,valAverage,valSEM,'Text1',CL);
...
end;
Please adivise how to solve this issue.
BR
emwamin
Re: Series Chart color and Legend Chart color.
Hello,
Give it a try at the latest version, v2015.16. I could reproduce the problem with v2015.14 but not with the latest version.
Give it a try at the latest version, v2015.16. I could reproduce the problem with v2015.14 but not with the latest version.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Series Chart color and Legend Chart color.
Hi
I have upgraded to v2015.16 and can confirm that the problem is solved.
Thanks a lot.
BR
emwamin
I have upgraded to v2015.16 and can confirm that the problem is solved.
Thanks a lot.
BR
emwamin