Package org.jfree.data.category

Examples of org.jfree.data.category.DefaultCategoryDataset


    }
    chartRemote.setDataSource(dataSource);
    Collection chartRawData = (Collection)chartRemote.getTicketBarData(individualId, listParameters);

    // Add the raw data to a JFree dataset
    DefaultCategoryDataset chartData = new DefaultCategoryDataset();
    Iterator iter = chartRawData.iterator();
    while (iter.hasNext())
    {
      HashMap row = (HashMap)iter.next();
      Number openTickets = (Number)row.get("count");
      String userName = (String)row.get("name");
      if(userName == null){
      userName = "UnAssigned";
    }
      Number ageValue = (Number)row.get("age");
      chartData.setValue(openTickets, userName, this.getAgeName(ageValue));
    }

    // create the chart
    JFreeChart barChart = ChartFactory.createStackedBarChart("Open Tickets by Age", "Age", "# Open Tickets",
                                                             chartData, org.jfree.chart.plot.PlotOrientation.VERTICAL,
View Full Code Here


    }
    chartRemote.setDataSource(dataSource);
    Collection chartRawData = (Collection)chartRemote.getOpportunityBarData(individualId, listParameters);

    // Add the raw data to a JFree dataset
    DefaultCategoryDataset chartData = new DefaultCategoryDataset();
  
    float totalForecast = 0.00f;
    float totalActual = 0.00f;
    Iterator iter = chartRawData.iterator();
    while (iter.hasNext())
    {
      HashMap row = (HashMap)iter.next();
      Number forecastAmount = (Number)row.get("forecastAmount");
      Number actualAmount = (Number)row.get("actualAmount");
      String stageName = (String)row.get("stageName");
      String month = (String)row.get("estimatedClose");
     
      totalForecast += forecastAmount.floatValue();
      totalActual += actualAmount.floatValue();

      chartData.setValue(forecastAmount, stageName, month);
    }

    NumberFormat numFormatter = NumberFormat.getCurrencyInstance();
    String totalForecastString = numFormatter.format(totalForecast);
    String totalActualString = numFormatter.format(totalActual);
View Full Code Here

    final String category1 = "Category 1";// NON-NLS
    final String category2 = "Category 2";// NON-NLS
    final String category3 = "Category 3";// NON-NLS
    final String category4 = "Category 4";// NON-NLS
    final String category5 = "Category 5";// NON-NLS
    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    dataset.addValue(1D, series1, category1);
    dataset.addValue(5D, series1, category2);
    dataset.addValue(4D, series1, category3);
    dataset.addValue(8D, series1, category4);
    dataset.addValue(7D, series1, category5);

    dataset.addValue(3D, series2, category1);
    dataset.addValue(4D, series2, category2);
    dataset.addValue(3D, series2, category3);
    dataset.addValue(5D, series2, category4);
    dataset.addValue(4D, series2, category5);

    dataset.addValue(1D, series3, category1);
    dataset.addValue(3D, series3, category2);
    dataset.addValue(2D, series3, category3);
    dataset.addValue(3D, series3, category4);
    dataset.addValue(2D, series3, category5);

    return dataset;
  }
View Full Code Here

  protected JFreeChart computeChart(final Dataset dataset)
  {

    //Initializing a default CategoryDataset
    DefaultCategoryDataset defaultDataset = new DefaultCategoryDataset();

    if (dataset instanceof DefaultCategoryDataset)
    {
      defaultDataset = (DefaultCategoryDataset) dataset;
    }
View Full Code Here

    this.categoryNames.addAll(Arrays.asList(fields));
  }

  protected void buildDataset()
  {
    final DefaultCategoryDataset dataset = (DefaultCategoryDataset) getDatasourceValue();

    //get value in column that identifies the rows       
    final Object currentRowHeader = getDataRow().get(seriesColumnHeader);

    //Check if row is part of the graph series
    final int catCount = getCategoryNameCount();
    final int seriesNameCount = getSeriesNameCount();

    for (int i = 0; i < seriesNameCount; i++)
    {
      final String seriesName = getSeriesName(i);
      if (ObjectUtilities.equal(seriesName, currentRowHeader) == false)
      {
        // filters out all series except the one marked as seriesColumnHeader.
        continue;
      }

      for (int j = 0; j < catCount; j++)
      {

        final String newRowHeader = getCategoryName(j);

        //if not rowHeader Column
        if (ObjectUtilities.equal(newRowHeader, seriesColumnHeader))
        {
          continue;
        }

        final Object valueObject = getDataRow().get(newRowHeader);
        Number value = (valueObject instanceof Number) ? (Number) valueObject : null;
        final Number existingValue = queryExistingValueFromDataSet(dataset, seriesName, newRowHeader);

        if (existingValue != null)
        {
          final double val = (value != null) ? value.doubleValue() : 0;
          value = new Double(val + existingValue.doubleValue());
          dataset.setValue(value, seriesName, newRowHeader);
        }
        else
        {
          dataset.addValue(value, seriesName, newRowHeader);
        }
      }
    }
  }
View Full Code Here

    this.valueColumns.addAll(Arrays.asList(fields));
  }

  protected Dataset createNewDataset()
  {
    return new DefaultCategoryDataset();
  }
View Full Code Here

    }

    final Comparable categoryComparable = (Comparable) categoryObject;

    // I love to be paranoid!
    final DefaultCategoryDataset categoryDataset = (DefaultCategoryDataset) getDataSet();

    final int maxIndex = this.valueColumns.size();
    for (int i = 0; i < maxIndex; i++)
    {
      final Comparable seriesName = querySeriesValue(i);
      if (seriesName == null)
      {
        continue;
      }
      final Object valueObject = dataRow.get(getValueColumn(i));

      final Number value = (valueObject instanceof Number) ? (Number) valueObject : null;

      final Number existingValue =
          CollectorFunctionUtil.queryExistingValueFromDataSet(categoryDataset, seriesName, categoryComparable);
      if (existingValue != null)
      {
        if (value != null)
        {
          categoryDataset.setValue(CollectorFunctionUtil.add(existingValue, value), seriesName, categoryComparable);
        }
      }
      else
      {
        categoryDataset.setValue(value, seriesName, categoryComparable);
      }
    }
  }
View Full Code Here

  }


  protected Dataset createNewDataset()
  {
    return new DefaultCategoryDataset();
  }
View Full Code Here

    }

    final Comparable categoryComparable = (Comparable) categoryObject;

    // I love to be paranoid!
    final DefaultCategoryDataset categoryDataset = (DefaultCategoryDataset) getDataSet();

    final int maxIndex = this.valueColumns.size();
    for (int i = 0; i < maxIndex; i++)
    {
      final Comparable seriesName = querySeriesValue(i);
      final Object valueObject = dataRow.get(getValueColumn(i));
      final Number value = (valueObject instanceof Number) ? (Number) valueObject : null;
      final Number existingValue = CollectorFunctionUtil.queryExistingValueFromDataSet(categoryDataset, categoryComparable, seriesName);
      if (existingValue != null)
      {
        if (value != null)
        {
          categoryDataset.setValue(CollectorFunctionUtil.add(existingValue, value), categoryComparable, seriesName);
        }
      }
      else
      {
        categoryDataset.setValue(value, categoryComparable, seriesName);
      }
    }
  }
View Full Code Here

   * ---------------------------------------------------------------- Now the function implementation ...
   */

  public Dataset createNewDataset()
  {
    return new DefaultCategoryDataset();
  }
View Full Code Here

TOP

Related Classes of org.jfree.data.category.DefaultCategoryDataset

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.