Distance between axis title and axis labels
Distance between axis title and axis labels
Hi,
How do we control the distance between axis title and axis labels?
http://picasaweb.google.com/cbvarun/Ste ... 4912540786
Thanks,
Varun
How do we control the distance between axis title and axis labels?
http://picasaweb.google.com/cbvarun/Ste ... 4912540786
Thanks,
Varun
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Varun,
You need to set labels CustomSize like this:
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 |
Instructions - How to post in this forum |
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);
}
}
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
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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:
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.
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);
}
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:What is the difference between chart.getAxes().getLeft().getLabels().setCustomSize(30);
and
chart.getAxes().getLeft().getTitle().setCustomSize(30);
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 |
Instructions - How to post in this forum |
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.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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:
But I found that maxLabelsWidth property is not working. I've added this defect (TJ71013569) to the list to be fixed for next releases.
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);
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
Hi Jessie,
Ok, I've sent to your registered mail account the fix of this issue.
Ok, I've sent to your registered mail account the fix of this issue.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Distance between axis title and axis labels
We also have the same issue. Can we get the solution?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Distance between axis title and axis labels
Hi mahendran,
We just replied to your other thread about the same issue:
http://www.teechart.net/support/viewtop ... 949#p41949
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 |
Instructions - How to post in this forum |