Package org.jfree.data.general

Examples of org.jfree.data.general.DefaultPieDataset


  }

  private DefaultPieDataset createPieChartDataset(String[] kategori,
      Double[] tutar) {

    dataset2 = new DefaultPieDataset();
    for (int i = 0; i < tutar.length; i++) {
      if (kategori[i] == null) {
        break;
      }
      dataset2.setValue(kategori[i], tutar[i]);
View Full Code Here


    /* Create total power history chart for tracked node */
    nodeHistoryLabel = new JLabel();
    createHistoryChartForNode(nodeHistoryLabel, trackedNodeIndex);

    /* Create moving average relative power distribution chart */
    relativeDataset = new DefaultPieDataset();
    for (String category: CATEGORIES) {
      relativeDataset.setValue(category, 0);
    }
    relativeChart = ChartFactory.createPieChart("Moving Average: Relative power distribution", relativeDataset, false, false, false);
    image = relativeChart.createBufferedImage(NODE_WIDTH,NODE_HEIGHT);
View Full Code Here

      Collection<ModeleClassement> top10Real = _ladder.top10Realisateurs();
      Collection<ModeleRepartition> repartition = _repart.getRepartitions();
      Vector<ModeleClassement> lstacteurs = (Vector<ModeleClassement>) top10Acteurs;
      Vector<ModeleClassement> lstreal = (Vector<ModeleClassement>)top10Real;
      Vector<ModeleRepartition> repart = (Vector<ModeleRepartition>) repartition;
      DefaultPieDataset pieDataset = new DefaultPieDataset();
   
 
      for(int i=0; i<top10Acteurs.size(); i++){
       
        // On remplit ligne par ligne chaque colone du tableau.
        data1[i][0] =  lstacteurs.elementAt(i).getIndividu().getPrenom();
        data1[i][1] =  lstacteurs.elementAt(i).getIndividu().getNom();
        data1[i][2] =  lstacteurs.elementAt(i).getNbAppritions();
       
      }
     
      for(int i=0; i<top10Real.size(); i++){
       
        data1[i][0] =  lstreal.elementAt(i).getIndividu().getPrenom();
        data1[i][1] =  lstreal.elementAt(i).getIndividu().getNom();
        data1[i][2] =  lstreal.elementAt(i).getNbAppritions();
       
      }
     
      for(int i=0; i<repart.size(); i++){
       
        // remplissage du diagramme 3D pour les repartitions par genre.
        pieDataset.setValue(repart.elementAt(i).getGenre().getLibelle(), repart.elementAt(i).getTaux());
       
      }
     
      // On finalise les tableaux avant de les ajouter aux JScrollPane.
      JTable tableActeurs = new JTable(data1, columnNames);
View Full Code Here

    // get a list of data
    List<ChartData> kunAmountList = getChartService().getChartDataForCustomer(kunId);

    if (kunAmountList.size() > 0) {

      DefaultPieDataset pieDataset = new DefaultPieDataset();

      for (ChartData chartData : kunAmountList) {

        Calendar calendar = new GregorianCalendar();
        calendar.setTime(chartData.getChartKunInvoiceDate());

        int month = calendar.get(Calendar.MONTH) + 1;
        int year = calendar.get(Calendar.YEAR);
        String key = String.valueOf(month) + "/" + String.valueOf(year);

        BigDecimal bd = chartData.getChartKunInvoiceAmount().setScale(15, 3);
        String amount = String.valueOf(bd.doubleValue());

        // fill the data
        pieDataset.setValue(key + " " + amount, new Double(chartData.getChartKunInvoiceAmount().doubleValue()));
      }

      String title = "Monthly amount for year 2009";
      JFreeChart chart = ChartFactory.createPieChart(title, pieDataset, true, true, true);
      PiePlot plot = (PiePlot) chart.getPlot();
View Full Code Here

    // get a list of data
    List<ChartData> kunAmountList = getChartService().getChartDataForCustomer(kunId);

    if (kunAmountList.size() > 0) {

      DefaultPieDataset pieDataset = new DefaultPieDataset();

      for (ChartData chartData : kunAmountList) {

        Calendar calendar = new GregorianCalendar();
        calendar.setTime(chartData.getChartKunInvoiceDate());

        int month = calendar.get(Calendar.MONTH) + 1;
        int year = calendar.get(Calendar.YEAR);
        String key = String.valueOf(month) + "/" + String.valueOf(year);

        BigDecimal bd = chartData.getChartKunInvoiceAmount().setScale(15, 3);
        String amount = String.valueOf(bd.doubleValue());

        // fill the data
        pieDataset.setValue(key + " " + amount, new Double(chartData.getChartKunInvoiceAmount().doubleValue()));
      }

      String title = "Monthly amount for year 2009";
      JFreeChart chart = ChartFactory.createPieChart3D(title, pieDataset, true, true, true);
      PiePlot3D plot = (PiePlot3D) chart.getPlot();
View Full Code Here

    // get a list of data
    List<ChartData> kunAmountList = getChartService().getChartDataForCustomer(kunId);

    if (kunAmountList.size() > 0) {

      DefaultPieDataset pieDataset = new DefaultPieDataset();

      for (ChartData chartData : kunAmountList) {

        Calendar calendar = new GregorianCalendar();
        calendar.setTime(chartData.getChartKunInvoiceDate());

        int month = calendar.get(Calendar.MONTH) + 1;
        int year = calendar.get(Calendar.YEAR);
        String key = String.valueOf(month) + "/" + String.valueOf(year);

        BigDecimal bd = chartData.getChartKunInvoiceAmount().setScale(15, 3);
        String amount = String.valueOf(bd.doubleValue());

        // fill the data
        pieDataset.setValue(key + " " + amount, new Double(chartData.getChartKunInvoiceAmount().doubleValue()));
      }

      String title = "Monthly amount for year 2009";
      JFreeChart chart = ChartFactory.createRingChart(title, pieDataset, true, true, true);
      RingPlot plot = (RingPlot) chart.getPlot();
View Full Code Here

   *            strings and displayed too.
   * @return
   * @throws SQLException
   */
  public static JFreeChart createPieChart(List<List<Object>> series, int numberOfCategories, ResultSetMetaData metadata, int column) throws SQLException {
    DefaultPieDataset dataset = new DefaultPieDataset();
    HashMap<String, Integer> map = new HashMap<String, Integer>();
    List<String> stringsInRS = new ArrayList<String>();

    List<Double> extremes = getExtremeNumbers(series.get(0));
    for (Object o : series.get(0)) {
      if (o instanceof Number) {

        stringsInRS.add(convertToString((Number) o, extremes,numberOfCategories));
      } else if(o != null && o instanceof String){
        stringsInRS.add((String) o);
      }
    }
    /* counting frequency of strings */
    for (String s : stringsInRS) {
      if (map.containsKey(s)) {
        map.put(s, map.get(s) + 1);
      } else {
        map.put(s, new Integer(1));
      }
    }
    Set<String> keys = map.keySet();
    String[] keyArray = keys.toArray(new String[0]);
    Arrays.sort(keyArray);

    for (String key : keyArray) {
      dataset.setValue(key, map.get(key));
    }

    return ChartFactory.createPieChart(metadata.getColumnName(column + 1), dataset, true, true, false);

  }
View Full Code Here

        responseMock.verify();
        assertFalse(os.isWritten());
    }

    protected void setUp() throws Exception {
        DefaultPieDataset data = new DefaultPieDataset();
        data.setValue("Java", new Double(43.2));
        data.setValue("Visual Basic", new Double(0.0));
        data.setValue("C/C++", new Double(17.5));
        mockChart = ChartFactory.createPieChart("Pie Chart", data, true, true, false);

        Mock mockActionInvocation = new Mock(ActionInvocation.class);
        actionInvocation = (ActionInvocation) mockActionInvocation.proxy();
        os = new MockServletOutputStream();
View Full Code Here

    private ChartWriter _writer;

    @Override
    public void setUp()
    {
        DefaultPieDataset dataset = new DefaultPieDataset();
        dataset.setValue("a", 1);
        dataset.setValue("b", 2);

        _chart1 = ChartFactory.createPieChart("chart1", dataset, true, true, false);
        _chart2 = ChartFactory.createPieChart("chart2", dataset, true, true, false);

        _chartDir = TestFileUtils.createTestDirectory();
View Full Code Here

     *
     * @return A sample dataset.
     */
    public static PieDataset createDataset(Sampleform sampleform) {
     
        DefaultPieDataset dataset = new DefaultPieDataset();
        /*dataset.setValue("One", new Double(43.2));
        dataset.setValue("Two", new Double(10.0));
        dataset.setValue("Three", new Double(27.5));
        dataset.setValue("Four", new Double(17.5));
        dataset.setValue("Five", new Double(11.0));
        dataset.setValue("Six", new Double(19.4));*/
        String[] dataArr = rangeData(sampleform.getStepFigName());
        for (int i=0;i<dataArr.length;i++) {
          dataset.setValue(dataArr[i].split(";;;")[0], Double.valueOf(dataArr[i].split(";;;")[1]));
      }
        /*for (int i=0;i<10;i++) {
          dataset.setValue(sampleform.getStepAve()[0][i], Double.valueOf(sampleform.getStepAve()[1][i]));
        }*/
        return dataset;       
View Full Code Here

TOP

Related Classes of org.jfree.data.general.DefaultPieDataset

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.