MCPcopy
hub / github.com/chartjs/Chart.js / applyStack

Function applyStack

src/core/core.datasetController.js:70–100  ·  src/core/core.datasetController.js::applyStack
(stack, value, dsIndex, options = {})

Source from the content-addressed store, hash-verified

68}
69
70function applyStack(stack, value, dsIndex, options = {}) {
71 const keys = stack.keys;
72 const singleMode = options.mode === class="st">'single';
73 let i, ilen, datasetIndex, otherValue;
74
75 if (value === null) {
76 return;
77 }
78
79 let found = false;
80 for (i = 0, ilen = keys.length; i < ilen; ++i) {
81 datasetIndex = +keys[i];
82 if (datasetIndex === dsIndex) {
83 found = true;
84 if (options.all) {
85 continue;
86 }
87 break;
88 }
89 otherValue = stack.values[datasetIndex];
90 if (isFinite(otherValue) && (singleMode || (value === 0 || sign(value) === sign(otherValue)))) {
91 value += otherValue;
92 }
93 }
94
95 if (!found && !options.all) {
96 return 0;
97 }
98
99 return value;
100}
101
102function convertObjectDataToArray(data, meta) {
103 const {iScale, vScale} = meta;

Callers 2

applyStackMethod · 0.85
updateRangeFromParsedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected