Examples of JRPiePlot


Examples of net.sf.jasperreports.charts.JRPiePlot

    configureChart(jfreeChart);
    PiePlot piePlot = (PiePlot)jfreeChart.getPlot();
    //plot.setStartAngle(290);
    //plot.setDirection(Rotation.CLOCKWISE);
    //plot.setNoDataMessage("No data to display");
    JRPiePlot jrPiePlot = (JRPiePlot)getPlot();
    boolean isCircular = jrPiePlot.getCircular() == null ? true : jrPiePlot.getCircular().booleanValue();
    piePlot.setCircular(isCircular);

    boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels().booleanValue();
   
    if(isShowLabels)
    {
      PieSectionLabelGenerator labelGenerator = (PieSectionLabelGenerator)getLabelGenerator();
      JRItemLabel itemLabel = jrPiePlot.getItemLabel();
      if (labelGenerator != null)
      {
        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(jrPiePlot.getLegendLabelFormat())
        );
    }
   
    return jfreeChart;
  }
View Full Code Here

Examples of net.sf.jasperreports.charts.JRPiePlot

    configureChart(jfreeChart, getPlot());
    PiePlot piePlot = (PiePlot)jfreeChart.getPlot();
    //plot.setStartAngle(290);
    //plot.setDirection(Rotation.CLOCKWISE);
    //plot.setNoDataMessage("No data to display");
    JRPiePlot jrPiePlot = (JRPiePlot)getPlot();
    boolean isCircular = jrPiePlot.getCircular() == null ? true : jrPiePlot.getCircular().booleanValue();
    piePlot.setCircular(isCircular);

    boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels().booleanValue();
   
    if(isShowLabels)
    {
      PieSectionLabelGenerator labelGenerator = (PieSectionLabelGenerator)getLabelGenerator();
      JRItemLabel itemLabel = jrPiePlot.getItemLabel();
      if (labelGenerator != null)
      {
        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())
        );
    }
View Full Code Here

Examples of net.sf.jasperreports.charts.JRPiePlot

    writer.startElement(JRXmlConstants.ELEMENT_pieChart, getNamespace());
    writeChart(chart);
    writePieDataset((JRPieDataset) chart.getDataset());

    // write plot
    JRPiePlot plot = (JRPiePlot) chart.getPlot();
    writer.startElement(JRXmlConstants.ELEMENT_piePlot);
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_isShowLabels, plot.getShowLabels());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_isCircular, plot.getCircular());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_labelFormat, plot.getLabelFormat());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_legendLabelFormat, plot.getLegendLabelFormat());
    writePlot(chart.getPlot());
    writeItemLabel(plot.getItemLabel());
    writer.closeElement();

    writer.closeElement();
  }
View Full Code Here

Examples of net.sf.jasperreports.charts.JRPiePlot

    {
      write( "JRDesignChart " + chartName + " = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_PIE);\n");
      writeChart( chart, chartName);
      writePieDataset( (JRPieDataset)chart.getDataset(), chartName, "PieDataset");
      // write plot
      JRPiePlot plot = (JRPiePlot) chart.getPlot();
      if(plot != null)
      {
        String plotName = chartName + "PiePlot";
        write( "JRDesignPiePlot " + plotName + " = (JRDesignPiePlot)" + chartName + ".getPlot();\n");
        write( plotName + ".setShowLabels({0});\n", getBooleanText(plot.getShowLabels()));
        write( plotName + ".setCircular({0});\n", getBooleanText(plot.getCircular()));
        write( plotName + ".setLabelFormat(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(plot.getLabelFormat()));
        write( plotName + ".setLegendLabelFormat(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(plot.getLegendLabelFormat()));
       
        writePlot( plot, plotName);
        writeItemLabel( plot.getItemLabel(),plotName, "ItemLabel");
        flush();
      }
      flush();
    }
  }
View Full Code Here

Examples of net.sf.jasperreports.charts.JRPiePlot

    configureChart(jfreeChart, getPlot());
    PiePlot piePlot = (PiePlot)jfreeChart.getPlot();
    //plot.setStartAngle(290);
    //plot.setDirection(Rotation.CLOCKWISE);
    //plot.setNoDataMessage("No data to display");
    JRPiePlot jrPiePlot = (JRPiePlot)getPlot();
    boolean isCircular = jrPiePlot.getCircular() == null ? true : jrPiePlot.getCircular().booleanValue();
    piePlot.setCircular(isCircular);

    boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels().booleanValue();
   
    if(isShowLabels)
    {
      PieSectionLabelGenerator labelGenerator = (PieSectionLabelGenerator)getLabelGenerator();
      JRItemLabel itemLabel = jrPiePlot.getItemLabel();
 
      if (labelGenerator != null)
      {
        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())
  //          );
  //
  //    }
 
      Integer baseFontSize = (Integer)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.BASEFONT_SIZE);
      JRFont font = itemLabel != null && itemLabel.getFont() != null ? itemLabel.getFont() : null;
     
      piePlot.setLabelFont(getFont(new JRBaseFont(getChart(), null), font, baseFontSize));
 
      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(jrPiePlot.getLegendLabelFormat())
        );
    }
   
    return jfreeChart;
  }
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.