我在使用getTime()
时遇到问题。该方法从另一个类传递并使用System.currentTimeMillis()
.有人可以帮助我吗?我非常感谢您的帮助。谢谢。
panelGraph = new JPanel();
panelGraph.setLayout(new BorderLayout());
aesDataset = XYDataset(caes.getTimeTotal());
JFreeChart chart = ChartFactory.createTimeSeriesChart(
"Graph: Encrypted Result", "SetFile", "Time", aesDataset, true, true, false);
chart.setBackgroundPaint(Color.green);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setOrientation(PlotOrientation.VERTICAL);
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
XYItemRenderer renderer = plot.getRenderer();
renderer.setSeriesPaint(0, Color.red);
NumberAxis yAxis1 = (NumberAxis) plot.getRangeAxis();
yAxis1.setTickLabelPaint(Color.red);
ChartPanel frame1 = new ChartPanel(chart);
frame1.setSize(400, 300);
panelGraph.add(frame1);
使用 TimeSeriesCollection dataset = new TimeSeriesCollection();
而不是 XYDataset
。然后添加到数据集时间dataset.addSeries(timeSeries);
序列中,其中时间序列是具有TimeSeriesDataItem
列表的对象。