JfreeChart Renderer draw wrong lines.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Merihim
Posts: 5
Joined: Tue Mar 08, 2016 5:57 pm
antibot: No, of course not.

JfreeChart Renderer draw wrong lines.

Post by Merihim » Wed Nov 30, 2016 12:49 pm

Hello,
i have a problem with the renderer of Jfreechart.

Here are 2 Screenshots:
Image

The top chart is a old software with other technologies, but we know that this graph is right.

In the second chart we can see the lines are not connected to the datapoint. This is just 1 timeSeries.

Does someone have a idea why the chart is drawing the line like this ?

Thanks to everybody for any help!

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: JfreeChart Renderer draw wrong lines.

Post by John Matthews » Wed Nov 30, 2016 4:45 pm

Have you tried XYStepRenderer?

Image

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: JfreeChart Renderer draw wrong lines.

Post by david.gilbert » Wed Nov 30, 2016 9:01 pm

Please post the code you use to populate the dataset, preferably in a small self-contained demo.

If you are using XYSeries to represent your data, note that by default the series will sort the data items in order of x-values...that might cause the effect you are seeing (but you can easily switch off this feature in the constructor).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Merihim
Posts: 5
Joined: Tue Mar 08, 2016 5:57 pm
antibot: No, of course not.

Re: JfreeChart Renderer draw wrong lines.

Post by Merihim » Thu Dec 01, 2016 11:42 am

Thank you both for the quick response.

The renderer on the screenshot is a XYItemRenderer (SamplingXYLineRenderer)

First i have implemented the XYStepRenderer as suggested. It looks like this is a solution for my problem.

But i will try the second solution to overwrite the constructor of the XYSeries to avoid sorting the data items, too.

Thank you very much!

Locked