Search in sources :

Example 6 with PolarPlot

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

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

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

the class DefaultPolarItemRenderer method getLegendItem.

/**
 * Return the legend for the given series.
 *
 * @param series  the series index.
 *
 * @return The legend item.
 */
@Override
public LegendItem getLegendItem(int series) {
    LegendItem result;
    PolarPlot plot = getPlot();
    if (plot == null) {
        return null;
    }
    XYDataset dataset = plot.getDataset(plot.getIndexOf(this));
    if (dataset == null) {
        return null;
    }
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset, series);
    }
    Comparable seriesKey = dataset.getSeriesKey(series);
    String label = seriesKey.toString();
    String description = label;
    Shape shape = lookupSeriesShape(series);
    Paint paint;
    if (this.useFillPaint) {
        paint = lookupSeriesFillPaint(series);
    } else {
        paint = lookupSeriesPaint(series);
    }
    Stroke stroke = lookupSeriesStroke(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);
    boolean shapeOutlined = isSeriesFilled(series) && this.drawOutlineWhenFilled;
    result = new LegendItem(label, description, toolTipText, urlText, getShapesVisible(), shape, /* shapeFilled=*/
    true, paint, shapeOutlined, outlinePaint, outlineStroke, /* lineVisible= */
    true, this.legendLine, stroke, paint);
    result.setToolTipText(toolTipText);
    result.setURLText(urlText);
    result.setDataset(dataset);
    result.setSeriesKey(seriesKey);
    result.setSeriesIndex(series);
    return result;
}
Also used : Stroke(java.awt.Stroke) Shape(java.awt.Shape) LegendItem(org.jfree.chart.legend.LegendItem) PolarPlot(org.jfree.chart.plot.PolarPlot) XYDataset(org.jfree.data.xy.XYDataset) Paint(java.awt.Paint)

Example 8 with PolarPlot

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

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)

Example 9 with PolarPlot

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

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} permitted).
 * @param dataset  the dataset ({@code null} 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.chart.api.RectangleInsets)

Example 10 with PolarPlot

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

the class DefaultPolarItemRenderer method getLegendItem.

/**
 * Return the legend for the given series.
 *
 * @param series  the series index.
 *
 * @return The legend item.
 */
@Override
public LegendItem getLegendItem(int series) {
    LegendItem result;
    PolarPlot plot = getPlot();
    if (plot == null) {
        return null;
    }
    XYDataset dataset = plot.getDataset(plot.getIndexOf(this));
    if (dataset == null) {
        return null;
    }
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset, series);
    }
    Comparable seriesKey = dataset.getSeriesKey(series);
    String label = seriesKey.toString();
    String description = label;
    Shape shape = lookupSeriesShape(series);
    Paint paint;
    if (this.useFillPaint) {
        paint = lookupSeriesFillPaint(series);
    } else {
        paint = lookupSeriesPaint(series);
    }
    Stroke stroke = lookupSeriesStroke(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);
    boolean shapeOutlined = isSeriesFilled(series) && this.drawOutlineWhenFilled;
    result = new LegendItem(label, description, toolTipText, urlText, getShapesVisible(), shape, /* shapeFilled=*/
    true, paint, shapeOutlined, outlinePaint, outlineStroke, /* lineVisible= */
    true, this.legendLine, stroke, paint);
    result.setToolTipText(toolTipText);
    result.setURLText(urlText);
    result.setDataset(dataset);
    result.setSeriesKey(seriesKey);
    result.setSeriesIndex(series);
    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