a bug on exponential values at 0.0 axis
Posted: Mon Feb 09, 2009 10:40 pm
Hi,
I found a bug within Teechart lib v1 and v2. While this "#.#######" kind of value format is working fine with small values, exponential value format for the small values is not working properly at 0.0 axis.
Please try to run the following code and you will see "1.39E-16" at min(Y axis values) instead of 0 (zero)
------------------------------------------------------------
import javax.swing.JFrame;
import javax.swing.JPanel;
import com.steema.teechart.TChart;
import com.steema.teechart.styles.*;
public class TestForZeroAxis {
public static void main(String[] args) {
int panelsize=600;
JFrame frame = new JFrame();
JPanel panel = new JPanel();
panel.setSize(panelsize, panelsize);
TChart chart = new TChart();
chart.getAxes().getBottom().setIncrement(1);
chart.getAxes().getLeft().getLabels().setValueFormat("0.00E0");
panel.add(chart);
Points p = new Points(chart.getChart());
p.add(1,0.99);
p.add(2,0.135);
p.add(3,0.025);
p.add(4,0.012);
p.add(5,0.433);
frame.add(panel);
frame.setSize(panelsize, panelsize);
frame.setVisible(true);
}
}
------------------------------------------------------------
If you change the valueformat to setValueFormat("#.######"), it works fine. Is this bug going to be fixed any soon? Or Is there a quick way I can fix this issue while waiting for the next fixed version?
Thanks,
Jonathan
I found a bug within Teechart lib v1 and v2. While this "#.#######" kind of value format is working fine with small values, exponential value format for the small values is not working properly at 0.0 axis.
Please try to run the following code and you will see "1.39E-16" at min(Y axis values) instead of 0 (zero)
------------------------------------------------------------
import javax.swing.JFrame;
import javax.swing.JPanel;
import com.steema.teechart.TChart;
import com.steema.teechart.styles.*;
public class TestForZeroAxis {
public static void main(String[] args) {
int panelsize=600;
JFrame frame = new JFrame();
JPanel panel = new JPanel();
panel.setSize(panelsize, panelsize);
TChart chart = new TChart();
chart.getAxes().getBottom().setIncrement(1);
chart.getAxes().getLeft().getLabels().setValueFormat("0.00E0");
panel.add(chart);
Points p = new Points(chart.getChart());
p.add(1,0.99);
p.add(2,0.135);
p.add(3,0.025);
p.add(4,0.012);
p.add(5,0.433);
frame.add(panel);
frame.setSize(panelsize, panelsize);
frame.setVisible(true);
}
}
------------------------------------------------------------
If you change the valueformat to setValueFormat("#.######"), it works fine. Is this bug going to be fixed any soon? Or Is there a quick way I can fix this issue while waiting for the next fixed version?
Thanks,
Jonathan