James Moger
2013-11-26 4fcac9d2cbdafb51e3ee9ca3b3da64fd86103174
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);