Java Code Examples for org.jfree.data.xy.XYDataset#addChangeListener()

The following examples show how to use org.jfree.data.xy.XYDataset#addChangeListener() . 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 5 votes vote down vote up
/**
 * Sets a dataset for the plot, replacing the existing dataset at the same
 * index if there is one, and sends a {@code link PlotChangeEvent} to all
 * registered listeners.
 *
 * @param index  the dataset index.
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset(int)
 *
 * @since 1.0.14
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.set(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 2
Source File: Chart_14_XYPlot_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets a dataset for the plot.
 *
 * @param index  the dataset index.
 * @param dataset  the dataset (<code>null</code> permitted).
 * 
 * @see #getDataset(int)
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.set(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 3
Source File: XYPlot.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets a dataset for the plot.
 *
 * @param index  the dataset index.
 * @param dataset  the dataset (<code>null</code> permitted).
 * 
 * @see #getDataset(int)
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.set(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 4
Source File: XYPlot.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets a dataset for the plot and sends a change event to all registered
 * listeners.
 *
 * @param index  the dataset index (must be &gt;= 0).
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset(int)
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.put(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 5
Source File: 1_XYPlot.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets a dataset for the plot.
 *
 * @param index  the dataset index.
 * @param dataset  the dataset (<code>null</code> permitted).
 * 
 * @see #getDataset(int)
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.set(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 6
Source File: PolarPlot.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets a dataset for the plot, replacing the existing dataset at the same
 * index if there is one, and sends a {@code link PlotChangeEvent} to all
 * registered listeners.
 *
 * @param index  the dataset index.
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset(int)
 *
 * @since 1.0.14
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.set(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 7
Source File: PolarPlot.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets a dataset for the plot, replacing the existing dataset at the same
 * index if there is one, and sends a {@code link PlotChangeEvent} to all
 * registered listeners.
 *
 * @param index  the dataset index.
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset(int)
 *
 * @since 1.0.14
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.set(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 8
Source File: Cardumen_009_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets a dataset for the plot.
 *
 * @param index  the dataset index.
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset(int)
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.set(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 9
Source File: PolarPlot.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a dataset for the plot, replacing the existing dataset at the same
 * index if there is one, and sends a {@code link PlotChangeEvent} to all
 * registered listeners.
 *
 * @param index  the dataset index.
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset(int)
 *
 * @since 1.0.14
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.set(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 10
Source File: XYPlot.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a dataset for the plot and sends a change event to all registered
 * listeners.
 *
 * @param index  the dataset index (must be &gt;= 0).
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset(int)
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.put(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 11
Source File: Cardumen_009_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets a dataset for the plot.
 *
 * @param index  the dataset index.
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset(int)
 */
public void setDataset(int index, XYDataset dataset) {
    XYDataset existing = getDataset(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    this.datasets.set(index, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
Example 12
Source File: Chart_14_XYPlot_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Creates a new plot with the specified dataset, axes and renderer.  Any
 * of the arguments can be <code>null</code>, but in that case you should
 * take care to specify the value before using the plot (otherwise a
 * <code>NullPointerException</code> may be thrown).
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the renderer (<code>null</code> permitted).
 */
public XYPlot(XYDataset dataset,
              ValueAxis domainAxis,
              ValueAxis rangeAxis,
              XYItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;
    this.weight = 1;  // only relevant when this is a subplot
    this.axisOffset = new RectangleInsets(4.0, 4.0, 4.0, 4.0);

    // allocate storage for datasets, axes and renderers (all optional)
    this.domainAxes = new ObjectList();
    this.domainAxisLocations = new ObjectList();
    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();

    this.rangeAxes = new ObjectList();
    this.rangeAxisLocations = new ObjectList();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.datasets = new ObjectList();
    this.renderers = new ObjectList();

    this.datasetToDomainAxisMap = new TreeMap();
    this.datasetToRangeAxisMap = new TreeMap();

    this.datasets.set(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

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

    this.domainAxes.set(0, domainAxis);
    this.mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.domainAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT);

    this.rangeAxes.set(0, rangeAxis);
    this.mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }
    this.rangeAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT);

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = true;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.domainZeroBaselineVisible = false;
    this.domainZeroBaselinePaint = Color.black;
    this.domainZeroBaselineStroke = new BasicStroke(0.5f);

    this.rangeGridlinesVisible = true;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    this.rangeZeroBaselinePaint = Color.black;
    this.rangeZeroBaselineStroke = new BasicStroke(0.5f);

    this.domainCrosshairVisible = false;
    this.domainCrosshairValue = 0.0;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = false;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

}
 
Example 13
Source File: PolarPlot.java    From openstock 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;
}
 
Example 14
Source File: XYPlot.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new plot with the specified dataset, axes and renderer.  Any
 * of the arguments can be <code>null</code>, but in that case you should
 * take care to specify the value before using the plot (otherwise a
 * <code>NullPointerException</code> may be thrown).
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the renderer (<code>null</code> permitted).
 */
