⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pieplot.java

📁 JFreeChartweb图表
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            this.sectionLabelFont = font;
            notifyListeners(new PlotChangeEvent(this));
        }

    }

    /**
     * Returns the section label paint.
     *
     * @return the section label paint.
     */
    public Paint getSectionLabelPaint() {
        return this.sectionLabelPaint;
    }

    /**
     * Sets the section label paint.
     * <P>
     * Notifies registered listeners that the plot has been changed.
     *
     * @param paint  the new section label paint.
     */
    public void setSectionLabelPaint(Paint paint) {

        // check arguments...
        if (paint == null) {
            throw new IllegalArgumentException(
                "PiePlot.setSectionLabelPaint(...): null paint not allowed.");
        }

        // make the change...
        if (!this.sectionLabelPaint.equals(paint)) {
            this.sectionLabelPaint = paint;
            notifyListeners(new PlotChangeEvent(this));
        }

    }

    /**
     * Returns the section label gap, measured as a percentage of the radius.
     *
     * @return the section label gap, measured as a percentage of the radius.
     */
    public double getSectionLabelGap() {
        return this.sectionLabelGap;
    }

    /**
     * Sets the section label gap percent.
     *
     * @param percent  the gap.
     */
    public void setSectionLabelGap(double percent) {

        // check arguments...
        if ((percent < 0.0) || (percent > MAX_SECTION_LABEL_GAP)) {
            throw new IllegalArgumentException(
                "PiePlot.setSectionLabelGapPercent(double): percentage outside valid range.");
        }

        // make the change...
        if (this.sectionLabelGap != percent) {
            this.sectionLabelGap = percent;
            notifyListeners(new PlotChangeEvent(this));
        }

    }

    /**
     * Sets the format string for the value labels.
     *
     * @param format  The format.
     */
    public void setValueFormatString(String format) {
        this.valueFormatter = new DecimalFormat(format);
    }

    /**
     * Sets the format for the value labels.
     *
     * @param format  the format.
     */
    public void setValueFormat(NumberFormat format) {

        if (format == null) {
            return;
        }
        this.valueFormatter = format;

    }

    /**
     * Sets the format string for the percent labels.
     *
     * @param format  the format.
     */
    public void setPercentFormatString(String format) {
        this.percentFormatter = new DecimalFormat(format);
    }

    /**
     * Sets the format for the value labels.
     *
     * @param format  the format.
     */
    public void setPercentFormat(NumberFormat format) {

        if (format == null) {
            return;
        }
        this.percentFormatter = format;

    }

    /**
     * Returns the dataset for the plot, cast as a {@link PieDataset}.
     * <P>
     * Provided for convenience.
     *
     * @return the dataset for the plot, cast as a {@link PieDataset}.
     */
    public PieDataset getPieDataset() {
        return (PieDataset) getDataset();
    }

    /**
     * Returns the show series labels flag.
     *
     * @return the show series label flag.
     */
    public boolean getShowSeriesLabels () {
        return (this.showSeriesLabels);
    }

    /**
     * Sets the show series labels flag.
     * <P>
     * Notifies registered listeners that the plot has been changed.
     *
     * @param flag  the new show series labels flag.
     */
    public void setShowSeriesLabels(boolean flag) {
        if (this.showSeriesLabels != flag) {
            this.showSeriesLabels = flag;
            notifyListeners(new PlotChangeEvent(this));
        }
    }

    /**
     * Returns the series label font.
     *
     * @return the series label font.
     */
    public Font getSeriesLabelFont() {
        return this.seriesLabelFont;
    }

    /**
     * Sets the series label font.
     * <P>
     * Notifies registered listeners that the plot has been changed.
     *
     * @param font the new series label font.
     */
    public void setSeriesLabelFont(Font font) {

        // check arguments...
        if (font == null) {
            throw new IllegalArgumentException("PiePlot.setSeriesLabelFont(...): "
                                               + "null font not allowed.");
        }

        // make the change...
        if (!this.seriesLabelFont.equals(font)) {
            this.seriesLabelFont = font;
            notifyListeners(new PlotChangeEvent(this));
        }

    }

    /**
     * Returns the series label paint.
     *
     * @return the series label paint.
     */
    public Paint getSeriesLabelPaint() {
        return this.seriesLabelPaint;
    }

    /**
     * Sets the series label paint.
     * <P>
     * Notifies registered listeners that the plot has been changed.
     *
     * @param paint the new series label paint.
� � �*/
    public void setSeriesLabelPaint(Paint paint) {

        // check arguments...
        if (paint == null) {
            throw new IllegalArgumentException("PiePlot.setSeriesLabelPaint(...): "
                                               + "null paint not allowed.");
        }

        // make the change...
        if (!this.seriesLabelPaint.equals(paint)) {
            this.seriesLabelPaint = paint;
            notifyListeners(new PlotChangeEvent(this));
        }

    }

    /**
     * Returns a collection of the section keys (or categories) in the dataset.
     *
     * @return the categories.
     */
    public Collection getKeys() {

        Collection result = null;

        final Dataset d = getDataset();
        if (d instanceof PieDataset) {
            PieDataset p = (PieDataset) d;
            result = Collections.unmodifiableCollection(p.getKeys());
        }
        else if (d instanceof CategoryDataset) {
            final CategoryDataset c = (CategoryDataset) d;
            if (this.extractType == PiePlot.PER_ROW) {
                result = Collections.unmodifiableCollection(c.getColumnKeys());
            }
            else if (this.extractType == PER_COLUMN) {
                result = Collections.unmodifiableCollection(c.getRowKeys());
            }
        }

        return result;

    }

    /**
     * Returns the paint used to fill a section of the pie plot.
     *
     * @param section  the section index (zero-based).
     *
     * @return The paint.
     */
    public Paint getSectionPaint(int section) {
        
        Paint result = null;
        
        if (this.sectionPaint != null) {
            result = this.sectionPaint;
        }   
        else {
            result = this.sectionPaintList.getPaint(section);
            if (result == null && getSectionPaintListAutoFill()) {
                DrawingSupplier supplier = getDrawingSupplier();
                if (supplier != null) {
                    result = supplier.getNextPaint();
                    this.sectionPaintList.setPaint(section, result);
                }
            }
            
        }
        
        return result;
            
    }
    
    /**
     * Sets the paint used to fill a section of the pie.
     *
     * @param section  the section index (zero-based).
     * @param paint  the paint.
     */
    public void setSectionPaint(int section, Paint paint) {  
        
        this.sectionPaintList.setPaint(section, paint);
        notifyListeners(new PlotChangeEvent(this));
        
    }

    /**
     * Returns the paint used to fill a section of the pie plot.
     *
     * @param section  the section index (zero-based).
     *
     * @return The paint.
     * 
     * @deprecated Use getSectionPaint(int).
     */
    public Paint getPaint(int section) {
        return getSectionPaint(section);
    }

    /**
     * Sets the paint used to fill a section of the pie.
     *
     * @param section  the section index (zero-based).
     * @param paint  the paint.
     * 
     * @deprecated Use setSectionPaint(int, Paint).
     */
    public void setPaint(int section, Paint paint) {
        setSectionPaint(section, paint);
    }

    /**
     * Returns the paint for ALL sections in the plot.
     * 
     * @return The paint (possibly <code>null</code>).
     */
    public Paint getSectionPaint() {
        return this.sectionPaint;
    }
    
    /**
     * Sets the 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 setSectionPaint(Paint paint) {
        this.sectionPaint = paint;
        notifyListeners(new PlotChangeEvent(this));
    }

    /**
     * Returns a flag that controls whether or not <code>null</code> values are 
     * automatically replaced with a value from the {@link DrawingSupplier}.
     * 
     * @return A boolean.
     */
    public boolean getSectionPaintListAutoFill() {
        return this.sectionPaintListAutoFill;
    }
    
    /**
     * Sets a flag that controls whether or not <code>null</code> values are 
     * automatically replaced with a value from the {@link DrawingSupplier}.
     * 
     * @param fill  the flag.
     */
    public void setSectionPaintListAutoFill(boolean fill) {
        this.sectionPaintListAutoFill = fill;
    }
    
    /**
     * Returns the default paint.  This is used to fill pie sections when the paint
     * table is inactive (not common).
     *
     * @return The paint.
     * 
     * @deprecated Use getSectionPaint().
     */
    public Paint getDefaultPaint() {
        return getSectionPaint();
    }

    /**
     * Sets the default paint.
     *
     * @param paint  the paint.
     * 
     * @deprecated Use setSectionPaint(Paint).
     */
    public void setDefaultPaint(Paint paint) {
        setSectionPaint(paint);
    }

    /**
     * Returns the outline paint for ALL sections in the plot.
     * 
     * @return The paint (possibly <code>null</code>.
     */
    public Paint getSectionOutlinePaint() {
        return this.sectionOutlinePaint;
    }

⌨️ 快捷键说明

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