How to change chart empty space margins

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
mts
Newbie
Newbie
Posts: 18
Joined: Fri Apr 29, 2011 12:00 am

How to change chart empty space margins

Post by mts » Fri Jul 22, 2011 7:49 pm

I'm making a chart that plots n number of series, and each series has it's own custom axis. I would like to display all axes left of the chart area. The problem is, by the time I get to the third axis I've run out of room. I need to know how to increase the margin between the left of the component's graphical area and the actual chart so I can fit more axes in there.

mts
Newbie
Newbie
Posts: 18
Joined: Fri Apr 29, 2011 12:00 am

Re: How to change chart empty space margins

Post by mts » Fri Jul 22, 2011 8:04 pm

Another related question, how do I get the color of the values on the axis to change? I see that I can do axis.getPen.setColor but that just changes the axis line color, not the values on it. The label color options doesn't work either.

mts
Newbie
Newbie
Posts: 18
Joined: Fri Apr 29, 2011 12:00 am

Re: How to change chart empty space margins

Post by mts » Fri Jul 22, 2011 9:02 pm

I found solutions to both of my issues. Unfortunately there are not a lot of postings in the java forum, but once I searched the vcl forum I found hints to point me in the right direction pretty quickly. Posting the solutions here for others.

To change the margins you have to do chart1.getChart().getPanel().setMarginLeft(10) - where chart1 is your TChart object. This will set the left margin to 10% of the space of the chart. Pretty cool, took me forever to realize to use the get panel method.

To change the label color you have to do getLabels().getFont().setColor( *value*). Simply doing getLabels.setColor() doesn't seem to do anything.

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

Re: How to change chart empty space margins

Post by Yeray » Fri Jul 29, 2011 12:06 pm

Hello mts,

Thanks for sharing the solutions.
mts wrote:I found solutions to both of my issues. Unfortunately there are not a lot of postings in the java forum, but once I searched the vcl forum I found hints to point me in the right direction pretty quickly.
Right, TeeChart Java is very young compared to the VCL, ActiveX and .NET versions but we try to make them as much equivalent as possible so searching in the whole forums is generally a good idea.
I hope that the TeeChart Java forums will grow with the recent TeeChart Java for Android and the next TeeChart Java 3.
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

Post Reply