Commit dc0545ce authored by Joshua Gould's avatar Joshua Gould

bin count for stacked bars

parent 3b8bc217
...@@ -2189,17 +2189,18 @@ morpheus.VectorTrack.prototype = { ...@@ -2189,17 +2189,18 @@ morpheus.VectorTrack.prototype = {
for (var i = start; i < end; i++) { for (var i = start; i < end; i++) {
var array = vector.getValue(i); var array = vector.getValue(i);
if (array != null) { if (array != null) {
var selectedBins = new morpheus.Set(); var selectedBinToCount = new morpheus.Map();
if (array.modelIndexToBin != null) { if (array.modelIndexToBin != null) {
for (var j = 0; j < selectedModelIndices.length; j++) { for (var j = 0; j < selectedModelIndices.length; j++) {
var bin = array.modelIndexToBin var bin = array.modelIndexToBin
.get(selectedModelIndices[j]); .get(selectedModelIndices[j]);
if (bin !== undefined) { if (bin !== undefined) {
selectedBins.add(bin); var prior = selectedBinToCount.get(bin) || 0;
selectedBinToCount.set(bin, prior + 1);
} }
} }
} }
var position = positions.getPosition(i); var position = positions.getPosition(i);
var size = positions.getItemSize(i); var size = positions.getItemSize(i);
var positivePairs = []; var positivePairs = [];
...@@ -2243,7 +2244,7 @@ morpheus.VectorTrack.prototype = { ...@@ -2243,7 +2244,7 @@ morpheus.VectorTrack.prototype = {
- scaledValue), size); - scaledValue), size);
context.fill(); context.fill();
} }
if (selectedBins.has(index)) { if (selectedBinToCount.has(index)) {
context.beginPath(); context.beginPath();
var ytop = (nextScaledValue + scaledValue) / 2; var ytop = (nextScaledValue + scaledValue) / 2;
context.moveTo(position, ytop); context.moveTo(position, ytop);
...@@ -2277,7 +2278,7 @@ morpheus.VectorTrack.prototype = { ...@@ -2277,7 +2278,7 @@ morpheus.VectorTrack.prototype = {
- scaledValue), size); - scaledValue), size);
context.fill(); context.fill();
} }
if (selectedBins.has(index)) { if (selectedBinToCount.has(index)) {
// draw a line at top of bin // draw a line at top of bin
context.beginPath(); context.beginPath();
var ytop = (nextScaledValue + scaledValue) / 2; var ytop = (nextScaledValue + scaledValue) / 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment