亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? multiplepieplot.java

?? 制作圖表的好工具
?? JAVA
字號:
/* ===========================================================
 * JFreeChart : a free chart library for the Java(tm) platform
 * ===========================================================
 *
 * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
 *
 * Project Info:  http://www.jfree.org/jfreechart/index.html
 *
 * This library is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU Lesser General Public License as published by 
 * the Free Software Foundation; either version 2.1 of the License, or 
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
 * USA.  
 *
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
 * in the United States and other countries.]
 *
 * --------------------
 * MultiplePiePlot.java
 * --------------------
 * (C) Copyright 2004, 2005, by Object Refinery Limited.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   -;
 *
 * $Id: MultiplePiePlot.java,v 1.12.2.4 2005/11/28 12:06:35 mungady Exp $
 *
 * Changes (from 21-Jun-2001)
 * --------------------------
 * 29-Jan-2004 : Version 1 (DG);
 * 31-Mar-2004 : Added setPieIndex() call during drawing (DG);
 * 20-Apr-2005 : Small change for update to LegendItem constructors (DG);
 * 05-May-2005 : Updated draw() method parameters (DG);
 * 16-Jun-2005 : Added get/setDataset() and equals() methods (DG);
 *
 */

package org.jfree.chart.plot;

import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Stroke;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;

import org.jfree.chart.ChartRenderingInfo;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.LegendItem;
import org.jfree.chart.LegendItemCollection;
import org.jfree.chart.event.PlotChangeEvent;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.CategoryToPieDataset;
import org.jfree.data.general.DatasetChangeEvent;
import org.jfree.data.general.DatasetUtilities;
import org.jfree.data.general.PieDataset;
import org.jfree.ui.RectangleEdge;
import org.jfree.ui.RectangleInsets;
import org.jfree.util.ObjectUtilities;
import org.jfree.util.TableOrder;

/**
 * A plot that displays multiple pie plots using data from a 
 * {@link CategoryDataset}.
 */
public class MultiplePiePlot extends Plot implements Cloneable, Serializable {
    
    /** For serialization. */
    private static final long serialVersionUID = -355377800470807389L;
    
    /** The chart object that draws the individual pie charts. */
    private JFreeChart pieChart;
    
    /** The dataset. */
    private CategoryDataset dataset;
    
    /** The data extract order (by row or by column). */
    private TableOrder dataExtractOrder;
    
    /** The pie section limit percentage. */
    private double limit = 0.0;
    
    /**
     * Creates a new plot with no data.
     */
    public MultiplePiePlot() {
        this(null);
    }
    
    /**
     * Creates a new plot.
     * 
     * @param dataset  the dataset (<code>null</code> permitted).
     */
    public MultiplePiePlot(CategoryDataset dataset) {
        super();
        this.dataset = dataset;
        PiePlot piePlot = new PiePlot(null);
        this.pieChart = new JFreeChart(piePlot);
        this.pieChart.removeLegend();
        this.dataExtractOrder = TableOrder.BY_COLUMN;
        this.pieChart.setBackgroundPaint(null);
        TextTitle seriesTitle = new TextTitle(
            "Series Title", new Font("SansSerif", Font.BOLD, 12)
        );
        seriesTitle.setPosition(RectangleEdge.BOTTOM);
        this.pieChart.setTitle(seriesTitle);
    }
    
    /**
     * Returns the dataset used by the plot.
     * 
     * @return The dataset (possibly <code>null</code>).
     */
    public CategoryDataset getDataset() {
        return this.dataset;   
    }
    
