ColorGrid AddPalette
Posted: Tue Apr 10, 2007 5:38 pm
Hello,
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.
Marc
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;
}
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.
Marc
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;
}