-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathstyle.js
39 lines (30 loc) · 1.09 KB
/
style.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
var d3 = require('@plotly/d3');
var Drawing = require('../../components/drawing');
var Color = require('../../components/color');
var scatterStyle = require('../scatter/style');
var stylePoints = scatterStyle.stylePoints;
var styleText = scatterStyle.styleText;
module.exports = function style(gd, calcTrace) {
if(calcTrace) styleTrace(gd, calcTrace);
};
function styleTrace(gd, calcTrace) {
var trace = calcTrace[0].trace;
var s = calcTrace[0].node3;
s.style('opacity', calcTrace[0].trace.opacity);
stylePoints(s, trace, gd);
styleText(s, trace, gd);
// this part is incompatible with Drawing.lineGroupStyle
s.selectAll('path.js-line')
.style('fill', 'none')
.each(function(d) {
var path = d3.select(this);
var trace = d.trace;
var line = trace.line || {};
path.call(Color.stroke, line.color)
.call(Drawing.dashLine, line.dash || '', line.width || 0);
if(trace.fill !== 'none') {
path.call(Color.fill, trace.fillcolor);
}
});
}