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

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

?? groupedstackedbarrenderer.java

?? jfreechart1.0.1 jsp繪制圖表的開發包
?? 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.]
 *
 * ------------------------------
 * GroupedStackedBarRenderer.java
 * ------------------------------
 * (C) Copyright 2004, 2005, by Object Refinery Limited and Contributors.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   -;
 *
 * $Id: GroupedStackedBarRenderer.java,v 1.7.2.3 2005/12/01 20:16:57 mungady Exp $
 *
 * Changes
 * -------
 * 29-Apr-2004 : Version 1 (DG);
 * 08-Jul-2004 : Added equals() method (DG);
 * 05-Nov-2004 : Modified drawItem() signature (DG);
 * 07-Jan-2005 : Renamed getRangeExtent() --> findRangeBounds (DG);
 * 20-Apr-2005 : Renamed CategoryLabelGenerator 
 *               --> CategoryItemLabelGenerator (DG);
 * 22-Sep-2005 : Renamed getMaxBarWidth() --> getMaximumBarWidth() (DG);
 * 
 */
 
package org.jfree.chart.renderer.category;

import java.awt.GradientPaint;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;

import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.entity.CategoryItemEntity;
import org.jfree.chart.entity.EntityCollection;
import org.jfree.chart.event.RendererChangeEvent;
import org.jfree.chart.labels.CategoryItemLabelGenerator;
import org.jfree.chart.labels.CategoryToolTipGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.KeyToGroupMap;
import org.jfree.data.Range;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.general.DatasetUtilities;
import org.jfree.ui.RectangleEdge;
import org.jfree.util.PublicCloneable;

/**
 * A renderer that draws stacked bars within groups.  This will probably be 
 * merged with the {@link StackedBarRenderer} class at some point.
 */
