动态改变Jfreechart中的Y轴范围
我有一个时间序列数据,可以使用 jfreechart 绘制。问题是,随着新数据的出现,图表将根据新数据集而变化。我用过,
chart.fireChartChanged(); 图表面板.repaint();
问题是,某些数据可能超出了 Y 轴的当前范围,我想知道如何根据我迄今为止的时间序列中的最大值来更改轴范围?谢谢!
I have a time series data which I can draw using jfreechart. the issue is, as new data comes in, the chart will change based on the new dataset. I used,
chart.fireChartChanged();
chartPanel.repaint();
the issue is, some data may be out of the current range of Y axis, I'm wondering how can the axis range be changed according to the maximum value in the timeseries I had so far? thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这一切似乎不必要地复杂:轴测距和通知应该是自动的。在此示例中,范围随着离群值的累积而变化,因为 <代码> add() “向所有已注册的侦听器发送
SeriesChangeEvent
。”在此示例中,范围是固定的,但相同发生通知。由于我们无法猜测您的程序在这方面如何失败,因此提供显示问题的 sscce 可能会有所帮助(s) 你描述的。
This all seems unnecessarily complicated: axis ranging and notification should be automatic. In this example, the range changes as outliers accumulate, because
add()
"sends aSeriesChangeEvent
to all registered listeners." In this example, the range is fixed, but the same notification happens.As we can't guess how your program fails in this regard, it may help to provide an sscce that exhibits the problem(s) you describe.
查看范围类。
有很多方法,例如
您可以根据您的要求使用任何方法,
您甚至可能需要添加以下内容[根据您的评论]
Have a look at Range class .
There are many methods like
You can use any depending upon your requirements
you might even have to add following [based on your comments]