File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Graphics Pie Chart! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply locked New topic
Author

Graphics Pie Chart!

Brittany Ansteatt
Greenhorn

Joined: Nov 06, 2008
Posts: 6
Can anyone tell me why when I run this the output is not correct? It should be just a plain circle with pie slices....

Don Solomon
Ranch Hand

Joined: Jul 20, 2008
Posts: 48
I am unaware of your requirements. I am not sure if you are looking for an even distrubution of the values, or a circle with "slices" representing values. First I just added a drawcircle method, which I first envoked, so I could focus on the slices (see code addition). I then removed the calculations from the setAngle Method (again, see code modification). Code needs cleaning. Hope it helps.

[code]

...
void drawcircle() {
Arc2D arc = new Arc2D.Double(0,0,width,height,0,360,Arc2D.PIE);
arcs.add(arc);
}
...
public void setAngle(double value) {
angle = value;
}


Software development is an exercise in thinking not coding.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Please don't use two threads for the same problem. This is a continuation of this thread; please continue all discussion there.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Originally posted by Campbell Ritchie:
Please don't use two threads for the same problem. This is a continuation of this thread; please continue all discussion there.


Closing this duplicate.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Graphics Pie Chart!