Small Axis values not displayed or chopped

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Marius
Newbie
Newbie
Posts: 44
Joined: Thu Jan 31, 2008 12:00 am

Small Axis values not displayed or chopped

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
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("#.##########");
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

Marius
Newbie
Newbie
Posts: 44
Joined: Thu Jan 31, 2008 12:00 am

:D

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
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.
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

Marius
Newbie
Newbie
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
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");
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