0

我在使用时遇到问题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);
4

1 回答 1

0

使用TimeSeriesCollection dataset = new TimeSeriesCollection();而不是XYDataset. 然后将 TimeSeries 添加到数据集,dataset.addSeries(timeSeries); 其中 timeSeries 是一个对象,其列表为TimeSeriesDataItem.

于 2012-09-27T01:00:00.987 回答