Package net.sf.jasperreports.charts.design

Examples of net.sf.jasperreports.charts.design.JRDesignCategorySeries


  /**
   *
   */
  public Object createObject(Attributes atts)
  {
    return new JRDesignCategorySeries();
  }
View Full Code Here


   */
  protected static JRDesignChartDataset createLineDataset(JRDesignGroup group, JRDesignGroup parentGroup, List vars, DJChart djchart) {
    JRDesignCategoryDataset data = new JRDesignCategoryDataset(null);

//    for (Iterator iterator = vars.iterator(); iterator.hasNext();) {
      JRDesignCategorySeries serie = new JRDesignCategorySeries();
//      JRDesignVariable var = (JRDesignVariable) iterator.next();
      JRDesignVariable var = (JRDesignVariable) vars.get(0);
      JRDesignVariable var1 = (JRDesignVariable) vars.get(0);
      if (vars.size() > 1)
        var1 = (JRDesignVariable) vars.get(1);
     
      //And use it as value for each bar
      JRDesignExpression varExp = getExpressionFromVariable(var);
      JRExpression varExp1 = var1.getExpression();
      serie.setValueExpression(varExp);
 
      //The key for each bar
      JRExpression exp2 = group.getExpression();
 
      JRDesignExpression exp3 = new JRDesignExpression();
      int index = vars.indexOf(var);
      AbstractColumn col = (AbstractColumn) djchart.getColumns().get(index);
      exp3.setText("\"" + col.getTitle() + "\"");
      exp3.setValueClass(String.class);
 
      //Here you can set subgroups of bars
      serie.setCategoryExpression(exp2);
//      serie.setCategoryExpression(varExp1);
 
      serie.setLabelExpression(exp2);
      serie.setSeriesExpression(varExp1);
       
      data.addCategorySeries(serie);
//    }

    setResetStyle(data, group, parentGroup);
View Full Code Here

  protected static JRDesignChartDataset createBarDataset(JRDesignGroup group, JRDesignGroup parentGroup, List vars, DJChart djchart) {
    JRDesignCategoryDataset data = new JRDesignCategoryDataset(null);

    for (Iterator iterator = vars.iterator(); iterator.hasNext();) {
      JRDesignCategorySeries serie = new JRDesignCategorySeries();
      JRDesignVariable var = (JRDesignVariable) iterator.next();
     
      //And use it as value for each bar
      JRDesignExpression varExp = getExpressionFromVariable(var);
      serie.setValueExpression(varExp);
 
      //The key for each bar
      JRExpression exp2 = group.getExpression();
 
      JRDesignExpression exp3 = new JRDesignExpression();
      int index = vars.indexOf(var);
      AbstractColumn col = (AbstractColumn) djchart.getColumns().get(index);
      exp3.setText("\"" + col.getTitle() + "\"");
      exp3.setValueClass(String.class);
 
      //Here you can set subgroups of bars
      serie.setCategoryExpression(exp3);
 
      serie.setLabelExpression(exp2);
      serie.setSeriesExpression(exp2);
       
      data.addCategorySeries(serie);
    }

    setResetStyle(data, group, parentGroup);
View Full Code Here

    return dataSet;
  }

  private static JRDesignChartDataset createBarDataset(JRDesignGroup group, JRDesignGroup parentGroup, JRDesignVariable var) {
    JRDesignCategoryDataset data = new JRDesignCategoryDataset(null);
    JRDesignCategorySeries serie = new JRDesignCategorySeries();

    //And use it as value for each bar
    serie.setValueExpression(getExpressionFromVariable(var));

    //The key for each bar
    JRExpression exp2 = group.getExpression();

    /*JRDesignExpression exp3 = new JRDesignExpression();
    exp3.setText("$F{productLine}");
    exp3.setValueClass(String.class);*/

    //Here you can set subgroups of bars
    //serie.setCategoryExpression(exp3);
    serie.setCategoryExpression(exp2);

    serie.setLabelExpression(exp2);
    serie.setSeriesExpression(exp2);

    data.addCategorySeries(serie);

    setResetStyle(data, group, parentGroup);

View Full Code Here

   */
  protected static JRDesignChartDataset createLineDataset(JRDesignGroup group, JRDesignGroup parentGroup, List vars, DJChart djchart) {
    JRDesignCategoryDataset data = new JRDesignCategoryDataset(null);

//    for (Iterator iterator = vars.iterator(); iterator.hasNext();) {
      JRDesignCategorySeries serie = new JRDesignCategorySeries();
//      JRDesignVariable var = (JRDesignVariable) iterator.next();
      JRDesignVariable var = (JRDesignVariable) vars.get(0);
      JRDesignVariable var1 = (JRDesignVariable) vars.get(0);
      if (vars.size() > 1)
        var1 = (JRDesignVariable) vars.get(1);
     
      //And use it as value for each bar
      JRDesignExpression varExp = getExpressionFromVariable(var);
      JRExpression varExp1 = var1.getExpression();
      serie.setValueExpression(varExp);
 
      //The key for each bar
      JRExpression exp2 = group.getExpression();
 
      JRDesignExpression exp3 = new JRDesignExpression();
      int index = vars.indexOf(var);
      AbstractColumn col = (AbstractColumn) djchart.getColumns().get(index);
      exp3.setText("\"" + col.getTitle() + "\"");
      exp3.setValueClass(String.class);
 
      //Here you can set subgroups of bars
      serie.setCategoryExpression(exp2);
//      serie.setCategoryExpression(varExp1);
 
      serie.setLabelExpression(exp2);
      serie.setSeriesExpression(varExp1);
       
      data.addCategorySeries(serie);
//    }

    setResetStyle(data, group, parentGroup);
View Full Code Here

  protected static JRDesignChartDataset createBarDataset(JRDesignGroup group, JRDesignGroup parentGroup, List vars, DJChart djchart) {
    JRDesignCategoryDataset data = new JRDesignCategoryDataset(null);

    for (Iterator iterator = vars.iterator(); iterator.hasNext();) {
      JRDesignCategorySeries serie = new JRDesignCategorySeries();
      JRDesignVariable var = (JRDesignVariable) iterator.next();
     
      //And use it as value for each bar
      JRDesignExpression varExp = getExpressionFromVariable(var);
      serie.setValueExpression(varExp);
 
      //The key for each bar
      JRExpression exp2 = group.getExpression();
 
      JRDesignExpression exp3 = new JRDesignExpression();
      int index = vars.indexOf(var);
      AbstractColumn col = (AbstractColumn) djchart.getColumns().get(index);
      exp3.setText("\"" + col.getTitle() + "\"");
      exp3.setValueClass(String.class);
 
      //Here you can set subgroups of bars
      if (!djchart.getOptions().isUseColumnsAsCategorie()){
        serie.setCategoryExpression(exp3);
       
        serie.setLabelExpression(exp2);
        serie.setSeriesExpression(exp2);
      } else {
        //FIXED: due to https://sourceforge.net/forum/message.php?msg_id=7396861
        serie.setCategoryExpression(exp2);
       
        serie.setLabelExpression(exp3);
        serie.setSeriesExpression(exp3);
      }

       
      data.addCategorySeries(serie);
    }
View Full Code Here

 
  public JRDesignChartDataset transform(DynamicJasperDesign design, String name, JRDesignGroup group, JRDesignGroup parentGroup, Map vars) {
    JRDesignCategoryDataset data = new JRDesignCategoryDataset(null);

    for (Iterator iterator = series.iterator(); iterator.hasNext();) {
      JRDesignCategorySeries serie = new JRDesignCategorySeries();
      AbstractColumn column = (AbstractColumn) iterator.next();
     
      //And use it as value for each bar
      JRDesignExpression varExp = getExpressionFromVariable((JRDesignVariable) vars.get(column));
      serie.setValueExpression(varExp);
 
      //The key for each bar
      JRExpression exp2 = group.getExpression();
 
      JRDesignExpression exp3;
      if (seriesLabels.containsKey(column)) {
        exp3 = ExpressionUtils.createAndRegisterExpression(design, "dataset_" + column.getName() + "_" + name, (CustomExpression) seriesLabels.get(column));
      }
      else {
        exp3 = new JRDesignExpression();
        exp3.setText("\"" + column.getTitle() + "\"");
      }
      exp3.setValueClass(String.class);
 
      //Here you can set subgroups of bars
      if (useSeriesAsCategory){
        serie.setCategoryExpression(exp3);
       
        serie.setLabelExpression(exp2);
        serie.setSeriesExpression(exp2);
      } else {
        //FIXED: due to https://sourceforge.net/forum/message.php?msg_id=7396861
        serie.setCategoryExpression(exp2);
       
        serie.setLabelExpression(exp3);
        serie.setSeriesExpression(exp3);
      }
       
      data.addCategorySeries(serie);
    }
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.charts.design.JRDesignCategorySeries

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.