-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathcross_trace_defaults.js
37 lines (29 loc) · 1.01 KB
/
cross_trace_defaults.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
/**
* Copyright 2012-2018, 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';
// remove opacity for any trace that has a fill or is filled to
module.exports = function crossTraceDefaults(fullData) {
for(var i = 0; i < fullData.length; i++) {
var tracei = fullData[i];
if(tracei.type !== 'scatter') continue;
var filli = tracei.fill;
if(filli === 'none' || filli === 'toself') continue;
tracei.opacity = undefined;
if(filli === 'tonexty' || filli === 'tonextx') {
for(var j = i - 1; j >= 0; j--) {
var tracej = fullData[j];
if((tracej.type === 'scatter') &&
(tracej.xaxis === tracei.xaxis) &&
(tracej.yaxis === tracei.yaxis)) {
tracej.opacity = undefined;
break;
}
}
}
}
};