📄 pieplot.java
字号:
* @param paint the paint (<code>null</code> not permitted).
*/
public void setBaseSectionOutlinePaint(Paint paint) {
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
this.baseSectionOutlinePaint = paint;
notifyListeners(new PlotChangeEvent(this));
}
//// SECTION OUTLINE STROKE ///////////////////////////////////////////////////////////////////
/**
* Returns the outline stroke for ALL sections in the plot.
*
* @return the stroke (possibly <code>null</code>).
*/
public Stroke getSectionOutlineStroke() {
return this.sectionOutlineStroke;
}
/**
* Sets the outline stroke for ALL sections in the plot. If this is set to
* </code>null</code>, then a list of paints is used instead (to allow
* different colors to be used for each section).
*
* @param stroke the stroke (<code>null</code> permitted).
*/
public void setSectionOutlineStroke(Stroke stroke) {
this.sectionOutlineStroke = stroke;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the stroke for the specified section.
*
* @param section the section index (zero-based).
*
* @return the stroke (never <code>null</code>).
*/
public Stroke getSectionOutlineStroke(int section) {
// return the override, if there is one...
if (this.sectionOutlineStroke != null) {
return this.sectionOutlineStroke;
}
// otherwise look up the paint list
Stroke result = this.sectionOutlineStrokeList.getStroke(section);
if (result == null) {
result = this.baseSectionOutlineStroke;
}
return result;
}
/**
* Sets the stroke used to fill a section of the pie and sends a {@link PlotChangeEvent} to
* all registered listeners.
*
* @param section the section index (zero-based).
* @param stroke the stroke (<code>null</code> permitted).
*/
public void setSectionOutlineStroke(int section, Stroke stroke) {
this.sectionOutlineStrokeList.setStroke(section, stroke);
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the base section stroke. This is used when no other stroke is available.
*
* @return the stroke (never <code>null</code>).
*/
public Stroke getBaseSectionOutlineStroke() {
return this.baseSectionOutlineStroke;
}
/**
* Sets the base section stroke.
*
* @param stroke the stroke (<code>null</code> not permitted).
*/
public void setBaseSectionOutlineStroke(Stroke stroke) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.baseSectionOutlineStroke = stroke;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the shadow paint.
*
* @return the paint (possibly <code>null</code>).
*/
public Paint getShadowPaint() {
return this.shadowPaint;
}
/**
* Sets the shadow paint and sends a {@link PlotChangeEvent} to all registered listeners.
*
* @param paint the paint (<code>null</code> permitted).
*/
public void setShadowPaint(Paint paint) {
this.shadowPaint = paint;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the x-offset for the shadow effect.
*
* @return the offset (in Java2D units).
*/
public double getShadowXOffset() {
return this.shadowXOffset;
}
/**
* Sets the x-offset for the shadow effect and sends a {@link PlotChangeEvent} to all
* registered listeners.
*
* @param offset the offset (in Java2D units).
*/
public void setShadowXOffset(double offset) {
this.shadowXOffset = offset;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the y-offset for the shadow effect.
*
* @return the offset (in Java2D units).
*/
public double getShadowYOffset() {
return this.shadowYOffset;
}
/**
* Sets the y-offset for the shadow effect and sends a {@link PlotChangeEvent} to all
* registered listeners.
*
* @param offset the offset (in Java2D units).
*/
public void setShadowYOffset(double offset) {
this.shadowYOffset = offset;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the amount that a section should be 'exploded'.
*
* @param section the section number.
*
* @return the amount that a section should be 'exploded'.
*/
public double getExplodePercent(int section) {
double result = 0.0;
if (this.explodePercentages != null) {
Number percent = (Number) this.explodePercentages.get(section);
if (percent != null) {
result = percent.doubleValue();
}
}
return result;
}
/**
* Sets the amount that a pie section should be exploded and sends a {@link PlotChangeEvent}
* to all registered listeners.
*
* @param section the section index.
* @param percent the explode percentage (0.30 = 30 percent).
*/
public void setExplodePercent(int section, double percent) {
if (this.explodePercentages == null) {
this.explodePercentages = new ObjectList();
}
this.explodePercentages.set(section, new Double(percent));
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the maximum explode percent.
*
* @return the percent.
*/
public double getMaximumExplodePercent() {
double result = 0.0;
for (int i = 0; i < this.explodePercentages.size(); i++) {
Number explode = (Number) this.explodePercentages.get(i);
if (explode != null) {
result = Math.max(result, explode.doubleValue());
}
}
return result;
}
/**
* Returns the section label generator.
*
* @return The generator (possibly <code>null</code>).
*/
public PieSectionLabelGenerator getLabelGenerator() {
return this.labelGenerator;
}
/**
* Sets the section label generator and sends a {@link PlotChangeEvent} to all registered
* listeners.
*
* @param generator the generator (<code>null</code> permitted).
*/
public void setLabelGenerator(PieSectionLabelGenerator generator) {
this.labelGenerator = generator;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the gap between the edge of the pie and the labels, expressed as a percentage of
* the plot width.
*
* @return the gap (a percentage, where 0.05 = five percent).
*/
public double getLabelGap() {
return this.labelGap;
}
/**
* Sets the gap between the edge of the pie and the labels (expressed as a percentage of the
* plot width) and sends a {@link PlotChangeEvent} to all registered listeners.
*
* @param gap the gap (a percentage, where 0.05 = five percent).
*/
public void setLabelGap(double gap) {
this.labelGap = gap;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the maximum label width as a percentage of the plot width.
*
* @return the width (a percentage, where 0.20 = 20 percent).
*/
public double getMaximumLabelWidth() {
return this.maximumLabelWidth;
}
/**
* Sets the maximum label width as a percentage of the plot width and sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param width the width (a percentage, where 0.20 = 20 percent).
*/
public void setMaximumLabelWidth(double width) {
this.maximumLabelWidth = width;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the margin (expressed as a percentage of the width or height) between the edge of
* the pie and the link point.
*
* @return The link margin (as a percentage, where 0.05 is five percent).
*/
public double getLabelLinkMargin() {
return this.labelLinkMargin;
}
/**
* Sets the link margin and sends a {@link PlotChangeEvent} to all registered listeners.
*
* @param margin the margin.
*/
public void setLabelLinkMargin(double margin) {
this.labelLinkMargin = margin;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the paint used for the lines that connect pie sections to their corresponding labels.
*
* @return The paint (never <code>null</code>).
*/
public Paint getLabelLinkPaint() {
return this.labelLinkPaint;
}
/**
* Sets the paint used for the lines that connect pie sections to their corresponding labels,
* and sends a {@link PlotChangeEvent} to all registered listeners.
*
* @param paint the paint (<code>null</code> not permitted).
*/
public void setLabelLinkPaint(Paint paint) {
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
this.labelLinkPaint = paint;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the stroke used for the label linking lines.
*
* @return the stroke.
*/
public Stroke getLabelLinkStroke() {
return this.labelLinkStroke;
}
/**
* Sets the link stroke and sends a {@link PlotChangeEvent} to all registered listeners.
*
* @param stroke the stroke.
*/
public void setLabelLinkStroke(Stroke stroke) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.labelLinkStroke = stroke;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the section label font.
*
* @return the font (never <code>null</code>).
*/
public Font getLabelFont() {
return this.labelFont;
}
/**
* Sets the section label font and sends a {@link PlotChangeEvent} to all registered listeners.
*
* @param font the font (<code>null</code> not permitted).
*/
public void setLabelFont(Font font) {
if (font == null) {
throw new IllegalArgumentException("Null 'font' argument.");
}
this.labelFont = font;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the section label paint.
*
* @return the paint (never <code>null</code>).
*/
public Paint getLabelPaint() {
return this.labelPaint;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -