Skip to content

Commit cfefd40

Browse files
authored
Merge pull request #1254 from plotly/choropleth-map-doc-fix
fixes JS choropleth broken example
2 parents 916d2c0 + 2acf615 commit cfefd40

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

_posts/plotly_js/maps/choropleth-maps/2015-08-11-US-pop-by-state-choropleth.html

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,31 @@
99
---
1010

1111
Plotly.d3.csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_usa_states.csv', function(err, rows){
12-
function unpack(rows, key) {
13-
return rows.map(function(row) { return row[key]; });
14-
}
12+
function unpack(rows, key) {
13+
return rows.map(function(row) { return row[key]; });
14+
}
15+
var data = [{
16+
type: 'choropleth',
17+
locationmode: 'USA-states',
18+
locations: unpack(rows, 'Postal'),
19+
z: unpack(rows, 'Population'),
20+
text: unpack(rows, 'State'),
21+
autocolorscale: true
22+
}];
1523

16-
var data = [{
17-
type: 'choropleth',
18-
locationmode: 'USA-states',
19-
locations: unpack(rows, 'postal'),
20-
z: unpack(rows, 'pop'),
21-
text: unpack(rows, 'state'),
22-
autocolorscale: true
23-
}];
24-
25-
26-
var layout = {
27-
title: '2014 US Population by State',
28-
geo:{
29-
scope: 'usa',
30-
countrycolor: 'rgb(255, 255, 255)',
31-
showland: true,
32-
landcolor: 'rgb(217, 217, 217)',
33-
showlakes: true,
34-
lakecolor: 'rgb(255, 255, 255)',
35-
subunitcolor: 'rgb(255, 255, 255)',
36-
lonaxis: {},
37-
lataxis: {}
38-
}
39-
};
40-
Plotly.plot(myDiv, data, layout, {showLink: false});
41-
});
24+
var layout = {
25+
title: '2014 US Popultaion by State',
26+
geo:{
27+
scope: 'usa',
28+
countrycolor: 'rgb(255, 255, 255)',
29+
showland: true,
30+
landcolor: 'rgb(217, 217, 217)',
31+
showlakes: true,
32+
lakecolor: 'rgb(255, 255, 255)',
33+
subunitcolor: 'rgb(255, 255, 255)',
34+
lonaxis: {},
35+
lataxis: {}
36+
}
37+
};
38+
Plotly.plot(myDiv, data, layout, {showLink: false});
39+
});

0 commit comments

Comments
 (0)