forked from plotly/plotly.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle_one.js
25 lines (20 loc) · 867 Bytes
/
style_one.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
'use strict';
var Color = require('../../components/color');
var castOption = require('./helpers').castOption;
var Drawing = require('../../components/drawing');
module.exports = function styleOne(s, pt, trace, gd) {
var line = trace.marker.line;
var lineColor = castOption(line.color, pt.pts) || Color.defaultLine;
var lineWidth = castOption(line.width, pt.pts) || 0;
// enforce the point color, when colors (with s) & the pattern shape are missing.
// 'abuse' the color attribute, used in the Drawing component for bar trace type.
var marker = trace.marker;
if(marker.pattern) {
if(!marker.colors || !marker.pattern.shape) marker.color = pt.color;
} else {
marker.color = pt.color;
}
Drawing.pointStyle(s, trace, gd, pt);
s.style('stroke-width', lineWidth)
.call(Color.stroke, lineColor);
};