Custom Palette
Posted: Sun Jun 13, 2004 9:00 pm
I have a tcolorgrid and have custom palette with-
series1.PaletteSteps:=6;
series1.ClearPalette();
datarange:=series1.YValues.Maxvalue-series1.YValues.Minvalue;
minval:=series1.YValues.Minvalue;
series1.AddPalette(minVal+(dataRange*0.1),Clnavy);
series1.AddPalette(minVal+(dataRange*0.2),Clblue);
series1.AddPalette(minVal+(dataRange*0.3),Claqua);
series1.AddPalette(minVal+(dataRange*0.4),Clyellow);
series1.AddPalette(minVal+(dataRange*0.5),Cllime);
series1.AddPalette(minVal+(dataRange*0.7),Clred);
series1.UseColorRange:=false;
series1.UsePalette:=true;
Chart1.Refresh();
The colours on the chart draw correcly, but the legend shows the colors incorrectly, it misses off clnacy and shows clred twice. Putting
legendtext:=inttostr(index);
into the ongetlegendtext event shows that index[0] is clred, index[1] is clred ... index[5] is clblue. What I expected was [0]=clnavy .. [5]=clred.
Is there an indexing bug in the addpalette somewhere, with palette colors being 1..6 and legend being 0..5 or something like that?
cheers
Sean.
series1.PaletteSteps:=6;
series1.ClearPalette();
datarange:=series1.YValues.Maxvalue-series1.YValues.Minvalue;
minval:=series1.YValues.Minvalue;
series1.AddPalette(minVal+(dataRange*0.1),Clnavy);
series1.AddPalette(minVal+(dataRange*0.2),Clblue);
series1.AddPalette(minVal+(dataRange*0.3),Claqua);
series1.AddPalette(minVal+(dataRange*0.4),Clyellow);
series1.AddPalette(minVal+(dataRange*0.5),Cllime);
series1.AddPalette(minVal+(dataRange*0.7),Clred);
series1.UseColorRange:=false;
series1.UsePalette:=true;
Chart1.Refresh();
The colours on the chart draw correcly, but the legend shows the colors incorrectly, it misses off clnacy and shows clred twice. Putting
legendtext:=inttostr(index);
into the ongetlegendtext event shows that index[0] is clred, index[1] is clred ... index[5] is clblue. What I expected was [0]=clnavy .. [5]=clred.
Is there an indexing bug in the addpalette somewhere, with palette colors being 1..6 and legend being 0..5 or something like that?
cheers
Sean.