From 058ed1b58e54bf813754e72ca8c37296cf5f704d Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Tue, 04 Mar 2014 09:56:23 -0500
Subject: [PATCH] Update contributors list

---
 src/main/java/com/gitblit/wicket/charting/GooglePieChart.java |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/main/java/com/gitblit/wicket/charting/GooglePieChart.java b/src/main/java/com/gitblit/wicket/charting/GooglePieChart.java
index a9b4667..7119166 100644
--- a/src/main/java/com/gitblit/wicket/charting/GooglePieChart.java
+++ b/src/main/java/com/gitblit/wicket/charting/GooglePieChart.java
@@ -24,9 +24,9 @@
 
 /**
  * Builds an interactive pie chart using the Visualization API.
- * 
+ *
  * @author James Moger
- * 
+ *
  */
 public class GooglePieChart extends GoogleChart {
 
@@ -47,23 +47,15 @@
 
 		Collections.sort(values);
 		List<ChartValue> list = new ArrayList<ChartValue>();
-		
+
 		int maxSlices = 10;
-		int maxCount = Math.min(maxSlices - 1,  values.size());
-		
-		for (int i = 0; i < maxCount; i++) {
-			ChartValue value = values.get(i);
-			list.add(value);
+
+		if (values.size() > maxSlices) {
+			list.addAll(values.subList(0,  maxSlices));
+		} else {
+			list.addAll(values);
 		}
-		if (values.size() >= maxSlices) {
-			float others = 0;
-			for (int i = maxSlices - 1; i < values.size(); i++) {
-				others += values.get(i).value;	
-			}
-			ChartValue other = new ChartValue("other", others);
-			list.add(other);
-		}
-		
+
 		StringBuilder colors = new StringBuilder("colors:[");
 		for (int i = 0; i < list.size(); i++) {
 			ChartValue value = list.get(i);
@@ -73,7 +65,7 @@
 			if (i < values.size() - 1) {
 				colors.append(',');
 			}
-			line(sb, MessageFormat.format("{0}.setValue({1,number,0}, 0, ''{2}'');", dName, i,
+			line(sb, MessageFormat.format("{0}.setValue({1,number,0}, 0, \"{2}\");", dName, i,
 					value.name));
 			line(sb, MessageFormat.format("{0}.setValue({1,number,0}, 1, {2,number,0.0});", dName,
 					i, value.value));

--
Gitblit v1.9.1