Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #36 from unchartedsoftware/bugfix/correct_histogra…
Browse files Browse the repository at this point in the history
…m_selection_multiple_slices

Bugfix/correct histogram selection multiple slices
  • Loading branch information
saskcan authored Oct 29, 2018
2 parents 9260568 + c3f29fa commit f020556
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Facets Component developed by Uncharted Software",
"repository": "https://github.com/unchartedsoftware/stories-facets",
"license": "Apache-2.0",
"version": "2.12.8",
"version": "2.12.9",
"devDependencies": {
"body-parser": "~1.13.2",
"browserify": "^12.0.1",
Expand Down
25 changes: 13 additions & 12 deletions src/components/facet/facetHistogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,24 +272,25 @@ FacetHistogram.prototype.select = function (slices) {
for (var i = 0, n = bars.length; i < n; ++i) {
var bar = bars[i];
var barMetadata = bar.metadata;
var count = 0;
for (var ii = 0, nn = barMetadata.length; ii < nn; ++ii) {
var slice = barMetadata[ii];
var count = 0;
if (slice.label in slices) {
count = slices[slice.label];
count += slices[slice.label];
}

if(this._scaleFn) {
count = this._scaleFn(count);
}
}

var newHeight = Math.ceil(svgHeight * (count / yMax));
if (bar.selectedHeight === null) {
bar.selectedHeight = newHeight;
} else {
bar.selectedHeight = Math.max(bar.selectedHeight, newHeight);
}
}
if(this._scaleFn) {
count = this._scaleFn(count);
}

var newHeight = Math.ceil(svgHeight * (count / yMax));
if (bar.selectedHeight === null) {
bar.selectedHeight = newHeight;
} else {
bar.selectedHeight = Math.max(bar.selectedHeight, newHeight);
}
}
};

Expand Down

0 comments on commit f020556

Please sign in to comment.