Distance between axis title and axis labels

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Chen
Newbie
Newbie
Posts: 43
Joined: Tue Mar 11, 2008 12:00 am
Contact:

Distance between axis title and axis labels

Post by Chen » Mon Nov 10, 2008 8:45 pm

Hi,

How do we control the distance between axis title and axis labels?
http://picasaweb.google.com/cbvarun/Ste ... 4912540786

Thanks,
Varun

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

Post by Narcís » Tue Nov 11, 2008 9:38 am

Hi Varun,

You need to set labels CustomSize like this:

Code: Select all

        myChart.getAxes().getLeft().getLabels().setCustomSize(30);
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

Chen
Newbie
Newbie
Posts: 43
Joined: Tue Mar 11, 2008 12:00 am
Contact:

Post by Chen » Wed Nov 12, 2008 7:40 pm

Code: Select all

package com.amd.ngeda.chart.teechart;

import javax.swing.JFrame;
import javax.swing.JPanel;

import com.steema.teechart.TChart;
import com.steema.teechart.styles.FastLine;

public class Test {

	public static void main(String[] args) {
		JFrame frame = new JFrame();
		JPanel panel = new JPanel();
		panel.setSize(600, 600);
		TChart chart = new TChart();
		chart.getAxes().getLeft().getTitle().setText("Help Needed");
		chart.getAxes().getLeft().getLabels().setCustomSize(30);
		chart.getAxes().getLeft().getLabels().setValueFormat("0.00E0");
		panel.add(chart);
		FastLine fastLine = new FastLine(chart.getChart());
		for (int i = 0; i < 100; i++) {
			fastLine.add(i, i * i);
		}

		frame.add(panel);
		frame.setSize(600, 600);
		frame.setVisible(true);
	}
}
If you run this code then you will see that title and labels are overlapping.
I want to know whether I can set a min distance between AXIS TITLE and AXIS LABELS.

What is the difference between chart.getAxes().getLeft().getLabels().setCustomSize(30);
and
chart.getAxes().getLeft().getTitle().setCustomSize(30);

Thanks,
Varun

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

Post by Narcís » Thu Nov 13, 2008 9:57 am

Hi Varun,

Yes, in that particular case you need to set a bigger size for the labels so that title and labels don't overlap:

Code: Select all

        chart.getAxes().getLeft().getTitle().setText("Help Needed");
        chart.getAxes().getLeft().getLabels().setCustomSize(50);
        chart.getAxes().getLeft().getLabels().setValueFormat("0.00E0");
        FastLine fastLine = new FastLine(chart.getChart());
        for (int i = 0; i < 100; i++) {
            fastLine.add(i, i * i);
        }
What is the difference between chart.getAxes().getLeft().getLabels().setCustomSize(30);
and
chart.getAxes().getLeft().getTitle().setCustomSize(30);
The difference is that the first sets a custom size for axis labels while the second one sets a custom size for the axis title. As described in context sensitive help:

getLabels().setCustomSize(int value) changes the spacing occupied by the axis labels between the Ticks and the Title.

getTitle().setCustomSize(int value) sets the spacing between the axis/labels and the outer panel edge.
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

Chen
Newbie
Newbie
Posts: 43
Joined: Tue Mar 11, 2008 12:00 am
Contact:

Post by Chen » Thu Nov 13, 2008 2:56 pm

I know that a bigger size would solve it. But I was not looking for this answer. I want to set it dynamically based on the size of the labels. The axis format can be different based on the type of chart and based on the user input. At least it would have been better if teechart could do it automatically.

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

Post by Narcís » Thu Nov 13, 2008 3:34 pm

Hi Varun,

Yes, this is a known issue on the list to be enhanced for future releases.

For doing something automatic you could do something like this:

Code: Select all

        myChart.getAxes().getLeft().getTitle().setText("Help Needed");
        myChart.getAxes().getLeft().getLabels().setValueFormat("0.00E0");
        FastLine fastLine = new FastLine(myChart.getChart());
        for (int i = 0; i < 100; i++) {
            fastLine.add(i, i * i);
        } 
        
        myChart.invalidate();
        int tmp = myChart.getAxes().getLeft().maxLabelsWidth();
        myChart.getAxes().getLeft().getLabels().setCustomSize(tmp);
But I found that maxLabelsWidth property is not working. I've added this defect (TJ71013569) to the list to be fixed for next releases.
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

Chen
Newbie
Newbie
Posts: 43
Joined: Tue Mar 11, 2008 12:00 am
Contact:

Post by Chen » Fri Nov 14, 2008 7:30 pm

Will you be able to provide a patch for this ??. This funtionality is very important for the look and feel of the chart.

Thanks,
Varun

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

Post by Narcís » Mon Nov 17, 2008 9:57 am

Hi Varun,

This is a high priority item in the bug list to be fixed but I'm not able to give you an estimate date at the moment. When the issue is fixed we will try to send you source code files with the fix.
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

Jesse
Newbie
Newbie
Posts: 28
Joined: Tue Mar 11, 2008 12:00 am
Location: Austin, TX

Post by Jesse » Fri Feb 06, 2009 11:09 pm

Hello Narcis,
Varun is no longer with our company. You will not be able to send him the fix any longer. Please send to me.

Thanks,
Jesse

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

Post by Yeray » Mon Feb 09, 2009 9:36 am

Hi Jessie,

Ok, I've sent to your registered mail account the fix of this issue.
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

mahendran
Newbie
Newbie
Posts: 5
Joined: Mon Jul 27, 2009 12:00 am

Re: Distance between axis title and axis labels

Post by mahendran » Thu Jul 30, 2009 8:33 am

We also have the same issue. Can we get the solution?

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

Re: Distance between axis title and axis labels

Post by Narcís » Thu Jul 30, 2009 9:18 am

Hi mahendran,

We just replied to your other thread about the same issue:

http://www.teechart.net/support/viewtop ... 949#p41949
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

Post Reply