use of org.jfree.chart.plot.PolarPlot in project seng438-a3-R41Ryan by seng438-winter-2022.
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);
}
}
use of org.jfree.chart.plot.PolarPlot in project seng438-a3-R41Ryan by seng438-winter-2022.
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)
}
use of org.jfree.chart.plot.PolarPlot in project graphcode2vec by graphcode2vec.
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?
*
* @return A chart.
*/
public static JFreeChart createPolarChart(String title, XYDataset dataset, boolean legend) {
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;
}
use of org.jfree.chart.plot.PolarPlot in project SIMVA-SoS by SESoS.
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;
}
use of org.jfree.chart.plot.PolarPlot in project SIMVA-SoS by SESoS.
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);
}
Aggregations