English 中文(简体)
将固定电网添加到一个自由制图时间序列图
原标题:Adding a static gridline to a JFreeChart time series chart

我正试图执行 a series克,在JFreeChart有特殊要求。 我可以提取图表,但我不知道如何按照图表的最后价值执行垂直红线。 它应始终处于同一地点,并应始终与最后价值交叉。

I am absolutely out of ideas on how this would be done. I was thinking that it might be possible to implement it as a static gridline, but I don t know how to specify one.

此外,海图的大小也将是固定的,因此,某些四舍五入的方式是可以接受的,希望不引入任何三边图书馆。

http://i55.tinypic.com/2l8ystc.png” rel=“nofollow”here

感谢。

最佳回答

我用标记解决问题。 这部法律是:

JFreeChart chart = ChartFactory.createTimeSeriesChart(...);
XYPlot plot = chart.getXYPlot();
Long timestampToMark = new Date().getTime();
Marker m = new ValueMarker(timestampToMark);
m.setStroke(new BasicStroke(2));
m.setPaint(Color.RED);
plot.addDomainMarker(m);

也许其他人会认为这一点有用。

问题回答

I d just set a custom cross-hair on the last domain value:

XYPlot plot = chart.getXYPlot();
plot.setDomainCrosshairVisible(true);
plot.setDomainCrosshairPaint(Color.red);
plot.setDomainCrosshairStroke(new BasicStroke(3f));
plot.setDomainCrosshairValue(dataset.getXValue(0, dataset.getItemCount(0) - 1));




相关问题
Can t find bundle for base name

I m using a library that has a dependency on jfreechart (v 1.0.9). When I try to run the .jar, I get: java.util.MissingResourceException: Can t find bundle for base name org.jfree.chart....

How to prevent duplication of bar chart in iReport

I ve tried to use chart in iReport for the first time. I ve used a bar chart and anytime I preview the chart I see plenty of them, iIthink about 6. I only need a single one is there anything that I ...

Width of the bar in Jfreechart

Is there a way to adjust the width of the bars in a Barchart? I create my chart with the following code. final JFreeChart chart = ChartFactory.createBarChart("Report", // chart title ...

How to handle mouse dragging event in JFreeChart

I want to know whether it is possible to listen to the mouse event of dragging in JFreeCharts. By default it is assign to zooming. I remove this zooming functionality with, chartPanel....

JFreeChart in scrollpane

I m having a big graph created with jfreechart. This chart is too big for the screen, so I would like to put it in a scrollpane. However, when using the scrollbar, the complete graph is redrawn ...

JFreeChart connecting points in stacked bar charts

I created a stacked bar chart using JFreeChart (similar to this one). Now I would like to connect the points of the corresponding series for all rows. Is this possible using JFreeChart?

热门标签