/ Published in: Java
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import java.awt.Font; import javax.swing.JFrame; import javax.swing.JPanel; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PiePlot; import org.jfree.data.general.DefaultPieDataset; { private static final long serialVersionUID = 1L; private DefaultPieDataset dataset; private JFreeChart jfc; public jfcExample() { dataset = new DefaultPieDataset(); } { dataset.setValue(title, numDouble); } { jfc = ChartFactory.createPieChart(title, dataset, true, true, false); PiePlot pp = (PiePlot) jfc.getPlot(); pp.setSectionOutlinesVisible(false); pp.setNoDataMessage("Nessun Dato Inserito"); pp.setCircular(false); pp.setLabelGap(0.02); } { return new ChartPanel(jfc); } public void Show() { setContentPane(createPanel()); setVisible(true); } { jfcExample j = new jfcExample(); j.setTitle("Example Chart..."); j.setSize(640, 430); j.setChar("Example Chart..."); j.Show(); } }