Skip to content

Commit 70fcaad

Browse files
authored
Merge pull request #2960 from plotly/stacked-area
Stacked Area Charts
2 parents 33e1acf + 9fdf522 commit 70fcaad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1756
-286
lines changed

src/components/errorbars/calc.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,29 @@ function calcOneAxis(calcTrace, trace, axis, coord) {
4343
var computeError = makeComputeError(opts);
4444

4545
for(var i = 0; i < calcTrace.length; i++) {
46-
var calcPt = calcTrace[i],
47-
calcCoord = calcPt[coord];
46+
var calcPt = calcTrace[i];
47+
48+
var iIn = calcPt.i;
49+
50+
// for types that don't include `i` in each calcdata point
51+
if(iIn === undefined) iIn = i;
52+
53+
// for stacked area inserted points
54+
// TODO: errorbars have been tested cursorily with stacked area,
55+
// but not thoroughly. It's not even really clear what you want to do:
56+
// Should it just be calculated based on that trace's size data?
57+
// Should you add errors from below in quadrature?
58+
// And what about normalization, where in principle the errors shrink
59+
// again when you get up to the top end?
60+
// One option would be to forbid errorbars with stacking until we
61+
// decide how to handle these questions.
62+
else if(iIn === null) continue;
63+
64+
var calcCoord = calcPt[coord];
4865

4966
if(!isNumeric(axis.c2l(calcCoord))) continue;
5067

51-
var errors = computeError(calcCoord, i);
68+
var errors = computeError(calcCoord, iIn);
5269
if(isNumeric(errors[0]) && isNumeric(errors[1])) {
5370
var shoe = calcPt[coord + 's'] = calcCoord - errors[0],
5471
hat = calcPt[coord + 'h'] = calcCoord + errors[1];

0 commit comments

Comments
 (0)