Page 1 of 1

Change series color for bars does not work

Posted: Fri Sep 21, 2007 8:48 am
by 9244467
Hi,

I'm using Version 7 in a CBuilder 5.

I have a bar chart in which the user can change bar colors programmatically. The color of the legend changes OK but the corresponding color in the bar chart remains as it was before the change. Line series change OK.

To set and change the color I use the SeriesColor property of TBarSeries. I have used the Series and Chart Repaint method to force repainting but no result.

Thanks in advance.

Posted: Tue Sep 25, 2007 12:04 pm
by narcis
Hi cic,

We haven't been able to reproduce the problem here. 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 either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Sat Sep 29, 2007 11:02 am
by 9244467
Hi Narcís ,

I've uploaded the project you asked me. It is a CBuilder5 project using TeeChart version 7.07. Click "Open Chart" and try to change the colors of one of the bars.

cic

Posted: Mon Oct 01, 2007 10:09 am
by narcis
Hi cic,

Thanks for the example project but I'm not able to run it here because I ghet this error message:
[Pascal Error] TeeMIFCanvas.pas(61): Declaration of 'Arc' differs from previous declaration
Could you please let us know how we should solve this?

Thanks in advance!

Posted: Mon Oct 01, 2007 10:34 am
by 9244467
Hi Narcis,

You could try to comment out the line

//USEUNIT("TeeMIFCanvas.pas");


Thanks in advance,

cic

Posted: Mon Oct 01, 2007 10:35 am
by 9244467
You'll find the line in the tchart.cpp

Posted: Tue Oct 02, 2007 8:39 am
by yeray
Hi cic,

We've done what you said and now we have another error message:
[C++ Error] main.cpp(6): E2209 Unable to open include file 'iode.hpp'
Would you be so kind to send us a simple example project we can run "as-is" to reproduce the problem here?

Thanks in advance.

Posted: Tue Oct 02, 2007 9:06 am
by 9244467
The tchart.exe included in the zip file I uploaded reproduces the problem.

Click "Open Chart" and try to change the colors of one of the bars using
your editor. Line colors change, only the legend bar color changes.

Sorry for the problems and thanks in advance.

cic

Posted: Tue Oct 02, 2007 11:36 am
by narcis
Hi cic,

Thank you very much for the information but it would be really helpful if we could debug the project here to find where the problem is. So we would really appreciate if you could arrange a simple example project we can run "as-is" to reproduce the problem here.

Thanks in advance!

Posted: Tue Oct 02, 2007 12:01 pm
by 9244467
Hi Narcís ,

I've uploaded the project again. I've included iode.hpp and hope it compiles now.

cic

Posted: Thu Oct 11, 2007 8:18 am
by narcis
Hi cic,

Sorry for the delayed reply but your project wasn't a simple one and took us some time debugging it.

The problem was that you tried to assign a color to the series when you had already assigned a color for each point in the AddXY method and therefore TeeChart didn't take into account the color of the series. To achieve what you request you should modify the code below at ChrtAdd:

Code: Select all

    for(i = 0; i < nobs; i++)  {
	    if(SCR_ISAN(vals[i*2+1]))
            {
	        Series->AddXY(vals[i*2], vals[i*2+1], """", clTeeColor); // Color
                Series->SeriesColor=Color;
            }
	    else
            {
	        if(type != 'B') Series->AddNullXY(vals[i*2], oval, "");
            }
    }

Posted: Thu Oct 11, 2007 8:31 am
by 9244467
Hi Narcís,


I tried it and it works like I wanted it to.
Thanks.

Best Regards,
cic