Custom Palette

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
sean
Newbie
Newbie
Posts: 11
Joined: Fri Jan 30, 2004 5:00 am
Location: uk
Contact:

Custom Palette

Post by sean » 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.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Jun 14, 2004 6:41 am

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();
Marjan Slatinek,
http://www.steema.com

sean
Newbie
Newbie
Posts: 11
Joined: Fri Jan 30, 2004 5:00 am
Location: uk
Contact:

Post by sean » Mon Jun 14, 2004 12:05 pm

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

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Jun 14, 2004 2:22 pm

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.
Marjan Slatinek,
http://www.steema.com

Xia
Newbie
Newbie
Posts: 47
Joined: Tue Oct 16, 2007 12:00 am

Post by Xia » Wed May 27, 2009 9:26 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed May 27, 2009 11:33 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Xia
Newbie
Newbie
Posts: 47
Joined: Tue Oct 16, 2007 12:00 am

Post by Xia » Wed May 27, 2009 11:41 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed May 27, 2009 2:24 pm

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!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply