Search in sources :

Example 1 with PolarPlot

use of org.jfree.chart.plot.PolarPlot in project Gemma by PavlidisLab.

the class VisualizeDataSetApp method showProfilesPolarView.

public void showProfilesPolarView(String title, Collection<double[]> dataCol, int numProfiles) {
    if (dataCol == null)
        throw new RuntimeException("dataCol cannot be " + null);
    JFreeChart chart = ChartFactory.createPolarChart(title, null, false, false, false);
    if (dataCol.size() < numProfiles) {
        VisualizeDataSetApp.log.info("Collection smaller than number of elements. Will display " + VisualizeDataSetApp.DEFAULT_MAX_SIZE + " profiles.");
        numProfiles = VisualizeDataSetApp.DEFAULT_MAX_SIZE;
    }
    Iterator<double[]> iter = dataCol.iterator();
    for (int j = 0; j < numProfiles; j++) {
        XYSeries series = this.getSeries(j, iter.next());
        PolarPlot plot = (PolarPlot) chart.getPlot();
        plot.setDataset(new XYSeriesCollection(series));
    }
    ChartFrame frame = new ChartFrame(title, chart, true);
    this.showWindow(frame);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) ChartFrame(org.jfree.chart.ChartFrame) PolarPlot(org.jfree.chart.plot.PolarPlot) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) JFreeChart(org.jfree.chart.JFreeChart)

Example 2 with PolarPlot

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

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

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

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

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

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)

Example 5 with PolarPlot

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

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).setDefaultLinesVisible(this.drawLines);
            }
        } else if (plot instanceof XYPlot) {
            XYPlot p = (XYPlot) plot;
            XYItemRenderer r = p.getRenderer();
            if (r instanceof StandardXYItemRenderer) {
                ((StandardXYItemRenderer) r).setPlotLines(this.drawLines);
            }
        }
    }
    if (this.drawShapes != null) {
        if (plot instanceof CategoryPlot) {
            CategoryPlot p = (CategoryPlot) plot;
            CategoryItemRenderer r = p.getRenderer();
            if (r instanceof LineAndShapeRenderer) {
                ((LineAndShapeRenderer) r).setDefaultShapesVisible(this.drawShapes);
            }
        } else if (plot instanceof XYPlot) {
            XYPlot p = (XYPlot) plot;
            XYItemRenderer r = p.getRenderer();
            if (r instanceof StandardXYItemRenderer) {
                ((StandardXYItemRenderer) r).setBaseShapesVisible(this.drawShapes);
            }
        }
    }
}
Also used : LineAndShapeRenderer(org.jfree.chart.renderer.category.LineAndShapeRenderer) 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)

Aggregations

PolarPlot (org.jfree.chart.plot.PolarPlot)22 Axis (org.jfree.chart.axis.Axis)6 CategoryPlot (org.jfree.chart.plot.CategoryPlot)6 XYPlot (org.jfree.chart.plot.XYPlot)6 ColorBar (org.jfree.chart.axis.ColorBar)4 ContourPlot (org.jfree.chart.plot.ContourPlot)4 Paint (java.awt.Paint)3 Shape (java.awt.Shape)3 Stroke (java.awt.Stroke)3 JTabbedPane (javax.swing.JTabbedPane)3 NumberAxis (org.jfree.chart.axis.NumberAxis)3 NumberTickUnit (org.jfree.chart.axis.NumberTickUnit)3 DrawingSupplier (org.jfree.chart.plot.DrawingSupplier)3 DefaultPolarItemRenderer (org.jfree.chart.renderer.DefaultPolarItemRenderer)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 XYDataset (org.jfree.data.xy.XYDataset)3 LegendItem (org.jfree.chart.LegendItem)2