Package org.jfree.chart.labels

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator


    // chart.getTitle().setFont(new Font("新細明體", Font.BOLD, 20));
    chart.getLegend().setItemFont(new Font("微軟正黑體", Font.PLAIN, 15));
    PiePlot3D pieplot3d = (PiePlot3D) chart.getPlot();
    pieplot3d.setLabelFont(new Font("微軟正黑體", Font.PLAIN, 12));
    pieplot3d.setLabelGenerator(new   StandardPieSectionLabelGenerator( "{0}--{2}"));

    ChartPanel cp = new ChartPanel(chart);
    cp.setPreferredSize(new java.awt.Dimension(600, 300));

    return cp;
View Full Code Here


      numFormat.setRoundingMode(RoundingMode.HALF_UP);

      final DecimalFormat percentFormat = new DecimalFormat(fastPercent.getPattern(), new DecimalFormatSymbols(locale));
      percentFormat.setRoundingMode(RoundingMode.HALF_UP);

      final StandardPieSectionLabelGenerator labelGen = new StandardPieSectionLabelGenerator(pieLabelFormat,
                                                                                             numFormat, percentFormat);
      pp.setLabelGenerator(labelGen);

      final StandardPieSectionLabelGenerator legendGen = new StandardPieSectionLabelGenerator(pieLegendLabelFormat,
                                                                                              numFormat, percentFormat);
      pp.setLegendLabelGenerator(legendGen);
    }

    if (StringUtils.isEmpty(getLabelFont()) == false)
View Full Code Here

    JFreeChart chart = ChartFactory.createPieChart3D(name, dataset, true, true, false)
    PiePlot3D  plot = (PiePlot3D)chart.getPlot()
    // 图片中显示百分比:默认方式 
    //plot.setLabelGenerator(new           StandardPieSectionLabelGenerator(StandardPieToolTipGenerator.DEFAULT_TOOLTIP_FORMAT)); 
    // 图片中显示百分比:自定义方式,{0} 表示选项, {1} 表示数值, {2} 表示所占比例 ,小数点后两位 
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}({2})", NumberFormat.getNumberInstance(), new DecimalFormat("0.00%")));  
    // 图例显示百分比:自定义方式, {0} 表示选项, {1} 表示数值, {2} 表示所占比例                 
    plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}({2})"));  
    // 设置背景色为白色  
    chart.setBackgroundPaint(Color.white);  
    // 指定图片的透明度(0.0-1.0)  
    plot.setForegroundAlpha(1.0f);  
    // 指定显示的饼图上圆形(false)还椭圆形(true)  
View Full Code Here

     */
    public static JFreeChart createPieChart(String title, PieDataset dataset,
            boolean legend, boolean tooltips, Locale locale) {

        PiePlot plot = new PiePlot(dataset);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
        if (tooltips) {
            plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
        }
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
View Full Code Here

                                            boolean legend,
                                            boolean tooltips,
                                            boolean urls) {

        PiePlot plot = new PiePlot(dataset);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
        if (tooltips) {
            plot.setToolTipGenerator(new StandardPieToolTipGenerator());
        }
        if (urls) {
View Full Code Here

            PieDataset previousDataset, int percentDiffForMaxScale,
            boolean greenForIncrease, boolean legend, boolean tooltips,
            Locale locale, boolean subTitle, boolean showDifference) {

        PiePlot plot = new PiePlot(dataset);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));

        if (tooltips) {
            plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
        }
View Full Code Here

                                            boolean urls,
                                            boolean subTitle,
                                            boolean showDifference) {

        PiePlot plot = new PiePlot(dataset);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));

        if (tooltips) {
            plot.setToolTipGenerator(new StandardPieToolTipGenerator());
        }
View Full Code Here

     */
    public static JFreeChart createRingChart(String title, PieDataset dataset,
            boolean legend, boolean tooltips, Locale locale) {

        RingPlot plot = new RingPlot(dataset);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
        if (tooltips) {
            plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
        }
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
View Full Code Here

                                             boolean legend,
                                             boolean tooltips,
                                             boolean urls) {

        RingPlot plot = new RingPlot(dataset);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
        if (tooltips) {
            plot.setToolTipGenerator(new StandardPieToolTipGenerator());
        }
        if (urls) {
View Full Code Here

        }
        this.interiorGap = DEFAULT_INTERIOR_GAP;
        this.discDistributor = new StandardDiscItemDistributor(dataset);
        this.discRenderer = new StandardDiscItemRenderer();

        this.labelGenerator = new StandardPieSectionLabelGenerator();
        this.labelFont = DEFAULT_LABEL_FONT;
        this.labelPaint = DEFAULT_LABEL_PAINT;
       
        this.toolTipGenerator = new StandardPieToolTipGenerator();
        this.urlGenerator = null;
View Full Code Here

TOP

Related Classes of org.jfree.chart.labels.StandardPieSectionLabelGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.