public class GroupedStackedBarRenderer extends StackedBarRenderer 
                                       implements Cloneable, PublicCloneable, 
                                                  Serializable {
            
    /** For serialization. */
    private static final long serialVersionUID = -2725921399005922939L;
    
    /** A map used to assign each series to a group. */
    private KeyToGroupMap seriesToGroupMap;
    
    /**
     * Creates a new renderer.
     */
    public GroupedStackedBarRenderer() {
        super();
        this.seriesToGroupMap = new KeyToGroupMap();
    }
    
    /**
     * Updates the map used to assign each series to a group.
     * 
     * @param map  the map (<code>null</code> not permitted).
     */
    public void setSeriesToGroupMap(KeyToGroupMap map) {
        if (map == null) {
            throw new IllegalArgumentException("Null 'map' argument.");   
        }
        this.seriesToGroupMap = map;   
        notifyListeners(new RendererChangeEvent(this));
    }
    
    /**
     * Returns the range of values the renderer requires to display all the 
     * items from the specified dataset.
     * 
     * @param dataset  the dataset (<code>null</code> permitted).
     * 
     * @return The range (or <code>null</code> if the dataset is 
     *         <code>null</code> or empty).
     */
    public Range findRangeBounds(CategoryDataset dataset) {
        Range r = DatasetUtilities.findStackedRangeBounds(
            dataset, this.seriesToGroupMap
        );
        return r;
    }

    /**
     * Calculates the bar width and stores it in the renderer state.  We 
     * override the method in the base class to take account of the 
     * series-to-group mapping.
     * 
     * @param plot  the plot.
     * @param dataArea  the data area.
     * @param rendererIndex  the renderer index.
     * @param state  the renderer state.
     */
    protected void calculateBarWidth(CategoryPlot plot, 
                                     Rectangle2D dataArea, 
                                     int rendererIndex,
                                     CategoryItemRendererState state) {

        // calculate the bar width
        CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex);
        CategoryDataset data = plot.getDataset(rendererIndex);
        if (data != null) {
            PlotOrientation orientation = plot.getOrientation();
            double space = 0.0;
            if (orientation == PlotOrientation.HORIZONTAL) {
                space = dataArea.getHeight();
            }
            else if (orientation == PlotOrientation.VERTICAL) {
                space = dataArea.getWidth();
            }
            double maxWidth = space * getMaximumBarWidth();
            int groups = this.seriesToGroupMap.getGroupCount();
            int categories = data.getColumnCount();
            int columns = groups * categories;
            double categoryMargin = 0.0;
            double itemMargin = 0.0;
            if (categories > 1) {
                categoryMargin = xAxis.getCategoryMargin();
            }
            if (groups > 1) {
                itemMargin = getItemMargin();   
            }

            double used = space * (1 - xAxis.getLowerMargin() 
                                     - xAxis.getUpperMargin()
                                     - categoryMargin - itemMargin);
            if (columns > 0) {
                state.setBarWidth(Math.min(used / columns, maxWidth));
            }
            else {
                state.setBarWidth(Math.min(used, maxWidth));
            }
        }

    }

    /**
     * Calculates the coordinate of the first "side" of a bar.  This will be 
     * the minimum x-coordinate for a vertical bar, and the minimum 
     * y-coordinate for a horizontal bar.
     * 
     * @param plot  the plot.
     * @param orientation  the plot orientation.
     * @param dataArea  the data area.
     * @param domainAxis  the domain axis.
     * @param state  the renderer state (has the bar width precalculated).
     * @param row  the row index.
     * @param column  the column index.
     * 
     * @return The coordinate.
     */
    protected double calculateBarW0(CategoryPlot plot, 
                                    PlotOrientation orientation, 
                                    Rectangle2D dataArea,
                                    CategoryAxis domainAxis,
                                    CategoryItemRendererState state,
                                    int row,
                                    int column) {
        // calculate bar width...
        double space = 0.0;
        if (orientation == PlotOrientation.HORIZONTAL) {
            space = dataArea.getHeight();
        }
        else {
            space = dataArea.getWidth();
        }
        double barW0 = domainAxis.getCategoryStart(
            column, getColumnCount(), dataArea, plot.getDomainAxisEdge()
        );
        int groupCount = this.seriesToGroupMap.getGroupCount();
        int groupIndex = this.seriesToGroupMap.getGroupIndex(
            this.seriesToGroupMap.getGroup(plot.getDataset().getRowKey(row))
        );
        int categoryCount = getColumnCount();
        if (groupCount > 1) {
            double groupGap = space * getItemMargin() 
                              / (categoryCount * (groupCount - 1));
            double groupW = calculateSeriesWidth(
                space, domainAxis, categoryCount, groupCount
            );
            barW0 = barW0 + groupIndex * (groupW + groupGap) 
                          + (groupW / 2.0) - (state.getBarWidth() / 2.0);
        }
        else {
            barW0 = domainAxis.getCategoryMiddle(
                column, getColumnCount(), dataArea, plot.getDomainAxisEdge()
            ) - state.getBarWidth() / 2.0;
        }
        return barW0;
    }
    
    /**
     * Draws a stacked bar for a specific item.
     *
     * @param g2  the graphics device.
     * @param state  the renderer state.
     * @param dataArea  the plot area.
     * @param plot  the plot.
     * @param domainAxis  the domain (category) axis.
     * @param rangeAxis  the range (value) axis.
     * @param dataset  the data.
     * @param row  the row index (zero-based).
     * @param column  the column index (zero-based).
     * @param pass  the pass index.
     */
    public void drawItem(Graphics2D g2,
                         CategoryItemRendererState state,
                         Rectangle2D dataArea,
                         CategoryPlot plot,
                         CategoryAxis domainAxis,
                         ValueAxis rangeAxis,
                         CategoryDataset dataset,
                         int row,
                         int column,
                         int pass) {
     
        // nothing is drawn for null values...
        Number dataValue = dataset.getValue(row, column);
        if (dataValue == null) {
            return;
        }
        
        double value = dataValue.doubleValue();
        Comparable group 
            = this.seriesToGroupMap.getGroup(dataset.getRowKey(row));
        PlotOrientation orientation = plot.getOrientation();
        double barW0 = calculateBarW0(
            plot, orientation, dataArea, domainAxis, 
            state, row, column
        );

        double positiveBase = 0.0;
        double negativeBase = 0.0;

        for (int i = 0; i < row; i++) {
            if (group.equals(
                this.seriesToGroupMap.getGroup(dataset.getRowKey(i))
            )) {
                Number v = dataset.getValue(i, column);
                if (v != null) {
                    double d = v.doubleValue();
                    if (d > 0) {
                        positiveBase = positiveBase + d;
                    }
                    else {
                        negativeBase = negativeBase + d;
                    }
                }
            }
        }

        double translatedBase;
        double translatedValue;
        RectangleEdge location = plot.getRangeAxisEdge();
        if (value > 0.0) {
            translatedBase 
                = rangeAxis.valueToJava2D(positiveBase, dataArea, location);
            translatedValue = rangeAxis.valueToJava2D(
                positiveBase + value, dataArea, location
            );
        }
        else {
            translatedBase = rangeAxis.valueToJava2D(
                negativeBase, dataArea, location
            );
            translatedValue = rangeAxis.valueToJava2D(
                negativeBase + value, dataArea, location
            );
        }
        double barL0 = Math.min(translatedBase, translatedValue);
        double barLength = Math.max(
            Math.abs(translatedValue - translatedBase), getMinimumBarLength()
        );

        Rectangle2D bar = null;
        if (orientation == PlotOrientation.HORIZONTAL) {
            bar = new Rectangle2D.Double(
                barL0, barW0, barLength, state.getBarWidth()
            );
        }
        else {
            bar = new Rectangle2D.Double(
                barW0, barL0, state.getBarWidth(), barLength
            );
        }
        Paint itemPaint = getItemPaint(row, column);
        if (getGradientPaintTransformer() != null 
                && itemPaint instanceof GradientPaint) {
            GradientPaint gp = (GradientPaint) itemPaint;
            itemPaint = getGradientPaintTransformer().transform(gp, bar);
        }
        g2.setPaint(itemPaint);
        g2.fill(bar);
        if (isDrawBarOutline() 
                && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
            g2.setStroke(getItemStroke(row, column));
            g2.setPaint(getItemOutlinePaint(row, column));
            g2.draw(bar);
        }

        CategoryItemLabelGenerator generator 
            = getItemLabelGenerator(row, column);
        if (generator != null && isItemLabelVisible(row, column)) {
            drawItemLabel(
                g2, dataset, row, column, plot, generator, bar, 
                (value < 0.0)
            );
        }        
                
        // collect entity and tool tip information...
        if (state.getInfo() != null) {
            EntityCollection entities = state.getEntityCollection();
            if (entities != null) {
                String tip = null;
                CategoryToolTipGenerator tipster 
                    = getToolTipGenerator(row, column);
                if (tipster != null) {
                    tip = tipster.generateToolTip(dataset, row, column);
                }
                String url = null;
                if (getItemURLGenerator(row, column) != null) {
                    url = getItemURLGenerator(row, column).generateURL(
                        dataset, row, column
                    );
                }
                CategoryItemEntity entity = new CategoryItemEntity(
                    bar, tip, url, dataset, row, 
                    dataset.getColumnKey(column), column
                );
                entities.add(entity);
            }
        }
        
    }
   
    /**
     * Tests this renderer for equality with an arbitrary object.
     * 
     * @param obj  the object (<code>null</code> permitted).
     * 
     * @return A boolean.
     */
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;   
        }
        if (obj instanceof GroupedStackedBarRenderer && super.equals(obj)) {
            GroupedStackedBarRenderer r = (GroupedStackedBarRenderer) obj;
            if (!r.seriesToGroupMap.equals(this.seriesToGroupMap)) {
                return false;   
            }
            return true;
        }
        return false;
    }
    
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区视频在线观看视频| 精品国产伦一区二区三区观看方式| 国产婷婷精品av在线| 国产一区二区三区精品欧美日韩一区二区三区 | 在线观看一区二区精品视频| 亚洲日本一区二区| 欧美亚洲精品一区| 青青草原综合久久大伊人精品优势| 911精品国产一区二区在线| 欧美aⅴ一区二区三区视频| 欧美大片在线观看一区二区| 国产激情精品久久久第一区二区| 中文字幕va一区二区三区| 91一区二区三区在线播放| 亚洲高清视频中文字幕| 日韩免费高清av| 成人一区二区在线观看| 艳妇臀荡乳欲伦亚洲一区| 国产三级欧美三级| 成人a级免费电影| 亚洲综合在线视频| 日韩精品中文字幕一区二区三区 | 国产拍欧美日韩视频二区| 成人avav影音| 亚洲成人激情自拍| www国产精品av| 99久久99久久精品免费看蜜桃| 亚洲成人激情社区| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 精彩视频一区二区三区| 亚洲人成影院在线观看| 欧美一区二区三区性视频| 高清不卡在线观看| 亚洲国产精品人人做人人爽| 久久久精品人体av艺术| 欧美日韩一区二区在线观看| 粉嫩蜜臀av国产精品网站| 亚洲专区一二三| 2023国产精品| 欧美色图免费看| 国产69精品久久久久777| 亚洲一卡二卡三卡四卡| 欧美国产一区视频在线观看| 欧美一二三区精品| 在线免费亚洲电影| 国产v日产∨综合v精品视频| 日韩国产高清在线| 亚洲视频狠狠干| 久久久美女艺术照精彩视频福利播放| 欧洲中文字幕精品| 99在线视频精品| 国产一区二区三区黄视频| 视频一区国产视频| 亚洲男女一区二区三区| 国产亚洲精品福利| 欧美一二区视频| 欧美日韩国产另类不卡| 在线影院国内精品| 99视频超级精品| 成人激情小说乱人伦| 国产在线一区观看| 免费成人美女在线观看.| 亚洲电影一级片| 亚洲午夜激情网页| 一区二区三区高清| 国产精品久久久久久亚洲伦| 久久综合色播五月| 精品国内片67194| 欧美一卡二卡三卡| 欧美一级在线观看| 欧美一区二区三区影视| 在线不卡欧美精品一区二区三区| 91国产成人在线| 99国产精品国产精品毛片| 成人av在线资源网| 99免费精品在线观看| 91丨九色丨国产丨porny| 99久久精品一区| 91欧美一区二区| 91免费版在线| 在线视频欧美区| 欧美系列亚洲系列| 欧美日韩亚洲高清一区二区| 欧美日韩久久一区二区| 7777精品伊人久久久大香线蕉经典版下载 | 欧美一级免费观看| 日韩一级免费一区| 91精品国产色综合久久不卡蜜臀| 337p亚洲精品色噜噜狠狠| 91精品国产aⅴ一区二区| 欧美一区二区三区四区在线观看| 日韩精品专区在线| 国产拍揄自揄精品视频麻豆| 亚洲手机成人高清视频| 一区二区在线免费观看| 一区二区三区波多野结衣在线观看| 亚洲激情第一区| 午夜欧美电影在线观看| 男男成人高潮片免费网站| 久久精品国产在热久久| 国产精品亚洲一区二区三区在线| 高清shemale亚洲人妖| 日本韩国精品在线| 欧美一区二区三区在线观看| 国产亚洲精品中文字幕| 一区二区三区欧美激情| 免费三级欧美电影| 成人一二三区视频| 欧洲精品中文字幕| 欧美成人在线直播| 中文字幕日韩av资源站| 亚洲成av人片一区二区三区 | 国产一区二区三区免费播放| 99麻豆久久久国产精品免费 | 日韩欧美国产午夜精品| 国产欧美一区二区精品婷婷| 亚洲男帅同性gay1069| 麻豆精品视频在线观看视频| av在线不卡电影| 69精品人人人人| 日本一区二区成人| 亚洲成年人影院| 国产精品亚洲午夜一区二区三区| 成人欧美一区二区三区小说| 午夜电影网一区| 成人毛片老司机大片| 91精品午夜视频| 国产精品国产三级国产专播品爱网| 亚洲大型综合色站| www.av精品| 91精品国产综合久久福利 | 欧美成人精品1314www| 中文字幕在线一区免费| 午夜成人免费视频| 成人激情视频网站| 精品电影一区二区三区| 亚洲在线成人精品| 豆国产96在线|亚洲| 5566中文字幕一区二区电影| 亚洲久草在线视频| 国产馆精品极品| 日韩一级片在线播放| 亚洲午夜羞羞片| 91视频在线观看| 久久精品在线免费观看| 奇米888四色在线精品| 色综合亚洲欧洲| 国产精品家庭影院| 国产成人高清在线| 欧美一区二区三区四区高清| 一片黄亚洲嫩模| 99久久国产免费看| 国产精品丝袜在线| 国产自产v一区二区三区c| 欧美一区在线视频| 亚洲成人7777| 精品婷婷伊人一区三区三| 亚洲欧洲制服丝袜| 91蜜桃视频在线| 国产精品国产三级国产普通话99| 国产成人免费在线观看不卡| 精品免费视频.| 另类调教123区| 91麻豆精品国产91久久久资源速度| 欧美性受xxxx| 亚洲欧美激情一区二区| 91一区一区三区| 亚洲欧美福利一区二区| 色成年激情久久综合| 亚洲天天做日日做天天谢日日欢| 国产黄色精品网站| 亚洲国产精华液网站w | 日本vs亚洲vs韩国一区三区二区| 91高清视频在线| 亚洲午夜激情av| 欧美一区二区网站| 麻豆精品一二三| 久久精品欧美日韩精品| 国产成人免费在线视频| 国产精品久久久久影院色老大 | 欧美tickling网站挠脚心| 久久精品国产亚洲一区二区三区| 日韩午夜三级在线| 国产精品一区二区你懂的| 国产精品丝袜91| 一本久道久久综合中文字幕| 亚洲国产日韩在线一区模特| 欧美群妇大交群中文字幕| 免费在线观看不卡| 久久天天做天天爱综合色| 菠萝蜜视频在线观看一区| 亚洲精品久久久蜜桃| 91精品国产综合久久久久久| 另类综合日韩欧美亚洲| 国产女主播一区| 精品婷婷伊人一区三区三| 久久99国产精品久久| 综合婷婷亚洲小说| 337p亚洲精品色噜噜狠狠| 日韩你懂的在线观看|