MCPcopy Index your code
hub / github.com/plotly/plotly.js / convertStyle

Function convertStyle

src/traces/scattergl/convert.js:34–106  ·  view source on GitHub ↗
(gd, trace)

Source from the content-addressed store, hash-verified

32var appendArrayPointValue = require('../../components/fx/helpers').appendArrayPointValue;
33
34function convertStyle(gd, trace) {
35 var i;
36
37 var opts = {
38 marker: undefined,
39 markerSel: undefined,
40 markerUnsel: undefined,
41 line: undefined,
42 fill: undefined,
43 errorX: undefined,
44 errorY: undefined,
45 text: undefined,
46 textSel: undefined,
47 textUnsel: undefined
48 };
49
50 var plotGlPixelRatio = gd._context.plotGlPixelRatio;
51
52 if (trace.visible !== true) return opts;
53
54 if (subTypes.hasText(trace)) {
55 opts.text = convertTextStyle(gd, trace);
56 opts.textSel = convertTextSelection(gd, trace, trace.selected);
57 opts.textUnsel = convertTextSelection(gd, trace, trace.unselected);
58 }
59
60 if (subTypes.hasMarkers(trace)) {
61 opts.marker = convertMarkerStyle(gd, trace);
62 opts.markerSel = convertMarkerSelection(gd, trace, trace.selected);
63 opts.markerUnsel = convertMarkerSelection(gd, trace, trace.unselected);
64
65 if (!trace.unselected && isArrayOrTypedArray(trace.marker.opacity)) {
66 var mo = trace.marker.opacity;
67 opts.markerUnsel.opacity = new Array(mo.length);
68 for (i = 0; i < mo.length; i++) {
69 opts.markerUnsel.opacity[i] = DESELECTDIM * mo[i];
70 }
71 }
72 }
73
74 if (subTypes.hasLines(trace)) {
75 opts.line = {
76 overlay: true,
77 thickness: trace.line.width * plotGlPixelRatio,
78 color: trace.line.color,
79 opacity: trace.opacity
80 };
81
82 var dashes = (constants.DASHES[trace.line.dash] || [1]).slice();
83 for (i = 0; i < dashes.length; ++i) {
84 dashes[i] *= trace.line.width * plotGlPixelRatio;
85 }
86 opts.line.dashes = dashes;
87 }
88
89 if (trace.error_x && trace.error_x.visible) {
90 opts.errorX = convertErrorBarStyle(trace, trace.error_x, plotGlPixelRatio);
91 }

Callers

nothing calls this directly

Calls 6

convertTextStyleFunction · 0.85
convertTextSelectionFunction · 0.85
convertMarkerStyleFunction · 0.85
convertMarkerSelectionFunction · 0.85
convertErrorBarStyleFunction · 0.85
isArrayOrTypedArrayFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…