Skip to content

Commit 6337313

Browse files
committed
put scatter3d calc in separate, use it in scattergl
1 parent 71ad19b commit 6337313

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

src/traces/scatter3d/calc.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Copyright 2012-2016, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
var arraysToCalcdata = require('../scatter/arrays_to_calcdata');
12+
var calcMarkerColorscale = require('../scatter/marker_colorscale_calc');
13+
14+
15+
/**
16+
* This is a kludge to put the array attributes into
17+
* calcdata the way Scatter.plot does, so that legends and
18+
* popovers know what to do with them.
19+
*/
20+
module.exports = function calc(gd, trace) {
21+
var cd = [{x: false, y: false, trace: trace, t: {}}];
22+
23+
arraysToCalcdata(cd);
24+
calcMarkerColorscale(trace);
25+
26+
return cd;
27+
};

src/traces/scatter3d/index.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,14 @@
88

99
'use strict';
1010

11-
var Scatter = require('../scatter');
12-
1311
var Scatter3D = {};
1412

1513
Scatter3D.plot = require('./convert');
1614
Scatter3D.attributes = require('./attributes');
1715
Scatter3D.markerSymbols = require('../../constants/gl_markers.json');
1816
Scatter3D.supplyDefaults = require('./defaults');
1917
Scatter3D.colorbar = require('../scatter/colorbar');
20-
21-
Scatter3D.calc = function(gd, trace) {
22-
// this is a kludge to put the array attributes into
23-
// calcdata the way Scatter.plot does, so that legends and
24-
// popovers know what to do with them.
25-
var cd = [{x: false, y: false, trace: trace, t: {}}];
26-
Scatter.arraysToCalcdata(cd);
27-
28-
Scatter.calcMarkerColorscales(trace);
29-
30-
return cd;
31-
};
18+
Scatter3D.calc = require('./calc');
3219

3320
Scatter3D.moduleType = 'trace';
3421
Scatter3D.name = 'scatter3d';

src/traces/scattergl/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88

99
'use strict';
1010

11-
var Scatter3D = require('../scatter3d');
12-
1311
var ScatterGl = {};
1412

1513
ScatterGl.attributes = require('./attributes');
1614
ScatterGl.supplyDefaults = require('./defaults');
1715
ScatterGl.colorbar = require('../scatter/colorbar');
1816

1917
// reuse the Scatter3D 'dummy' calc step so that legends know what to do
20-
ScatterGl.calc = Scatter3D.calc;
18+
ScatterGl.calc = require('../scatter3d/calc');
2119
ScatterGl.plot = require('./convert');
2220

2321
ScatterGl.moduleType = 'trace';

0 commit comments

Comments
 (0)