google-map-react/src/google_heatmap.js
2018-05-08 19:09:13 -03:00

17 lines
466 B
JavaScript

export const generateHeatmap = (instance, { positions }) =>
new instance.visualization.HeatmapLayer({
data: positions.reduce(
(acc, { lat, lng, weight = 1 }) => {
acc.push({
location: new instance.LatLng(lat, lng),
weight,
});
return acc;
},
[]
),
});
export const optionsHeatmap = (instance, { options = {} }) =>
Object.keys(options).map(option => instance.set(option, options[option]));