Examples of StandardPieSectionLabelGenerator


Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator

        piePlot.setLabelGenerator(labelGenerator);
      }
      else if (jrPiePlot.getLabelFormat() != null)
      {
        piePlot.setLabelGenerator(
          new StandardPieSectionLabelGenerator(jrPiePlot.getLabelFormat())
          );
      }
  //    else if (itemLabel != null && itemLabel.getMask() != null)
  //    {
  //      piePlot.setLabelGenerator(
  //          new StandardPieSectionLabelGenerator(itemLabel.getMask())
  //          );
  //    }
     
      if(itemLabel != null && itemLabel.getFont() != null)
      {
        piePlot.setLabelFont(JRFontUtil.getAwtFont(itemLabel.getFont(), getLocale()));
      }
      else
      {
        piePlot.setLabelFont(JRFontUtil.getAwtFont(new JRBaseFont(getChart(), null), getLocale()));
      }
 
      if(itemLabel != null && itemLabel.getColor() != null)
      {
        piePlot.setLabelPaint(itemLabel.getColor());
      }
      else
      {
        piePlot.setLabelPaint(getChart().getForecolor());
      }
 
      if(itemLabel != null && itemLabel.getBackgroundColor() != null)
      {
        piePlot.setLabelBackgroundPaint(itemLabel.getBackgroundColor());
      }
      else
      {
        piePlot.setLabelBackgroundPaint(getChart().getBackcolor());
      }
    }
    else
    {
      piePlot.setLabelGenerator(null);
    }
   
    if (jrPiePlot.getLegendLabelFormat() != null)
    {
      piePlot.setLegendLabelGenerator(
        new StandardPieSectionLabelGenerator(((JRPie3DPlot)getPlot()).getLegendLabelFormat())
        );
    }
   
    return jfreeChart;
  }
View Full Code Here

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator

      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(multipieLabelFormat, numFormat, percentFormat);
      pp.setLabelGenerator(labelGen);
    }
  }
View Full Code Here

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

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator

      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

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator

    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

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator

     */
    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

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator

                                            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

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator

            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

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator

                                            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

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator

     */
    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
TOP
Copyright © 2018 www.massapi.com. 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.