org.jfree.chart.plot.PolarPlot Java Examples

The following examples show how to use org.jfree.chart.plot.PolarPlot. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChartFactory.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;

}
 
Example #2
Source File: ChartFactory.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;

}
 
Example #3
Source File: ChartFactory.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * 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;

}
 
Example #4
Source File: ChartFactory.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;

}
 
Example #5
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link PolarPlot}.  This
 * method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToPolarPlot(PolarPlot plot) {
    plot.setAngleLabelFont(this.regularFont);
    plot.setAngleLabelPaint(this.tickLabelPaint);
    plot.setAngleGridlinePaint(this.domainGridlinePaint);
    plot.setRadiusGridlinePaint(this.rangeGridlinePaint);
    ValueAxis axis = plot.getAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #6
Source File: DefaultPolarItemRenderer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface (<code>null</code> not permitted).
 * @param plot  the plot (<code>null</code> not permitted).
 * @param radialAxis  the radial axis (<code>null</code> not permitted).
 * @param ticks  the ticks (<code>null</code> not permitted).
 * @param dataArea  the data area.
 */
@Override
public void drawRadialGridLines(Graphics2D g2, PolarPlot plot, 
        ValueAxis radialAxis, List ticks, Rectangle2D dataArea) {

    ParamChecks.nullNotPermitted(radialAxis, "radialAxis");
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double centerValue;
    if (radialAxis.isInverted()) {
        centerValue = radialAxis.getUpperBound();
    } else {
        centerValue = radialAxis.getLowerBound();
    }
    Point center = plot.translateToJava2D(0, centerValue, radialAxis, dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        double angleDegrees = plot.isCounterClockwise() 
                ? plot.getAngleOffset() : -plot.getAngleOffset();
        Point p = plot.translateToJava2D(angleDegrees,
                tick.getNumber().doubleValue(), radialAxis, dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
Example #7
Source File: PolarChartPanel.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Test that the chart is using an xy plot with time as the domain axis.
 *
 * @param chart  the chart.
 */
private void checkChart(JFreeChart chart) {
    Plot plot = chart.getPlot();
    if (!(plot instanceof PolarPlot)) {
        throw new IllegalArgumentException("plot is not a PolarPlot");
   }
}
 
Example #8
Source File: PolarChartPanel.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Test that the chart is using an xy plot with time as the domain axis.
 * 
 * @param chart  the chart.
 */
private void checkChart(JFreeChart chart) {
    Plot plot = chart.getPlot();
    if (!(plot instanceof PolarPlot)) {
        throw new IllegalArgumentException("plot is not a PolarPlot");
   }
}
 
Example #9
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link PolarPlot}.  This
 * method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToPolarPlot(PolarPlot plot) {
    plot.setAngleLabelFont(this.regularFont);
    plot.setAngleLabelPaint(this.tickLabelPaint);
    plot.setAngleGridlinePaint(this.domainGridlinePaint);
    plot.setRadiusGridlinePaint(this.rangeGridlinePaint);
    ValueAxis axis = plot.getAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #10
Source File: DefaultPolarPlotEditor.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Standard constructor - constructs a panel for editing the properties of
 * the specified plot.
 *
 * @param plot  the plot, which should be changed.
 */
public DefaultPolarPlotEditor(PolarPlot plot) {
    super(plot);
    this.angleOffsetValue = plot.getAngleOffset();
    this.angleOffset.setText(Double.toString(this.angleOffsetValue));
    this.manualTickUnitValue = plot.getAngleTickUnit().getSize();
    this.manualTickUnit.setText(Double.toString(this.manualTickUnitValue));
}
 
Example #11
Source File: DefaultPolarItemRenderer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #12
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link PolarPlot}.  This
 * method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToPolarPlot(PolarPlot plot) {
    plot.setAngleLabelFont(this.regularFont);
    plot.setAngleLabelPaint(this.tickLabelPaint);
    plot.setAngleGridlinePaint(this.domainGridlinePaint);
    plot.setRadiusGridlinePaint(this.rangeGridlinePaint);
    ValueAxis axis = plot.getAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #13
Source File: DefaultPolarItemRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface.
 * @param plot  the plot.
 * @param radialAxis  the radial axis.
 * @param ticks  the ticks.
 * @param dataArea  the data area.
 */
public void drawRadialGridLines(Graphics2D g2,
                                PolarPlot plot,
                                ValueAxis radialAxis,
                                List ticks,
                                Rectangle2D dataArea) {

    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double axisMin = radialAxis.getLowerBound();
    Point center = plot.translateValueThetaRadiusToJava2D(axisMin, axisMin,
            dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        Point p = plot.translateValueThetaRadiusToJava2D(90.0,
                tick.getNumber().doubleValue(), dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
Example #14
Source File: DefaultPolarItemRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draw the radial gridlines - the rings.
 * 
 * @param g2  the drawing surface.
 * @param plot  the plot.
 * @param radialAxis  the radial axis.
 * @param ticks  the ticks.
 * @param dataArea  the data area.
 */
public void drawRadialGridLines(Graphics2D g2, 
                                PolarPlot plot,
                                ValueAxis radialAxis,
                                List ticks,
                                Rectangle2D dataArea) {
    
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double axisMin = radialAxis.getLowerBound();
    Point center = plot.translateValueThetaRadiusToJava2D(axisMin, axisMin,
            dataArea);
    
    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        Point p = plot.translateValueThetaRadiusToJava2D(90.0, 
                tick.getNumber().doubleValue(), dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
Example #15
Source File: DefaultPolarItemRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface (<code>null</code> not permitted).
 * @param plot  the plot (<code>null</code> not permitted).
 * @param radialAxis  the radial axis (<code>null</code> not permitted).
 * @param ticks  the ticks (<code>null</code> not permitted).
 * @param dataArea  the data area.
 */
@Override
public void drawRadialGridLines(Graphics2D g2, PolarPlot plot, 
        ValueAxis radialAxis, List ticks, Rectangle2D dataArea) {

    ParamChecks.nullNotPermitted(radialAxis, "radialAxis");
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double centerValue;
    if (radialAxis.isInverted()) {
        centerValue = radialAxis.getUpperBound();
    } else {
        centerValue = radialAxis.getLowerBound();
    }
    Point center = plot.translateToJava2D(0, centerValue, radialAxis, dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        double angleDegrees = plot.isCounterClockwise() 
                ? plot.getAngleOffset() : -plot.getAngleOffset();
        Point p = plot.translateToJava2D(angleDegrees,
                tick.getNumber().doubleValue(), radialAxis, dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
Example #16
Source File: PolarChartPanel.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test that the chart is using an xy plot with time as the domain axis.
 *
 * @param chart  the chart.
 */
private void checkChart(JFreeChart chart) {
    Plot plot = chart.getPlot();
    if (!(plot instanceof PolarPlot)) {
        throw new IllegalArgumentException("plot is not a PolarPlot");
   }
}
 
Example #17
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to a {@link PolarPlot}.  This
 * method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToPolarPlot(PolarPlot plot) {
    plot.setAngleLabelFont(this.regularFont);
    plot.setAngleLabelPaint(this.tickLabelPaint);
    plot.setAngleGridlinePaint(this.domainGridlinePaint);
    plot.setRadiusGridlinePaint(this.rangeGridlinePaint);
    ValueAxis axis = plot.getAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #18
Source File: DefaultPolarPlotEditor.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Standard constructor - constructs a panel for editing the properties of
 * the specified plot.
 *
 * @param plot  the plot, which should be changed.
 */
public DefaultPolarPlotEditor(PolarPlot plot) {
    super(plot);
    this.angleOffsetValue = plot.getAngleOffset();
    this.angleOffset.setText(Double.toString(this.angleOffsetValue));
    this.manualTickUnitValue = plot.getAngleTickUnit().getSize();
    this.manualTickUnit.setText(Double.toString(this.manualTickUnitValue));
}
 
Example #19
Source File: PolarChartPanel.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Test that the chart is using an xy plot with time as the domain axis.
 *
 * @param chart  the chart.
 */
private void checkChart(JFreeChart chart) {
    Plot plot = chart.getPlot();
    if (!(plot instanceof PolarPlot)) {
        throw new IllegalArgumentException("plot is not a PolarPlot");
   }
}
 
Example #20
Source File: DefaultPolarPlotEditor.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Standard constructor - constructs a panel for editing the properties of
 * the specified plot.
 *
 * @param plot  the plot, which should be changed.
 */
public DefaultPolarPlotEditor(PolarPlot plot) {
    super(plot);
    this.angleOffsetValue = plot.getAngleOffset();
    this.angleOffset.setText(Double.toString(this.angleOffsetValue));
    this.manualTickUnitValue = plot.getAngleTickUnit().getSize();
    this.manualTickUnit.setText(Double.toString(this.manualTickUnitValue));
}
 
Example #21
Source File: DefaultPolarItemRenderer.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Plots the data for a given series.
 * 
 * @param g2  the drawing surface.
 * @param dataArea  the data area.
 * @param info  collects plot rendering info.
 * @param plot  the plot.
 * @param dataset  the dataset.
 * @param seriesIndex  the series index.
 */
public void drawSeries(Graphics2D g2, 
                       Rectangle2D dataArea, 
                       PlotRenderingInfo info,
                       PolarPlot plot,
                       XYDataset dataset,
                       int seriesIndex) {
    
    Polygon poly = new Polygon();
    int numPoints = dataset.getItemCount(seriesIndex);
    for (int i = 0; i < numPoints; i++) {
        double theta = dataset.getXValue(seriesIndex, i);
        double radius = dataset.getYValue(seriesIndex, i);
        Point p = plot.translateValueThetaRadiusToJava2D(theta, radius, 
                dataArea);
        poly.addPoint(p.x, p.y);
    }
    g2.setPaint(getSeriesPaint(seriesIndex));
    g2.setStroke(getSeriesStroke(seriesIndex));
    if (isSeriesFilled(seriesIndex)) {
        Composite savedComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(
                AlphaComposite.SRC_OVER, 0.5f));
        g2.fill(poly);
        g2.setComposite(savedComposite);
    }
    else {
        g2.draw(poly);
    }
}
 
Example #22
Source File: DefaultPolarItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface (<code>null</code> not permitted).
 * @param plot  the plot (<code>null</code> not permitted).
 * @param radialAxis  the radial axis (<code>null</code> not permitted).
 * @param ticks  the ticks (<code>null</code> not permitted).
 * @param dataArea  the data area.
 */
@Override
public void drawRadialGridLines(Graphics2D g2, PolarPlot plot, 
        ValueAxis radialAxis, List ticks, Rectangle2D dataArea) {

    ParamChecks.nullNotPermitted(radialAxis, "radialAxis");
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double centerValue;
    if (radialAxis.isInverted()) {
        centerValue = radialAxis.getUpperBound();
    } else {
        centerValue = radialAxis.getLowerBound();
    }
    Point center = plot.translateToJava2D(0, centerValue, radialAxis, dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        double angleDegrees = plot.isCounterClockwise() 
                ? plot.getAngleOffset() : -plot.getAngleOffset();
        Point p = plot.translateToJava2D(angleDegrees,
                tick.getNumber().doubleValue(), radialAxis, dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
Example #23
Source File: DefaultPolarItemRenderer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #24
Source File: DefaultPolarItemRenderer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface (<code>null</code> not permitted).
 * @param plot  the plot (<code>null</code> not permitted).
 * @param radialAxis  the radial axis (<code>null</code> not permitted).
 * @param ticks  the ticks (<code>null</code> not permitted).
 * @param dataArea  the data area.
 */
@Override
public void drawRadialGridLines(Graphics2D g2, PolarPlot plot, 
        ValueAxis radialAxis, List ticks, Rectangle2D dataArea) {

    ParamChecks.nullNotPermitted(radialAxis, "radialAxis");
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double centerValue;
    if (radialAxis.isInverted()) {
        centerValue = radialAxis.getUpperBound();
    } else {
        centerValue = radialAxis.getLowerBound();
    }
    Point center = plot.translateToJava2D(0, centerValue, radialAxis, dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        double angleDegrees = plot.isCounterClockwise() 
                ? plot.getAngleOffset() : -plot.getAngleOffset();
        Point p = plot.translateToJava2D(angleDegrees,
                tick.getNumber().doubleValue(), radialAxis, dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
Example #25
Source File: DefaultPolarItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #26
Source File: PolarChartPanel.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Test that the chart is using an xy plot with time as the domain axis.
 *
 * @param chart  the chart.
 */
private void checkChart(JFreeChart chart) {
    Plot plot = chart.getPlot();
    if (!(plot instanceof PolarPlot)) {
        throw new IllegalArgumentException("plot is not a PolarPlot");
   }
}
 
Example #27
Source File: DefaultPolarPlotEditor.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
@Override
public void updatePlotProperties(Plot plot) {
    super.updatePlotProperties(plot);
    PolarPlot pp = (PolarPlot) plot;
    pp.setAngleTickUnit(new NumberTickUnit(this.manualTickUnitValue));
    pp.setAngleOffset(this.angleOffsetValue);
}
 
Example #28
Source File: DefaultPolarPlotEditor.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Standard constructor - constructs a panel for editing the properties of
 * the specified plot.
 *
 * @param plot  the plot, which should be changed.
 */
public DefaultPolarPlotEditor(PolarPlot plot) {
    super(plot);
    this.angleOffsetValue = plot.getAngleOffset();
    this.angleOffset.setText(Double.toString(this.angleOffsetValue));
    this.manualTickUnitValue = plot.getAngleTickUnit().getSize();
    this.manualTickUnit.setText(Double.toString(this.manualTickUnitValue));
}
 
Example #29
Source File: PolarChartPanel.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Test that the chart is using an xy plot with time as the domain axis.
 *
 * @param chart  the chart.
 */
private void checkChart(JFreeChart chart) {
    Plot plot = chart.getPlot();
    if (!(plot instanceof PolarPlot)) {
        throw new IllegalArgumentException("plot is not a PolarPlot");
   }
}
 
Example #30
Source File: DefaultPolarItemRenderer.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/** 
 * 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;
}