A pie chart displays information using sectors of a circle or ellipse to represent parts of the whole that is being displayed. Basically, there
are four classes to be used to create a pie chart and set its properties. The pie chart context is represented by the PieGraph
class. The sequence for creating a pie chart is the following:
import javax.swing.*; import java.awt.*; import com.jinsight.jetchart.*; public class Main extends JFrame { public Main() { PieGraph graph=new PieGraph(); graph.set3DEnabled(true); PieSerie ps=new PieSerie(); graph.addSerie(ps); Color[] colors={Color.red,Color.green,Color.blue,Color.yellow}; double[] values={50,80,40,90}; String[] legends={"slice1","slice2","slice3","slice4"}; for (int counter=0;counter<values.length;counter++) { Slice slice=new Slice(values[counter],legends[counter],colors[counter]); ps.addSlice(slice); } Container ct=getContentPane(); ct.add("Center",graph); setSize(500,400); setVisible(true); } public static void main(String[] args) { new Main(); } }