[英]JFreeChart initial 'zoom'
I am using JFreeChart 1.0.19
to create a timeseries graph. 我正在使用
JFreeChart 1.0.19
创建时间序列图。 The graph contains both positive and negative values, however when the graph is initially displayed the Y axis always baselines to 0, and therefore I only know about the negative numbers when I manually zoom out. 该图包含正值和负值,但是最初显示该图时,Y轴始终以0为基线,因此,当我手动缩小时,我只知道负数。
Is there a way to get JFreeChart to display the full range when it is first drawn. 有没有办法让JFreeChart在第一次绘制时显示整个范围。
I have tried: 我努力了:
Number maximum = DatasetUtilities.findMaximumRangeValue(data);
Number minimum = DatasetUtilities.findMinimumRangeValue(data);
((XYPlot)timeSeriesChart.getPlot()).getRangeAxis().setRange(minimum.intValue(),
maximum.intValue());
The API doc doesn't seem very clear on why this behaviour is or how to alter it. 关于此行为的原因或更改方法,API文档似乎不太清楚。 Any help appreicated.
任何帮助。
@raul1ro was along the right lines. @ raul1ro是正确的路线。 I solved this by adding:
我通过添加解决了这个问题:
timeSeriesChart.getXYPlot().getRangeAxis().setDefaultAutoRange(new Range(minimum.doubleValue(), maximum.doubleValue()));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.