public XYPlot(XYDataset dataset,
              ValueAxis domainAxis,
              ValueAxis rangeAxis,
              XYItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;
    this.weight = 1;  // only relevant when this is a subplot
    this.axisOffset = RectangleInsets.ZERO_INSETS;

    // allocate storage for datasets, axes and renderers (all optional)
    this.domainAxes = new ObjectList();
    this.domainAxisLocations = new ObjectList();
    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();

    this.rangeAxes = new ObjectList();
    this.rangeAxisLocations = new ObjectList();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.datasets = new ObjectList();
    this.renderers = new ObjectList();

    this.datasetToDomainAxisMap = new TreeMap();
    this.datasetToRangeAxisMap = new TreeMap();

    this.datasets.set(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

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

    this.domainAxes.set(0, domainAxis);
    this.mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.domainAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT);

    this.rangeAxes.set(0, rangeAxis);
    this.mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }
    this.rangeAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT);

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = true;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeGridlinesVisible = true;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    this.rangeZeroBaselinePaint = Color.black;
    this.rangeZeroBaselineStroke = new BasicStroke(0.5f);

    this.domainCrosshairVisible = false;
    this.domainCrosshairValue = 0.0;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = false;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

}
 
Example 15
Source File: PolarPlot.java    From SIMVA-SoS with Apache License 2.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;
}
 
Example 16
Source File: PolarPlot.java    From buffer_bci 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;
}
 
Example 17
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;
}
 
Example 18
Source File: 1_XYPlot.java    From SimFix with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new plot with the specified dataset, axes and renderer.  Any
 * of the arguments can be <code>null</code>, but in that case you should
 * take care to specify the value before using the plot (otherwise a
 * <code>NullPointerException</code> may be thrown).
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the renderer (<code>null</code> permitted).
 */
public XYPlot(XYDataset dataset,
              ValueAxis domainAxis,
              ValueAxis rangeAxis,
              XYItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;
    this.weight = 1;  // only relevant when this is a subplot
    this.axisOffset = new RectangleInsets(4.0, 4.0, 4.0, 4.0);

    // allocate storage for datasets, axes and renderers (all optional)
    this.domainAxes = new ObjectList();
    this.domainAxisLocations = new ObjectList();
    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();

    this.rangeAxes = new ObjectList();
    this.rangeAxisLocations = new ObjectList();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.datasets = new ObjectList();
    this.renderers = new ObjectList();

    this.datasetToDomainAxisMap = new TreeMap();
    this.datasetToRangeAxisMap = new TreeMap();

    this.datasets.set(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

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

    this.domainAxes.set(0, domainAxis);
    this.mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.domainAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT);

    this.rangeAxes.set(0, rangeAxis);
    this.mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }
    this.rangeAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT);

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = true;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.domainZeroBaselineVisible = false;
    this.domainZeroBaselinePaint = Color.black;
    this.domainZeroBaselineStroke = new BasicStroke(0.5f);

    this.rangeGridlinesVisible = true;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    this.rangeZeroBaselinePaint = Color.black;
    this.rangeZeroBaselineStroke = new BasicStroke(0.5f);

    this.domainCrosshairVisible = false;
    this.domainCrosshairValue = 0.0;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = false;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

}
 
Example 19
Source File: PolarPlot.java    From ECG-Viewer with GNU General Public License v2.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;
}
 
Example 20
Source File: XYPlot.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new plot with the specified dataset, axes and renderer.  Any
 * of the arguments can be <code>null</code>, but in that case you should
 * take care to specify the value before using the plot (otherwise a
 * <code>NullPointerException</code> may be thrown).
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the renderer (<code>null</code> permitted).
 */
public XYPlot(XYDataset dataset,
              ValueAxis domainAxis,
              ValueAxis rangeAxis,
              XYItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;
    this.weight = 1;  // only relevant when this is a subplot
    this.axisOffset = new RectangleInsets(4.0, 4.0, 4.0, 4.0);

    // allocate storage for datasets, axes and renderers (all optional)
    this.domainAxes = new ObjectList();
    this.domainAxisLocations = new ObjectList();
    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();

    this.rangeAxes = new ObjectList();
    this.rangeAxisLocations = new ObjectList();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.datasets = new ObjectList();
    this.renderers = new ObjectList();

    this.datasetToDomainAxisMap = new TreeMap();
    this.datasetToRangeAxisMap = new TreeMap();

    this.datasets.set(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

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

    this.domainAxes.set(0, domainAxis);
    this.mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.domainAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT);

    this.rangeAxes.set(0, rangeAxis);
    this.mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }
    this.rangeAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT);

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = true;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.domainZeroBaselineVisible = false;
    this.domainZeroBaselinePaint = Color.black;
    this.domainZeroBaselineStroke = new BasicStroke(0.5f);

    this.rangeGridlinesVisible = true;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    this.rangeZeroBaselinePaint = Color.black;
    this.rangeZeroBaselineStroke = new BasicStroke(0.5f);

    this.domainCrosshairVisible = false;
    this.domainCrosshairValue = 0.0;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = false;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

}