Page 1 of 1

colourgrid palette

Posted: Wed Jun 09, 2004 12:22 am
by 8442698
I have a tcolourgrid, not 3D mode, x is 1 to 15, z is 1 to 300, y varies between 2.0 and 12.0. I'd like to assign my own colour palette to values of y in bands - col1=2.0 to 3.0, col2=3.0 to 4.0 etc. Can someone give me an oindication how to do this please, user needs to be able to edit the palette and apply updated colours to the grid.

cheers
Sean.

Posted: Wed Jun 09, 2004 5:55 am
by Marjan
Hi, Sean.

Yes, this can be done by adding custom palette levels to internal palette color array. There is an example of this (for NET version, but the same approach can be used in VCL) available here.

Posted: Wed Jun 09, 2004 12:25 pm
by 8442698
cheers Marjan,

that did the trick once ported to Delphi, just need to add a way for user to customize the palette now.
thanks,
Sean.

Posted: Thu Jun 10, 2004 12:41 am
by 8442698
Is there a bug in the way this is handled?

The last two colours of the palette always take on the same colour for me. Try this

series1.PaletteSteps:=7;
series1.ClearPalette();
series1.AddPalette(4,Clnavy);
series1.AddPalette(5,Clblue);
series1.AddPalette(6,Claqua);
series1.AddPalette(7,Clyellow);
series1.AddPalette(8,Cllime);
series1.AddPalette(9,Clgreen);
series1.AddPalette(10,Clred);
series1.UseColorRange:=false;
series1.UsePalette:=true;
Chart1.Refresh();

the palette in the legend gets shunted along 1 position, ie clnavy never gets displayed and clred gets displayed twice. So I try forcing
series1.palette[6].color:=clwhite. 0/1 array indexing problem?

and get same thing, clwhite displayed twice.??

cheers
Sean.