Package net.sf.jasperreports.charts.design

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


    byte old = this.chartType;
    this.chartType = chartType;
   
    switch(chartType) {
      case CHART_TYPE_AREA:
        dataset = new JRDesignCategoryDataset(dataset);
        plot = new JRDesignAreaPlot(plot, this);
        break;
      case CHART_TYPE_BAR:
        dataset = new JRDesignCategoryDataset(dataset);
        plot = new JRDesignBarPlot(plot, this);
        break;
      case CHART_TYPE_BAR3D:
        dataset = new JRDesignCategoryDataset(dataset);
        plot = new JRDesignBar3DPlot(plot, this);
        break;
      case CHART_TYPE_BUBBLE:
        dataset = new JRDesignXyzDataset(dataset);
        plot = new JRDesignBubblePlot(plot, this);
        break;
      case CHART_TYPE_CANDLESTICK:
        dataset = new JRDesignHighLowDataset(dataset);
        plot = new JRDesignCandlestickPlot(plot, this);
        break;
      case CHART_TYPE_HIGHLOW:
        dataset = new JRDesignHighLowDataset(dataset);
        plot = new JRDesignHighLowPlot(plot, this);
        break;
      case CHART_TYPE_LINE:
        dataset = new JRDesignCategoryDataset(dataset);
        plot = new JRDesignLinePlot(plot, this);
        break;
      case CHART_TYPE_METER:
        dataset = new JRDesignValueDataset(dataset);
        plot = new JRDesignMeterPlot(plot, this);
        break;
      case CHART_TYPE_MULTI_AXIS:
        plot = new JRDesignMultiAxisPlot(plot, this);
        dataset = null;
        break;
      case CHART_TYPE_PIE:
        dataset = new JRDesignPieDataset(dataset);
        plot = new JRDesignPiePlot(plot, this);
        break;
      case CHART_TYPE_PIE3D:
        dataset = new JRDesignPieDataset(dataset);
        plot = new JRDesignPie3DPlot(plot, this);
        break;
      case CHART_TYPE_SCATTER:
        dataset = new JRDesignXyDataset(dataset);
        plot = new JRDesignScatterPlot(plot, this);
        break;
      case CHART_TYPE_STACKEDBAR:
        dataset = new JRDesignCategoryDataset(dataset);
        plot = new JRDesignBarPlot(plot, this);
        break;
      case CHART_TYPE_STACKEDBAR3D:
        dataset = new JRDesignCategoryDataset(dataset);
        plot = new JRDesignBar3DPlot(plot, this);
        break;
      case CHART_TYPE_THERMOMETER:
        dataset = new JRDesignValueDataset(dataset);
        plot = new JRDesignThermometerPlot(plot, this);
        break;
      case CHART_TYPE_TIMESERIES:
        dataset = new JRDesignTimeSeriesDataset(dataset);//other datasets could be supported
        plot = new JRDesignTimeSeriesPlot(plot, this);
        break;
      case CHART_TYPE_XYAREA:
        dataset = new JRDesignXyDataset(dataset);
        plot = new JRDesignAreaPlot(plot, this);
        break;
      case CHART_TYPE_XYBAR:
        plot = new JRDesignBarPlot(plot, this);
        break;
      case CHART_TYPE_XYLINE:
        dataset = new JRDesignXyDataset(dataset);
        plot = new JRDesignLinePlot(plot, this);
        break;
      case CHART_TYPE_STACKEDAREA:
        dataset = new JRDesignCategoryDataset(dataset);
        plot = new JRDesignAreaPlot(plot, this);
        break;
      case CHART_TYPE_GANTT:
        dataset = new JRDesignGanttDataset(dataset);
        plot = new JRDesignBarPlot(plot, this);
View Full Code Here


   * @param vars
   * @param djchart
   * @return
   */
  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);
    return data;
  }
View Full Code Here

    setResetStyle(data, group, parentGroup);
    return data;
  }

  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);

    return data;
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);

    return data;
  }
View Full Code Here

   * @param vars
   * @param djchart
   * @return
   */
  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);
    return data;
  }
View Full Code Here

    setResetStyle(data, group, parentGroup);
    return data;
  }

  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);
    }

    setResetStyle(data, group, parentGroup);

    return data;
View Full Code Here

  public boolean isUseSeriesAsCategory() {
    return useSeriesAsCategory;
  }
 
  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);
    }

    setResetStyle(data, group, parentGroup);

    return data;
View Full Code Here

TOP

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

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.