mapbox = (div, style, vectorFlag) => {
const rows = EarthquateRows;
function unpack(rows, key) {
return rows.map(function(row) {
return row[key];
});
}
var data = [
{
lon: unpack(rows, 'Longitude'),
lat: unpack(rows, 'Latitude'),
radius: 10,
z: unpack(rows, 'Magnitude'),
type: "densitymapbox",
coloraxis: 'coloraxis',
hoverinfo: 'skip'
}
];
var layout = {
mapbox: { center: { lon: 0, lat: 0 }, style: style, zoom: 0.55 },
coloraxis: { colorscale: "Viridis" },
title: { text: "Earthquake Magnitude" },
width: 900,
height: 500,
margin: { t: 30, b: 0 }
};
var config = { mapboxAccessToken: yourToken };
Plotly.newPlot(div, data, layout, vectorFlag ? config : {});
return div;
}