Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pie charts: don't group into "others" if there are less then 5 pies (…

…bug fix)
  • Loading branch information...
commit b935100e554dd99dde92523320d64af7a495d0df 1 parent a4cb524
Gregor Aisch gka authored
Showing with 12 additions and 7 deletions.
  1. +12 −7 www/static/visualizations/pie-chart/pie-chart.js
19 www/static/visualizations/pie-chart/pie-chart.js
View
@@ -62,20 +62,25 @@
var series = me.chart.dataSeries(true),
total = 0, min = Number.MAX_VALUE, max = 0,
- reverse, oseries, others = 0;
+ reverse, oseries, others = 0, ocnt = 0;
// now group small series into one big chunk named 'others'
oseries = [];
_.each(series, function(s, i) {
if (i < groupAfter) oseries.push(s);
- else others += s.data[0];
+ else {
+ ocnt += 1;
+ others += s.data[0];
+ }
});
- oseries.push(new Miso.Column({
- name: 'others',
- type: series[0].type,
- data: [others]
- }));
+ if (ocnt > 0) {
+ oseries.push(new Miso.Column({
+ name: 'others',
+ type: series[0].type,
+ data: [others]
+ }));
+ }
_.each(oseries, function(s) {
total += s.data[0];
Please sign in to comment.
Something went wrong with that request. Please try again.