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);
}
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;
}
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;
}
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;
}
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);
}
}
}
}
Aggregations