use of org.jfree.chart.renderer.PolarItemRenderer in project SIMVA-SoS by SESoS.
the class PolarPlot method render.
/**
* Draws a representation of the data within the dataArea region, using the
* current m_Renderer.
*
* @param g2 the graphics device.
* @param dataArea the region in which the data is to be drawn.
* @param info an optional object for collection dimension
* information (<code>null</code> permitted).
*/
protected void render(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info) {
// now get the data and plot it (the visual representation will depend
// on the m_Renderer that has been set)...
boolean hasData = false;
int datasetCount = this.datasets.size();
for (int i = datasetCount - 1; i >= 0; i--) {
XYDataset dataset = getDataset(i);
if (dataset == null) {
continue;
}
PolarItemRenderer renderer = getRenderer(i);
if (renderer == null) {
continue;
}
if (!DatasetUtilities.isEmptyOrNull(dataset)) {
hasData = true;
int seriesCount = dataset.getSeriesCount();
for (int series = 0; series < seriesCount; series++) {
renderer.drawSeries(g2, dataArea, info, this, dataset, series);
}
}
}
if (!hasData) {
drawNoDataMessage(g2, dataArea);
}
}
use of org.jfree.chart.renderer.PolarItemRenderer in project SIMVA-SoS by SESoS.
the class PolarPlot method readObject.
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.angleGridlineStroke = SerialUtilities.readStroke(stream);
this.angleGridlinePaint = SerialUtilities.readPaint(stream);
this.radiusGridlineStroke = SerialUtilities.readStroke(stream);
this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
this.angleLabelPaint = SerialUtilities.readPaint(stream);
int rangeAxisCount = this.axes.size();
for (int i = 0; i < rangeAxisCount; i++) {
Axis axis = (Axis) this.axes.get(i);
if (axis != null) {
axis.setPlot(this);
axis.addChangeListener(this);
}
}
int datasetCount = this.datasets.size();
for (int i = 0; i < datasetCount; i++) {
Dataset dataset = (Dataset) this.datasets.get(i);
if (dataset != null) {
dataset.addChangeListener(this);
}
}
int rendererCount = this.renderers.size();
for (int i = 0; i < rendererCount; i++) {
PolarItemRenderer renderer = (PolarItemRenderer) this.renderers.get(i);
if (renderer != null) {
renderer.addChangeListener(this);
}
}
}
use of org.jfree.chart.renderer.PolarItemRenderer in project SIMVA-SoS by SESoS.
the class PolarPlot method clone.
/**
* Returns a clone of the plot.
*
* @return A clone.
*
* @throws CloneNotSupportedException this can occur if some component of
* the plot cannot be cloned.
*/
@Override
public Object clone() throws CloneNotSupportedException {
PolarPlot clone = (PolarPlot) super.clone();
clone.axes = (ObjectList) ObjectUtilities.clone(this.axes);
for (int i = 0; i < this.axes.size(); i++) {
ValueAxis axis = (ValueAxis) this.axes.get(i);
if (axis != null) {
ValueAxis clonedAxis = (ValueAxis) axis.clone();
clone.axes.set(i, clonedAxis);
clonedAxis.setPlot(clone);
clonedAxis.addChangeListener(clone);
}
}
// the datasets are not cloned, but listeners need to be added...
clone.datasets = (ObjectList) ObjectUtilities.clone(this.datasets);
for (int i = 0; i < clone.datasets.size(); ++i) {
XYDataset d = getDataset(i);
if (d != null) {
d.addChangeListener(clone);
}
}
clone.renderers = (ObjectList) ObjectUtilities.clone(this.renderers);
for (int i = 0; i < this.renderers.size(); i++) {
PolarItemRenderer renderer2 = (PolarItemRenderer) this.renderers.get(i);
if (renderer2 instanceof PublicCloneable) {
PublicCloneable pc = (PublicCloneable) renderer2;
PolarItemRenderer rc = (PolarItemRenderer) pc.clone();
clone.renderers.set(i, rc);
rc.setPlot(clone);
rc.addChangeListener(clone);
}
}
clone.cornerTextItems = new ArrayList(this.cornerTextItems);
return clone;
}
use of org.jfree.chart.renderer.PolarItemRenderer in project SIMVA-SoS by SESoS.
the class PolarPlot method setRenderer.
/**
* Sets a renderer and, if requested, sends a {@link PlotChangeEvent} to
* all registered listeners.
*
* @param index the index.
* @param renderer the renderer.
* @param notify notify listeners?
*
* @see #getRenderer(int)
*
* @since 1.0.14
*/
public void setRenderer(int index, PolarItemRenderer renderer, boolean notify) {
PolarItemRenderer existing = getRenderer(index);
if (existing != null) {
existing.removeChangeListener(this);
}
this.renderers.set(index, renderer);
if (renderer != null) {
renderer.setPlot(this);
renderer.addChangeListener(this);
}
if (notify) {
fireChangeEvent();
}
}
use of org.jfree.chart.renderer.PolarItemRenderer in project SIMVA-SoS by SESoS.
the class PolarPlot method drawGridlines.
/**
* Draws the gridlines for the plot, if they are visible.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param angularTicks the ticks for the angular axis.
* @param radialTicks the ticks for the radial axis.
*/
protected void drawGridlines(Graphics2D g2, Rectangle2D dataArea, List angularTicks, List radialTicks) {
PolarItemRenderer renderer = getRenderer();
// no renderer, no gridlines...
if (renderer == null) {
return;
}
// draw the domain grid lines, if any...
if (isAngleGridlinesVisible()) {
Stroke gridStroke = getAngleGridlineStroke();
Paint gridPaint = getAngleGridlinePaint();
if ((gridStroke != null) && (gridPaint != null)) {
renderer.drawAngularGridLines(g2, this, angularTicks, dataArea);
}
}
// draw the radius grid lines, if any...
if (isRadiusGridlinesVisible()) {
Stroke gridStroke = getRadiusGridlineStroke();
Paint gridPaint = getRadiusGridlinePaint();
if ((gridStroke != null) && (gridPaint != null)) {
List ticks = buildRadialTicks(radialTicks);
renderer.drawRadialGridLines(g2, this, getAxis(), ticks, dataArea);
}
}
}
Aggregations