-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathplot.js
43 lines (33 loc) · 1.34 KB
/
plot.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
40
41
42
43
/**
* 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';
var scatterPlot = require('../scatter/plot');
var Axes = require('../../plots/cartesian/axes');
var Drawing = require('../../components/drawing');
module.exports = function plot(gd, plotinfoproxy, data) {
var i, trace, node;
var carpet = data[0][0].carpet;
// mimic cartesian plotinfo
var plotinfo = {
xaxis: Axes.getFromId(gd, carpet.xaxis || 'x'),
yaxis: Axes.getFromId(gd, carpet.yaxis || 'y'),
plot: plotinfoproxy.plot
};
scatterPlot(gd, plotinfo, data);
for(i = 0; i < data.length; i++) {
trace = data[i][0].trace;
// Note: .select is adequate but seems to mutate the node data,
// which is at least a bit suprising and causes problems elsewhere
node = plotinfo.plot.selectAll('g.trace' + trace.uid + ' .js-line');
// Note: it would be more efficient if this didn't need to be applied
// separately to all scattercarpet traces, but that would require
// lots of reorganization of scatter traces that is otherwise not
// necessary. That makes this a potential optimization.
Drawing.setClipUrl(node, carpet._clipPathId);
}
};