Skip to content

Commit 0a7222c

Browse files
committed
rm several Plotly[] calls in plot_schema.js
1 parent 1dcce20 commit 0a7222c

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src/plot_api/plot_schema.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
'use strict';
1111

1212
var Plotly = require('../plotly');
13+
var Plots = require('../plots/plots');
14+
var Lib = require('../lib');
1315

14-
var extendFlat = Plotly.Lib.extendFlat;
15-
var extendDeep = Plotly.Lib.extendDeep;
16-
var extendDeepAll = Plotly.Lib.extendDeepAll;
16+
var extendFlat = Lib.extendFlat;
17+
var extendDeep = Lib.extendDeep;
18+
var extendDeepAll = Lib.extendDeepAll;
1719

1820
var NESTED_MODULE = '_nestedModules',
1921
COMPOSED_MODULE = '_composedModules',
@@ -38,7 +40,7 @@ var PlotSchema = module.exports = {};
3840

3941

4042
PlotSchema.get = function() {
41-
Plotly.Plots.allTypes
43+
Plots.allTypes
4244
.concat('area') // FIXME polar 'area' attributes
4345
.forEach(getTraceAttributes);
4446

@@ -56,7 +58,7 @@ PlotSchema.crawl = function(attrs, callback) {
5658
callback(attr, attrName, attrs);
5759

5860
if(PlotSchema.isValObject(attr)) return;
59-
if(Plotly.Lib.isPlainObject(attr)) PlotSchema.crawl(attr, callback);
61+
if(Lib.isPlainObject(attr)) PlotSchema.crawl(attr, callback);
6062
});
6163
};
6264

@@ -65,7 +67,7 @@ PlotSchema.isValObject = function(obj) {
6567
};
6668

6769
function getTraceAttributes(type) {
68-
var globalAttributes = Plotly.Plots.attributes,
70+
var globalAttributes = Plots.attributes,
6971
_module = getModule({type: type}),
7072
meta = getMeta(type),
7173
subplotRegistry = getSubplotRegistry(type);
@@ -111,7 +113,7 @@ function getTraceAttributes(type) {
111113
}
112114

113115
function getLayoutAttributes() {
114-
var globalLayoutAttributes = Plotly.Plots.layoutAttributes,
116+
var globalLayoutAttributes = Plots.layoutAttributes,
115117
layoutAttributes = {};
116118

117119
// layout module attributes (+ nested + composed)
@@ -136,7 +138,7 @@ function getLayoutAttributes() {
136138

137139
function getDefs() {
138140
plotSchema.defs = {
139-
valObjects: Plotly.Lib.valObjects,
141+
valObjects: Lib.valObjects,
140142
metaKeys: UNDERSCORE_ATTRS.concat(['description', 'role'])
141143
};
142144
}
@@ -157,7 +159,7 @@ function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) {
157159
nestedAttrs, {}, whichAttrs, type
158160
);
159161

160-
Plotly.Lib.nestedProperty(attrsOut, kk)
162+
Lib.nestedProperty(attrsOut, kk)
161163
.set(extendDeep({}, nestedReference));
162164
});
163165
return;
@@ -180,7 +182,7 @@ function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) {
180182
return;
181183
}
182184

183-
attrsOut[k] = Plotly.Lib.isPlainObject(attrsIn[k]) ?
185+
attrsOut[k] = Lib.isPlainObject(attrsIn[k]) ?
184186
extendDeepAll({}, attrsIn[k]) :
185187
attrsIn[k];
186188
});
@@ -214,7 +216,7 @@ function mergeValTypeAndRole(attrs) {
214216
attrs[attrName + 'src'] = makeSrcAttr(attrName);
215217
}
216218
}
217-
else if(Plotly.Lib.isPlainObject(attr)) {
219+
else if(Lib.isPlainObject(attr)) {
218220
// all attrs container objects get role 'object'
219221
attr.role = 'object';
220222
}
@@ -229,10 +231,10 @@ function getModule(arg) {
229231
if('type' in arg) {
230232
return (arg.type === 'area') ? // FIXME
231233
{ attributes: polarAreaAttrs } :
232-
Plotly.Plots.getModule({type: arg.type});
234+
Plots.getModule({type: arg.type});
233235
}
234236

235-
var subplotsRegistry = Plotly.Plots.subplotsRegistry,
237+
var subplotsRegistry = Plots.subplotsRegistry,
236238
_module = arg.module;
237239

238240
if(subplotsRegistry[_module]) return subplotsRegistry[_module];
@@ -249,7 +251,7 @@ function removeUnderscoreAttrs(attributes) {
249251

250252
function getMeta(type) {
251253
if(type === 'area') return {}; // FIXME
252-
return Plotly.Plots.modules[type].meta || {};
254+
return Plots.modules[type].meta || {};
253255
}
254256

255257
function assignPolarLayoutAttrs(layoutAttributes) {
@@ -266,9 +268,9 @@ function assignPolarLayoutAttrs(layoutAttributes) {
266268
function getSubplotRegistry(traceType) {
267269
if(traceType === 'area') return {}; // FIXME
268270

269-
var subplotsRegistry = Plotly.Plots.subplotsRegistry,
271+
var subplotsRegistry = Plots.subplotsRegistry,
270272
subplotType = Object.keys(subplotsRegistry).filter(function(subplotType) {
271-
return Plotly.Plots.traceIs({type: traceType}, subplotType);
273+
return Plots.traceIs({type: traceType}, subplotType);
272274
})[0];
273275

274276
if(subplotType === undefined) return {};
@@ -277,7 +279,7 @@ function getSubplotRegistry(traceType) {
277279
}
278280

279281
function handleSubplotObjs(layoutAttributes) {
280-
var subplotsRegistry = Plotly.Plots.subplotsRegistry;
282+
var subplotsRegistry = Plots.subplotsRegistry;
281283

282284
Object.keys(layoutAttributes).forEach(function(k) {
283285
Object.keys(subplotsRegistry).forEach(function(subplotType) {

0 commit comments

Comments
 (0)