Skip to content
Prev Previous commit
Next Next commit
add new errobar style step (now grabs data from trace <g>)
  • Loading branch information
etpinard committed Mar 18, 2016
commit 360884002d7c389384de1a6a6f63f62342a071ce
35 changes: 35 additions & 0 deletions src/components/errorbars/style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright 2012-2016, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/


'use strict';

var d3 = require('d3');

var Color = require('../color');


module.exports = function style(traces) {
traces.each(function(d) {
var trace = d[0].trace,
yObj = trace.error_y || {},
xObj = trace.error_x || {};

var s = d3.select(this);

s.selectAll('path.yerror')
.style('stroke-width', yObj.thickness + 'px')
.call(Color.stroke, yObj.color);

if(xObj.copy_ystyle) xObj = yObj;

s.selectAll('path.xerror')
.style('stroke-width', xObj.thickness + 'px')
.call(Color.stroke, xObj.color);
});
};