使用jfreechart创建时间序列 [英] Creating a time series with jfreechart
问题描述
现在,我想在jfreechart中创建一个时间序列图.但是,在线示例仅具有使用日",月"等类的图表.所以我想本质上创建一个XY折线图.但是我遇到的问题是Jfreechart不能按添加数据点的顺序连接数据点.同样,它不按"X值"的顺序连接点.因此,基本上我在jfreechart中得到一个"Z".
Right now I want to create a time series graph in jfreechart. However the examples online only have charts using classes like "Day", "Month", and so on. So I want to essentially create a XY line chart. However the problem I'm having is that Jfreechart doesn't connect the data points in the order in which they were added. Also it doesn't connect the points in the order of the "X Values". So basically I get a "Z" in my jfreechart.
所以我的问题是,有没有办法更改jfreechart的设置,使其基于"X值"连接数据点?
So my question is, is there a way to change the setting for the jfreechart so that it connects the data points based on the "X values"?
推荐答案
您可以看看 API文档.运行演示的典型命令如下所示:
You might have a look at org.jfree.chart.demo.TimeSeriesChartDemo1
, and the associated API documentation. A typical command to run the demo might look like this:
java -cp lib/jfreechart-1.0.13.jar:lib/jcommon-1.0.16.jar \
org.jfree.chart.demo.TimeSeriesChartDemo1
该示例使用 org.jfree.data.time.Month
代表月度数据,但 org.jfree.data.time
.另请参阅基于TimeSeriesChartDemo1
的此相关示例中显示的方法.
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
.
这篇关于使用jfreechart创建时间序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!