This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

Graphics Pie Chart!

 
Brittany Ansteatt
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 48
  • Mark post as helpful
  • send pies
  • Report post to moderator
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;
}
 
Campbell Ritchie
Sheriff
Posts: 48441
56
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
    Bookmark Topic Watch Topic
  • New Topic