/** * Gets the time. * * @return the time */ public long getTime() { return getData().getX().longValue(); }
if (!list.isEmpty()) { XYDataItem xy = list.get(list.size() - 1); list.add(new XYDataItem(xy.getX().longValue() + 1, 0)); list.add(new XYDataItem(System.currentTimeMillis(), 0));
/** * 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; }
/** * Returns the x-value at the specified index. * * @param index the index (zero-based). * * @return The x-value (never <code>null</code>). */ public Number getX(int index) { return getRawDataItem(index).getX(); }
/** * Returns the x-value at the specified index. * * @param index the index (zero-based). * * @return The x-value (never {@code null}). */ public Number getX(int index) { return getRawDataItem(index).getX(); }
XYDataItem dataItem = (XYDataItem) o1; double compare = this.x.doubleValue() - dataItem.getX().doubleValue(); if (compare > 0.0) { result = 1;
XYDataItem dataItem = (XYDataItem) o1; double compare = this.x.doubleValue() - dataItem.getX().doubleValue(); if (compare > 0.0) { result = 1;
/** * Returns the index of the item with the specified x-value, or a negative * index if the series does not contain an item with that x-value. Be * aware that for an unsorted series, the index is found by iterating * through all items in the series. * * @param x the x-value (<code>null</code> not permitted). * * @return The index. */ public int indexOf(Number x) { if (this.autoSort) { return Collections.binarySearch(this.data, new XYDataItem(x, null)); } else { for (int i = 0; i < this.data.size(); i++) { XYDataItem item = (XYDataItem) this.data.get(i); if (item.getX().equals(x)) { return i; } } return -1; } }
/** * Returns the index of the item with the specified x-value, or a negative * index if the series does not contain an item with that x-value. Be * aware that for an unsorted series, the index is found by iterating * through all items in the series. * * @param x the x-value ({@code null} not permitted). * * @return The index. */ public int indexOf(Number x) { if (this.autoSort) { return Collections.binarySearch(this.data, new XYDataItem(x, null)); } else { for (int i = 0; i < this.data.size(); i++) { XYDataItem item = (XYDataItem) this.data.get(i); if (item.getX().equals(x)) { return i; } } return -1; } }
public void showAnnotations() { XYItemRenderer renderer = getChart().getXYPlot().getRenderer(); renderer.removeAnnotations(); for (int i = 0; i < eccSeries.getItemCount(); i++) { XYDataItem item = (XYDataItem) eccSeries.getDataItem(i); XYTextAnnotation annon = new XYTextAnnotation(new Integer(i).toString(), item.getX().longValue(), item .getY().longValue()); renderer.addAnnotation(annon); } }
for (Object o : s.getItems()) { XYDataItem item = (XYDataItem) o; time.add(item.getX() + ",");
int index = indexOf(item.getX()); if (index >= 0) { throw new SeriesException("X-value already exists.");
int index = indexOf(item.getX()); if (index >= 0) { throw new SeriesException("X-value already exists.");
int index = indexOf(item.getX()); if (index >= 0) { XYDataItem existing = (XYDataItem) this.data.get(index);
int index = indexOf(item.getX()); if (index >= 0) { XYDataItem existing = (XYDataItem) this.data.get(index);