Page 1 of 1

Small Axis values not displayed or chopped

Posted: Wed Jul 16, 2008 10:49 am
by 7667185
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

Posted: Wed Jul 16, 2008 11:07 am
by narcis
Hi Marius,

Have you tried setting labels' ValueFormat?

Code: Select all

chart1.getAxes().getBottom().getLabels().setValueFormat("#.##########");

:D

Posted: Wed Jul 16, 2008 11:17 am
by 7667185
That of course did the trick, and I thank you for the swift and precise answer!

M

Posted: Wed Jul 16, 2008 11:21 am
by narcis
Hi Marius,

You're very welcome! I'm glad to hear that helped.

Posted: Wed Jul 16, 2008 12:53 pm
by 7667185
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

Posted: Wed Jul 16, 2008 1:23 pm
by narcis
Hi Marius,

Yes, you can do this:

Code: Select all

        chart1.getAxes().getBottom().getLabels().setValueFormat("0.00E0");