| Method from org.jfree.chart.plot.PiePlot Detail: |
public Object clone() throws CloneNotSupportedException {
PiePlot clone = (PiePlot) super.clone();
if (clone.dataset != null) {
clone.dataset.addChangeListener(clone);
}
if (this.urlGenerator instanceof PublicCloneable) {
clone.urlGenerator = (PieURLGenerator) ObjectUtilities.clone(
this.urlGenerator);
}
clone.legendItemShape = ShapeUtilities.clone(this.legendItemShape);
if (this.legendLabelGenerator != null) {
clone.legendLabelGenerator = (PieSectionLabelGenerator)
ObjectUtilities.clone(this.legendLabelGenerator);
}
if (this.legendLabelToolTipGenerator != null) {
clone.legendLabelToolTipGenerator = (PieSectionLabelGenerator)
ObjectUtilities.clone(this.legendLabelToolTipGenerator);
}
if (this.legendLabelURLGenerator instanceof PublicCloneable) {
clone.legendLabelURLGenerator = (PieURLGenerator)
ObjectUtilities.clone(this.legendLabelURLGenerator);
}
return clone;
}
Returns a clone of the plot. |
public void draw(Graphics2D g2,
Rectangle2D area,
Point2D anchor,
PlotState parentState,
PlotRenderingInfo info) {
// adjust for insets...
RectangleInsets insets = getInsets();
insets.trim(area);
if (info != null) {
info.setPlotArea(area);
info.setDataArea(area);
}
drawBackground(g2, area);
drawOutline(g2, area);
Shape savedClip = g2.getClip();
g2.clip(area);
Composite originalComposite = g2.getComposite();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
getForegroundAlpha()));
if (!DatasetUtilities.isEmptyOrNull(this.dataset)) {
drawPie(g2, area, info);
}
else {
drawNoDataMessage(g2, area);
}
g2.setClip(savedClip);
g2.setComposite(originalComposite);
drawOutline(g2, area);
}
Draws the plot on a Java 2D graphics device (such as the screen or a
printer). |
protected void drawItem(Graphics2D g2,
int section,
Rectangle2D dataArea,
PiePlotState state,
int currentPass) {
Number n = this.dataset.getValue(section);
if (n == null) {
return;
}
double value = n.doubleValue();
double angle1 = 0.0;
double angle2 = 0.0;
if (this.direction == Rotation.CLOCKWISE) {
angle1 = state.getLatestAngle();
angle2 = angle1 - value / state.getTotal() * 360.0;
}
else if (this.direction == Rotation.ANTICLOCKWISE) {
angle1 = state.getLatestAngle();
angle2 = angle1 + value / state.getTotal() * 360.0;
}
else {
throw new IllegalStateException("Rotation type not recognised.");
}
double angle = (angle2 - angle1);
if (Math.abs(angle) > getMinimumArcAngleToDraw()) {
double ep = 0.0;
double mep = getMaximumExplodePercent();
if (mep > 0.0) {
ep = getExplodePercent(section) / mep;
}
Rectangle2D arcBounds = getArcBounds(state.getPieArea(),
state.getExplodedPieArea(), angle1, angle, ep);
Arc2D.Double arc = new Arc2D.Double(arcBounds, angle1, angle,
Arc2D.PIE);
if (currentPass == 0) {
if (this.shadowPaint != null) {
Shape shadowArc = ShapeUtilities.createTranslatedShape(
arc, (float) this.shadowXOffset,
(float) this.shadowYOffset);
g2.setPaint(this.shadowPaint);
g2.fill(shadowArc);
}
}
else if (currentPass == 1) {
Comparable key = getSectionKey(section);
Paint paint = lookupSectionPaint(key, true);
g2.setPaint(paint);
g2.fill(arc);
Paint outlinePaint = lookupSectionOutlinePaint(key);
Stroke outlineStroke = lookupSectionOutlineStroke(key);
if (this.sectionOutlinesVisible) {
g2.setPaint(outlinePaint);
g2.setStroke(outlineStroke);
g2.draw(arc);
}
// update the linking line target for later
// add an entity for the pie section
if (state.getInfo() != null) {
EntityCollection entities = state.getEntityCollection();
if (entities != null) {
String tip = null;
if (this.toolTipGenerator != null) {
tip = this.toolTipGenerator.generateToolTip(
this.dataset, key);
}
String url = null;
if (this.urlGenerator != null) {
url = this.urlGenerator.generateURL(this.dataset,
key, this.pieIndex);
}
PieSectionEntity entity = new PieSectionEntity(
arc, this.dataset, this.pieIndex, section, key,
tip, url);
entities.add(entity);
}
}
}
}
state.setLatestAngle(angle2);
}
Draws a single data item. |
protected void drawLabels(Graphics2D g2,
List keys,
double totalValue,
Rectangle2D plotArea,
Rectangle2D linkArea,
PiePlotState state) {
Composite originalComposite = g2.getComposite();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
1.0f));
// classify the keys according to which side the label will appear...
DefaultKeyedValues leftKeys = new DefaultKeyedValues();
DefaultKeyedValues rightKeys = new DefaultKeyedValues();
double runningTotal = 0.0;
Iterator iterator = keys.iterator();
while (iterator.hasNext()) {
Comparable key = (Comparable) iterator.next();
boolean include = true;
double v = 0.0;
Number n = this.dataset.getValue(key);
if (n == null) {
include = !this.ignoreNullValues;
}
else {
v = n.doubleValue();
include = this.ignoreZeroValues ? v > 0.0 : v >= 0.0;
}
if (include) {
runningTotal = runningTotal + v;
// work out the mid angle (0 - 90 and 270 - 360) = right,
// otherwise left
double mid = this.startAngle + (this.direction.getFactor()
* ((runningTotal - v / 2.0) * 360) / totalValue);
if (Math.cos(Math.toRadians(mid)) < 0.0) {
leftKeys.addValue(key, new Double(mid));
}
else {
rightKeys.addValue(key, new Double(mid));
}
}
}
g2.setFont(getLabelFont());
// calculate the max label width from the plot dimensions, because
// a circular pie can leave a lot more room for labels...
double marginX = plotArea.getX() + this.interiorGap
* plotArea.getWidth();
double gap = plotArea.getWidth() * this.labelGap;
double ww = linkArea.getX() - gap - marginX;
float labelWidth = (float) this.labelPadding.trimWidth(ww);
// draw the labels...
if (this.labelGenerator != null) {
drawLeftLabels(leftKeys, g2, plotArea, linkArea, labelWidth,
state);
drawRightLabels(rightKeys, g2, plotArea, linkArea, labelWidth,
state);
}
g2.setComposite(originalComposite);
}
Draws the labels for the pie sections. |
protected void drawLeftLabel(Graphics2D g2,
PiePlotState state,
PieLabelRecord record) {
double anchorX = state.getLinkArea().getMinX();
double targetX = anchorX - record.getGap();
double targetY = record.getAllocatedY();
if (this.labelLinksVisible) {
double theta = record.getAngle();
double linkX = state.getPieCenterX() + Math.cos(theta)
* state.getPieWRadius() * record.getLinkPercent();
double linkY = state.getPieCenterY() - Math.sin(theta)
* state.getPieHRadius() * record.getLinkPercent();
double elbowX = state.getPieCenterX() + Math.cos(theta)
* state.getLinkArea().getWidth() / 2.0;
double elbowY = state.getPieCenterY() - Math.sin(theta)
* state.getLinkArea().getHeight() / 2.0;
double anchorY = elbowY;
g2.setPaint(this.labelLinkPaint);
g2.setStroke(this.labelLinkStroke);
PieLabelLinkStyle style = getLabelLinkStyle();
if (style.equals(PieLabelLinkStyle.STANDARD)) {
g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));
g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));
g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));
}
else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {
QuadCurve2D q = new QuadCurve2D.Float();
q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);
g2.draw(q);
g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY));
}
else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {
CubicCurve2D c = new CubicCurve2D .Float();
c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY,
linkX, linkY);
g2.draw(c);
}
}
TextBox tb = record.getLabel();
tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.RIGHT);
}
Draws a section label on the left side of the pie chart. |
protected void drawLeftLabels(KeyedValues leftKeys,
Graphics2D g2,
Rectangle2D plotArea,
Rectangle2D linkArea,
float maxLabelWidth,
PiePlotState state) {
this.labelDistributor.clear();
double lGap = plotArea.getWidth() * this.labelGap;
double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;
for (int i = 0; i < leftKeys.getItemCount(); i++) {
String label = this.labelGenerator.generateSectionLabel(
this.dataset, leftKeys.getKey(i));
if (label != null) {
TextBlock block = TextUtilities.createTextBlock(label,
this.labelFont, this.labelPaint, maxLabelWidth,
new G2TextMeasurer(g2));
TextBox labelBox = new TextBox(block);
labelBox.setBackgroundPaint(this.labelBackgroundPaint);
labelBox.setOutlinePaint(this.labelOutlinePaint);
labelBox.setOutlineStroke(this.labelOutlineStroke);
labelBox.setShadowPaint(this.labelShadowPaint);
labelBox.setInteriorGap(this.labelPadding);
double theta = Math.toRadians(
leftKeys.getValue(i).doubleValue());
double baseY = state.getPieCenterY() - Math.sin(theta)
* verticalLinkRadius;
double hh = labelBox.getHeight(g2);
this.labelDistributor.addPieLabelRecord(new PieLabelRecord(
leftKeys.getKey(i), theta, baseY, labelBox, hh,
lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 0.9
+ getExplodePercent(leftKeys.getKey(i))));
}
}
double hh = plotArea.getHeight();
double gap = hh * getInteriorGap();
this.labelDistributor.distributeLabels(plotArea.getMinY() + gap,
hh - 2 * gap);
for (int i = 0; i < this.labelDistributor.getItemCount(); i++) {
drawLeftLabel(g2, state,
this.labelDistributor.getPieLabelRecord(i));
}
}
|
protected void drawPie(Graphics2D g2,
Rectangle2D plotArea,
PlotRenderingInfo info) {
PiePlotState state = initialise(g2, plotArea, this, null, info);
// adjust the plot area for interior spacing and labels...
double labelReserve = 0.0;
if (this.labelGenerator != null && !this.simpleLabels) {
labelReserve = this.labelGap + this.maximumLabelWidth;
}
double gapHorizontal = plotArea.getWidth() * (this.interiorGap
+ labelReserve) * 2.0;
double gapVertical = plotArea.getHeight() * this.interiorGap * 2.0;
if (DEBUG_DRAW_INTERIOR) {
double hGap = plotArea.getWidth() * this.interiorGap;
double vGap = plotArea.getHeight() * this.interiorGap;
double igx1 = plotArea.getX() + hGap;
double igx2 = plotArea.getMaxX() - hGap;
double igy1 = plotArea.getY() + vGap;
double igy2 = plotArea.getMaxY() - vGap;
g2.setPaint(Color.gray);
g2.draw(new Rectangle2D.Double(igx1, igy1, igx2 - igx1,
igy2 - igy1));
}
double linkX = plotArea.getX() + gapHorizontal / 2;
double linkY = plotArea.getY() + gapVertical / 2;
double linkW = plotArea.getWidth() - gapHorizontal;
double linkH = plotArea.getHeight() - gapVertical;
// make the link area a square if the pie chart is to be circular...
if (this.circular) {
double min = Math.min(linkW, linkH) / 2;
linkX = (linkX + linkX + linkW) / 2 - min;
linkY = (linkY + linkY + linkH) / 2 - min;
linkW = 2 * min;
linkH = 2 * min;
}
// the link area defines the dog leg points for the linking lines to
// the labels
Rectangle2D linkArea = new Rectangle2D.Double(linkX, linkY, linkW,
linkH);
state.setLinkArea(linkArea);
if (DEBUG_DRAW_LINK_AREA) {
g2.setPaint(Color.blue);
g2.draw(linkArea);
g2.setPaint(Color.yellow);
g2.draw(new Ellipse2D.Double(linkArea.getX(), linkArea.getY(),
linkArea.getWidth(), linkArea.getHeight()));
}
// the explode area defines the max circle/ellipse for the exploded
// pie sections. it is defined by shrinking the linkArea by the
// linkMargin factor.
double lm = 0.0;
if (!this.simpleLabels) {
lm = this.labelLinkMargin;
}
double hh = linkArea.getWidth() * lm * 2.0;
double vv = linkArea.getHeight() * lm * 2.0;
Rectangle2D explodeArea = new Rectangle2D.Double(linkX + hh / 2.0,
linkY + vv / 2.0, linkW - hh, linkH - vv);
state.setExplodedPieArea(explodeArea);
// the pie area defines the circle/ellipse for regular pie sections.
// it is defined by shrinking the explodeArea by the explodeMargin
// factor.
double maximumExplodePercent = getMaximumExplodePercent();
double percent = maximumExplodePercent / (1.0 + maximumExplodePercent);
double h1 = explodeArea.getWidth() * percent;
double v1 = explodeArea.getHeight() * percent;
Rectangle2D pieArea = new Rectangle2D.Double(explodeArea.getX()
+ h1 / 2.0, explodeArea.getY() + v1 / 2.0,
explodeArea.getWidth() - h1, explodeArea.getHeight() - v1);
if (DEBUG_DRAW_PIE_AREA) {
g2.setPaint(Color.green);
g2.draw(pieArea);
}
state.setPieArea(pieArea);
state.setPieCenterX(pieArea.getCenterX());
state.setPieCenterY(pieArea.getCenterY());
state.setPieWRadius(pieArea.getWidth() / 2.0);
state.setPieHRadius(pieArea.getHeight() / 2.0);
// plot the data (unless the dataset is null)...
if ((this.dataset != null) && (this.dataset.getKeys().size() > 0)) {
List keys = this.dataset.getKeys();
double totalValue = DatasetUtilities.calculatePieDatasetTotal(
this.dataset);
int passesRequired = state.getPassesRequired();
for (int pass = 0; pass < passesRequired; pass++) {
double runningTotal = 0.0;
for (int section = 0; section < keys.size(); section++) {
Number n = this.dataset.getValue(section);
if (n != null) {
double value = n.doubleValue();
if (value > 0.0) {
runningTotal += value;
drawItem(g2, section, explodeArea, state, pass);
}
}
}
}
if (this.simpleLabels) {
drawSimpleLabels(g2, keys, totalValue, plotArea, linkArea,
state);
}
else {
drawLabels(g2, keys, totalValue, plotArea, linkArea, state);
}
}
else {
drawNoDataMessage(g2, plotArea);
}
}
|
protected void drawRightLabel(Graphics2D g2,
PiePlotState state,
PieLabelRecord record) {
double anchorX = state.getLinkArea().getMaxX();
double targetX = anchorX + record.getGap();
double targetY = record.getAllocatedY();
if (this.labelLinksVisible) {
double theta = record.getAngle();
double linkX = state.getPieCenterX() + Math.cos(theta)
* state.getPieWRadius() * record.getLinkPercent();
double linkY = state.getPieCenterY() - Math.sin(theta)
* state.getPieHRadius() * record.getLinkPercent();
double elbowX = state.getPieCenterX() + Math.cos(theta)
* state.getLinkArea().getWidth() / 2.0;
double elbowY = state.getPieCenterY() - Math.sin(theta)
* state.getLinkArea().getHeight() / 2.0;
double anchorY = elbowY;
g2.setPaint(this.labelLinkPaint);
g2.setStroke(this.labelLinkStroke);
PieLabelLinkStyle style = getLabelLinkStyle();
if (style.equals(PieLabelLinkStyle.STANDARD)) {
g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));
g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));
g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));
}
else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {
QuadCurve2D q = new QuadCurve2D.Float();
q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);
g2.draw(q);
g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY));
}
else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {
CubicCurve2D c = new CubicCurve2D .Float();
c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY,
linkX, linkY);
g2.draw(c);
}
}
TextBox tb = record.getLabel();
tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.LEFT);
}
Draws a section label on the right side of the pie chart. |
protected void drawRightLabels(KeyedValues keys,
Graphics2D g2,
Rectangle2D plotArea,
Rectangle2D linkArea,
float maxLabelWidth,
PiePlotState state) {
// draw the right labels...
this.labelDistributor.clear();
double lGap = plotArea.getWidth() * this.labelGap;
double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;
for (int i = 0; i < keys.getItemCount(); i++) {
String label = this.labelGenerator.generateSectionLabel(
this.dataset, keys.getKey(i));
if (label != null) {
TextBlock block = TextUtilities.createTextBlock(label,
this.labelFont, this.labelPaint, maxLabelWidth,
new G2TextMeasurer(g2));
TextBox labelBox = new TextBox(block);
labelBox.setBackgroundPaint(this.labelBackgroundPaint);
labelBox.setOutlinePaint(this.labelOutlinePaint);
labelBox.setOutlineStroke(this.labelOutlineStroke);
labelBox.setShadowPaint(this.labelShadowPaint);
labelBox.setInteriorGap(this.labelPadding);
double theta = Math.toRadians(keys.getValue(i).doubleValue());
double baseY = state.getPieCenterY()
- Math.sin(theta) * verticalLinkRadius;
double hh = labelBox.getHeight(g2);
this.labelDistributor.addPieLabelRecord(new PieLabelRecord(
keys.getKey(i), theta, baseY, labelBox, hh,
lGap / 2.0 + lGap / 2.0 * Math.cos(theta),
0.9 + getExplodePercent(keys.getKey(i))));
}
}
double hh = plotArea.getHeight();
double gap = hh * getInteriorGap();
this.labelDistributor.distributeLabels(plotArea.getMinY() + gap,
hh - 2 * gap);
for (int i = 0; i < this.labelDistributor.getItemCount(); i++) {
drawRightLabel(g2, state,
this.labelDistributor.getPieLabelRecord(i));
}
}
|
protected void drawSimpleLabels(Graphics2D g2,
List keys,
double totalValue,
Rectangle2D plotArea,
Rectangle2D pieArea,
PiePlotState state) {
Composite originalComposite = g2.getComposite();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
1.0f));
RectangleInsets labelInsets = new RectangleInsets(UnitType.RELATIVE,
0.18, 0.18, 0.18, 0.18);
Rectangle2D labelsArea = labelInsets.createInsetRectangle(pieArea);
double runningTotal = 0.0;
Iterator iterator = keys.iterator();
while (iterator.hasNext()) {
Comparable key = (Comparable) iterator.next();
boolean include = true;
double v = 0.0;
Number n = getDataset().getValue(key);
if (n == null) {
include = !getIgnoreNullValues();
}
else {
v = n.doubleValue();
include = getIgnoreZeroValues() ? v > 0.0 : v >= 0.0;
}
if (include) {
runningTotal = runningTotal + v;
// work out the mid angle (0 - 90 and 270 - 360) = right,
// otherwise left
double mid = getStartAngle() + (getDirection().getFactor()
* ((runningTotal - v / 2.0) * 360) / totalValue);
Arc2D arc = new Arc2D.Double(labelsArea, getStartAngle(),
mid - getStartAngle(), Arc2D.OPEN);
int x = (int) arc.getEndPoint().getX();
int y = (int) arc.getEndPoint().getY();
PieSectionLabelGenerator labelGenerator = getLabelGenerator();
if (labelGenerator == null) {
continue;
}
String label = labelGenerator.generateSectionLabel(
this.dataset, key);
if (label == null) {
continue;
}
g2.setFont(this.labelFont);
FontMetrics fm = g2.getFontMetrics();
Rectangle2D bounds = TextUtilities.getTextBounds(label, g2, fm);
Rectangle2D out = this.labelPadding.createOutsetRectangle(
bounds);
Shape bg = ShapeUtilities.createTranslatedShape(out,
x - bounds.getCenterX(), y - bounds.getCenterY());
if (this.labelShadowPaint != null) {
Shape shadow = ShapeUtilities.createTranslatedShape(bg,
this.shadowXOffset, this.shadowYOffset);
g2.setPaint(this.labelShadowPaint);
g2.fill(shadow);
}
if (this.labelBackgroundPaint != null) {
g2.setPaint(this.labelBackgroundPaint);
g2.fill(bg);
}
if (this.labelOutlinePaint != null
&& this.labelOutlineStroke != null) {
g2.setPaint(this.labelOutlinePaint);
g2.setStroke(this.labelOutlineStroke);
g2.draw(bg);
}
g2.setPaint(this.labelPaint);
g2.setFont(this.labelFont);
TextUtilities.drawAlignedString(getLabelGenerator()
.generateSectionLabel(getDataset(), key), g2, x, y,
TextAnchor.CENTER);
}
}
g2.setComposite(originalComposite);
}
Draws the pie section labels in the simple form. |
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof PiePlot)) {
return false;
}
if (!super.equals(obj)) {
return false;
}
PiePlot that = (PiePlot) obj;
if (this.pieIndex != that.pieIndex) {
return false;
}
if (this.interiorGap != that.interiorGap) {
return false;
}
if (this.circular != that.circular) {
return false;
}
if (this.startAngle != that.startAngle) {
return false;
}
if (this.direction != that.direction) {
return false;
}
if (this.ignoreZeroValues != that.ignoreZeroValues) {
return false;
}
if (this.ignoreNullValues != that.ignoreNullValues) {
return false;
}
if (!PaintUtilities.equal(this.sectionPaint, that.sectionPaint)) {
return false;
}
if (!ObjectUtilities.equal(this.sectionPaintMap,
that.sectionPaintMap)) {
return false;
}
if (!PaintUtilities.equal(this.baseSectionPaint,
that.baseSectionPaint)) {
return false;
}
if (this.sectionOutlinesVisible != that.sectionOutlinesVisible) {
return false;
}
if (!PaintUtilities.equal(this.sectionOutlinePaint,
that.sectionOutlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.sectionOutlinePaintMap,
that.sectionOutlinePaintMap)) {
return false;
}
if (!PaintUtilities.equal(
this.baseSectionOutlinePaint, that.baseSectionOutlinePaint
)) {
return false;
}
if (!ObjectUtilities.equal(this.sectionOutlineStroke,
that.sectionOutlineStroke)) {
return false;
}
if (!ObjectUtilities.equal(this.sectionOutlineStrokeMap,
that.sectionOutlineStrokeMap)) {
return false;
}
if (!ObjectUtilities.equal(
this.baseSectionOutlineStroke, that.baseSectionOutlineStroke
)) {
return false;
}
if (!PaintUtilities.equal(this.shadowPaint, that.shadowPaint)) {
return false;
}
if (!(this.shadowXOffset == that.shadowXOffset)) {
return false;
}
if (!(this.shadowYOffset == that.shadowYOffset)) {
return false;
}
if (!ObjectUtilities.equal(this.explodePercentages,
that.explodePercentages)) {
return false;
}
if (!ObjectUtilities.equal(this.labelGenerator,
that.labelGenerator)) {
return false;
}
if (!ObjectUtilities.equal(this.labelFont, that.labelFont)) {
return false;
}
if (!PaintUtilities.equal(this.labelPaint, that.labelPaint)) {
return false;
}
if (!PaintUtilities.equal(this.labelBackgroundPaint,
that.labelBackgroundPaint)) {
return false;
}
if (!PaintUtilities.equal(this.labelOutlinePaint,
that.labelOutlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.labelOutlineStroke,
that.labelOutlineStroke)) {
return false;
}
if (!PaintUtilities.equal(this.labelShadowPaint,
that.labelShadowPaint)) {
return false;
}
if (this.simpleLabels != that.simpleLabels) {
return false;
}
if (!this.simpleLabelOffset.equals(that.simpleLabelOffset)) {
return false;
}
if (!this.labelPadding.equals(that.labelPadding)) {
return false;
}
if (!(this.maximumLabelWidth == that.maximumLabelWidth)) {
return false;
}
if (!(this.labelGap == that.labelGap)) {
return false;
}
if (!(this.labelLinkMargin == that.labelLinkMargin)) {
return false;
}
if (this.labelLinksVisible != that.labelLinksVisible) {
return false;
}
if (!this.labelLinkStyle.equals(that.labelLinkStyle)) {
return false;
}
if (!PaintUtilities.equal(this.labelLinkPaint, that.labelLinkPaint)) {
return false;
}
if (!ObjectUtilities.equal(this.labelLinkStroke,
that.labelLinkStroke)) {
return false;
}
if (!ObjectUtilities.equal(this.toolTipGenerator,
that.toolTipGenerator)) {
return false;
}
if (!ObjectUtilities.equal(this.urlGenerator, that.urlGenerator)) {
return false;
}
if (!(this.minimumArcAngleToDraw == that.minimumArcAngleToDraw)) {
return false;
}
if (!ShapeUtilities.equal(this.legendItemShape, that.legendItemShape)) {
return false;
}
if (!ObjectUtilities.equal(this.legendLabelGenerator,
that.legendLabelGenerator)) {
return false;
}
if (!ObjectUtilities.equal(this.legendLabelToolTipGenerator,
that.legendLabelToolTipGenerator)) {
return false;
}
if (!ObjectUtilities.equal(this.legendLabelURLGenerator,
that.legendLabelURLGenerator)) {
return false;
}
// can't find any difference...
return true;
}
Tests this plot for equality with an arbitrary object. Note that the
plot's dataset is NOT included in the test for equality. |
protected Rectangle2D getArcBounds(Rectangle2D unexploded,
Rectangle2D exploded,
double angle,
double extent,
double explodePercent) {
if (explodePercent == 0.0) {
return unexploded;
}
else {
Arc2D arc1 = new Arc2D.Double(unexploded, angle, extent / 2,
Arc2D.OPEN);
Point2D point1 = arc1.getEndPoint();
Arc2D.Double arc2 = new Arc2D.Double(exploded, angle, extent / 2,
Arc2D.OPEN);
Point2D point2 = arc2.getEndPoint();
double deltaX = (point1.getX() - point2.getX()) * explodePercent;
double deltaY = (point1.getY() - point2.getY()) * explodePercent;
return new Rectangle2D.Double(unexploded.getX() - deltaX,
unexploded.getY() - deltaY, unexploded.getWidth(),
unexploded.getHeight());
}
}
Returns a rectangle that can be used to create a pie section (taking
into account the amount by which the pie section is 'exploded'). |
public Paint getBaseSectionOutlinePaint() {
return this.baseSectionOutlinePaint;
}
Returns the base section paint. This is used when no other paint is
available. |
public Stroke getBaseSectionOutlineStroke() {
return this.baseSectionOutlineStroke;
}
Returns the base section stroke. This is used when no other stroke is
available. |
public Paint getBaseSectionPaint() {
return this.baseSectionPaint;
}
Returns the base section paint. This is used when no other paint is
defined, which is rare. The default value is Color.gray. |
public PieDataset getDataset() {
return this.dataset;
}
|
public Rotation getDirection() {
return this.direction;
}
Returns the direction in which the pie sections are drawn (clockwise or
anti-clockwise). |
public double getExplodePercent(Comparable key) {
double result = 0.0;
if (this.explodePercentages != null) {
Number percent = (Number) this.explodePercentages.get(key);
if (percent != null) {
result = percent.doubleValue();
}
}
return result;
}
Returns the amount that the section with the specified key should be
exploded. |
public double getExplodePercent(int section) {
Comparable key = getSectionKey(section);
return getExplodePercent(key);
} Deprecated! Use - #getExplodePercent(Comparable) instead.
Returns the amount that a section should be 'exploded'. |
public boolean getIgnoreNullValues() {
return this.ignoreNullValues;
}
Returns the flag that controls whether null values in the
dataset are ignored. |
public boolean getIgnoreZeroValues() {
return this.ignoreZeroValues;
}
Returns the flag that controls whether zero values in the
dataset are ignored. |
public double getInteriorGap() {
return this.interiorGap;
}
Returns the interior gap, measured as a percentage of the available
drawing space. |
public Paint getLabelBackgroundPaint() {
return this.labelBackgroundPaint;
}
Returns the section label background paint. |
public AbstractPieLabelDistributor getLabelDistributor() {
return this.labelDistributor;
}
Returns the object responsible for the vertical layout of the pie
section labels. |
public Font getLabelFont() {
return this.labelFont;
}
Returns the section label font. |
public double getLabelGap() {
return this.labelGap;
}
Returns the gap between the edge of the pie and the labels, expressed as
a percentage of the plot width. |
public PieSectionLabelGenerator getLabelGenerator() {
return this.labelGenerator;
}
Returns the section label generator. |
public double getLabelLinkMargin() {
return this.labelLinkMargin;
}
Returns the margin (expressed as a percentage of the width or height)
between the edge of the pie and the link point. |
public Paint getLabelLinkPaint() {
return this.labelLinkPaint;
}
Returns the paint used for the lines that connect pie sections to their
corresponding labels. |
public Stroke getLabelLinkStroke() {
return this.labelLinkStroke;
}
Returns the stroke used for the label linking lines. |
public PieLabelLinkStyle getLabelLinkStyle() {
return this.labelLinkStyle;
}
Returns the label link style. |
public boolean getLabelLinksVisible() {
return this.labelLinksVisible;
}
Returns the flag that controls whether or not label linking lines are
visible. |
public Paint getLabelOutlinePaint() {
return this.labelOutlinePaint;
}
Returns the section label outline paint. |
public Stroke getLabelOutlineStroke() {
return this.labelOutlineStroke;
}
Returns the section label outline stroke. |
public RectangleInsets getLabelPadding() {
return this.labelPadding;
}
Returns the label padding. |
public Paint getLabelPaint() {
return this.labelPaint;
}
Returns the section label paint. |
public Paint getLabelShadowPaint() {
return this.labelShadowPaint;
}
Returns the section label shadow paint. |
public Shape getLegendItemShape() {
return this.legendItemShape;
}
Returns the shape used for legend items. |
public LegendItemCollection getLegendItems() {
LegendItemCollection result = new LegendItemCollection();
if (this.dataset == null) {
return result;
}
List keys = this.dataset.getKeys();
int section = 0;
Shape shape = getLegendItemShape();
Iterator iterator = keys.iterator();
while (iterator.hasNext()) {
Comparable key = (Comparable) iterator.next();
Number n = this.dataset.getValue(key);
boolean include = true;
if (n == null) {
include = !this.ignoreNullValues;
}
else {
double v = n.doubleValue();
if (v == 0.0) {
include = !this.ignoreZeroValues;
}
else {
include = v > 0.0;
}
}
if (include) {
String label = this.legendLabelGenerator.generateSectionLabel(
this.dataset, key);
if (label != null) {
String description = label;
String toolTipText = null;
if (this.legendLabelToolTipGenerator != null) {
toolTipText = this.legendLabelToolTipGenerator
.generateSectionLabel(this.dataset, key);
}
String urlText = null;
if (this.legendLabelURLGenerator != null) {
urlText = this.legendLabelURLGenerator.generateURL(
this.dataset, key, this.pieIndex);
}
Paint paint = lookupSectionPaint(key, true);
Paint outlinePaint = lookupSectionOutlinePaint(key);
Stroke outlineStroke = lookupSectionOutlineStroke(key);
LegendItem item = new LegendItem(label, description,
toolTipText, urlText, true, shape, true, paint,
true, outlinePaint, outlineStroke,
false, // line not visible
new Line2D.Float(), new BasicStroke(), Color.black);
item.setDataset(getDataset());
result.add(item);
}
section++;
}
else {
section++;
}
}
return result;
}
Returns a collection of legend items for the pie chart. |
public PieSectionLabelGenerator getLegendLabelGenerator() {
return this.legendLabelGenerator;
}
Returns the legend label generator. |
public PieSectionLabelGenerator getLegendLabelToolTipGenerator() {
return this.legendLabelToolTipGenerator;
}
Returns the legend label tool tip generator. |
public PieURLGenerator getLegendLabelURLGenerator() {
return this.legendLabelURLGenerator;
}
Returns the legend label URL generator. |
public double getMaximumExplodePercent() {
if (this.dataset == null) {
return 0.0;
}
double result = 0.0;
Iterator iterator = this.dataset.getKeys().iterator();
while (iterator.hasNext()) {
Comparable key = (Comparable) iterator.next();
Number explode = (Number) this.explodePercentages.get(key);
if (explode != null) {
result = Math.max(result, explode.doubleValue());
}
}
return result;
}
Returns the maximum explode percent. |
public double getMaximumLabelWidth() {
return this.maximumLabelWidth;
}
Returns the maximum label width as a percentage of the plot width. |
public double getMinimumArcAngleToDraw() {
return this.minimumArcAngleToDraw;
}
Returns the minimum arc angle that will be drawn. Pie sections for an
angle smaller than this are not drawn, to avoid a JDK bug. |
public int getPieIndex() {
return this.pieIndex;
}
Returns the pie index (this is used by the MultiplePiePlot class
to track subplots). |
public String getPlotType() {
return localizationResources.getString("Pie_Plot");
}
Returns a short string describing the type of plot. |
protected Comparable getSectionKey(int section) {
Comparable key = null;
if (this.dataset != null) {
if (section >= 0 && section < this.dataset.getItemCount()) {
key = this.dataset.getKey(section);
}
}
if (key == null) {
key = new Integer(section);
}
return key;
}
Returns a key for the specified section. If there is no such section
in the dataset, we generate a key. This is to provide some backward
compatibility for the (now deprecated) methods that get/set attributes
based on section indices. The preferred way of doing this now is to
link the attributes directly to the section key (there are new methods
for this, starting from version 1.0.3). |
public Paint getSectionOutlinePaint() {
return this.sectionOutlinePaint;
} Deprecated! Use - #getSectionOutlinePaint(Comparable) and
#getBaseSectionOutlinePaint() . Deprecated as of version
1.0.6.
Returns the outline paint for ALL sections in the plot. |
public Paint getSectionOutlinePaint(Comparable key) {
// null argument check delegated...
return this.sectionOutlinePaintMap.getPaint(key);
}
Returns the outline paint associated with the specified key, or
null if there is no paint associated with the key. |
public Paint getSectionOutlinePaint(int section) {
Comparable key = getSectionKey(section);
return getSectionOutlinePaint(key);
} Deprecated! Use - #getSectionOutlinePaint(Comparable) instead.
Returns the paint for the specified section. |
public Stroke getSectionOutlineStroke() {
return this.sectionOutlineStroke;
} Deprecated! Use - #getSectionOutlineStroke(Comparable) and
#getBaseSectionOutlineStroke() . Deprecated as of version
1.0.6.
Returns the outline stroke for ALL sections in the plot. |
public Stroke getSectionOutlineStroke(Comparable key) {
// null argument check delegated...
return this.sectionOutlineStrokeMap.getStroke(key);
}
Returns the outline stroke associated with the specified key, or
null if there is no stroke associated with the key. |
public Stroke getSectionOutlineStroke(int section) {
Comparable key = getSectionKey(section);
return getSectionOutlineStroke(key);
} Deprecated! Use - #getSectionOutlineStroke(Comparable) instead.
Returns the stroke for the specified section. |
public boolean getSectionOutlinesVisible() {
return this.sectionOutlinesVisible;
}
Returns the flag that controls whether or not the outline is drawn for
each pie section. |
public Paint getSectionPaint() {
return this.sectionPaint;
} Deprecated! Use - #getSectionPaint(Comparable) and
#getBaseSectionPaint() . Deprecated as of version 1.0.6.
Returns the paint for ALL sections in the plot. |
public Paint getSectionPaint(Comparable key) {
// null argument check delegated...
return this.sectionPaintMap.getPaint(key);
}
Returns the paint associated with the specified key, or
null if there is no paint associated with the key. |
public Paint getSectionPaint(int section) {
Comparable key = getSectionKey(section);
return getSectionPaint(key);
} Deprecated! Use - #getSectionPaint(Comparable) instead.
Returns the paint for the specified section. |
public Paint getShadowPaint() {
return this.shadowPaint;
}
Returns the shadow paint. |
public double getShadowXOffset() {
return this.shadowXOffset;
}
Returns the x-offset for the shadow effect. |
public double getShadowYOffset() {
return this.shadowYOffset;
}
Returns the y-offset for the shadow effect. |
public RectangleInsets getSimpleLabelOffset() {
return this.simpleLabelOffset;
}
Returns the offset used for the simple labels, if they are displayed. |
public boolean getSimpleLabels() {
return this.simpleLabels;
}
Returns the flag that controls whether simple or extended labels are
displayed on the plot. |
public double getStartAngle() {
return this.startAngle;
}
Returns the start angle for the first pie section. This is measured in
degrees starting from 3 o'clock and measuring anti-clockwise. |
public PieToolTipGenerator getToolTipGenerator() {
return this.toolTipGenerator;
}
Returns the tool tip generator, an object that is responsible for
generating the text items used for tool tips by the plot. If the
generator is null, no tool tips will be created. |
public PieURLGenerator getURLGenerator() {
return this.urlGenerator;
}
Returns the URL generator. |
public PiePlotState initialise(Graphics2D g2,
Rectangle2D plotArea,
PiePlot plot,
Integer index,
PlotRenderingInfo info) {
PiePlotState state = new PiePlotState(info);
state.setPassesRequired(2);
if (this.dataset != null) {
state.setTotal(DatasetUtilities.calculatePieDatasetTotal(
plot.getDataset()));
}
state.setLatestAngle(plot.getStartAngle());
return state;
}
Initialises the drawing procedure. This method will be called before
the first item is rendered, giving the plot an opportunity to initialise
any state information it wants to maintain. |
public boolean isCircular() {
return this.circular;
}
Returns a flag indicating whether the pie chart is circular, or
stretched into an elliptical shape. |
protected Paint lookupSectionOutlinePaint(Comparable key) {
return lookupSectionOutlinePaint(key, false);
}
Returns the outline paint for the specified section. This is equivalent
to lookupSectionPaint(section, false). |
protected Paint lookupSectionOutlinePaint(Comparable key,
boolean autoPopulate) {
// is there an override?
Paint result = getSectionOutlinePaint();
if (result != null) {
return result;
}
// if not, check if there is a paint defined for the specified key
result = this.sectionOutlinePaintMap.getPaint(key);
if (result != null) {
return result;
}
// nothing defined - do we autoPopulate?
if (autoPopulate) {
DrawingSupplier ds = getDrawingSupplier();
if (ds != null) {
result = ds.getNextOutlinePaint();
this.sectionOutlinePaintMap.put(key, result);
}
else {
result = this.baseSectionOutlinePaint;
}
}
else {
result = this.baseSectionOutlinePaint;
}
return result;
}
Returns the outline paint for the specified section. The lookup
involves these steps:
|
protected Stroke lookupSectionOutlineStroke(Comparable key) {
return lookupSectionOutlineStroke(key, false);
}
Returns the outline stroke for the specified section. This is
equivalent to lookupSectionOutlineStroke(section, false). |
protected Stroke lookupSectionOutlineStroke(Comparable key,
boolean autoPopulate) {
// is there an override?
Stroke result = getSectionOutlineStroke();
if (result != null) {
return result;
}
// if not, check if there is a stroke defined for the specified key
result = this.sectionOutlineStrokeMap.getStroke(key);
if (result != null) {
return result;
}
// nothing defined - do we autoPopulate?
if (autoPopulate) {
DrawingSupplier ds = getDrawingSupplier();
if (ds != null) {
result = ds.getNextOutlineStroke();
this.sectionOutlineStrokeMap.put(key, result);
}
else {
result = this.baseSectionOutlineStroke;
}
}
else {
result = this.baseSectionOutlineStroke;
}
return result;
}
Returns the outline stroke for the specified section. The lookup
involves these steps:
|
protected Paint lookupSectionPaint(Comparable key) {
return lookupSectionPaint(key, false);
}
Returns the paint for the specified section. This is equivalent to
lookupSectionPaint(section, false). |
protected Paint lookupSectionPaint(Comparable key,
boolean autoPopulate) {
// is there an override?
Paint result = getSectionPaint();
if (result != null) {
return result;
}
// if not, check if there is a paint defined for the specified key
result = this.sectionPaintMap.getPaint(key);
if (result != null) {
return result;
}
// nothing defined - do we autoPopulate?
if (autoPopulate) {
DrawingSupplier ds = getDrawingSupplier();
if (ds != null) {
result = ds.getNextPaint();
this.sectionPaintMap.put(key, result);
}
else {
result = this.baseSectionPaint;
}
}
else {
result = this.baseSectionPaint;
}
return result;
}
Returns the paint for the specified section. The lookup involves these
steps:
|
public void setBaseSectionOutlinePaint(Paint paint) {
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
this.baseSectionOutlinePaint = paint;
fireChangeEvent();
}
Sets the base section paint. |
public void setBaseSectionOutlineStroke(Stroke stroke) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.baseSectionOutlineStroke = stroke;
fireChangeEvent();
}
Sets the base section stroke. |
public void setBaseSectionPaint(Paint paint) {
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
this.baseSectionPaint = paint;
fireChangeEvent();
}
Sets the base section paint and sends a PlotChangeEvent to all
registered listeners. |
public void setCircular(boolean flag) {
setCircular(flag, true);
}
A flag indicating whether the pie chart is circular, or stretched into
an elliptical shape. |
public void setCircular(boolean circular,
boolean notify) {
this.circular = circular;
if (notify) {
fireChangeEvent();
}
}
Sets the circular attribute and, if requested, sends a
PlotChangeEvent to all registered listeners. |
public void setDataset(PieDataset dataset) {
// if there is an existing dataset, remove the plot from the list of
// change listeners...
PieDataset existing = this.dataset;
if (existing != null) {
existing.removeChangeListener(this);
}
// set the new dataset, and register the chart as a change listener...
this.dataset = dataset;
if (dataset != null) {
setDatasetGroup(dataset.getGroup());
dataset.addChangeListener(this);
}
// send a dataset change event to self...
DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
datasetChanged(event);
}
|
public void setDirection(Rotation direction) {
if (direction == null) {
throw new IllegalArgumentException("Null 'direction' argument.");
}
this.direction = direction;
fireChangeEvent();
}
Sets the direction in which the pie sections are drawn and sends a
PlotChangeEvent to all registered listeners. |
public void setExplodePercent(Comparable key,
double percent) {
if (key == null) {
throw new IllegalArgumentException("Null 'key' argument.");
}
if (this.explodePercentages == null) {
this.explodePercentages = new TreeMap();
}
this.explodePercentages.put(key, new Double(percent));
fireChangeEvent();
}
Sets the amount that a pie section should be exploded and sends a
PlotChangeEvent to all registered listeners. |
public void setExplodePercent(int section,
double percent) {
Comparable key = getSectionKey(section);
setExplodePercent(key, percent);
} Deprecated! Use - #setExplodePercent(Comparable, double) instead.
Sets the amount that a pie section should be exploded and sends a
PlotChangeEvent to all registered listeners. |
public void setIgnoreNullValues(boolean flag) {
this.ignoreNullValues = flag;
fireChangeEvent();
}
Sets a flag that controls whether null values are ignored,
and sends a PlotChangeEvent to all registered listeners. At
present, this only affects whether or not the key is presented in the
legend. |
public void setIgnoreZeroValues(boolean flag) {
this.ignoreZeroValues = flag;
fireChangeEvent();
}
Sets a flag that controls whether zero values are ignored,
and sends a PlotChangeEvent to all registered listeners. This
only affects whether or not a label appears for the non-visible
pie section. |
public void setInteriorGap(double percent) {
if ((percent < 0.0) || (percent > MAX_INTERIOR_GAP)) {
throw new IllegalArgumentException(
"Invalid 'percent' (" + percent + ") argument.");
}
if (this.interiorGap != percent) {
this.interiorGap = percent;
fireChangeEvent();
}
}
Sets the interior gap and sends a PlotChangeEvent to all
registered listeners. This controls the space between the edges of the
pie plot and the plot area itself (the region where the section labels
appear). |
public void setLabelBackgroundPaint(Paint paint) {
this.labelBackgroundPaint = paint;
fireChangeEvent();
}
Sets the section label background paint and sends a
PlotChangeEvent to all registered listeners. |
public void setLabelDistributor(AbstractPieLabelDistributor distributor) {
if (distributor == null) {
throw new IllegalArgumentException("Null 'distributor' argument.");
}
this.labelDistributor = distributor;
fireChangeEvent();
}
Sets the label distributor and sends a PlotChangeEvent to all
registered listeners. |
public void setLabelFont(Font font) {
if (font == null) {
throw new IllegalArgumentException("Null 'font' argument.");
}
this.labelFont = font;
fireChangeEvent();
}
Sets the section label font and sends a PlotChangeEvent to all
registered listeners. |
public void setLabelGap(double gap) {
this.labelGap = gap;
fireChangeEvent();
}
Sets the gap between the edge of the pie and the labels (expressed as a
percentage of the plot width) and sends a PlotChangeEvent to all
registered listeners. |
public void setLabelGenerator(PieSectionLabelGenerator generator) {
this.labelGenerator = generator;
fireChangeEvent();
}
Sets the section label generator and sends a PlotChangeEvent to
all registered listeners. |
public void setLabelLinkMargin(double margin) {
this.labelLinkMargin = margin;
fireChangeEvent();
}
Sets the link margin and sends a PlotChangeEvent to all
registered listeners. |
public void setLabelLinkPaint(Paint paint) {
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
this.labelLinkPaint = paint;
fireChangeEvent();
}
Sets the paint used for the lines that connect pie sections to their
corresponding labels, and sends a PlotChangeEvent to all
registered listeners. |
public void setLabelLinkStroke(Stroke stroke) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.labelLinkStroke = stroke;
fireChangeEvent();
}
Sets the link stroke and sends a PlotChangeEvent to all
registered listeners. |
public void setLabelLinkStyle(PieLabelLinkStyle style) {
if (style == null) {
throw new IllegalArgumentException("Null 'style' argument.");
}
this.labelLinkStyle = style;
fireChangeEvent();
}
Sets the label link style and sends a PlotChangeEvent to all
registered listeners. |
public void setLabelLinksVisible(boolean visible) {
this.labelLinksVisible = visible;
fireChangeEvent();
}
Sets the flag that controls whether or not label linking lines are
visible and sends a PlotChangeEvent to all registered listeners.
Please take care when hiding the linking lines - depending on the data
values, the labels can be displayed some distance away from the
corresponding pie section. |
public void setLabelOutlinePaint(Paint paint) {
this.labelOutlinePaint = paint;
fireChangeEvent();
}
Sets the section label outline paint and sends a
PlotChangeEvent to all registered listeners. |
public void setLabelOutlineStroke(Stroke stroke) {
this.labelOutlineStroke = stroke;
fireChangeEvent();
}
Sets the section label outline stroke and sends a
PlotChangeEvent to all registered listeners. |
public void setLabelPadding(RectangleInsets padding) {
if (padding == null) {
throw new IllegalArgumentException("Null 'padding' argument.");
}
this.labelPadding = padding;
fireChangeEvent();
}
Sets the padding between each label and its outline and sends a
PlotChangeEvent to all registered listeners. |
public void setLabelPaint(Paint paint) {
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
this.labelPaint = paint;
fireChangeEvent();
}
Sets the section label paint and sends a PlotChangeEvent to all
registered listeners. |
public void setLabelShadowPaint(Paint paint) {
this.labelShadowPaint = paint;
fireChangeEvent();
}
Sets the section label shadow paint and sends a PlotChangeEvent
to all registered listeners. |
public void setLegendItemShape(Shape shape) {
if (shape == null) {
throw new IllegalArgumentException("Null 'shape' argument.");
}
this.legendItemShape = shape;
fireChangeEvent();
}
Sets the shape used for legend items and sends a PlotChangeEvent
to all registered listeners. |
public void setLegendLabelGenerator(PieSectionLabelGenerator generator) {
if (generator == null) {
throw new IllegalArgumentException("Null 'generator' argument.");
}
this.legendLabelGenerator = generator;
fireChangeEvent();
}
Sets the legend label generator and sends a PlotChangeEvent to
all registered listeners. |
![]()
|