我在我的程序中使用MilliDTSC类。我希望刷新率设置为100毫秒。我使用javax.swing.Timer在100ms后更新GUI,但我的域轴在每毫秒后更新,因为单位是' MilliSecond' (如下所示)
有没有办法将域轴的单位改为100ms而不是1ms?
答案 0 :(得分:1)
试试这段代码:
ValueAxis range = plot.getRangeAxis();
range.setRange(0, 1000);
domain.setTickUnit(new NumberTickUnit(100));
请把假冒伪劣放在这样的自动量范围内:
domain.setAutoRange(false);
编辑:
请替换:
XYPlot plot = chart.getXYPlot();
final ValueAxis domain = plot.getDomainAxis();
domain.setAutoRange(true);
NumberAxis axis = new NumberAxis();
axis.setTickUnit(new NumberTickUnit(100));
ValueAxis range = plot.getRangeAxis();
range.setRange(0, 100);
with:
XYPlot plot = chart.getXYPlot();
final NumberAxis domain = (NumberAxis)plot.getDomainAxis();
domain.setAutoRange(false);
domain.setRange(0,1000);
domain.setTickUnit(new NumberTickUnit(100));
NumberAxis range = (NumberAxis)plot.getRangeAxis();
range.setRange(0,100);
答案 1 :(得分:1)