Page 1 of 1

cusom colors for pie

Posted: Thu Mar 22, 2012 4:32 pm
by 10553605
Hi

We have a pie that is based on a clientdataset
we want to give it our own colors but couldn't find a way to do that, it seems to have a fixed number of themes to be used but not a manual one
please advice
Thanks

Re: cusom colors for pie

Posted: Fri Mar 23, 2012 3:43 pm
by yeray
Hi Nati,

You can assign a color manually to the series' ValueColor array.
Alternatively, you could use ColorSource property to use the colors from the datasource as explained here

Re: cusom colors for pie

Posted: Fri Mar 23, 2012 3:49 pm
by narcis
Hi Nati,

You can provide colors either using VCL TColor values, for example: clRed, clGreen, clWhite, etc.; or using RGB(r,g,b) method.

Re: cusom colors for pie

Posted: Sun Mar 25, 2012 8:12 am
by 10553605
Hi

I have a set of several colors and I don't know how many colors I will need in pie so instead of looping and guessing, can't I just set a palette and let it use it automatically?

Re: cusom colors for pie

Posted: Sun Mar 25, 2012 8:18 am
by 10553605
I'm doing the following, just to check:
for i := 0 to DBChart1.Series[0].ValuesList.Count - 1 do
DBChart1.Series[0].ValueColor := $00FE9B82;

and even though DBChart1.Series[0].ValuesList.Count returns 2
I get list index out of bounds(1) error for DBChart1.Series[0].ValueColor (when i equals 1)

If there is a way to set this palette in design time it will help a lot
Thanks

Re: cusom colors for pie

Posted: Mon Mar 26, 2012 7:31 am
by narcis
Hi Nati,
I have a set of several colors and I don't know how many colors I will need in pie so instead of looping and guessing, can't I just set a palette and let it use it automatically?
Yes, you can create your own custom color palettes as explained in the All Features\Welcome!\Aspect\Custom palettes example at the new features demo available at TeeChart's program group.
I'm doing the following, just to check:
for i := 0 to DBChart1.Series[0].ValuesList.Count - 1 do
DBChart1.Series[0].ValueColor := $00FE9B82;

and even though DBChart1.Series[0].ValuesList.Count returns 2
I get list index out of bounds(1) error for DBChart1.Series[0].ValueColor (when i equals 1)


Series' ValueLists are the structure where series' values are stored so usually series have those ValueLists: XValues, YValues, ValueColor and LabelText. Some series have more ValueLists. Each ValueList store correpsonding values. For your purpose you should not loop according to ValueList.Count, this will give you the number of ValueLists, not the number of points in a series. You should loop ValueColor.Count or Series.Count instead.

If the problem persist please attach a simple example project we can run "as-is" to reproduce the problem here.

If there is a way to set this palette in design time it will help a lot


No, there's no design-time support for that.