Page 1 of 1

Custom Palette

Posted: Sun Jun 13, 2004 9:00 pm
by 8442698
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.

Posted: Mon Jun 14, 2004 6:41 am
by Marjan
Hi.

Which Teechart version are you using ? Using v7.01 (but I think you'll get the same results with 7.00) I get correct results (6 entires in the legend, correct colors). Here is the code:

Code: Select all

  Series1.FillSampleValues(10);
  series1.UseColorRange:=false;
  series1.UsePalette:=true;
  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);

  Chart1.Refresh();

Posted: Mon Jun 14, 2004 12:05 pm
by 8442698
Ah, I've got Teechart 6.01 here, will go download the upgrade. Pasting your code snippet I get the same results, ie. the clred appears twice in the legend and the clnavy doesn't appear.
thanks for your help
Sean

Posted: Mon Jun 14, 2004 2:22 pm
by Marjan
Hi, Sean.

Yes, I, think v6.01 had some problems with palette list. Bu tI think we fixed in for v.7.0 release. Just to be sure, please send me small sample application (sources only) which I can run here using TeeChart v7.0. I'll send you back the compiled version (exe) and if it works, you could consider upgrading to TeeChart v7. You can send the sample applicaton to "marjan at steema dot com" email address.

Posted: Wed May 27, 2009 9:26 am
by 10047047
Hi,

I am not sure whether the reported legend palette problem has been resolved in the latest version.

I have the TeeChart Pro V8.02 but it has a similar problem when using the Legend Palette tool. If you define 5 custom palettes for a TColorGridSeries data and then add a Legend Palette tool using TChart editor in the design time, the Legend palette only displays the 3rd, 4th and 5th color palettes. It does not display the 1st and 2nd custom palettes and also shows the 5th color palette twice.

Cheers

Xia

Posted: Wed May 27, 2009 11:33 am
by narcis
Hi Xia,

I've tried this with v8.05, which was published last Monday, and I could reproduce the issue here. I've added it (TV52014190) to the bug list to be fixed for future releases.

Posted: Wed May 27, 2009 11:41 am
by 10047047
Dear Narcis,

Thanks for your speedy reply.

Is there a walk-around for this bug? Can I change the legend palette index number by programming?

Thanks

Xia

Posted: Wed May 27, 2009 2:24 pm
by narcis
Dear Xia,

The only workaround I can think of is something like this:

Code: Select all

  ChartTool1.Chart.Axes.Left.MinimumOffset:=30;
  ChartTool1.Chart.Axes.Right.MinimumOffset:=30;
Hope this helps!