Skip to content

Commit

Permalink
Fix sorting of bar chart elements
Browse files Browse the repository at this point in the history
  • Loading branch information
chandanbn committed Mar 19, 2020
1 parent 6c776cb commit 5787301
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions public/js/chart.js
Expand Up @@ -169,6 +169,8 @@ function barChart (a) {
keys = Object.keys(d.items);
delete keys.t;
var y = 0;
var skey = Object.keys(d.items[0])[0];
d.items.sort(function(a,b){return a[skey]>b[skey]});
for (item of d.items) {
item.y = y;
y = y+item.t;
Expand Down

0 comments on commit 5787301

Please sign in to comment.