# HG changeset patch # User dbrosius@mebigfatguy.com # Date 1242317748 14400 # Node ID 48228766ed4c6eb287f1f25afef070f8246ce1bc # Parent 27ca8522be85df12c11614d1969207722edb8deb when expecting floating point math, do floating point math diff -r 27ca8522be85 -r 48228766ed4c src/org/dancres/blitz/tools/dash/PieChart.java --- 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 diff -r 27ca8522be85 -r 48228766ed4c src/org/dancres/blitz/tools/dash/graph/Chart.java --- a/src/org/dancres/blitz/tools/dash/graph/Chart.java Sat May 23 09:17:17 2009 +0100 +++ b/src/org/dancres/blitz/tools/dash/graph/Chart.java Thu May 14 12:15:48 2009 -0400 @@ -325,7 +325,7 @@ g.drawLine(xoff-3,(int)y,xoff+wid,(int)y); } - y+=(hi/(nLabels-1)); + y+=(hi/(nLabels-1.0)); }