TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
-
Marius
- Newbie
![Newbie Newbie](./images/ranks/1star.gif)
- Posts: 44
- Joined: Thu Jan 31, 2008 12:00 am
Post
by Marius » Wed Jul 16, 2008 10:49 am
I have a probably very trivial question: I have an axis scale which could require some very small values (E-8'ish), but when I plot it the values stop being differentiated at around E-3. When setting the xaxis.getIncrement to something very small, nothing happens. If I do not set it at all, no values (or only one) are displayed on the axis.
So, any thoughts? I am including a very small dummyproject so you can tell me what I am not getting right
Code: Select all
import javax.swing.JFrame;
import javax.swing.JPanel;
import com.steema.teechart.TChart;
import com.steema.teechart.styles.Points;
public class SmallValues extends JFrame
{
JPanel dmb = new JPanel();
TChart myChart = new TChart();
double[] x = new double[] {0.00001,0.00002,0.00005};
double[] y = new double[] {1,2,3};
public static void main(String[] args)
{
new SmallValues().setVisible(true);
}
public SmallValues()
{
dmb.add(myChart);
add(dmb);
setSize(400,300);
Points p = new Points(myChart.getChart().chart);
p.add(y);
p.getXValues().value = x;
myChart.getAxes().getBottom().setIncrement(0.000001);
}
}
Thanks in advance
Marius
-
Narcís
- Site Admin
![Site Admin Site Admin](./images/ranks/6stars.gif)
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Wed Jul 16, 2008 11:07 am
Hi Marius,
Have you tried setting labels' ValueFormat?
Code: Select all
chart1.getAxes().getBottom().getLabels().setValueFormat("#.##########");
-
Marius
- Newbie
![Newbie Newbie](./images/ranks/1star.gif)
- Posts: 44
- Joined: Thu Jan 31, 2008 12:00 am
Post
by Marius » Wed Jul 16, 2008 11:17 am
That of course did the trick, and I thank you for the swift and precise answer!
M
-
Narcís
- Site Admin
![Site Admin Site Admin](./images/ranks/6stars.gif)
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Wed Jul 16, 2008 11:21 am
Hi Marius,
You're very welcome! I'm glad to hear that helped.
-
Marius
- Newbie
![Newbie Newbie](./images/ranks/1star.gif)
- Posts: 44
- Joined: Thu Jan 31, 2008 12:00 am
Post
by Marius » Wed Jul 16, 2008 12:53 pm
One follow-up; can the valueformat be set to Exponential somehow? I tried setExponent(true) but with no luck. Or do I need to format the values before I include them on the axis(/ie before I add them onto the series)?
M
-
Narcís
- Site Admin
![Site Admin Site Admin](./images/ranks/6stars.gif)
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Wed Jul 16, 2008 1:23 pm
Hi Marius,
Yes, you can do this:
Code: Select all
chart1.getAxes().getBottom().getLabels().setValueFormat("0.00E0");