org.jfree.chart.renderer.PolarItemRenderer Java Examples

The following examples show how to use org.jfree.chart.renderer.PolarItemRenderer. 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: PolarPlot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets a renderer and, if requested, sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param index  the index.
 * @param renderer  the renderer.
 * @param notify  notify listeners?
 *
 * @see #getRenderer(int)
 *
 * @since 1.0.14
 */
public void setRenderer(int index, PolarItemRenderer renderer,
                        boolean notify) {
    PolarItemRenderer existing = getRenderer(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.renderers.set(index, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }
    if (notify) {
        fireChangeEvent();
    }
}
 
Example #2
Source File: PolarPlot.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the legend items for the plot.  Each legend item is generated by
 * the plot's m_Renderer, since the m_Renderer is responsible for the visual
 * representation of the data.
 *
 * @return The legend items.
 */
@Override
public LegendItemCollection getLegendItems() {
    if (this.fixedLegendItems != null) {
        return this.fixedLegendItems;
    }
    LegendItemCollection result = new LegendItemCollection();
    int count = this.datasets.size();
    for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {
        XYDataset dataset = getDataset(datasetIndex);
        PolarItemRenderer renderer = getRenderer(datasetIndex);
        if (dataset != null && renderer != null) {
            int seriesCount = dataset.getSeriesCount();
            for (int i = 0; i < seriesCount; i++) {
                LegendItem item = renderer.getLegendItem(i);
                result.add(item);
            }
        }
    }
    return result;
}
 
Example #3
Source File: PolarPlot.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets a renderer and, if requested, sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param index  the index.
 * @param renderer  the renderer.
 * @param notify  notify listeners?
 *
 * @see #getRenderer(int)
 *
 * @since 1.0.14
 */
public void setRenderer(int index, PolarItemRenderer renderer,
                        boolean notify) {
    PolarItemRenderer existing = getRenderer(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.renderers.set(index, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }
    if (notify) {
        fireChangeEvent();
    }
}
 
Example #4
Source File: PolarPlot.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the legend items for the plot.  Each legend item is generated by
 * the plot's m_Renderer, since the m_Renderer is responsible for the visual
 * representation of the data.
 *
 * @return The legend items.
 */
@Override
public LegendItemCollection getLegendItems() {
    if (this.fixedLegendItems != null) {
        return this.fixedLegendItems;
    }
    LegendItemCollection result = new LegendItemCollection();
    int count = this.datasets.size();
    for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {
        XYDataset dataset = getDataset(datasetIndex);
        PolarItemRenderer renderer = getRenderer(datasetIndex);
        if (dataset != null && renderer != null) {
            int seriesCount = dataset.getSeriesCount();
            for (int i = 0; i < seriesCount; i++) {
                LegendItem item = renderer.getLegendItem(i);
                result.add(item);
            }
        }
    }
    return result;
}
 
Example #5
Source File: PolarPlot.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Sets a renderer and, if requested, sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param index  the index.
 * @param renderer  the renderer.
 * @param notify  notify listeners?
 *
 * @see #getRenderer(int)
 *
 * @since 1.0.14
 */
public void setRenderer(int index, PolarItemRenderer renderer,
                        boolean notify) {
    PolarItemRenderer existing = getRenderer(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.renderers.set(index, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }
    if (notify) {
        fireChangeEvent();
    }
}
 
Example #6
Source File: PolarPlot.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets a renderer and, if requested, sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param index  the index.
 * @param renderer  the renderer.
 * @param notify  notify listeners?
 *
 * @see #getRenderer(int)
 *
 * @since 1.0.14
 */
public void setRenderer(int index, PolarItemRenderer renderer,
                        boolean notify) {
    PolarItemRenderer existing = getRenderer(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.renderers.set(index, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }
    if (notify) {
        fireChangeEvent();
    }
}
 
Example #7
Source File: PolarPlot.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the legend items for the plot.  Each legend item is generated by
 * the plot's m_Renderer, since the m_Renderer is responsible for the visual
 * representation of the data.
 *
 * @return The legend items.
 */
@Override
public LegendItemCollection getLegendItems() {
    if (this.fixedLegendItems != null) {
        return this.fixedLegendItems;
    }
    LegendItemCollection result = new LegendItemCollection();
    int count = this.datasets.size();
    for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {
        XYDataset dataset = getDataset(datasetIndex);
        PolarItemRenderer renderer = getRenderer(datasetIndex);
        if (dataset != null && renderer != null) {
            int seriesCount = dataset.getSeriesCount();
            for (int i = 0; i < seriesCount; i++) {
                LegendItem item = renderer.getLegendItem(i);
                result.add(item);
            }
        }
    }
    return result;
}
 
Example #8
Source File: PolarPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the legend items for the plot.  Each legend item is generated by
 * the plot's m_Renderer, since the m_Renderer is responsible for the visual
 * representation of the data.
 *
 * @return The legend items.
 */
@Override
public LegendItemCollection getLegendItems() {
    if (this.fixedLegendItems != null) {
        return this.fixedLegendItems;
    }
    LegendItemCollection result = new LegendItemCollection();
    int count = this.datasets.size();
    for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {
        XYDataset dataset = getDataset(datasetIndex);
        PolarItemRenderer renderer = getRenderer(datasetIndex);
        if (dataset != null && renderer != null) {
            int seriesCount = dataset.getSeriesCount();
            for (int i = 0; i < seriesCount; i++) {
                LegendItem item = renderer.getLegendItem(i);
                result.add(item);
            }
        }
    }
    return result;
}
 
Example #9
Source File: PolarPlot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the legend items for the plot.  Each legend item is generated by
 * the plot's m_Renderer, since the m_Renderer is responsible for the visual
 * representation of the data.
 *
 * @return The legend items.
 */
@Override
public LegendItemCollection getLegendItems() {
    if (this.fixedLegendItems != null) {
        return this.fixedLegendItems;
    }
    LegendItemCollection result = new LegendItemCollection();
    int count = this.datasets.size();
    for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {
        XYDataset dataset = getDataset(datasetIndex);
        PolarItemRenderer renderer = getRenderer(datasetIndex);
        if (dataset != null && renderer != null) {
            int seriesCount = dataset.getSeriesCount();
            for (int i = 0; i < seriesCount; i++) {
                LegendItem item = renderer.getLegendItem(i);
                result.add(item);
            }
        }
    }
    return result;
}
 
Example #10
Source File: PolarPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets a renderer and, if requested, sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param index  the index.
 * @param renderer  the renderer.
 * @param notify  notify listeners?
 *
 * @see #getRenderer(int)
 *
 * @since 1.0.14
 */
public void setRenderer(int index, PolarItemRenderer renderer,
                        boolean notify) {
    PolarItemRenderer existing = getRenderer(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.renderers.set(index, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }
    if (notify) {
        fireChangeEvent();
    }
}
 
Example #11
Source File: PolarPlot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets a renderer and, if requested, sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param index  the index.
 * @param renderer  the renderer.
 * @param notify  notify listeners?
 *
 * @see #getRenderer(int)
 *
 * @since 1.0.14
 */
public void setRenderer(int index, PolarItemRenderer renderer,
                        boolean notify) {
    PolarItemRenderer existing = getRenderer(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.renderers.set(index, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }
    if (notify) {
        fireChangeEvent();
    }
}
 
Example #12
Source File: PolarPlot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the legend items for the plot.  Each legend item is generated by
 * the plot's m_Renderer, since the m_Renderer is responsible for the visual
 * representation of the data.
 *
 * @return The legend items.
 */
@Override
public LegendItemCollection getLegendItems() {
    if (this.fixedLegendItems != null) {
        return this.fixedLegendItems;
    }
    LegendItemCollection result = new LegendItemCollection();
    int count = this.datasets.size();
    for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {
        XYDataset dataset = getDataset(datasetIndex);
        PolarItemRenderer renderer = getRenderer(datasetIndex);
        if (dataset != null && renderer != null) {
            int seriesCount = dataset.getSeriesCount();
            for (int i = 0; i < seriesCount; i++) {
                LegendItem item = renderer.getLegendItem(i);
                result.add(item);
            }
        }
    }
    return result;
}
 
Example #13
Source File: PolarPlot.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a representation of the data within the dataArea region, using the
 * current m_Renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param info  an optional object for collection dimension
 *              information (<code>null</code> permitted).
 */
protected void render(Graphics2D g2, Rectangle2D dataArea,
        PlotRenderingInfo info) {

    // now get the data and plot it (the visual representation will depend
    // on the m_Renderer that has been set)...
    boolean hasData = false;
    int datasetCount = this.datasets.size();
    for (int i = datasetCount - 1; i >= 0; i--) {
        XYDataset dataset = getDataset(i);
        if (dataset == null) {
            continue;
        }
        PolarItemRenderer renderer = getRenderer(i);
        if (renderer == null) {
            continue;
        }
        if (!DatasetUtilities.isEmptyOrNull(dataset)) {
            hasData = true;
            int seriesCount = dataset.getSeriesCount();
            for (int series = 0; series < seriesCount; series++) {
                renderer.drawSeries(g2, dataArea, info, this, dataset,
                        series);
            }
        }
    }
    if (!hasData) {
        drawNoDataMessage(g2, dataArea);
    }
}
 
Example #14
Source File: PolarPlot.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param radiusAxis  the radius axis (<code>null</code> permitted).
 * @param renderer  the renderer (<code>null</code> permitted).
 */
public PolarPlot(XYDataset dataset,
                 ValueAxis radiusAxis,
                 PolarItemRenderer renderer) {

    super();

    this.dataset = dataset;
    if (this.dataset != null) {
        this.dataset.addChangeListener(this);
    }
    this.angleTickUnit = new NumberTickUnit(DEFAULT_ANGLE_TICK_UNIT_SIZE);

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

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

    this.angleGridlinesVisible = true;
    this.angleGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.angleGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.radiusGridlinesVisible = true;
    this.radiusGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.radiusGridlinePaint = DEFAULT_GRIDLINE_PAINT;
}
 
Example #15
Source File: PolarPlot.java    From ccu-historian with GNU General Public License v3.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();
    this.angleGridlineStroke = SerialUtilities.readStroke(stream);
    this.angleGridlinePaint = SerialUtilities.readPaint(stream);
    this.radiusGridlineStroke = SerialUtilities.readStroke(stream);
    this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
    this.angleLabelPaint = SerialUtilities.readPaint(stream);

    int rangeAxisCount = this.axes.size();
    for (int i = 0; i < rangeAxisCount; i++) {
        Axis axis = (Axis) this.axes.get(i);
        if (axis != null) {
            axis.setPlot(this);
            axis.addChangeListener(this);
        }
    }
    int datasetCount = this.datasets.size();
    for (int i = 0; i < datasetCount; i++) {
        Dataset dataset = (Dataset) this.datasets.get(i);
        if (dataset != null) {
            dataset.addChangeListener(this);
        }
    }
    int rendererCount = this.renderers.size();
    for (int i = 0; i < rendererCount; i++) {
        PolarItemRenderer renderer = (PolarItemRenderer) this.renderers.get(i);
        if (renderer != null) {
            renderer.addChangeListener(this);
        }
    }
}
 
Example #16
Source File: PolarPlot.java    From openstock with GNU General Public License v3.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();
    this.angleGridlineStroke = SerialUtilities.readStroke(stream);
    this.angleGridlinePaint = SerialUtilities.readPaint(stream);
    this.radiusGridlineStroke = SerialUtilities.readStroke(stream);
    this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
    this.angleLabelPaint = SerialUtilities.readPaint(stream);

    int rangeAxisCount = this.axes.size();
    for (int i = 0; i < rangeAxisCount; i++) {
        Axis axis = (Axis) this.axes.get(i);
        if (axis != null) {
            axis.setPlot(this);
            axis.addChangeListener(this);
        }
    }
    int datasetCount = this.datasets.size();
    for (int i = 0; i < datasetCount; i++) {
        Dataset dataset = (Dataset) this.datasets.get(i);
        if (dataset != null) {
            dataset.addChangeListener(this);
        }
    }
    int rendererCount = this.renderers.size();
    for (int i = 0; i < rendererCount; i++) {
        PolarItemRenderer renderer = (PolarItemRenderer) this.renderers.get(i);
        if (renderer != null) {
            renderer.addChangeListener(this);
        }
    }
}
 
Example #17
Source File: PolarPlot.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a representation of the data within the dataArea region, using the
 * current m_Renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param info  an optional object for collection dimension
 *              information (<code>null</code> permitted).
 */
protected void render(Graphics2D g2, Rectangle2D dataArea,
        PlotRenderingInfo info) {

    // now get the data and plot it (the visual representation will depend
    // on the m_Renderer that has been set)...
    boolean hasData = false;
    int datasetCount = this.datasets.size();
    for (int i = datasetCount - 1; i >= 0; i--) {
        XYDataset dataset = getDataset(i);
        if (dataset == null) {
            continue;
        }
        PolarItemRenderer renderer = getRenderer(i);
        if (renderer == null) {
            continue;
        }
        if (!DatasetUtilities.isEmptyOrNull(dataset)) {
            hasData = true;
            int seriesCount = dataset.getSeriesCount();
            for (int series = 0; series < seriesCount; series++) {
                renderer.drawSeries(g2, dataArea, info, this, dataset,
                        series);
            }
        }
    }
    if (!hasData) {
        drawNoDataMessage(g2, dataArea);
    }
}
 
Example #18
Source File: PolarPlot.java    From SIMVA-SoS with Apache License 2.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();
    this.angleGridlineStroke = SerialUtilities.readStroke(stream);
    this.angleGridlinePaint = SerialUtilities.readPaint(stream);
    this.radiusGridlineStroke = SerialUtilities.readStroke(stream);
    this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
    this.angleLabelPaint = SerialUtilities.readPaint(stream);

    int rangeAxisCount = this.axes.size();
    for (int i = 0; i < rangeAxisCount; i++) {
        Axis axis = (Axis) this.axes.get(i);
        if (axis != null) {
            axis.setPlot(this);
            axis.addChangeListener(this);
        }
    }
    int datasetCount = this.datasets.size();
    for (int i = 0; i < datasetCount; i++) {
        Dataset dataset = (Dataset) this.datasets.get(i);
        if (dataset != null) {
            dataset.addChangeListener(this);
        }
    }
    int rendererCount = this.renderers.size();
    for (int i = 0; i < rendererCount; i++) {
        PolarItemRenderer renderer = (PolarItemRenderer) this.renderers.get(i);
        if (renderer != null) {
            renderer.addChangeListener(this);
        }
    }
}
 
Example #19
Source File: PolarPlot.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Draws a representation of the data within the dataArea region, using the
 * current m_Renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param info  an optional object for collection dimension
 *              information (<code>null</code> permitted).
 */
protected void render(Graphics2D g2, Rectangle2D dataArea,
        PlotRenderingInfo info) {

    // now get the data and plot it (the visual representation will depend
    // on the m_Renderer that has been set)...
    boolean hasData = false;
    int datasetCount = this.datasets.size();
    for (int i = datasetCount - 1; i >= 0; i--) {
        XYDataset dataset = getDataset(i);
        if (dataset == null) {
            continue;
        }
        PolarItemRenderer renderer = getRenderer(i);
        if (renderer == null) {
            continue;
        }
        if (!DatasetUtilities.isEmptyOrNull(dataset)) {
            hasData = true;
            int seriesCount = dataset.getSeriesCount();
            for (int series = 0; series < seriesCount; series++) {
                renderer.drawSeries(g2, dataArea, info, this, dataset,
                        series);
            }
        }
    }
    if (!hasData) {
        drawNoDataMessage(g2, dataArea);
    }
}
 
Example #20
Source File: PolarPlot.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draws a representation of the data within the dataArea region, using the
 * current m_Renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param info  an optional object for collection dimension
 *              information (<code>null</code> permitted).
 */
protected void render(Graphics2D g2, Rectangle2D dataArea,
        PlotRenderingInfo info) {

    // now get the data and plot it (the visual representation will depend
    // on the m_Renderer that has been set)...
    boolean hasData = false;
    int datasetCount = this.datasets.size();
    for (int i = datasetCount - 1; i >= 0; i--) {
        XYDataset dataset = getDataset(i);
        if (dataset == null) {
            continue;
        }
        PolarItemRenderer renderer = getRenderer(i);
        if (renderer == null) {
            continue;
        }
        if (!DatasetUtilities.isEmptyOrNull(dataset)) {
            hasData = true;
            int seriesCount = dataset.getSeriesCount();
            for (int series = 0; series < seriesCount; series++) {
                renderer.drawSeries(g2, dataArea, info, this, dataset,
                        series);
            }
        }
    }
    if (!hasData) {
        drawNoDataMessage(g2, dataArea);
    }
}
 
Example #21
Source File: PolarPlot.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();
    this.angleGridlineStroke = SerialUtilities.readStroke(stream);
    this.angleGridlinePaint = SerialUtilities.readPaint(stream);
    this.radiusGridlineStroke = SerialUtilities.readStroke(stream);
    this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
    this.angleLabelPaint = SerialUtilities.readPaint(stream);

    int rangeAxisCount = this.axes.size();
    for (int i = 0; i < rangeAxisCount; i++) {
        Axis axis = (Axis) this.axes.get(i);
        if (axis != null) {
            axis.setPlot(this);
            axis.addChangeListener(this);
        }
    }
    int datasetCount = this.datasets.size();
    for (int i = 0; i < datasetCount; i++) {
        Dataset dataset = (Dataset) this.datasets.get(i);
        if (dataset != null) {
            dataset.addChangeListener(this);
        }
    }
    int rendererCount = this.renderers.size();
    for (int i = 0; i < rendererCount; i++) {
        PolarItemRenderer renderer = (PolarItemRenderer) this.renderers.get(i);
        if (renderer != null) {
            renderer.addChangeListener(this);
        }
    }
}
 
Example #22
Source File: PolarPlot.java    From buffer_bci with GNU General Public License v3.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();
    this.angleGridlineStroke = SerialUtilities.readStroke(stream);
    this.angleGridlinePaint = SerialUtilities.readPaint(stream);
    this.radiusGridlineStroke = SerialUtilities.readStroke(stream);
    this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
    this.angleLabelPaint = SerialUtilities.readPaint(stream);

    int rangeAxisCount = this.axes.size();
    for (int i = 0; i < rangeAxisCount; i++) {
        Axis axis = (Axis) this.axes.get(i);
        if (axis != null) {
            axis.setPlot(this);
            axis.addChangeListener(this);
        }
    }
    int datasetCount = this.datasets.size();
    for (int i = 0; i < datasetCount; i++) {
        Dataset dataset = (Dataset) this.datasets.get(i);
        if (dataset != null) {
            dataset.addChangeListener(this);
        }
    }
    int rendererCount = this.renderers.size();
    for (int i = 0; i < rendererCount; i++) {
        PolarItemRenderer renderer = (PolarItemRenderer) this.renderers.get(i);
        if (renderer != null) {
            renderer.addChangeListener(this);
        }
    }
}
 
Example #23
Source File: PolarPlot.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the item renderer, and notifies all listeners of a change to the
 * plot.
 * <P>
 * If the renderer is set to <code>null</code>, no chart will be drawn.
 *
 * @param renderer  the new renderer (<code>null</code> permitted).
 *
 * @see #getRenderer()
 */
public void setRenderer(PolarItemRenderer renderer) {
    if (this.renderer != null) {
        this.renderer.removeChangeListener(this);
    }

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

    fireChangeEvent();
}
 
Example #24
Source File: PolarPlot.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param radiusAxis  the radius axis (<code>null</code> permitted).
 * @param renderer  the renderer (<code>null</code> permitted).
 */
public PolarPlot(XYDataset dataset, 
                 ValueAxis radiusAxis,
                 PolarItemRenderer renderer) {
  
    super();
        
    this.dataset = dataset;
    if (this.dataset != null) {
        this.dataset.addChangeListener(this);
    }
    this.angleTickUnit = new NumberTickUnit(DEFAULT_ANGLE_TICK_UNIT_SIZE);
    
    this.axis = radiusAxis;
    if (this.axis != null) {
        this.axis.setPlot(this);
        this.axis.addChangeListener(this);
    }
  
    this.renderer = renderer;
    if (this.renderer != null) {
        this.renderer.setPlot(this);
        this.renderer.addChangeListener(this);
    }
  
    this.angleGridlinesVisible = true;
    this.angleGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.angleGridlinePaint = DEFAULT_GRIDLINE_PAINT;
  
    this.radiusGridlinesVisible = true;
    this.radiusGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.radiusGridlinePaint = DEFAULT_GRIDLINE_PAINT;      
}
 
Example #25
Source File: PolarPlot.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the item renderer, and notifies all listeners of a change to the 
 * plot.
 * <P>
 * If the renderer is set to <code>null</code>, no chart will be drawn.
 *
 * @param renderer  the new renderer (<code>null</code> permitted).
 * 
 * @see #getRenderer()
 */
public void setRenderer(PolarItemRenderer renderer) {
    if (this.renderer != null) {
        this.renderer.removeChangeListener(this);
    }
   
    this.renderer = renderer;
    if (this.renderer != null) {
        this.renderer.setPlot(this);
    }
   
    fireChangeEvent();
}
 
Example #26
Source File: PolarPlot.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the item renderer, and notifies all listeners of a change to the 
 * plot.
 * <P>
 * If the renderer is set to <code>null</code>, no chart will be drawn.
 *
 * @param renderer  the new renderer (<code>null</code> permitted).
 * 
 * @see #getRenderer()
 */
public void setRenderer(PolarItemRenderer renderer) {
    if (this.renderer != null) {
        this.renderer.removeChangeListener(this);
    }
   
    this.renderer = renderer;
    if (this.renderer != null) {
        this.renderer.setPlot(this);
    }
   
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #27
Source File: PolarPlot.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a representation of the data within the dataArea region, using the
 * current m_Renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param info  an optional object for collection dimension
 *              information (<code>null</code> permitted).
 */
protected void render(Graphics2D g2, Rectangle2D dataArea,
        PlotRenderingInfo info) {

    // now get the data and plot it (the visual representation will depend
    // on the m_Renderer that has been set)...
    boolean hasData = false;
    int datasetCount = this.datasets.size();
    for (int i = datasetCount - 1; i >= 0; i--) {
        XYDataset dataset = getDataset(i);
        if (dataset == null) {
            continue;
        }
        PolarItemRenderer renderer = getRenderer(i);
        if (renderer == null) {
            continue;
        }
        if (!DatasetUtilities.isEmptyOrNull(dataset)) {
            hasData = true;
            int seriesCount = dataset.getSeriesCount();
            for (int series = 0; series < seriesCount; series++) {
                renderer.drawSeries(g2, dataArea, info, this, dataset,
                        series);
            }
        }
    }
    if (!hasData) {
        drawNoDataMessage(g2, dataArea);
    }
}
 
Example #28
Source File: PolarPlot.java    From buffer_bci with GNU General Public License v3.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();
    this.angleGridlineStroke = SerialUtilities.readStroke(stream);
    this.angleGridlinePaint = SerialUtilities.readPaint(stream);
    this.radiusGridlineStroke = SerialUtilities.readStroke(stream);
    this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
    this.angleLabelPaint = SerialUtilities.readPaint(stream);

    int rangeAxisCount = this.axes.size();
    for (int i = 0; i < rangeAxisCount; i++) {
        Axis axis = (Axis) this.axes.get(i);
        if (axis != null) {
            axis.setPlot(this);
            axis.addChangeListener(this);
        }
    }
    int datasetCount = this.datasets.size();
    for (int i = 0; i < datasetCount; i++) {
        Dataset dataset = (Dataset) this.datasets.get(i);
        if (dataset != null) {
            dataset.addChangeListener(this);
        }
    }
    int rendererCount = this.renderers.size();
    for (int i = 0; i < rendererCount; i++) {
        PolarItemRenderer renderer = (PolarItemRenderer) this.renderers.get(i);
        if (renderer != null) {
            renderer.addChangeListener(this);
        }
    }
}
 
Example #29
Source File: PolarPlot.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a representation of the data within the dataArea region, using the
 * current m_Renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param info  an optional object for collection dimension
 *              information (<code>null</code> permitted).
 */
protected void render(Graphics2D g2, Rectangle2D dataArea,
        PlotRenderingInfo info) {

    // now get the data and plot it (the visual representation will depend
    // on the m_Renderer that has been set)...
    boolean hasData = false;
    int datasetCount = this.datasets.size();
    for (int i = datasetCount - 1; i >= 0; i--) {
        XYDataset dataset = getDataset(i);
        if (dataset == null) {
            continue;
        }
        PolarItemRenderer renderer = getRenderer(i);
        if (renderer == null) {
            continue;
        }
        if (!DatasetUtilities.isEmptyOrNull(dataset)) {
            hasData = true;
            int seriesCount = dataset.getSeriesCount();
            for (int series = 0; series < seriesCount; series++) {
                renderer.drawSeries(g2, dataArea, info, this, dataset,
                        series);
            }
        }
    }
    if (!hasData) {
        drawNoDataMessage(g2, dataArea);
    }
}
 
Example #30
Source File: PolarPlot.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param radiusAxis  the radius axis (<code>null</code> permitted).
 * @param renderer  the renderer (<code>null</code> permitted).
 */
public PolarPlot(XYDataset dataset, ValueAxis radiusAxis,
            PolarItemRenderer renderer) {

    super();

    this.datasets = new ObjectList();
    this.datasets.set(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }
    this.angleTickUnit = new NumberTickUnit(DEFAULT_ANGLE_TICK_UNIT_SIZE);

    this.axes = new ObjectList();
    this.datasetToAxesMap = new TreeMap();
    this.axes.set(0, radiusAxis);
    if (radiusAxis != null) {
        radiusAxis.setPlot(this);
        radiusAxis.addChangeListener(this);
    }

    // define the default locations for up to 8 axes...
    this.axisLocations = new ObjectList();
    this.axisLocations.set(0, PolarAxisLocation.EAST_ABOVE);
    this.axisLocations.set(1, PolarAxisLocation.NORTH_LEFT);
    this.axisLocations.set(2, PolarAxisLocation.WEST_BELOW);
    this.axisLocations.set(3, PolarAxisLocation.SOUTH_RIGHT);
    this.axisLocations.set(4, PolarAxisLocation.EAST_BELOW);
    this.axisLocations.set(5, PolarAxisLocation.NORTH_RIGHT);
    this.axisLocations.set(6, PolarAxisLocation.WEST_ABOVE);
    this.axisLocations.set(7, PolarAxisLocation.SOUTH_LEFT);

    this.renderers = new ObjectList();
    this.renderers.set(0, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }

    this.angleOffset = DEFAULT_ANGLE_OFFSET;
    this.counterClockwise = false;
    this.angleGridlinesVisible = true;
    this.angleGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.angleGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.radiusGridlinesVisible = true;
    this.radiusMinorGridlinesVisible = true;
    this.radiusGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.radiusGridlinePaint = DEFAULT_GRIDLINE_PAINT;
    this.margin = DEFAULT_MARGIN;
}