Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ee3c29

Browse files
committed
polar (yes polar): rm circular dep patterns
by: - removing add require('plotly'), - adding an index file, and - require the polar index in plot_api.js
1 parent 5af1c6d commit 5ee3c29

File tree

5 files changed

+30
-19
lines changed

5 files changed

+30
-19
lines changed

src/plot_api/plot_api.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var Queue = require('../lib/queue');
2020

2121
var Plots = require('../plots/plots');
2222
var Fx = require('../plots/cartesian/graph_interact');
23+
var Polar = require('../plots/polar');
2324

2425
var Color = require('../components/color');
2526
var Drawing = require('../components/drawing');
@@ -419,7 +420,7 @@ function plotPolar(gd, data, layout) {
419420
// fulfill gd requirements
420421
if(data) gd.data = data;
421422
if(layout) gd.layout = layout;
422-
Plotly.micropolar.manager.fillLayout(gd);
423+
Polar.manager.fillLayout(gd);
423424

424425
if(gd._fullLayout.autosize === 'initial' && gd._context.autosizable) {
425426
plotAutoSize(gd, {});
@@ -432,7 +433,7 @@ function plotPolar(gd, data, layout) {
432433
});
433434

434435
// instantiate framework
435-
gd.framework = Plotly.micropolar.manager.framework(gd);
436+
gd.framework = Polar.manager.framework(gd);
436437

437438
// plot
438439
gd.framework({data: gd.data, layout: gd.layout}, paperDiv.node());

src/plotly.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ var Plots = exports.Plots = require('./plots/plots');
3838

3939
exports.Axes = require('./plots/cartesian/axes');
4040
exports.Fx = require('./plots/cartesian/graph_interact');
41-
exports.micropolar = require('./plots/polar/micropolar');
4241

4342
// components
4443
exports.Color = require('./components/color');

src/plots/polar/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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 Polar = module.exports = require('./micropolar');
12+
13+
Polar.manager = require('./micropolar_manager');

src/plots/polar/micropolar.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
var Plotly = require('../../plotly');
109
var d3 = require('d3');
10+
var Lib = require('../../lib');
11+
var extendDeepAll = Lib.extendDeepAll;
1112

12-
var µ = module.exports = {
13-
version: '0.2.2',
14-
manager: require('./micropolar_manager')
15-
};
16-
17-
var extendDeepAll = Plotly.Lib.extendDeepAll;
13+
var µ = module.exports = { version: '0.2.2' };
1814

1915
µ.Axis = function module() {
2016
var config = {

src/plots/polar/micropolar_manager.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99

1010
'use strict';
1111

12-
var Plotly = require('../../plotly');
1312
var d3 = require('d3');
13+
var Lib = require('../../lib');
14+
var Color = require('../../components/color');
15+
16+
var micropolar = require('./micropolar');
1417
var UndoManager = require('./undo_manager');
18+
var extendDeepAll = Lib.extendDeepAll;
1519

1620
var manager = module.exports = {};
1721

18-
var extendDeepAll = Plotly.Lib.extendDeepAll;
19-
2022
manager.framework = function(_gd) {
2123
var config, previousConfigClone, plot, convertedInput, container;
2224
var undoManager = new UndoManager();
@@ -29,8 +31,8 @@ manager.framework = function(_gd) {
2931
_inputConfig :
3032
extendDeepAll(config, _inputConfig);
3133

32-
if(!plot) plot = Plotly.micropolar.Axis();
33-
convertedInput = Plotly.micropolar.adapter.plotly().convert(config);
34+
if(!plot) plot = micropolar.Axis();
35+
convertedInput = micropolar.adapter.plotly().convert(config);
3436
plot.config(convertedInput).render(container);
3537
_gd.data = config.data;
3638
_gd.layout = config.layout;
@@ -41,12 +43,12 @@ manager.framework = function(_gd) {
4143
exports.svg = function() { return plot.svg(); };
4244
exports.getConfig = function() { return config; };
4345
exports.getLiveConfig = function() {
44-
return Plotly.micropolar.adapter.plotly().convert(plot.getLiveConfig(), true);
46+
return micropolar.adapter.plotly().convert(plot.getLiveConfig(), true);
4547
};
4648
exports.getLiveScales = function() { return {t: plot.angularScale(), r: plot.radialScale()}; };
4749
exports.setUndoPoint = function() {
4850
var that = this;
49-
var configClone = Plotly.micropolar.util.cloneJson(config);
51+
var configClone = micropolar.util.cloneJson(config);
5052
(function(_configClone, _previousConfigClone) {
5153
undoManager.add({
5254
undo: function() {
@@ -57,7 +59,7 @@ manager.framework = function(_gd) {
5759
}
5860
});
5961
})(configClone, previousConfigClone);
60-
previousConfigClone = Plotly.micropolar.util.cloneJson(configClone);
62+
previousConfigClone = micropolar.util.cloneJson(configClone);
6163
};
6264
exports.undo = function() { undoManager.undo(); };
6365
exports.redo = function() { undoManager.redo(); };
@@ -71,7 +73,7 @@ manager.fillLayout = function(_gd) {
7173
dflts = {
7274
width: 800,
7375
height: 600,
74-
paper_bgcolor: Plotly.Color.background,
76+
paper_bgcolor: Color.background,
7577
_container: container,
7678
_paperdiv: paperDiv,
7779
_paper: paper

0 commit comments

Comments
 (0)