(instance, { positions })
| 1 | export const generateHeatmap = (instance, { positions }) => |
| 2 | new instance.visualization.HeatmapLayer({ |
| 3 | data: positions.reduce((acc, { lat, lng, weight = 1 }) => { |
| 4 | acc.push({ |
| 5 | location: new instance.LatLng(lat, lng), |
| 6 | weight, |
| 7 | }); |
| 8 | return acc; |
| 9 | }, []), |
| 10 | }); |
| 11 | |
| 12 | export const optionsHeatmap = (instance, { options = {} }) => |
| 13 | Object.keys(options).map((option) => instance.set(option, options[option])); |