ColorGrid AddPalette

TeeChart for ActiveX, COM and ASP
Post Reply
Posts: 36
Joined: Thu Aug 04, 2005 4:00 am

ColorGrid AddPalette

Post by TTL » Tue Apr 10, 2007 5:38 pm


I am not able to set negative values in the AddPalette() function of the ColorGrid object. I would like to map colors to values that range from -z1 to +z2, for example. I am using the following loop to create the colormap for two graphs (m_SpecColorGrid, which is used for a spectrogram, and PaletteColorGrid, which is used as the legend for the spectrogram). The result is a legend that goes from the first positive color to the last positive color (only the positive half is created):

Any suggestions? Thanks.

double dCurrentHeight = dRange;
double dDeltaHeight = dRange / COLOR_LEVELS;
for (int k = COLOR_LEVELS - 1; k >= 1; --k)
double color = double(k) / double(COLOR_LEVELS);
PaletteColorGrid.AddPalette(dCurrentHeight, RainbowColor(color));
m_SpecColorGrid.AddPalette(dCurrentHeight, RainbowColor(color));
dCurrentHeight -= dDeltaHeight;

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

Post by Narcís » Wed Apr 11, 2007 8:32 am


AddPalette method with negative values works fine here as you can see on this thread. Can you please check if it works fine at your end?

If the problem persists could you please send us a simple example project we can run "as-is" to reproduce the problem here and let us know which TeeChart version are you using?

You can post your files at news:// newsgroups or at

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply