Skip to content

Commit 5dd8a0f

Browse files
committed
Merge pull request #165 from plotly/choropleth-tidy-up
Remove dependencies on Plotly for Choropleth
2 parents 7c6589a + 689a774 commit 5dd8a0f

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/traces/choropleth/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
'use strict';
1111

12-
var Plotly = require('../../plotly');
12+
var Plots = require('../../plots/plots');
1313

14-
Plotly.Plots.register(exports, 'choropleth', ['geo', 'noOpacity'], {
14+
Plots.register(exports, 'choropleth', ['geo', 'noOpacity'], {
1515
description: [
1616
'The data that describes the choropleth value-to-color mapping',
1717
'is set in `z`.',

src/traces/choropleth/plot.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ var Plotly = require('../../plotly');
1313
var d3 = require('d3');
1414

1515
var Color = require('../../components/color');
16+
var Drawing = require('../../components/drawing');
17+
18+
var getColorscale = require('../../components/colorscale/get_scale');
19+
var makeScaleFunction = require('../../components/colorscale/make_scale_function');
1620
var getTopojsonFeatures = require('../../lib/topojson_utils').getTopojsonFeatures;
1721
var locationToFeature = require('../../lib/geo_location_utils').locationToFeature;
1822
var arrayToCalcItem = require('../../lib/array_to_calc_item');
19-
var getColorscale = require('../../components/colorscale/get_scale');
20-
var makeScaleFunction = require('../../components/colorscale/make_scale_function');
2123

2224
var constants = require('../../constants/geo_constants');
25+
var attributes = require('./attributes');
2326

2427
var plotChoropleth = module.exports = {};
2528

@@ -141,7 +144,7 @@ plotChoropleth.style = function(geo) {
141144
d3.select(this)
142145
.attr('fill', function(d) { return sclFunc(d.z); })
143146
.call(Color.stroke, d.mlc || markerLine.color)
144-
.call(Plotly.Drawing.dashLine, '', d.mlw || markerLine.width);
147+
.call(Drawing.dashLine, '', d.mlw || markerLine.width);
145148
});
146149
});
147150
};
@@ -157,7 +160,7 @@ function makeCleanHoverLabelsFunc(geo, trace) {
157160
}
158161

159162
var hoverinfoParts = (hoverinfo === 'all') ?
160-
Plotly.Choropleth.attributes.hoverinfo.flags :
163+
attributes.hoverinfo.flags :
161164
hoverinfo.split('+');
162165

163166
var hasName = (hoverinfoParts.indexOf('name') !== -1),

src/traces/scatter/attributes.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
10-
var Plotly = require('../../plotly');
9+
var Drawing = require('../../components/drawing');
1110

1211
var PTS_LINESONLY = 20; // TODO put in constants/
1312

@@ -166,7 +165,7 @@ module.exports = {
166165
marker: {
167166
symbol: {
168167
valType: 'enumerated',
169-
values: Plotly.Drawing.symbolList,
168+
values: Drawing.symbolList,
170169
dflt: 'circle',
171170
arrayOk: true,
172171
role: 'style',

0 commit comments

Comments
 (0)