Example usage for org.jfree.data ComparableObjectItem setObject

List of usage examples for org.jfree.data ComparableObjectItem setObject

Introduction

In this page you can find the example usage for org.jfree.data ComparableObjectItem setObject.

Prototype

protected void setObject(Object y) 

Source Link

Document

Sets the y-value for this data item.

Usage

From source file:org.jfree.data.ComparableObjectSeries.java

/**
 * Updates the value of an item in the series and sends a
 * {@link SeriesChangeEvent} to all registered listeners.
 *
 * @param index  the item (zero based index).
 * @param y  the new value (<code>null</code> permitted).
 *//*from w  w  w  . j a  v a  2s.com*/
protected void updateByIndex(int index, Object y) {
    ComparableObjectItem item = getDataItem(index);
    item.setObject(y);
    fireSeriesChanged();
}

From source file:org.jfree.data.ComparableObjectSeries.java

/**
 * Updates an item in the series./*from  w w w .j  av a 2 s .  c  o m*/
 *
 * @param x  the x-value (<code>null</code> not permitted).
 * @param y  the y-value (<code>null</code> permitted).
 *
 * @throws SeriesException if there is no existing item with the specified
 *         x-value.
 */
protected void update(Comparable x, Object y) {
    int index = indexOf(x);
    if (index < 0) {
        throw new SeriesException("No observation for x = " + x);
    } else {
        ComparableObjectItem item = getDataItem(index);
        item.setObject(y);
        fireSeriesChanged();
    }
}