Skip to content

Commit

Permalink
Merge pull request plotly#1254 from plotly/choropleth-map-doc-fix
Browse files Browse the repository at this point in the history
fixes JS choropleth broken example
  • Loading branch information
priyatharsan authored Feb 27, 2019
2 parents 916d2c0 + 2acf615 commit cfefd40
Showing 1 changed file with 27 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,31 @@
---

Plotly.d3.csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_usa_states.csv', function(err, rows){
function unpack(rows, key) {
return rows.map(function(row) { return row[key]; });
}
function unpack(rows, key) {
return rows.map(function(row) { return row[key]; });
}
var data = [{
type: 'choropleth',
locationmode: 'USA-states',
locations: unpack(rows, 'Postal'),
z: unpack(rows, 'Population'),
text: unpack(rows, 'State'),
autocolorscale: true
}];

var data = [{
type: 'choropleth',
locationmode: 'USA-states',
locations: unpack(rows, 'postal'),
z: unpack(rows, 'pop'),
text: unpack(rows, 'state'),
autocolorscale: true
}];


var layout = {
title: '2014 US Population by State',
geo:{
scope: 'usa',
countrycolor: 'rgb(255, 255, 255)',
showland: true,
landcolor: 'rgb(217, 217, 217)',
showlakes: true,
lakecolor: 'rgb(255, 255, 255)',
subunitcolor: 'rgb(255, 255, 255)',
lonaxis: {},
lataxis: {}
}
};
Plotly.plot(myDiv, data, layout, {showLink: false});
});
var layout = {
title: '2014 US Popultaion by State',
geo:{
scope: 'usa',
countrycolor: 'rgb(255, 255, 255)',
showland: true,
landcolor: 'rgb(217, 217, 217)',
showlakes: true,
lakecolor: 'rgb(255, 255, 255)',
subunitcolor: 'rgb(255, 255, 255)',
lonaxis: {},
lataxis: {}
}
};
Plotly.plot(myDiv, data, layout, {showLink: false});
});

0 comments on commit cfefd40

Please sign in to comment.