Order to link points on a graph

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
yannJFreeChart
Posts: 13
Joined: Tue May 15, 2012 2:17 pm
antibot: No, of course not.

Order to link points on a graph

Post by yannJFreeChart » Tue Sep 18, 2012 10:28 am

Hello,

I display point thanks to JFreeChart. These points are into an array double[].

In order to define the way to display points, I use :

Code: Select all

XYItemRenderer render2= new XYLineAndShapeRenderer(true,true);
I would like to link the points in the order of they are in the array and not with their values.

Do you know how to do ?

Thank you.
Have a good day.

remiohead
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm
antibot: No, of course not.

Re: Order to link points on a graph

Post by remiohead » Tue Sep 18, 2012 12:24 pm

When you create your XYSeries use the constructor that allows you to specify autoSort.

yannJFreeChart
Posts: 13
Joined: Tue May 15, 2012 2:17 pm
antibot: No, of course not.

Re: Order to link points on a graph

Post by yannJFreeChart » Tue Sep 18, 2012 12:46 pm

Thank you.

To follow that you sais, I use :

Code: Select all

XYSeries series1 = new XYSeries("title", true);
But, how can I define the autosort ?

remiohead
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm
antibot: No, of course not.

Re: Order to link points on a graph

Post by remiohead » Tue Sep 18, 2012 2:47 pm

Code: Select all

XYSeries series1 = new XYSeries("title", false);
This will not sort your values.

yannJFreeChart
Posts: 13
Joined: Tue May 15, 2012 2:17 pm
antibot: No, of course not.

Re: Order to link points on a graph

Post by yannJFreeChart » Tue Sep 18, 2012 3:50 pm

I find the solution. I have to define the XYSeries like this :

Code: Select all

XYSeries series= new XYSeries("Title", false, true);
Thank you for your help.

Locked