Creating a time series with jfreechart

Now I want to create a time series chart in jfreechart. However, in the online examples, only charts using classes such as Day, Month, etc. Therefore, I essentially want to create an XY graphics line. However, the problem I am facing is that Jfreechart does not bind data points in the order in which they were added. Nor does it connect the dots in the order of "X Values." So basically I get "Z" in my jfreechart.

So my question is, is there a way to change the jfreechart setting so that it connects data points based on β€œX values”?

+4
source share
1 answer

You might look at org.jfree.chart.demo.TimeSeriesChartDemo1 and its associated API . A typical command to start a demo might look like this:

 java -cp lib/jfreechart-1.0.13.jar:lib/jcommon-1.0.16.jar \ org.jfree.chart.demo.TimeSeriesChartDemo1 

image

The example uses org.jfree.data.time.Month to represent monthly data, but other units are available in org.jfree.data.time . See Also the approach shown in this related example , which is based on TimeSeriesChartDemo1 .

+11
source

Source: https://habr.com/ru/post/1306397/


All Articles