Unable to change the bar color

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
mcpang
Newbie
Newbie
Posts: 15
Joined: Wed Mar 31, 2010 12:00 am

Unable to change the bar color

Post by mcpang » Tue Sep 07, 2010 2:36 am

Hi,

I have created a bar chart using TeeChart.

I am able to change the bar color using the following code:

series.Color = Color.Red

However, the bar color cannot be changed using the above code when the bar value is changing at the same time.

The above code is working fine in TeeChart v2005, but fail to work in TeeChart v2010.

Please help.

Thanks.

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Unable to change the bar color

Post by Yeray » Tue Sep 07, 2010 4:30 pm

Hi mcpang,

I'm not sure about what do you mean with "at the same time". Are you using threads? Could you please send us a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

mcpang
Newbie
Newbie
Posts: 15
Joined: Wed Mar 31, 2010 12:00 am

Re: Unable to change the bar color

Post by mcpang » Wed Sep 08, 2010 3:28 am

Yes, there is a thread to update the bar value.

I have done more debugging, and noticed the following:

The thread updates the bar value in 100ms interval.
For testing purpose, I changed the code to update the bar value at a longer interval (such as 5 secs), and I am able to change the bar color.

I didn't encounter this problem in TeeChartv2.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Unable to change the bar color

Post by Narcís » Wed Sep 08, 2010 2:00 pm

Hi mcpang,

Can you please attach a simple example project we can run "as-is" to reproduce the problem here?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

mcpang
Newbie
Newbie
Posts: 15
Joined: Wed Mar 31, 2010 12:00 am

Re: Unable to change the bar color

Post by mcpang » Thu Sep 09, 2010 3:29 am

Hi,

Attached is simple test application to illustrate the problem.

I also noticed that if I commented off this line of code, it works.

series.Colors.Add(series.Color);

Thanks.
Attachments
TestBarChart.zip
(36.26 KiB) Downloaded 640 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Unable to change the bar color

Post by Yeray » Fri Sep 10, 2010 11:45 am

Hi mcpang,

As you can see here,
Narcis wrote:if you populate a Pie series with a specific color for each slice it will prevail over series' color
What you could do is to clear the Colors list to use the series' color again:

Code: Select all

series1.Colors.Clear();
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

mcpang
Newbie
Newbie
Posts: 15
Joined: Wed Mar 31, 2010 12:00 am

Re: Unable to change the bar color

Post by mcpang » Tue Sep 14, 2010 1:22 am

Sorry, can you elaborate on what you have mentioned in the previous post regarding on the solution?

Thanks.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Unable to change the bar color

Post by Sandra » Tue Sep 14, 2010 11:26 am

Hello mcpang,

I think Yeray suggested you do is that you clean series list colors before change series color to red in click_button event:

Code: Select all

private void button1_Click(object sender, EventArgs e)
        {
            series1.Colors.Clear();
            series1.Color = Color.Red;
            
        }
So if you use previous code, you solve your problem and you don't need remove or comment next line of code:

Code: Select all

 series.Colors.Add(series.Color);
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply