传递XYPlot的计时值

时间:2012-05-27 09:16:28

标签: java jfreechart long-integer

使用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);

1 个答案:

答案 0 :(得分:0)

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