Skip to content

Commit d24eaef

Browse files
committed
replace Axes.expand -> findExtremes for ErrorBars
- here we append the min/max arrays of the corresponding trace
1 parent 13cb0f0 commit d24eaef

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/components/errorbars/calc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,8 @@ function calcOneAxis(calcTrace, trace, axis, coord) {
5757
}
5858
}
5959

60-
Axes.expand(axis, vals, {padded: true});
60+
var extremes = Axes.findExtremes(axis, vals, {padded: true});
61+
var axId = axis._id;
62+
trace._extremes[axId].min = trace._extremes[axId].min.concat(extremes.min);
63+
trace._extremes[axId].max = trace._extremes[axId].max.concat(extremes.max);
6164
}

src/traces/scattergl/convert.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ var rgba = require('color-normalize');
1515
var Registry = require('../../registry');
1616
var Lib = require('../../lib');
1717
var Drawing = require('../../components/drawing');
18-
var Axes = require('../../plots/cartesian/axes');
1918
var AxisIDs = require('../../plots/cartesian/axis_ids');
2019

2120
var formatColor = require('../../lib/gl_format_color').formatColor;
@@ -511,11 +510,10 @@ function convertErrorBarPositions(gd, trace, positions, x, y) {
511510
}
512511
}
513512

514-
Axes.expand(ax, [minShoe, maxHat], {padded: true});
515-
516513
out[axLetter] = {
517514
positions: positions,
518-
errors: errors
515+
errors: errors,
516+
_bnds: [minShoe, maxHat]
519517
};
520518
}
521519
}

src/traces/scattergl/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var Registry = require('../../registry');
1919
var Lib = require('../../lib');
2020
var prepareRegl = require('../../lib/prepare_regl');
2121
var AxisIDs = require('../../plots/cartesian/axis_ids');
22+
var findExtremes = require('../../plots/cartesian/autorange').findExtremes;
2223
var Color = require('../../components/color');
2324

2425
var subTypes = require('../scatter/subtypes');
@@ -95,6 +96,8 @@ function calc(gd, trace) {
9596
ppad = 2 * (opts.marker.sizeAvg || Math.max(opts.marker.size, 3));
9697
}
9798
calcAxisExpansion(gd, trace, xa, ya, x, y, ppad);
99+
if(opts.errorX) expandForErrorBars(trace, xa, opts.errorX);
100+
if(opts.errorY) expandForErrorBars(trace, ya, opts.errorY);
98101

99102
// set flags to create scene renderers
100103
if(opts.fill && !scene.fill2d) scene.fill2d = true;
@@ -136,6 +139,12 @@ function calc(gd, trace) {
136139
return [{x: false, y: false, t: stash, trace: trace}];
137140
}
138141

142+
function expandForErrorBars(trace, ax, opts) {
143+
var extremes = trace._extremes[ax._id];
144+
var errExt = findExtremes(ax, opts._bnds, {padded: true});
145+
extremes.min = extremes.min.concat(errExt.min);
146+
extremes.max = extremes.max.concat(errExt.max);
147+
}
139148

140149
// create scene options
141150
function sceneOptions(gd, subplot, trace, positions, x, y) {

0 commit comments

Comments
 (0)