Mercurial > hg > blitz_stable
changeset 7:48228766ed4c
when expecting floating point math, do floating point math
author | dbrosius@mebigfatguy.com |
---|---|
date | Thu, 14 May 2009 12:15:48 -0400 |
parents | 27ca8522be85 |
children | fa7203ea1622 |
files | src/org/dancres/blitz/tools/dash/PieChart.java src/org/dancres/blitz/tools/dash/graph/Chart.java |
diffstat | 2 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/org/dancres/blitz/tools/dash/PieChart.java Sat May 23 09:17:17 2009 +0100 +++ b/src/org/dancres/blitz/tools/dash/PieChart.java Thu May 14 12:15:48 2009 -0400 @@ -5,6 +5,7 @@ import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; + import javax.swing.JPanel; public class PieChart extends JPanel { @@ -50,7 +51,7 @@ max = values[i]; } maxLabelWidth = Math.max(fontMetrics - .stringWidth((String) (labels[i])), + .stringWidth((labels[i])), maxLabelWidth); } float multiFactor = 100 / totalValue; @@ -93,8 +94,8 @@ int incSweepAngle = 0; int incLabelAngle = (int) (angle[0] / 2); for (int i = 0; i < columns; i++) { - sweepAngle = (int) Math.round(angle[i]); - g.setColor((Color) colors[i]); + sweepAngle = Math.round(angle[i]); + g.setColor(colors[i]); if (i == (columns - 1)) { sweepAngle = 360 - incSweepAngle; g.fillArc(x, y, width, height, initAngle, (-sweepAngle)); @@ -106,10 +107,10 @@ ly = (int) (cy + (radius * Math .sin((incLabelAngle * 3.14f / 180) - 3.14f / 2))); adjustLabel(i); - g.drawString((String) labels[i], lx, ly); + g.drawString(labels[i], lx, ly); } if (showPercent) { - px = (int) (cx + ((radius * 2 / 3) * Math + px = (int) (cx + ((radius * 2.0f / 3) * Math .cos((incLabelAngle * 3.14f / 180) - 3.14f / 2))); py = (int) (cy + ((radius * 2 / 3) * Math .sin((incLabelAngle * 3.14f / 180) - 3.14f / 2))); @@ -133,7 +134,7 @@ ly = (int) (cy + (radius * Math .sin((incLabelAngle * 3.14f / 180) - 3.14f / 2))); adjustLabel(i); - g.drawString((String) labels[i], lx, ly); + g.drawString(labels[i], lx, ly); } if (showPercent) { px = (int) (cx + ((radius * 2 / 3) * Math