Hi.
Chart uses an colorpalette to assign colors to series when they are added.
At runtime I clone the series x number of times. The problem with this is that every clone has the same color in the chart, and I can't tell them apart.
How can I use the charts coloring methods to get the next color?
E.g
newseries.color:= chart1.GetNextColor;
Thanks
Get next color, colorpalette
Get next color, colorpalette
Thanks
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Get next color, colorpalette
Hi Infront,
You can do something like this:
You can do something like this:
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
var i,j: Integer;
begin
Chart1.AddSeries(TLineSeries.Create(Self));
Chart1[0].FillSampleValues;
j:=0;
for i:=0 to 15 do
begin
CloneChartSeries(Chart1[0]);
while ((Chart1[Chart1.SeriesCount-1].Color = Chart1[0].Color) and
(j<High(Chart1.ColorPalette))) do
begin
Chart1[Chart1.SeriesCount-1].Color:=Chart1.ColorPalette[j];
inc(j);
end;
end;
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: Get next color, colorpalette
Thanks.
But how can I change the color palette used by the TChart.
I have tried this
And this
None of this attempts change the colors in Chart1.Colorpalette.
How can I get all charts to use a colorpalette that I define?
But how can I change the color palette used by the TChart.
I have tried this
Code: Select all
const Colors:Array[0..19] of TColor=
( clRed,
clGreen,
clYellow);
SetDefaultColorPalette(Colors);
Code: Select all
SetLength(TeeProcs.ColorPalette,2);
TeeProcs.ColorPalette[0] := clRed;
TeeProcs.ColorPalette[1] := clBlue;
TeeProcs.ColorPalette[2] := clYellow;
How can I get all charts to use a colorpalette that I define?
Thanks
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Get next color, colorpalette
Hi Infront,
You can change TeeChart palette to predefined or custom palettes as shown at the All Features\Welcome!\Aspect\Custom Palettes example in the new feature demo, available at TeeChart's program group.
You can change TeeChart palette to predefined or custom palettes as shown at the All Features\Welcome!\Aspect\Custom Palettes example in the new feature demo, available at TeeChart's program group.
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 |