通过最小/最大峰值的时间序列图表水平网格线 [英] Time series chart horizontal gridlines through min/max peaks
问题描述
我正在使用 JFreeChart 绘制时间序列图.图表工作正常,但网格线对齐成为问题.
I am using JFreeChart to plot a timeseries chart. The chart is working fine, but the gridline alignment is becoming a problem.
我的要求是通过峰值(即最大值和最小值)显示水平网格线.您能否让我知道这是否有任何属性,因为我正在随机获取网格.
My requirement is to show the horizontal gridlines through the peak values (i.e for the max and min value). Could you please let me know if there is any property for this, as I am getting grids randomly.
推荐答案
您是否考虑过使用 Marker
来突出显示最小值和最大值?
Have you considered using a Marker
to highlight the min and max values?
作为trashgod sugested,您使用Dataset
来获取最小值和最大值,然后将Marker
添加到Plot
As trashgod sugested you use the Dataset
to get the minimum and maximum values and then add a Marker
to the Plot
Range range = dataset.getRangeBounds(true);
plot.addRangeMarker(new ValueMarker(range.getLowerBound(),Color.GREEN,new BasicStroke(2.0f)),Layer.BACKGROUND);
plot.addRangeMarker(new ValueMarker(range.getUpperBound(),Color.BLUE,new BasicStroke(2.0f)),Layer.BACKGROUND);
这篇关于通过最小/最大峰值的时间序列图表水平网格线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!