Java Code Examples for org.jfree.chart.axis.ValueAxis#configure()

The following examples show how to use org.jfree.chart.axis.ValueAxis#configure() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CategoryPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets a range axis and, if requested, sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param index  the axis index.
 * @param axis  the axis.
 * @param notify  notify listeners?
 */
public void setRangeAxis(int index, ValueAxis axis, boolean notify) {
    ValueAxis existing = this.rangeAxes.get(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    if (axis != null) {
        axis.setPlot(this);
    }
    this.rangeAxes.put(index, axis);
    if (axis != null) {
        axis.configure();
        axis.addChangeListener(this);
    }
    if (notify) {
        fireChangeEvent();
    }
}
 
Example 2
Source File: CategoryPlot.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets a range axis and, if requested, sends a {@link PlotChangeEvent} to 
 * all registered listeners.
 *
 * @param index  the axis index.
 * @param axis  the axis.
 * @param notify  notify listeners?
 */
public void setRangeAxis(int index, ValueAxis axis, boolean notify) {
    ValueAxis existing = (ValueAxis) this.rangeAxes.get(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    if (axis != null) {
        axis.setPlot(this);
    }
    this.rangeAxes.set(index, axis);
    if (axis != null) {
        axis.configure();
        axis.addChangeListener(this);
    }
    if (notify) {
        fireChangeEvent();
    }
}
 
Example 3
Source File: CombinedDomainXYPlot.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a clone of the annotation.
 *
 * @return A clone.
 *
 * @throws CloneNotSupportedException  this class will not throw this
 *         exception, but subclasses (if any) might.
 */
public Object clone() throws CloneNotSupportedException {

    CombinedDomainXYPlot result = (CombinedDomainXYPlot) super.clone();
    result.subplots = (List) ObjectUtilities.deepClone(this.subplots);
    for (Iterator it = result.subplots.iterator(); it.hasNext();) {
        Plot child = (Plot) it.next();
        child.setParent(result);
    }

    // after setting up all the subplots, the shared domain axis may need
    // reconfiguring
    ValueAxis domainAxis = result.getDomainAxis();
    if (domainAxis != null) {
        domainAxis.configure();
    }

    return result;

}
 
Example 4
Source File: CombinedRangeCategoryPlot.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a clone of the plot.
 *
 * @return A clone.
 *
 * @throws CloneNotSupportedException  this class will not throw this
 *         exception, but subclasses (if any) might.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    CombinedRangeCategoryPlot result
        = (CombinedRangeCategoryPlot) super.clone();
    result.subplots = (List) ObjectUtilities.deepClone(this.subplots);
    for (Iterator it = result.subplots.iterator(); it.hasNext();) {
        Plot child = (Plot) it.next();
        child.setParent(result);
    }

    // after setting up all the subplots, the shared range axis may need
    // reconfiguring
    ValueAxis rangeAxis = result.getRangeAxis();
    if (rangeAxis != null) {
        rangeAxis.configure();
    }

    return result;
}
 
Example 5
Source File: PolarPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Receives notification of a change to the plot's m_Dataset.
 * <P>
 * The axis ranges are updated if necessary.
 *
 * @param event  information about the event (not used here).
 */
@Override
public void datasetChanged(DatasetChangeEvent event) {
    for (int i = 0; i < this.axes.size(); i++) {
        final ValueAxis axis = (ValueAxis) this.axes.get(i);
        if (axis != null) {
            axis.configure();
        }
    }
    if (getParent() != null) {
        getParent().datasetChanged(event);
    }
    else {
        super.datasetChanged(event);
    }
}
 
Example 6
Source File: PolarPlot.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Sets an axis for the plot and, if requested, sends a
 * {@link PlotChangeEvent} to all registered listeners.
 *
 * @param index  the axis index.
 * @param axis  the axis (<code>null</code> permitted).
 * @param notify  notify listeners?
 *
 * @see #getAxis(int)
 *
 * @since 1.0.14
 */
public void setAxis(int index, ValueAxis axis, boolean notify) {
    ValueAxis existing = getAxis(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    if (axis != null) {
        axis.setPlot(this);
    }
    this.axes.set(index, axis);
    if (axis != null) {
        axis.configure();
        axis.addChangeListener(this);
    }
    if (notify) {
        fireChangeEvent();
    }
}
 
Example 7
Source File: Cardumen_00243_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Receives notification of a change to the plot's dataset.
 * <P>
 * The range axis bounds will be recalculated if necessary.
 *
 * @param event  information about the event (not used here).
 */
public void datasetChanged(DatasetChangeEvent event) {

    int count = this.rangeAxes.size();
    for (int axisIndex = 0; axisIndex < count; axisIndex++) {
        ValueAxis yAxis = getRangeAxis(axisIndex);
        if (yAxis != null) {
            yAxis.configure();
        }
    }
    if (getParent() != null) {
        getParent().datasetChanged(event);
    }
    else {
        PlotChangeEvent e = new PlotChangeEvent(this);
        e.setType(ChartChangeEventType.DATASET_UPDATED);
        notifyListeners(e);
    }

}
 
Example 8
Source File: JGenProg2017_0081_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Sets a range axis and, if requested, sends a {@link PlotChangeEvent} to 
 * all registered listeners.
 *
 * @param index  the axis index.
 * @param axis  the axis.
 * @param notify  notify listeners?
 */
public void setRangeAxis(int index, ValueAxis axis, boolean notify) {
    ValueAxis existing = (ValueAxis) this.rangeAxes.get(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    if (axis != null) {
        axis.setPlot(this);
    }
    this.rangeAxes.set(index, axis);
    if (axis != null) {
        axis.configure();
        axis.addChangeListener(this);
    }
    if (notify) {
        notifyListeners(new PlotChangeEvent(this));
    }
}
 
Example 9
Source File: Cardumen_00143_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Receives notification of a change to the plot's dataset.
 * <P>
 * The range axis bounds will be recalculated if necessary.
 *
 * @param event  information about the event (not used here).
 */
public void datasetChanged(DatasetChangeEvent event) {

    int count = this.rangeAxes.size();
    for (int axisIndex = 0; axisIndex < count; axisIndex++) {
        ValueAxis yAxis = getRangeAxis(axisIndex);
        if (yAxis != null) {
            yAxis.configure();
        }
    }
    if (getParent() != null) {
        getParent().datasetChanged(event);
    }
    else {
        PlotChangeEvent e = new PlotChangeEvent(this);
        e.setType(ChartChangeEventType.DATASET_UPDATED);
        notifyListeners(e);
    }

}
 
Example 10
Source File: 1_XYPlot.java    From SimFix with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets a domain axis and, if requested, sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param index  the axis index.
 * @param axis  the axis.
 * @param notify  notify listeners?
 * 
 * @see #getDomainAxis(int)
 */
public void setDomainAxis(int index, ValueAxis axis, boolean notify) {
    ValueAxis existing = getDomainAxis(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    if (axis != null) {
        axis.setPlot(this);
    }
    this.domainAxes.set(index, axis);
    if (axis != null) {
        axis.configure();
        axis.addChangeListener(this);
    }
    if (notify) {
        fireChangeEvent();
    }
}
 
Example 11
Source File: XYPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the range axis for the plot and sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param axis  the axis (<code>null</code> permitted).
 *
 * @see #getRangeAxis()
 * @see #setRangeAxis(int, ValueAxis)
 */
public void setRangeAxis(ValueAxis axis)  {
    if (axis != null) {
        axis.setPlot(this);
    }
    // plot is likely registered as a listener with the existing axis...
    ValueAxis existing = getRangeAxis();
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.rangeAxes.put(0, axis);
    if (axis != null) {
        axis.configure();
        axis.addChangeListener(this);
    }
    fireChangeEvent();
}
 
Example 12
Source File: Cardumen_0082_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Sets the range axis for the plot and sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param axis  the axis (<code>null</code> permitted).
 *
 * @see #getRangeAxis()
 * @see #setRangeAxis(int, ValueAxis)
 */
public void setRangeAxis(ValueAxis axis)  {

    if (axis != null) {
        axis.setPlot(this);
    }

    // plot is likely registered as a listener with the existing axis...
    ValueAxis existing = getRangeAxis();
    if (existing != null) {
        existing.removeChangeListener(this);
    }

    this.rangeAxes.set(0, axis);
    if (axis != null) {
        axis.configure();
        axis.addChangeListener(this);
    }
    fireChangeEvent();

}
 
Example 13
Source File: XYPlot.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the range axis for the plot and sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param axis  the axis (<code>null</code> permitted).
 *
 * @see #getRangeAxis()
 * @see #setRangeAxis(int, ValueAxis)
 */
public void setRangeAxis(ValueAxis axis)  {
    if (axis != null) {
        axis.setPlot(this);
    }
    // plot is likely registered as a listener with the existing axis...
    ValueAxis existing = getRangeAxis();
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.rangeAxes.put(0, axis);
    if (axis != null) {
        axis.configure();
        axis.addChangeListener(this);
    }
    fireChangeEvent();
}
 
Example 14
Source File: 1_CategoryPlot.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Configures the range axes.
 */
public void configureRangeAxes() {
    for (int i = 0; i < this.rangeAxes.size(); i++) {
        ValueAxis axis = (ValueAxis) this.rangeAxes.get(i);
        if (axis != null) {
            axis.configure();
        }
    }
}
 
Example 15
Source File: Cardumen_0082_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Configures the range axes.
 *
 * @see #configureDomainAxes()
 */
public void configureRangeAxes() {
    for (int i = 0; i < this.rangeAxes.size(); i++) {
        ValueAxis axis = (ValueAxis) this.rangeAxes.get(i);
        if (axis != null) {
            axis.configure();
        }
    }
}
 
Example 16
Source File: XYPlot.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Configures the range axes.
 *
 * @see #configureDomainAxes()
 */
public void configureRangeAxes() {
    for (ValueAxis axis: this.rangeAxes.values()) {
        if (axis != null) {
            axis.configure();
        }
    }
}
 
Example 17
Source File: 1_XYPlot.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Configures the domain axes. 
 */
public void configureDomainAxes() {
    for (int i = 0; i < this.domainAxes.size(); i++) {
        ValueAxis axis = (ValueAxis) this.domainAxes.get(i);
        if (axis != null) {
            axis.configure();
        }
    }
}
 
Example 18
Source File: CombinedRangeCategoryPlot.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    stream.defaultReadObject();

    // the range axis is deserialized before the subplots, so its value
    // range is likely to be incorrect...
    ValueAxis rangeAxis = getRangeAxis();
    if (rangeAxis != null) {
        rangeAxis.configure();
    }

}
 
Example 19
Source File: Chart_14_XYPlot_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Configures the domain axes. 
 */
public void configureDomainAxes() {
    for (int i = 0; i < this.domainAxes.size(); i++) {
        ValueAxis axis = (ValueAxis) this.domainAxes.get(i);
        if (axis != null) {
            axis.configure();
        }
    }
}
 
Example 20
Source File: CombinedRangeCategoryPlot.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    stream.defaultReadObject();

    // the range axis is deserialized before the subplots, so its value
    // range is likely to be incorrect...
    ValueAxis rangeAxis = getRangeAxis();
    if (rangeAxis != null) {
        rangeAxis.configure();
    }

}