    /**
     * Sets the dataset used by the plot and sends a {@link PlotChangeEvent}
     * to all registered listeners.
     * 
     * @param dataset  the dataset (<code>null</code> permitted).
     */
    public void setDataset(CategoryDataset dataset) {
        // if there is an existing dataset, remove the plot from the list of 
        // change listeners...
        if (this.dataset != null) {
            this.dataset.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 to trigger plot change event
        datasetChanged(new DatasetChangeEvent(this, dataset));
    }
    
    /**
     * Returns the pie chart that is used to draw the individual pie plots.
     * 
     * @return The pie chart.
     */
    public JFreeChart getPieChart() {
        return this.pieChart;
    }
    
    /**
     * Sets the chart that is used to draw the individual pie plots.
     * 
     * @param pieChart  the pie chart.
     */
    public void setPieChart(JFreeChart pieChart) {
        this.pieChart = pieChart;
        notifyListeners(new PlotChangeEvent(this));
    }
    
    /**
     * Returns the data extract order (by row or by column).
     * 
     * @return The data extract order (never <code>null</code>).
     */
    public TableOrder getDataExtractOrder() {
        return this.dataExtractOrder;
    }
    
    /**
     * Sets the data extract order (by row or by column) and sends a 
     * {@link PlotChangeEvent} to all registered listeners.
     * 
     * @param order  the order (<code>null</code> not permitted).
     */
    public void setDataExtractOrder(TableOrder order) {
        if (order == null) {
            throw new IllegalArgumentException("Null 'order' argument");
        }
        this.dataExtractOrder = order;
        notifyListeners(new PlotChangeEvent(this));
    }
    
    /**
     * Returns the limit (as a percentage) below which small pie sections are 
     * aggregated.
     * 
     * @return The limit percentage.
     */
    public double getLimit() {
        return this.limit;
    }
    
    /**
     * Sets the limit below which pie sections are aggregated.  
     * Set this to 0.0 if you don't want any aggregation to occur.
     * 
     * @param limit  the limit percent.
     */
    public void setLimit(double limit) {
        this.limit = limit;
        notifyListeners(new PlotChangeEvent(this));
    }
    
    /**
     * Returns a short string describing the type of plot.
     *
     * @return The plot type.
     */
    public String getPlotType() {
        return "Multiple Pie Plot";  
         // TODO: need to fetch this from localised resources
    }

    /**
     * Draws the plot on a Java 2D graphics device (such as the screen or a 
     * printer).
     *
     * @param g2  the graphics device.
     * @param area  the area within which the plot should be drawn.
     * @param anchor  the anchor point (<code>null</code> permitted).
     * @param parentState  the state from the parent plot, if there is one.
     * @param info  collects info about the drawing.
     */
    public void draw(Graphics2D g2, 
                     Rectangle2D area,
                     Point2D anchor,
                     PlotState parentState,
                     PlotRenderingInfo info) {
        
       
        // adjust the drawing area for the plot insets (if any)...
        RectangleInsets insets = getInsets();
        insets.trim(area);
        drawBackground(g2, area);
        drawOutline(g2, area);
        
        // check that there is some data to display...
        if (DatasetUtilities.isEmptyOrNull(this.dataset)) {
            drawNoDataMessage(g2, area);
            return;
        }

        int pieCount = 0;
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            pieCount = this.dataset.getRowCount();
        }
        else {
            pieCount = this.dataset.getColumnCount();
        }

        // the columns variable is always >= rows
        int displayCols = (int) Math.ceil(Math.sqrt(pieCount));
        int displayRows 
            = (int) Math.ceil((double) pieCount / (double) displayCols);

        // swap rows and columns to match plotArea shape
        if (displayCols > displayRows && area.getWidth() < area.getHeight()) {
            int temp = displayCols;
            displayCols = displayRows;
            displayRows = temp;
        }

        // int fontHeight 
        //     = g2.getFontMetrics(this.plotLabelFont).getHeight() * 2;
        int x = (int) area.getX();
        int y = (int) area.getY();
        int width = ((int) area.getWidth()) / displayCols;
        int height = ((int) area.getHeight()) / displayRows;
        int row = 0;
        int column = 0;
        int diff = (displayRows * displayCols) - pieCount;
        int xoffset = 0;
        Rectangle rect = new Rectangle();

        for (int pieIndex = 0; pieIndex < pieCount; pieIndex++) {
            rect.setBounds(
                x + xoffset + (width * column), y + (height * row), 
                width, height
            );

            String title = null;
            if (this.dataExtractOrder == TableOrder.BY_ROW) {
                title = this.dataset.getRowKey(pieIndex).toString();
            }
            else {
                title = this.dataset.getColumnKey(pieIndex).toString();
            }
            this.pieChart.setTitle(title);
            
            PieDataset piedataset = null;
            PieDataset dd = new CategoryToPieDataset(
                this.dataset, this.dataExtractOrder, pieIndex
            );
            if (this.limit > 0.0) {
                piedataset = DatasetUtilities.createConsolidatedPieDataset(
                    dd, "Other", this.limit
                );
            }
            else {
                piedataset = dd;
            }
            PiePlot piePlot = (PiePlot) this.pieChart.getPlot();
            piePlot.setDataset(piedataset);
            piePlot.setPieIndex(pieIndex);
            ChartRenderingInfo subinfo = null;
            if (info != null) {
                subinfo = new ChartRenderingInfo();
            }
            this.pieChart.draw(g2, rect, subinfo);
            if (info != null) {
                info.getOwner().getEntityCollection().addAll(
                    subinfo.getEntityCollection()
                );
                info.addSubplotInfo(subinfo.getPlotInfo());
            }
            
            ++column;
            if (column == displayCols) {
                column = 0;
                ++row;

                if (row == displayRows - 1 && diff != 0) {
                    xoffset = (diff * width) / 2;
                }
            }
        }

    }
    
