use of org.jfree.chart.renderer.category.CategoryItemRenderer in project SIMVA-SoS by SESoS.
the class CategoryPlot method setRenderer.
/**
* Sets the renderer to use for the dataset with the specified index and,
* if requested, sends a change event to all registered listeners. Note
* that each dataset should have its own renderer, you should not use one
* renderer for multiple datasets.
*
* @param index the index.
* @param renderer the renderer (<code>null</code> permitted).
* @param notify notify listeners?
*
* @see #getRenderer(int)
*/
public void setRenderer(int index, CategoryItemRenderer renderer, boolean notify) {
CategoryItemRenderer existing = this.renderers.get(index);
if (existing != null) {
existing.removeChangeListener(this);
}
this.renderers.put(index, renderer);
if (renderer != null) {
renderer.setPlot(this);
renderer.addChangeListener(this);
}
configureDomainAxes();
configureRangeAxes();
if (notify) {
fireChangeEvent();
}
}
use of org.jfree.chart.renderer.category.CategoryItemRenderer in project SIMVA-SoS by SESoS.
the class CategoryPlot method drawRangeMarkers.
/**
* Draws the range markers (if any) for an axis and layer. This method is
* typically called from within the draw() method.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param index the renderer index.
* @param layer the layer (foreground or background).
*
* @see #drawDomainMarkers(Graphics2D, Rectangle2D, int, Layer)
*/
protected void drawRangeMarkers(Graphics2D g2, Rectangle2D dataArea, int index, Layer layer) {
CategoryItemRenderer r = getRenderer(index);
if (r == null) {
return;
}
Collection markers = getRangeMarkers(index, layer);
ValueAxis axis = getRangeAxisForDataset(index);
if (markers != null && axis != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker marker = (Marker) iterator.next();
r.drawRangeMarker(g2, this, axis, marker, dataArea);
}
}
}
use of org.jfree.chart.renderer.category.CategoryItemRenderer in project SIMVA-SoS by SESoS.
the class CategoryPlot method getLegendItems.
/**
* Returns the legend items for the plot. By default, this method creates
* a legend item for each series in each of the datasets. You can change
* this behaviour by overriding this method.
*
* @return The legend items.
*/
@Override
public LegendItemCollection getLegendItems() {
if (this.fixedLegendItems != null) {
return this.fixedLegendItems;
}
LegendItemCollection result = new LegendItemCollection();
// get the legend items for the datasets...
for (CategoryDataset dataset : this.datasets.values()) {
if (dataset != null) {
int datasetIndex = indexOf(dataset);
CategoryItemRenderer renderer = getRenderer(datasetIndex);
if (renderer != null) {
result.addAll(renderer.getLegendItems());
}
}
}
return result;
}
use of org.jfree.chart.renderer.category.CategoryItemRenderer in project SIMVA-SoS by SESoS.
the class CategoryPlot 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.domainGridlineStroke = SerialUtilities.readStroke(stream);
this.domainGridlinePaint = SerialUtilities.readPaint(stream);
this.rangeGridlineStroke = SerialUtilities.readStroke(stream);
this.rangeGridlinePaint = SerialUtilities.readPaint(stream);
this.rangeCrosshairStroke = SerialUtilities.readStroke(stream);
this.rangeCrosshairPaint = SerialUtilities.readPaint(stream);
this.domainCrosshairStroke = SerialUtilities.readStroke(stream);
this.domainCrosshairPaint = SerialUtilities.readPaint(stream);
this.rangeMinorGridlineStroke = SerialUtilities.readStroke(stream);
this.rangeMinorGridlinePaint = SerialUtilities.readPaint(stream);
this.rangeZeroBaselineStroke = SerialUtilities.readStroke(stream);
this.rangeZeroBaselinePaint = SerialUtilities.readPaint(stream);
for (CategoryAxis xAxis : this.domainAxes.values()) {
if (xAxis != null) {
xAxis.setPlot(this);
xAxis.addChangeListener(this);
}
}
for (ValueAxis yAxis : this.rangeAxes.values()) {
if (yAxis != null) {
yAxis.setPlot(this);
yAxis.addChangeListener(this);
}
}
for (CategoryDataset dataset : this.datasets.values()) {
if (dataset != null) {
dataset.addChangeListener(this);
}
}
for (CategoryItemRenderer renderer : this.renderers.values()) {
if (renderer != null) {
renderer.addChangeListener(this);
}
}
}
use of org.jfree.chart.renderer.category.CategoryItemRenderer in project SIMVA-SoS by SESoS.
the class CategoryPlot method drawZeroRangeBaseline.
/**
* Draws a base line across the chart at value zero on the range axis.
*
* @param g2 the graphics device.
* @param area the data area.
*
* @see #setRangeZeroBaselineVisible(boolean)
*
* @since 1.0.13
*/
protected void drawZeroRangeBaseline(Graphics2D g2, Rectangle2D area) {
if (!isRangeZeroBaselineVisible()) {
return;
}
CategoryItemRenderer r = getRenderer();
if (r instanceof AbstractCategoryItemRenderer) {
AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r;
aci.drawRangeLine(g2, this, getRangeAxis(), area, 0.0, this.rangeZeroBaselinePaint, this.rangeZeroBaselineStroke);
} else {
r.drawRangeGridline(g2, this, getRangeAxis(), area, 0.0);
}
}
Aggregations