Package org.jfree.chart.labels

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator


     
      //饼图显示比例
      plot.setNoDataMessage("无数据可供显示!"); // 没有数据的时候显示的内容 
      DecimalFormat df = new DecimalFormat("0.00%");//获得一个DecimalFormat对象,主要是设置小数问题,表示小数点后保留两位。 
      NumberFormat nf = NumberFormat.getNumberInstance();//获得一个NumberFormat对象 
      StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator
              "{0}:{2}", nf, df);//获得StandardPieSectionLabelGenerator对象,生成的格式,{0}表示section名,{1}表示section的值,{2}表示百分比。可以自定义 
      plot.setLabelGenerator(sp);//设置饼图显示百分比 
     
    }else {
      CategoryPlot plot = (CategoryPlot)chart.getPlot();
View Full Code Here


      if (plot instanceof PiePlot)
      {
         PiePlot pieplot = (PiePlot) plot;
         if (label != null)
         {
            pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator(label));
         }

         if (baseSectionOutlinePaint != null)
         {
            pieplot.setBaseSectionOutlinePaint(findColor(baseSectionOutlinePaint));
View Full Code Here

        plot.setSectionPaint("Five", new Color(32, 32, 255 - 128));
        plot.setSectionPaint("Six", new Color(0, 0, 255 - 144));

        plot.setNoDataMessage("No data available");

        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
                  "{0} ({2} percent)"));
        plot.setLabelBackgroundPaint(new Color(220, 220, 220));

        plot.setLegendLabelToolTipGenerator(new StandardPieSectionLabelGenerator(
                  "Tooltip for legend item {0}"));
        plot.setSimpleLabels(true);
        plot.setInteriorGap(0.1);
                   
        //pie plots done use abstract renderers need to react to selection on our own
View Full Code Here

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

        PiePlot plot = new PiePlot(dataset);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
        plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
        JFreeChart chart = new JFreeChart(title, plot);
        currentTheme.apply(chart);
        return chart;
View Full Code Here

     * @return A pie chart.
     */
    public static JFreeChart createPieChart(String title, PieDataset dataset) {

        PiePlot plot = new PiePlot(dataset);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
        JFreeChart chart = new JFreeChart(title, plot);
        currentTheme.apply(chart);
        return chart;
View Full Code Here

            PieDataset previousDataset, int percentDiffForMaxScale,
            boolean greenForIncrease, 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));

        plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));

        List<Comparable> keys = dataset.getKeys();
View Full Code Here

            PieDataset dataset, PieDataset previousDataset,
            int percentDiffForMaxScale, boolean greenForIncrease,
            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));

        plot.setToolTipGenerator(new StandardPieToolTipGenerator());

        List<Comparable> keys = dataset.getKeys();
View Full Code Here

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

        RingPlot plot = new RingPlot(dataset);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
        plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
        JFreeChart chart = new JFreeChart(title, plot);
        currentTheme.apply(chart);
        return chart;
View Full Code Here

     * @return A ring chart.
     */
    public static JFreeChart createRingChart(String title, PieDataset dataset) {

        RingPlot plot = new RingPlot(dataset);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
        JFreeChart chart = new JFreeChart(title, plot);
        currentTheme.apply(chart);
        return chart;
View Full Code Here

        this.baseSectionOutlineStroke = DEFAULT_OUTLINE_STROKE;
        this.autoPopulateSectionOutlineStroke = false;

        this.explodePercentages = new TreeMap<Comparable<?>, Number>();

        this.labelGenerator = new StandardPieSectionLabelGenerator();
        this.labelFont = DEFAULT_LABEL_FONT;
        this.labelPaint = DEFAULT_LABEL_PAINT;
        this.labelBackgroundPaint = DEFAULT_LABEL_BACKGROUND_PAINT;
        this.labelOutlinePaint = DEFAULT_LABEL_OUTLINE_PAINT;
        this.labelOutlineStroke = DEFAULT_LABEL_OUTLINE_STROKE;
        this.labelShadowPaint = DEFAULT_LABEL_SHADOW_PAINT;
        this.labelLinksVisible = true;
        this.labelDistributor = new PieLabelDistributor(0);

        this.simpleLabels = false;
        this.simpleLabelOffset = new RectangleInsets(UnitType.RELATIVE, 0.18,
                0.18, 0.18, 0.18);
        this.labelPadding = new RectangleInsets(2, 2, 2, 2);

        this.toolTipGenerator = null;
        this.urlGenerator = null;
        this.legendLabelGenerator = new StandardPieSectionLabelGenerator();
        this.legendLabelToolTipGenerator = null;
        this.legendLabelURLGenerator = null;
        this.legendItemShape = Plot.DEFAULT_LEGEND_ITEM_CIRCLE;

        this.ignoreNullValues = false;
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.