    /**
     * Returns a collection of legend items for the pie chart.
     *
     * @return The legend items.
     */
    public LegendItemCollection getLegendItems() {

        LegendItemCollection result = new LegendItemCollection();

        if (this.dataset != null) {
            List keys = null;
      
            if (this.dataExtractOrder == TableOrder.BY_ROW) {
                keys = this.dataset.getColumnKeys();
            }
            else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
                keys = this.dataset.getRowKeys();
            }

            if (keys != null) {
                int section = 0;
                Iterator iterator = keys.iterator();
                while (iterator.hasNext()) {
                    String label = iterator.next().toString();
                    String description = label;
                    PiePlot plot = (PiePlot) this.pieChart.getPlot();
                    Paint paint = plot.getSectionPaint(section);
                    Paint outlinePaint = plot.getSectionOutlinePaint(section);
                    Stroke outlineStroke 
                        = plot.getSectionOutlineStroke(section);
                    LegendItem item = new LegendItem(label, description, 
                            null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE, 
                            paint, outlineStroke, outlinePaint);

                    result.add(item);
                    section++;
                }
            }
        }
        return result;
    }
    
    /**
     * Tests this plot for equality with an arbitrary object.  Note that the 
     * plot's dataset is not considered in the equality test.
     * 
     * @param obj  the object (<code>null</code> permitted).
     */
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;   
        }
        if (!(obj instanceof MultiplePiePlot)) {
            return false;   
        }
        MultiplePiePlot that = (MultiplePiePlot) obj;
        if (this.dataExtractOrder != that.dataExtractOrder) {
            return false;   
        }
        if (this.limit != that.limit) {
            return false;   
        }
        if (!ObjectUtilities.equal(this.pieChart, that.pieChart)) {
            return false;   
        }
        if (!super.equals(obj)) {
            return false;   
        }
        return true;
    }
    
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美美女喷水视频| 亚洲精品一区二区三区影院| 久久国产精品72免费观看| 中文字幕欧美日韩一区| 欧美精品三级日韩久久| 成人av电影在线观看| 蜜臀久久99精品久久久久久9| 亚洲欧洲日产国产综合网| 欧美tk丨vk视频| 欧美日韩一级二级| 99精品视频中文字幕| 国产一区二区三区在线观看免费 | 中文字幕亚洲在| 精品毛片乱码1区2区3区| 欧美在线免费观看视频| jvid福利写真一区二区三区| 免费人成在线不卡| 亚洲资源中文字幕| 中文字幕字幕中文在线中不卡视频| 精品美女一区二区| 日韩视频一区在线观看| 欧洲在线/亚洲| 91网址在线看| 不卡免费追剧大全电视剧网站| 久久99精品久久久久久国产越南| 午夜精品福利一区二区三区av| 亚洲欧洲在线观看av| 国产亚洲精品bt天堂精选| 日韩欧美成人午夜| 欧美一区二区在线看| 欧美精三区欧美精三区| 欧美日韩亚州综合| 欧美精品自拍偷拍动漫精品| 欧美视频一区在线观看| 97se亚洲国产综合自在线观| 粗大黑人巨茎大战欧美成人| 国产成人av自拍| 国产精品一区二区果冻传媒| 国产一区二区在线观看免费 | 国产精品一区专区| 九九久久精品视频| 经典三级视频一区| 国产精品一级二级三级| 国产精品亚洲专一区二区三区 | 成人精品视频一区二区三区 | 不卡大黄网站免费看| 成人精品国产福利| 91女神在线视频| 日本乱人伦aⅴ精品| 欧洲日韩一区二区三区| 欧美三级电影网站| 91精品啪在线观看国产60岁| 欧美一区二区视频免费观看| 欧美一区二区精品| 久久精品日产第一区二区三区高清版| 久久久久久**毛片大全| 国产精品视频你懂的| 亚洲同性同志一二三专区| 一区二区三区免费在线观看| 亚洲国产欧美另类丝袜| 蜜臀久久99精品久久久久宅男| 久久精品国产99国产精品| 国内精品国产三级国产a久久| 高清成人免费视频| 在线观看视频欧美| 日韩一区二区三区免费观看| 久久久美女艺术照精彩视频福利播放| 国产精品久久久久久久久动漫| 尤物在线观看一区| 免费人成黄页网站在线一区二区| 精品中文字幕一区二区| 成人精品在线视频观看| 欧美年轻男男videosbes| 日韩欧美黄色影院| 国产精品久线观看视频| 亚洲一级电影视频| 久久99热狠狠色一区二区| 不卡视频一二三| 欧美丰满美乳xxx高潮www| 久久久久久久性| 亚洲精品免费电影| 激情图片小说一区| 色综合天天狠狠| 日韩免费电影网站| 亚洲美女视频在线| 久久国产精品免费| 日本韩国欧美一区二区三区| 精品国产百合女同互慰| 一区二区三区在线观看网站| 久久91精品久久久久久秒播| 99久久99久久综合| 欧美一区日韩一区| 一区二区三区在线看| 国产一区二区三区电影在线观看| 色av一区二区| 欧美激情在线看| 免费看精品久久片| 色琪琪一区二区三区亚洲区| 欧美精品一区二区三区蜜桃| 亚洲六月丁香色婷婷综合久久| 精品一区二区三区影院在线午夜| 日本电影亚洲天堂一区| 久久精品在线免费观看| 日韩精品久久久久久| 91色婷婷久久久久合中文| 精品国产a毛片| 日本欧洲一区二区| 91国内精品野花午夜精品| 国产精品久久久爽爽爽麻豆色哟哟| 麻豆国产一区二区| 欧美中文字幕一区| 国产精品乱码一区二三区小蝌蚪| 久草中文综合在线| 欧美伦理电影网| 亚洲男同性恋视频| 成人免费视频一区| 精品少妇一区二区| 麻豆精品一区二区三区| 欧美日韩你懂得| 亚洲欧美日韩国产一区二区三区| 国产iv一区二区三区| 日韩欧美激情四射| 免费在线观看一区| 欧美精品在线观看一区二区| 亚洲综合免费观看高清完整版| 99riav一区二区三区| 国产精品青草久久| 成人午夜电影网站| 2021中文字幕一区亚洲| 精品一区二区三区免费| 欧美一区二区黄| 久久精品99久久久| 精品女同一区二区| 激情文学综合丁香| 国产婷婷色一区二区三区在线| 黑人巨大精品欧美黑白配亚洲| 日韩免费视频一区| 久久er精品视频| 久久女同性恋中文字幕| 韩国女主播一区二区三区| 久久久久久亚洲综合影院红桃| 国产揄拍国内精品对白| 国产日产亚洲精品系列| 成人国产精品视频| 亚洲男人电影天堂| 欧美日韩一区二区三区四区五区 | 国产精品一二三在| 国产精品久久久久天堂| 91视频免费观看| 亚洲狠狠爱一区二区三区| 欧美色视频在线| 青青草国产精品亚洲专区无| 欧美电视剧免费观看| 国产精品资源网| 亚洲欧美色图小说| 91精品婷婷国产综合久久性色| 久久99精品久久久久婷婷| 久久久国产精品麻豆| jvid福利写真一区二区三区| 亚洲欧美日韩国产成人精品影院| 国产精品2024| 国产精品免费视频网站| 色94色欧美sute亚洲线路一久 | 久久精品亚洲乱码伦伦中文| 国产自产视频一区二区三区| 国产欧美一区二区精品婷婷| 处破女av一区二区| 亚洲777理论| 日韩一区二区三区观看| 盗摄精品av一区二区三区| 亚洲免费成人av| 欧美精品xxxxbbbb| 成人永久免费视频| 亚洲视频一区在线| 日韩一卡二卡三卡四卡| 久99久精品视频免费观看| 日本一区二区三区久久久久久久久不| 国产麻豆视频精品| 一区二区三区久久久| 精品国产一区久久| 成人av免费观看| 麻豆精品国产91久久久久久| 久久精品一区二区| 欧美日韩国产精品自在自线| 国产乱码精品一区二区三| 中文字幕一区二区三区在线观看| 欧美精品tushy高清| 国产一区二区三区不卡在线观看| 亚洲在线中文字幕| 在线观看免费亚洲| 国产一区免费电影| 日产欧产美韩系列久久99| 精品国产人成亚洲区| 欧美丝袜第三区| 国产一区二区美女诱惑| 午夜精品久久久久久久| 国产精品女人毛片| 欧美一区二区三区视频在线观看| 色一情一伦一子一伦一区| 日本女人一区二区三区|