Search in sources :

Example 21 with PolarPlot

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

the class ChartFactory method createPolarChart.

/**
 * Creates a polar plot for the specified dataset (x-values interpreted as
 * angles in degrees).  The chart object returned by this method uses a
 * {@link PolarPlot} instance as the plot, with a {@link NumberAxis} for
 * the radial axis.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param legend  legend required?
 * @param tooltips  tooltips required?
 * @param urls  URLs required?
 *
 * @return A chart.
 */
public static JFreeChart createPolarChart(String title, XYDataset dataset, boolean legend, boolean tooltips, boolean urls) {
    PolarPlot plot = new PolarPlot();
    plot.setDataset(dataset);
    NumberAxis rangeAxis = new NumberAxis();
    rangeAxis.setAxisLineVisible(false);
    rangeAxis.setTickMarksVisible(false);
    rangeAxis.setTickLabelInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
    plot.setAxis(rangeAxis);
    plot.setRenderer(new DefaultPolarItemRenderer());
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}
Also used : NumberAxis(org.jfree.chart.axis.NumberAxis) PolarPlot(org.jfree.chart.plot.PolarPlot) DefaultPolarItemRenderer(org.jfree.chart.renderer.DefaultPolarItemRenderer) RectangleInsets(org.jfree.ui.RectangleInsets)

Example 22 with PolarPlot

use of org.jfree.chart.plot.PolarPlot in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

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 23 with PolarPlot

use of org.jfree.chart.plot.PolarPlot in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class DefaultPlotEditor method createPlotTabs.

/**
 * Creates a tabbed pane for the plot.
 *
 * @param plot  the plot.
 *
 * @return A tabbed pane.
 */
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);
    }
    return tabs;
}
Also used : 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)

Example 24 with PolarPlot

use of org.jfree.chart.plot.PolarPlot in project graphcode2vec by graphcode2vec.

the class DefaultPolarItemRenderer method getDrawingSupplier.

/**
 * Returns the drawing supplier from the plot.
 *
 * @return The drawing supplier.
 */
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)

Example 25 with PolarPlot

use of org.jfree.chart.plot.PolarPlot in project graphcode2vec by graphcode2vec.

the class DefaultPolarItemRenderer method getLegendItem.

/**
 * Return the legend for the given series.
 *
 * @param series  the series index.
 *
 * @return The legend item.
 */
public LegendItem getLegendItem(int series) {
    LegendItem result = null;
    PolarPlot polarPlot = getPlot();
    if (polarPlot != null) {
        XYDataset dataset = polarPlot.getDataset();
        if (dataset != null) {
            String label = dataset.getSeriesKey(series).toString();
            String description = label;
            Shape shape = lookupSeriesShape(series);
            Paint paint = lookupSeriesPaint(series);
            Paint outlinePaint = lookupSeriesOutlinePaint(series);
            Stroke outlineStroke = lookupSeriesOutlineStroke(series);
            result = new LegendItem(label, description, null, null, shape, paint, outlineStroke, outlinePaint);
            result.setDataset(dataset);
        }
    }
    return result;
}
Also used : Stroke(java.awt.Stroke) Shape(java.awt.Shape) LegendItem(org.jfree.chart.LegendItem) PolarPlot(org.jfree.chart.plot.PolarPlot) XYDataset(org.jfree.data.xy.XYDataset) Paint(java.awt.Paint)

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