Search in sources :

Example 1 with ContourDataset

use of org.jfree.data.contour.ContourDataset in project SIMVA-SoS by SESoS.

the class ContourPlot method render.

/**
 * Draws a representation of the data within the dataArea region, using the
 * current renderer.
 * <P>
 * The <code>info</code> and <code>crosshairState</code> arguments may be
 * <code>null</code>.
 *
 * @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.
 * @param crosshairState  an optional object for collecting crosshair info.
 */
public void render(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, CrosshairState crosshairState) {
    // now get the data and plot it (the visual representation will depend
    // on the renderer that has been set)...
    ContourDataset data = getDataset();
    if (data != null) {
        ColorBar zAxis = getColorBar();
        if (this.clipPath != null) {
            GeneralPath clipper = getClipPath().draw(g2, dataArea, this.domainAxis, this.rangeAxis);
            if (this.clipPath.isClip()) {
                g2.clip(clipper);
            }
        }
        if (this.renderAsPoints) {
            pointRenderer(g2, dataArea, info, this, this.domainAxis, this.rangeAxis, zAxis, data, crosshairState);
        } else {
            contourRenderer(g2, dataArea, info, this, this.domainAxis, this.rangeAxis, zAxis, data, crosshairState);
        }
        // draw vertical crosshair if required...
        setDomainCrosshairValue(crosshairState.getCrosshairX(), false);
        if (isDomainCrosshairVisible()) {
            drawVerticalLine(g2, dataArea, getDomainCrosshairValue(), getDomainCrosshairStroke(), getDomainCrosshairPaint());
        }
        // draw horizontal crosshair if required...
        setRangeCrosshairValue(crosshairState.getCrosshairY(), false);
        if (isRangeCrosshairVisible()) {
            drawHorizontalLine(g2, dataArea, getRangeCrosshairValue(), getRangeCrosshairStroke(), getRangeCrosshairPaint());
        }
    } else if (this.clipPath != null) {
        getClipPath().draw(g2, dataArea, this.domainAxis, this.rangeAxis);
    }
}
Also used : GeneralPath(java.awt.geom.GeneralPath) ContourDataset(org.jfree.data.contour.ContourDataset) ColorBar(org.jfree.chart.axis.ColorBar)

Example 2 with ContourDataset

use of org.jfree.data.contour.ContourDataset in project SIMVA-SoS by SESoS.

the class ContourPlot method setDataset.

/**
 * Sets the dataset for the plot, replacing the existing dataset if there
 * is one.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public void setDataset(ContourDataset dataset) {
    // if there is an existing dataset, remove the plot from the list of
    // change listeners...
    ContourDataset existing = this.dataset;
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    // set the new dataset, and register the chart as a change listener...
    this.dataset = dataset;
    if (dataset != null) {
        setDatasetGroup(dataset.getGroup());
        dataset.addChangeListener(this);
    }
    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
Also used : ContourDataset(org.jfree.data.contour.ContourDataset) DatasetChangeEvent(org.jfree.data.general.DatasetChangeEvent)

Example 3 with ContourDataset

use of org.jfree.data.contour.ContourDataset in project SIMVA-SoS by SESoS.

the class ContourPlot method getContourDataRange.

/**
 * Returns the range for the Contours.
 *
 * @return The range for the Contours (z-axis).
 */
@Override
public Range getContourDataRange() {
    Range result = null;
    ContourDataset data = getDataset();
    if (data != null) {
        Range h = getDomainAxis().getRange();
        Range v = getRangeAxis().getRange();
        result = this.visibleRange(data, h, v);
    }
    return result;
}
Also used : ContourDataset(org.jfree.data.contour.ContourDataset) Range(org.jfree.data.Range)

Aggregations

ContourDataset (org.jfree.data.contour.ContourDataset)3 GeneralPath (java.awt.geom.GeneralPath)1 ColorBar (org.jfree.chart.axis.ColorBar)1 Range (org.jfree.data.Range)1 DatasetChangeEvent (org.jfree.data.general.DatasetChangeEvent)1