Package org.jfree.data.general

Examples of org.jfree.data.general.DefaultPieDataset


        }

        File testSummaryFile = new File(reportFile.getParentFile(), testSummaryFileName);
        File tempTestSummaryFile = new File(testSummaryFile.getPath() + ".tmp");

        final DefaultPieDataset pieDataSet = new DefaultPieDataset();

        pieDataSet.setValue("Passed", new Integer(currentTestSuite.getNbTestsPassed()));
        pieDataSet.setValue("Failed", new Integer(currentTestSuite.getNbTestsFailed()));
        pieDataSet.setValue("Tests in error", new Integer(currentTestSuite.getNbTestsNotAvailable()));
        pieDataSet.setValue("Not executed", new Integer(currentTestSuite.getNbTestsToExecute() - currentTestSuite.getNbTestsExecuted()));
        JFreeChart chart = null;
        final boolean drilldown = true;

        // create the chart...
        if (drilldown) {
View Full Code Here


    return dataset;
  }

  private PieDataset createPieDataset(ChartValue[] values)
  {
    DefaultPieDataset dataset = new DefaultPieDataset();

    for (int i = 0; i < values.length; i++)
    {
      PieChartValue value = (PieChartValue) values[i];
      dataset.setValue(value.getKey(), value.getValue());
    }

    return dataset;
  }
View Full Code Here

            }
        }
    }

  private void addDataToPieChart(ChartEvent event, ParCollection params) {
    DefaultPieDataset dataset = this.pieDataSet.get(event.getChartName());
        JFreeChart chart = this.chartList.get(event.getChartName());
       
        if (dataset == null) {
            dataset = new DefaultPieDataset();
           
            if (event.isPaintChart3D()) {
                chart = ChartFactory.createPieChart3D(event.getChartName(), dataset, true, true, true);
            } else {
                chart = ChartFactory.createPieChart(event.getChartName(), dataset, true, true, true);
            }
           
            createFrame(event.getChartName(), event.getChartType(), params, chart);
           
            this.pieDataSet.put(event.getChartName(), dataset);
            this.chartList.put(event.getChartName(), chart);

            if (event.getSortOrderPieChartByKey() != null) {
                dataset.sortByKeys(event.getSortOrderPieChartByKey());
            }
            if (event.getSortOrderPieChartByValue() != null) {
                dataset.sortByKeys(event.getSortOrderPieChartByValue());
            }
           
            PiePlot plot = (PiePlot) chart.getPlot();
           
            if (event.isShowPercentages()) {
                plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} = {2}"));
            } else {
                plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} = {1}"));
            }
        }

        for (int i = 0; i < event.getPieData().length; i++) {
            dataset.setValue(event.getPieDataNames()[i], event.getPieData()[i]);
        }
       
        // Exploded segments.
        PiePlot plot = (PiePlot) chart.getPlot();
       
View Full Code Here

    // * Sales are used to provide funding for the JFreeChart project - please    *
    // * support us so that we can continue developing free software.             *
    // ****************************************************************************
   
    private PieDataset createDataset() {
        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));
        return dataset;
    }
View Full Code Here

   * create a Dataset for the PieChart of the priorities of the goals
   * @param builder the SelectedGoalsGraphBuilder
   * @return the created Chart
   */
  private PieDataset createDataset(final SelectedGoalsGraphBuilder builder) {
    final DefaultPieDataset result = new DefaultPieDataset();
    updateDataSet(builder, result);
    builder.getCacheManager().addCacheChangedListener(
        new ICacheChangedListener() {

          @Override
View Full Code Here

    }
    int size = data.length;
    switch (type) {
    case PIE: {
      // 设置填充的数据集
      DefaultPieDataset dataset = new DefaultPieDataset();
      for (int i = 0; i < size; i++) {
        String name;
        if (itemNames != null) {
          name = itemNames[i];
        } else {
          name = data[i].toString();
          i++;
        }
        dataset.setValue(name, Double.parseDouble(data[i].toString()));
      }

      chart = ChartFactory.createPieChart(title, dataset, true, false, false);
      PiePlot plot = (PiePlot) chart.getPlot();
      // 设置显示格式, {0}表示名称, {1}表示值, {2}表示百分比值
      if (labelFormat != null) {
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
            labelFormat, NumberFormat.getNumberInstance(), new DecimalFormat(
                "0.0%")));
      }
      plot.setLabelFont(tickLabelFont);
      break;
    }
    case VBAR:
    case HBAR:
    case LINE:
    case SPIDER: {
      // 设置填充的数据集
      DefaultCategoryDataset dataset = new DefaultCategoryDataset();

      int step = 1 + (itemNames == null ? 1 : 0)
          + (groupNames != null && groupNames[0].length() == 0 ? 1 : 0);
      for (int i = 0; i < size; i++) {
        String name;
        if (itemNames != null) {
          name = itemNames[groupNames != null && groupNames[0].length() > 0 ? (i / step)
              / groupNames.length
              : i * itemNames.length / size];
        } else {
          name = data[i].toString();
          i++;
        }
        String category;
        if (groupNames != null) {
          if (groupNames[0].length() == 0) {
            category = data[i].toString();
            i++;
          } else {
            category = groupNames[((i / step) % groupNames.length)];
          }
        } else {
          category = "";
        }
        dataset
            .addValue(Double.parseDouble(data[i].toString()), category, name);
      }

      if (type == SPIDER) {
        AdvancedSpiderWebPlot plot = new AdvancedSpiderWebPlot(dataset);
View Full Code Here

     * Creates a Pie Chart based on map.
     *
     * @return the Pie Chart generated.
     */
    public JFreeChart getPieChart(Map<String, Double> pieValues) {
        DefaultPieDataset dataset = new DefaultPieDataset();

        for (String key : pieValues.keySet()) {
            dataset.setValue(key, pieValues.get(key));
        }

        JFreeChart chart = ChartFactory.createPieChart3D(
                null,  // chart title
                dataset, // data
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

   */
  public static void ulozGrafUzivatelu(Hashtable<String, Long> data, String soubor,
      boolean png) throws SVNstatistikaChybaVystupu {

    /* vytvoříme dataset, který bude zadáním pro vytvoření grafu */
    DefaultPieDataset dataSet = new DefaultPieDataset();
    for (String jmeno : data.keySet()) {
      dataSet.setValue(jmeno, data.get(jmeno));
    }

    /* vytvoříme graf a nastavíme mu okraje */
    JFreeChart graf = ChartFactory.createPieChart3D(null, dataSet, false, false,
        false);
View Full Code Here

    return cp;
  }

  public ChartPanel pastaDilimi(Double[] tutar, String barIsmi,
      String[] kategori) {
    DefaultPieDataset dpd = createPieChartDataset(kategori, tutar);
    JFreeChart chart = ChartFactory.createPieChart(
        "Günlere Göre Satış Grafiği", dpd, true, true,
        false);

    PiePlot plot = (PiePlot) chart.getPlot();
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.