Search in sources :

Example 16 with PolarPlot

use of org.jfree.chart.plot.PolarPlot in project SIMVA-SoS by SESoS.

the class DefaultPlotEditor method updatePlotProperties.

/**
 * Updates the plot properties to match the properties defined on the panel.
 *
 * @param plot  The plot.
 */
public void updatePlotProperties(Plot plot) {
    // set the plot properties...
    plot.setOutlinePaint(getOutlinePaint());
    plot.setOutlineStroke(getOutlineStroke());
    plot.setBackgroundPaint(getBackgroundPaint());
    plot.setInsets(getPlotInsets());
    // then the axis properties...
    if (this.domainAxisPropertyPanel != null) {
        Axis domainAxis = null;
        if (plot instanceof CategoryPlot) {
            CategoryPlot p = (CategoryPlot) plot;
            domainAxis = p.getDomainAxis();
        } else if (plot instanceof XYPlot) {
            XYPlot p = (XYPlot) plot;
            domainAxis = p.getDomainAxis();
        }
        if (domainAxis != null) {
            this.domainAxisPropertyPanel.setAxisProperties(domainAxis);
        }
    }
    if (this.rangeAxisPropertyPanel != null) {
        Axis rangeAxis = null;
        if (plot instanceof CategoryPlot) {
            CategoryPlot p = (CategoryPlot) plot;
            rangeAxis = p.getRangeAxis();
        } else if (plot instanceof XYPlot) {
            XYPlot p = (XYPlot) plot;
            rangeAxis = p.getRangeAxis();
        } else if (plot instanceof PolarPlot) {
            PolarPlot p = (PolarPlot) plot;
            rangeAxis = p.getAxis();
        }
        if (rangeAxis != null) {
            this.rangeAxisPropertyPanel.setAxisProperties(rangeAxis);
        }
    }
    if (this.plotOrientation != null) {
        if (plot instanceof CategoryPlot) {
            CategoryPlot p = (CategoryPlot) plot;
            p.setOrientation(this.plotOrientation);
        } else if (plot instanceof XYPlot) {
            XYPlot p = (XYPlot) plot;
            p.setOrientation(this.plotOrientation);
        }
    }
    if (this.drawLines != null) {
        if (plot instanceof CategoryPlot) {
            CategoryPlot p = (CategoryPlot) plot;
            CategoryItemRenderer r = p.getRenderer();
            if (r instanceof LineAndShapeRenderer) {
                ((LineAndShapeRenderer) r).setLinesVisible(this.drawLines.booleanValue());
            }
        } else if (plot instanceof XYPlot) {
            XYPlot p = (XYPlot) plot;
            XYItemRenderer r = p.getRenderer();
            if (r instanceof StandardXYItemRenderer) {
                ((StandardXYItemRenderer) r).setPlotLines(this.drawLines.booleanValue());
            }
        }
    }
    if (this.drawShapes != null) {
        if (plot instanceof CategoryPlot) {
            CategoryPlot p = (CategoryPlot) plot;
            CategoryItemRenderer r = p.getRenderer();
            if (r instanceof LineAndShapeRenderer) {
                ((LineAndShapeRenderer) r).setShapesVisible(this.drawShapes.booleanValue());
            }
        } else if (plot instanceof XYPlot) {
            XYPlot p = (XYPlot) plot;
            XYItemRenderer r = p.getRenderer();
            if (r instanceof StandardXYItemRenderer) {
                ((StandardXYItemRenderer) r).setBaseShapesVisible(this.drawShapes.booleanValue());
            }
        }
    }
    // dmo: added this panel for colorbar control. (start dmo additions)
    if (this.colorBarAxisPropertyPanel != null) {
        ColorBar colorBar = null;
        if (plot instanceof ContourPlot) {
            ContourPlot p = (ContourPlot) plot;
            colorBar = p.getColorBar();
        }
        if (colorBar != null) {
            this.colorBarAxisPropertyPanel.setAxisProperties(colorBar);
        }
    }
// dmo: (end dmo additions)
}
Also used : LineAndShapeRenderer(org.jfree.chart.renderer.category.LineAndShapeRenderer) ContourPlot(org.jfree.chart.plot.ContourPlot) XYPlot(org.jfree.chart.plot.XYPlot) CategoryItemRenderer(org.jfree.chart.renderer.category.CategoryItemRenderer) StandardXYItemRenderer(org.jfree.chart.renderer.xy.StandardXYItemRenderer) PolarPlot(org.jfree.chart.plot.PolarPlot) StandardXYItemRenderer(org.jfree.chart.renderer.xy.StandardXYItemRenderer) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer) Axis(org.jfree.chart.axis.Axis) CategoryPlot(org.jfree.chart.plot.CategoryPlot) ColorBar(org.jfree.chart.axis.ColorBar)

Example 17 with PolarPlot

use of org.jfree.chart.plot.PolarPlot in project SIMVA-SoS by SESoS.

the class PolarChartPanel method actionPerformed.

/**
 * Handles action events generated by the popup menu.
 *
 * @param event  the event.
 */
@Override
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (command.equals(POLAR_ZOOM_IN_ACTION_COMMAND)) {
        PolarPlot plot = (PolarPlot) getChart().getPlot();
        plot.zoom(0.5);
    } else if (command.equals(POLAR_ZOOM_OUT_ACTION_COMMAND)) {
        PolarPlot plot = (PolarPlot) getChart().getPlot();
        plot.zoom(2.0);
    } else if (command.equals(POLAR_AUTO_RANGE_ACTION_COMMAND)) {
        PolarPlot plot = (PolarPlot) getChart().getPlot();
        plot.getAxis().setAutoRange(true);
    } else {
        super.actionPerformed(event);
    }
}
Also used : PolarPlot(org.jfree.chart.plot.PolarPlot)

