Skip to content

Commit

Permalink
argument and parameter change in DatasetController.js
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham242k committed Aug 28, 2021
1 parent 42350bd commit 57a0f63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/core/core.datasetController.js
Expand Up @@ -128,8 +128,8 @@ function getOrCreateStack(stacks, stackKey, indexValue) {
return subStack[indexValue] || (subStack[indexValue] = {});
}

function getLastIndexInStack(stack, vScale, positive) {
for (const meta of vScale.getMatchingVisibleMetas('bar').reverse()) {
function getLastIndexInStack(stack, vScale, positive, type) {
for (const meta of vScale.getMatchingVisibleMetas(type).reverse()) {
const value = stack[meta.index];
if ((positive && value > 0) || (!positive && value < 0)) {
return meta.index;
Expand All @@ -156,8 +156,8 @@ function updateStacks(controller, parsed) {
stack = itemStacks[vAxis] = getOrCreateStack(stacks, key, index);
stack[datasetIndex] = value;

stack._top = getLastIndexInStack(stack, vScale, true);
stack._bottom = getLastIndexInStack(stack, vScale, false);
stack._top = getLastIndexInStack(stack, vScale, true, meta.type);
stack._bottom = getLastIndexInStack(stack, vScale, false, meta.type);
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/specs/core.datasetController.tests.js
Expand Up @@ -829,7 +829,7 @@ describe('Chart.DatasetController', function() {
});

var meta = chart.getDatasetMeta(0);
expect(meta._parsed[0]._stacks).toEqual(jasmine.objectContaining({y: {0: 10, 1: 20, _top: null, _bottom: null}}));
expect(meta._parsed[0]._stacks).toEqual(jasmine.objectContaining({y: {0: 10, 1: 20, _top: 1, _bottom: null}}));
});

describe('resolveDataElementOptions', function() {
Expand Down

0 comments on commit 57a0f63

Please sign in to comment.