Skip to content

Commit ba21336

Browse files
committed
move errorbar plot calls to Bar.plot and Scatter.plot
1 parent 3608840 commit ba21336

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

src/plots/cartesian/index.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
var Lib = require('../../lib');
1313
var Plots = require('../plots');
14-
var ErrorBars = require('../../components/errorbars');
15-
1614

1715
exports.name = 'cartesian';
1816

@@ -71,8 +69,7 @@ exports.plot = function(gd) {
7169
for(var i = 0; i < subplots.length; i++) {
7270
var subplot = subplots[i],
7371
subplotInfo = fullLayout._plots[subplot],
74-
cdSubplot = getCdSubplot(calcdata, subplot),
75-
cdError = [];
72+
cdSubplot = getCdSubplot(calcdata, subplot);
7673

7774
// remove old traces, then redraw everything
7875
// TODO: use enter/exit appropriately in the plot functions
@@ -91,17 +88,9 @@ exports.plot = function(gd) {
9188
// plot all traces of this type on this subplot at once
9289
var cdModule = getCdModule(cdSubplot, _module);
9390
_module.plot(gd, subplotInfo, cdModule);
94-
Lib.markTime('done ' + (cdModule[0] && cdModule[0][0].trace.type));
9591

96-
// collect the traces that may have error bars
97-
if(cdModule[0] && cdModule[0][0].trace && Plots.traceIs(cdModule[0][0].trace, 'errorBarsOK')) {
98-
cdError = cdError.concat(cdModule);
99-
}
92+
Lib.markTime('done ' + (cdModule[0] && cdModule[0][0].trace.type));
10093
}
101-
102-
// finally do all error bars at once
103-
ErrorBars.plot(gd, subplotInfo, cdError);
104-
Lib.markTime('done ErrorBars');
10594
}
10695

10796
// now draw stuff not on subplots (ie, only pies at the moment)

src/traces/bar/plot.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var isNumeric = require('fast-isnumeric');
1414

1515
var Lib = require('../../lib');
1616
var Color = require('../../components/color');
17+
var ErrorBars = require('../../components/errorbars');
1718

1819
var arraysToCalcdata = require('./arrays_to_calcdata');
1920

@@ -102,4 +103,8 @@ module.exports = function plot(gd, plotinfo, cdbar) {
102103
'M'+x0+','+y0+'V'+y1+'H'+x1+'V'+y0+'Z');
103104
});
104105
});
106+
107+
// error bars are on the top
108+
bartraces.call(ErrorBars.plot, plotinfo);
109+
105110
};

src/traces/scatter/plot.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var d3 = require('d3');
1313

1414
var Lib = require('../../lib');
1515
var Drawing = require('../../components/drawing');
16+
var ErrorBars = require('../../components/errorbars');
1617

1718
var subTypes = require('./subtypes');
1819
var arraysToCalcdata = require('./arrays_to_calcdata');
@@ -30,10 +31,14 @@ module.exports = function plot(gd, plotinfo, cdscatter) {
3031
var scattertraces = plotinfo.plot.select('.scatterlayer')
3132
.selectAll('g.trace.scatter')
3233
.data(cdscatter);
34+
3335
scattertraces.enter().append('g')
3436
.attr('class', 'trace scatter')
3537
.style('stroke-miterlimit', 2);
3638

39+
// error bars are at the bottom
40+
scattertraces.call(ErrorBars.plot, plotinfo);
41+
3742
// BUILD LINES AND FILLS
3843
var prevpath = '',
3944
tozero, tonext, nexttonext;

0 commit comments

Comments
 (0)