Example 18 with PolarPlot

use of org.jfree.chart.plot.PolarPlot in project seng438-a3-R41Ryan by seng438-winter-2022.

the class DefaultPolarPlotEditor method updatePlotProperties.

@Override
public void updatePlotProperties(Plot plot) {
    super.updatePlotProperties(plot);
    PolarPlot pp = (PolarPlot) plot;
    pp.setAngleTickUnit(new NumberTickUnit(this.manualTickUnitValue));
    pp.setAngleOffset(this.angleOffsetValue);
}
Also used : PolarPlot(org.jfree.chart.plot.PolarPlot) NumberTickUnit(org.jfree.chart.axis.NumberTickUnit)

Example 19 with PolarPlot

use of org.jfree.chart.plot.PolarPlot in project seng438-a3-R41Ryan by seng438-winter-2022.

the class DefaultPlotEditor method createPlotTabs.

protected JTabbedPane createPlotTabs(Plot plot) {
    JTabbedPane tabs = new JTabbedPane();
    tabs.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    Axis domainAxis = null;
    if (plot instanceof CategoryPlot) {
        domainAxis = ((CategoryPlot) plot).getDomainAxis();
    } else if (plot instanceof XYPlot) {
        domainAxis = ((XYPlot) plot).getDomainAxis();
    }
    this.domainAxisPropertyPanel = DefaultAxisEditor.getInstance(domainAxis);
    if (this.domainAxisPropertyPanel != null) {
        this.domainAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Domain_Axis"), this.domainAxisPropertyPanel);
    }
    Axis rangeAxis = null;
    if (plot instanceof CategoryPlot) {
        rangeAxis = ((CategoryPlot) plot).getRangeAxis();
    } else if (plot instanceof XYPlot) {
        rangeAxis = ((XYPlot) plot).getRangeAxis();
    } else if (plot instanceof PolarPlot) {
        rangeAxis = ((PolarPlot) plot).getAxis();
    }
    this.rangeAxisPropertyPanel = DefaultAxisEditor.getInstance(rangeAxis);
    if (this.rangeAxisPropertyPanel != null) {
        this.rangeAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Range_Axis"), this.rangeAxisPropertyPanel);
    }
    // dmo: added this panel for colorbar control. (start dmo additions)
    ColorBar colorBar = null;
    if (plot instanceof ContourPlot) {
        colorBar = ((ContourPlot) plot).getColorBar();
    }
    this.colorBarAxisPropertyPanel = DefaultColorBarEditor.getInstance(colorBar);
    if (this.colorBarAxisPropertyPanel != null) {
        this.colorBarAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Color_Bar"), this.colorBarAxisPropertyPanel);
    }
    return tabs;
}
Also used : ContourPlot(org.jfree.chart.plot.ContourPlot) XYPlot(org.jfree.chart.plot.XYPlot) JTabbedPane(javax.swing.JTabbedPane) PolarPlot(org.jfree.chart.plot.PolarPlot) Axis(org.jfree.chart.axis.Axis) CategoryPlot(org.jfree.chart.plot.CategoryPlot) ColorBar(org.jfree.chart.axis.ColorBar)

Example 20 with PolarPlot

use of org.jfree.chart.plot.PolarPlot in project seng438-a3-R41Ryan by seng438-winter-2022.

the class DefaultPolarItemRenderer method getDrawingSupplier.

/**
 * Returns the drawing supplier from the plot.
 *
 * @return The drawing supplier.
 */
@Override
public DrawingSupplier getDrawingSupplier() {
    DrawingSupplier result = null;
    PolarPlot p = getPlot();
    if (p != null) {
        result = p.getDrawingSupplier();
    }
    return result;
}
Also used : PolarPlot(org.jfree.chart.plot.PolarPlot) DrawingSupplier(org.jfree.chart.plot.DrawingSupplier)

Aggregations

PolarPlot (org.jfree.chart.plot.PolarPlot)26 Axis (org.jfree.chart.axis.Axis)6 CategoryPlot (org.jfree.chart.plot.CategoryPlot)6 XYPlot (org.jfree.chart.plot.XYPlot)6 Paint (java.awt.Paint)4 Shape (java.awt.Shape)4 Stroke (java.awt.Stroke)4 ColorBar (org.jfree.chart.axis.ColorBar)4 NumberAxis (org.jfree.chart.axis.NumberAxis)4 ContourPlot (org.jfree.chart.plot.ContourPlot)4 DrawingSupplier (org.jfree.chart.plot.DrawingSupplier)4 DefaultPolarItemRenderer (org.jfree.chart.renderer.DefaultPolarItemRenderer)4 XYDataset (org.jfree.data.xy.XYDataset)4 JTabbedPane (javax.swing.JTabbedPane)3 LegendItem (org.jfree.chart.LegendItem)3 NumberTickUnit (org.jfree.chart.axis.NumberTickUnit)3 CategoryItemRenderer (org.jfree.chart.renderer.category.CategoryItemRenderer)3 LineAndShapeRenderer (org.jfree.chart.renderer.category.LineAndShapeRenderer)3 StandardXYItemRenderer (org.jfree.chart.renderer.xy.StandardXYItemRenderer)3 XYItemRenderer (org.jfree.chart.renderer.xy.XYItemRenderer)3