You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Start.java 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package graph;
  7. import org.jfree.chart.ChartFactory;
  8. import org.jfree.chart.ChartFrame;
  9. import org.jfree.chart.JFreeChart;
  10. import org.jfree.data.general.DefaultPieDataset;
  11. /**
  12. *
  13. * @author christophal67389
  14. */
  15. public class Start
  16. {
  17. /**
  18. * @param args the command line arguments
  19. */
  20. public static void main(String[] args)
  21. {
  22. // create a dataset...
  23. DefaultPieDataset data = new DefaultPieDataset();
  24. data.setValue("Category 1", 43.2);
  25. data.setValue("Category 2", 27.9);
  26. data.setValue("Category 3", 79.5);
  27. // create a chart...
  28. JFreeChart chart = ChartFactory.createPieChart(
  29. "Sample Pie Chart",
  30. data,
  31. true, // legend?
  32. true, // tooltips?
  33. false // URLs?
  34. );
  35. // create and display a frame...
  36. ChartFrame frame = new ChartFrame("First", chart);
  37. frame.pack();
  38. frame.setVisible(true);
  39. }
  40. }