pieplot.java

来自「JfreeChart 常用图表例子」· Java 代码 · 共 1,886 行 · 第 1/5 页

JAVA
1,886
字号
     * Returns the outline paint for ALL sections in the plot.     *     * @return The paint (possibly <code>null</code>).     */    public Paint getSectionOutlinePaint() {        return this.sectionOutlinePaint;    }    /**     * Sets the outline paint 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 paint  the paint (<code>null</code> permitted).     */    public void setSectionOutlinePaint(Paint paint) {        this.sectionOutlinePaint = paint;        notifyListeners(new PlotChangeEvent(this));    }    /**     * Returns the paint for the specified section.     *      * @param section  the section index (zero-based).     *      * @return The paint (never <code>null</code>).     */    public Paint getSectionOutlinePaint(int section) {                // return the override, if there is one...        if (this.sectionOutlinePaint != null) {            return this.sectionOutlinePaint;        }        // otherwise look up the paint list        Paint result = this.sectionOutlinePaintList.getPaint(section);        if (result == null) {            result = this.baseSectionOutlinePaint;        }        return result;           }        /**     * Sets the paint 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 paint  the paint (<code>null</code> permitted).     */    public void setSectionOutlinePaint(int section, Paint paint) {        this.sectionOutlinePaintList.setPaint(section, paint);        notifyListeners(new PlotChangeEvent(this));    }        /**     * Returns the base section paint.  This is used when no other paint is      * available.     *      * @return The paint (never <code>null</code>).     */    public Paint getBaseSectionOutlinePaint() {        return this.baseSectionOutlinePaint;       }        /**     * Sets the base section paint.     *      * @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 flag that controls whether or not label linking lines are     * visible.     *      * @return A boolean.     */    public boolean getLabelLinksVisible() {        return this.labelLinksVisible;    }        /**     * Sets the flag that controls whether or not label linking lines are      * visible and sends a {@link 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.     *      * @param visible  the flag.     */    public void setLabelLinksVisible(boolean visible) {        this.labelLinksVisible = visible;        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.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?