Package org.jfree.chart.labels

Examples of org.jfree.chart.labels.StandardPieSectionLabelGenerator


    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        StandardPieSectionLabelGenerator g1
                = new StandardPieSectionLabelGenerator();
        StandardPieSectionLabelGenerator g2 = null;
        try {
            g2 = (StandardPieSectionLabelGenerator) g1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(g1 != g2);
        assertTrue(g1.getClass() == g2.getClass());
        assertTrue(g1.equals(g2));
    }
View Full Code Here


    /**
     * Check to ensure that this class implements PublicCloneable.
     */
    public void testPublicCloneable() {
        StandardPieSectionLabelGenerator g1
                = new StandardPieSectionLabelGenerator();
        assertTrue(g1 instanceof PublicCloneable);
    }
View Full Code Here

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {

        StandardPieSectionLabelGenerator g1
                = new StandardPieSectionLabelGenerator();
        StandardPieSectionLabelGenerator g2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(g1);
View Full Code Here

      if ( pieDefinition.getLabelPaint() != null ) {
        pie.setLabelPaint( pieDefinition.getLabelPaint() );
      }
      pie.setLabelBackgroundPaint( pieDefinition.getLabelBackgroundPaint() );
      if ( pieDefinition.isLegendIncluded() ) {
        StandardPieSectionLabelGenerator labelGen = new StandardPieSectionLabelGenerator( "{0}" ); //$NON-NLS-1$
        pie.setLegendLabelGenerator( labelGen );
      }
      if ( pieDefinition.getExplodedSlices() != null ) {
        for ( Iterator iter = pieDefinition.getExplodedSlices().iterator(); iter.hasNext(); ) {
          pie.setExplodePercent( (Comparable) iter.next(), .30 );
        }
      }
      pie.setLabelGap( pieDefinition.getLabelGap() );
      if ( !pieDefinition.isDisplayLabels() ) {
        pie.setLabelGenerator( null );
      } else {
        if ( pieDefinition.isLegendIncluded() ) {
          StandardPieSectionLabelGenerator labelGen = new StandardPieSectionLabelGenerator( "{1} ({2})" ); //$NON-NLS-1$
          pie.setLabelGenerator( labelGen );
        } else {
          StandardPieSectionLabelGenerator labelGen = new StandardPieSectionLabelGenerator( "{0} = {1} ({2})" ); //$NON-NLS-1$
          pie.setLabelGenerator( labelGen );
        }
      }
    }
    if ( plot instanceof MultiplePiePlot ) {
View Full Code Here

      plot.setCircular(false);
      plot.setLabelGap(0.02);
      plot.setNoDataMessage("No data available");

      if(percentage==false){
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
        "{0} ({1})"));}
      else
      {
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
        "{0} ({2})"));
      }

      MyPieUrlGenerator pieUrl=new MyPieUrlGenerator(rootUrl);
      pieUrl.setDocument_composition(document_composition);
      pieUrl.setCategoryUrlLabel(categoryUrlName);
      pieUrl.setDrillDocTitle(drillDocTitle);
      pieUrl.setTarget(target);

      plot.setURLGenerator(pieUrl);     

     
     


    }
    else{
      chart = ChartFactory.createPieChart3D(
          name, 
          (PieDataset)dataset,             // data
          true,                // include legend
          true,
          false
      );



      chart.setBackgroundPaint(color);

      TextTitle title = chart.getTitle();
      title.setToolTipText("A title tooltip!");


      PiePlot3D plot = (PiePlot3D) chart.getPlot();

      plot.setDarkerSides(true);
      plot.setStartAngle(290);
      plot.setDirection(Rotation.CLOCKWISE);
      plot.setForegroundAlpha(1.0f);
      plot.setDepthFactor(0.2);

      plot.setLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
      plot.setCircular(false);
      plot.setLabelGap(0.02);
      plot.setNoDataMessage("No data available");



      //org.jfree.chart.renderer.category.BarRenderer renderer = new org.jfree.chart.renderer.category.AreaRenderer);

      MyPieUrlGenerator pieUrl=new MyPieUrlGenerator(rootUrl);
      pieUrl.setDocument_composition(document_composition);
      pieUrl.setCategoryUrlLabel(categoryUrlName);
      pieUrl.setDrillDocTitle(drillDocTitle);
      pieUrl.setTarget(target);

      plot.setURLGenerator(pieUrl);     


      if(percentage==false){
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
            "{0} ({1})"));}
      else
      {
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
        "{0} ({2})"));
      }
    }

View Full Code Here

      plot.setCircular(false);
      plot.setLabelGap(0.02);
      plot.setNoDataMessage("No data available");

      if(percentage==false){
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
        "{0} ({1})"));}
      else
      {
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
        "{0} ({2})"));
      }

    }
    else{
      chart = ChartFactory.createPieChart3D(
          name, 
          (PieDataset)dataset,             // data
          true,                // include legend
          true,
          false
      );


      chart.setBackgroundPaint(color);

      TextTitle title = chart.getTitle();
      title.setToolTipText("A title tooltip!");


      PiePlot3D plot = (PiePlot3D) chart.getPlot();

      plot.setDarkerSides(true);
      plot.setStartAngle(290);
      plot.setDirection(Rotation.CLOCKWISE);
      plot.setForegroundAlpha(1.0f);
      plot.setDepthFactor(0.2);

      plot.setLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
      // plot.setNoDataMessages("No data available");
      plot.setCircular(false);
      plot.setLabelGap(0.02);
      plot.setNoDataMessage("No data available");

      if(percentage==false){
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
        "{0} ({1})"));}
      else
      {
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
        "{0} ({2})"));
      }
    }

    TextTitle title =setStyleTitle(name, styleTitle);
View Full Code Here

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

        this.explodePercentages = new TreeMap();

        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

                }
            });
        } else if (labels.getDynamicText() != null) {
            plot.setLegendLabelGenerator(new DynamicPieGenerator(chartView, labels.getDynamicText()));
        } else {
            plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator());
        }

    }
View Full Code Here

        if (chartView.isLabelsVisible()) {
            ChartLabels labels = chartView.getLabels();
            if (labels != null && labels.getDynamicText() != null)
                plot.setLabelGenerator(new DynamicPieGenerator(chartView, labels.getDynamicText()));
            else
                plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
            //TODO: move to style helper
            if (labels != null) {
                StyleObjectModel cssLabelsModel = labels.getStyleObjectModel();
                plot.setLabelFont(CSSUtil.getFont(cssLabelsModel));
                plot.setLabelPaint(cssLabelsModel.getColor());
View Full Code Here

                }
            });
        } else if (labels.getDynamicText() != null) {
            plot.setLegendLabelGenerator(new DynamicPieGenerator(chartView, labels.getDynamicText()));
        } else {
            plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator());
        }

    }
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.