/** * Returns a sample dataset. * * @return A sample dataset. */ private static XYDataset createDataset() { TimeSeriesCollection result = new TimeSeriesCollection(); TimeSeries series1 = new TimeSeries("Value"); for (int i = 0; i <= 23; i++) { series1.add(new Hour(i, 18, 10, 2011), Math.random() * 50 + 40); } result.addSeries(series1); return result; }
@Override public void run() { while (true) { try { Thread.sleep(3000); serie.add(new Month(month++, year), month * 50); if (month == 12) { month = 1; year = year + 1; } } catch (InterruptedException ex) { System.out.println(ex.toString()); } } }