/** * To series. * * @param legend the legend * @param stats the stats * @return the XY series */ protected XYSeries toSeries(String legend, List<XYDataItem> stats) { XYSeries xySeries = new XYSeries(legend, true, false); synchronized (stats) { for (XYDataItem item : stats) { xySeries.addOrUpdate(item.getX(), item.getY()); } } return xySeries; }
/** * Adds or updates an item in the series and sends a * {@link SeriesChangeEvent} to all registered listeners. * * @param x the x-value. * @param y the y-value. * * @return The item that was overwritten, if any. * * @since 1.0.10 */ public XYDataItem addOrUpdate(double x, double y) { return addOrUpdate(new Double(x), new Double(y)); }
/** * Adds or updates an item in the series and sends a * {@link SeriesChangeEvent} to all registered listeners. * * @param x the x-value. * @param y the y-value. * * @return The item that was overwritten, if any. * * @since 1.0.10 */ public XYDataItem addOrUpdate(double x, double y) { return addOrUpdate(new Double(x), new Double(y)); }
/** * Adds or updates an item in the series and sends a * {@link SeriesChangeEvent} to all registered listeners. * * @param x the x-value ({@code null} not permitted). * @param y the y-value ({@code null} permitted). * * @return A copy of the overwritten data item, or {@code null} if no * item was overwritten. */ public XYDataItem addOrUpdate(Number x, Number y) { // defer argument checking return addOrUpdate(new XYDataItem(x, y)); }
/** * Adds or updates an item in the series and sends a * {@link SeriesChangeEvent} to all registered listeners. * * @param x the x-value (<code>null</code> not permitted). * @param y the y-value (<code>null</code> permitted). * * @return A copy of the overwritten data item, or <code>null</code> if no * item was overwritten. */ public XYDataItem addOrUpdate(Number x, Number y) { // defer argument checking return addOrUpdate(new XYDataItem(x, y)); }
/** * Updates the values for the specified seriesName with the given values * @param seriesName the name a series in the graph * @param index the index of the desired series to update * @param time the time at which to update * @param value the value to update */ public void updateValues(String seriesName, int index, double time, double value) { if (!lock) { XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(index); s.setKey(seriesName); s.addOrUpdate(time, value); } }
xySrs.addOrUpdate( crtXySeries.getXValue(), crtXySeries.getYValue()
public void actionPerformed(ActionEvent e) { balance += 5; series.addOrUpdate(INDEX, balance);