Change color of axis label

TeeChart for ActiveX, COM and ASP
Post Reply
corwl
Newbie
Newbie
Posts: 9
Joined: Thu Aug 09, 2007 12:00 am
Contact:

Change color of axis label

Post by corwl » Thu Nov 11, 2010 6:29 am

I would like to change the color of labels on axis.

I tested two codes below, but both of these did not works.

1)
chart.GetAxis().GetLeft().GetLabels().GetFont().SetColor(RGB(255, 0, 0));
chart.GetAxis().GetLeft().GetLabels().Add(1, "test");


2)
unsigned long idx = chart.GetAxis().GetLeft().GetLabels().Add(1, "test");
chart.GetAxis().GetLeft().GetLabels().GetItem(idx).SetColor(RGB(255, 0, 0));


How can I do it?

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

Re: Change color of axis label

Post by Narcís » Thu Nov 11, 2010 3:41 pm

Hi corwl,

Code below works fine for me here. Which TeeChart version are you using?

Code: Select all

	m_Chart1.GetAxis().GetLeft().GetLabels().GetFont().SetColor(RGB(255, 0, 0));
If problem persists 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

corwl
Newbie
Newbie
Posts: 9
Joined: Thu Aug 09, 2007 12:00 am
Contact:

Re: Change color of axis label

Post by corwl » Mon Nov 15, 2010 2:10 am

Thank you for your reply.

Please check the attached project.

project was produced with VC2003 and TChart version is V8.0 1.
Attachments
tchartTest.zip
(106.31 KiB) Downloaded 602 times

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

Re: Change color of axis label

Post by Yeray » Mon Nov 15, 2010 3:47 pm

Hi corwl,

In v8, if you are using custom labels, you have to change the label font:

Code: Select all

m_chart.GetAxis().GetLeft().GetLabels().GetItem(0).GetFont().SetColor(RGB(255, 0, 0));
In v2010 changing the axis labels font also applies to the custom labels.
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

corwl
Newbie
Newbie
Posts: 9
Joined: Thu Aug 09, 2007 12:00 am
Contact:

Re: Change color of axis label

Post by corwl » Tue Nov 16, 2010 12:20 am

Yes it works!

I really appreciate you Yeray.

Post Reply