Page 1 of 1

bars colors are not changing

Posted: Tue Sep 02, 2008 8:05 am
by 9527011
Hello,

We have a problem changing series colors using the teechart properties pop up.

we use teechart 7 activex

I have uploaded a file (problem.zip) with a small project that display the problem.
To recreate the problem:
1. run the project
2. press on "select tee" and select the tee file that is also in the uploaded zip file.
3. press on the properties icon to open the properties pop up.
4. press on the color squere near the Violation and complient series and change thier colors.

you can see that the color on the legend is changed but the color on the chart stays the same.

Is this a know issue? Is there a solution?

Thanks
Zoe.

Posted: Tue Sep 02, 2008 8:28 am
by narcis
Hi Zoe,

This is because all bars in "Violation" series have a value of zero. You'll notice that if you go to the "Data" tab in the editor and press the "X" icon on the bottom right. At the editor, if you change bar values you'll see they are visible in the color you selected.

Posted: Tue Sep 02, 2008 8:34 am
by 9527011
Hello Narcis,

thanks for your quick reply.

This is right for just one series. the other series (the blue one) is not all 0 and still color is not changed. It is true that if i change the 0 values to another value but what about the values that are not 0?

Zoe.

Posted: Mon Sep 08, 2008 10:26 am
by narcis
Hi Zoe,

With your *.tee file we can not see how did you generated the chart so we image that the problem could be that you are a assigning a color to each point when adding data to the series. Therefore you can not change series color if each point has been assigned a color individually.

So that it works as you request you should use clTeeColor constant as the color in the Add method when populating your series. Then you could set series color using like TChart1.Series(0).Color=clRed. Proceeding like this would also let you change series's colors in the editor.

Posted: Tue Sep 09, 2008 7:07 am
by 9527011
Hi Narcis,

Actually, the "color each" propertie is set to false.

We create the actual serie using this code (only part of the code is displayed here):
chart->AddSeries(TeeChart::scBar);
TeeChart::ISeriesPtr series;
series = chart->aSeries[seriesNum];
series->ColorEachPoint = FALSE;
series->Color = color;

and we fill the series using this code (again only part of it):
chart->aSeries[seriesNum]->Add(dValue, label.c_str(), color);

as you can see, we do pass the color parameter but this is becase we did not manage to find any Add method that does not ask for color. Does this affect the chart even though coloreachpoint is set to false? Is there an add method that we do not need to pass color to?

thanks
Zoe

Posted: Tue Sep 09, 2008 9:04 am
by narcis
Hi Zoe,

No, instead of passing "color" try passing "clTeeColor".

Posted: Tue Sep 09, 2008 9:31 am
by 9527011
Thank you very much.

This has solved the problem.

Zoe