Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create a pie chart

Status
Not open for further replies.

Londa1130

Technical User
Mar 25, 2004
15
US
Can someone explain to me how to create a pie chart using in a swing Applet. I have some fields that information is being entered into and would like it represented in a pie chart. I'm trying to use the drawArc() method but not understanding it completely.
 
Code:
            public void paint(Graphics g)
            {
                Graphics2D g2 = (Graphics2D)g;
g2.setColor(Color.blue);
g2.fillArc(200,200,100,100,90,-270);
            }
// this code draws a filled arc starting at 12 O'clock and ending at nine O'clock clockwisely, so 90 is the starting pointing
// g2.drawArc(200,200,100,100,90,270); will draw anticlockwisely because positive 270 means anticlockwise and negative 270 means clockwise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top