Skip to content

Commit

Permalink
Histogram - data correction
Browse files Browse the repository at this point in the history
  • Loading branch information
bilcus committed Apr 18, 2016
1 parent accb057 commit 3e339f9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/js/hist.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ function embeddCssToSvg(path, svg, cb) {
});
}

function correct() {
data.sort(function(a, b) {
return a[0] - b[0];
});
data = data.filter(function(item, pos, ary) {
return !pos || item[0] != ary[pos - 1][0];
})
}

function zoomed() {
svg.select("g.x.axis").call(xAxis);
svg.select("g.y.axis").call(yAxis);
Expand Down Expand Up @@ -160,6 +169,7 @@ function onLoad() {
data = dsv.parseRows(text, function(d) {
return d.map(Number);
});
correct();
draw();
});
});
Expand Down

0 comments on commit 3e339f9

Please sign in to comment.