我已经在网站上实现了热图代码,但是我需要能够对多年的数据进行排序。我使用了leaflet-heat.js插件。https://github.com/Leaflet/Leaflet.heat/tree/gh-pages/dist 我希望它从顺序栏中更改日期。 picture of current heatmap without sequence bar working
函数createHeatMap(花粉){
var locations = pollen.features.map(function(row) {
// the heatmap plugin wants an array of each location
var location = row.geometry.coordinates.reverse();
location.push(0.9);
return location; // [50.5, 30.5, 0.2], [lat, lng, intensity]
});
var heat = L.heatLayer(locations, {
minOpacity: 0.3,
radius: 20,
blur:10,
maxZoom:5,
max:50,
gradient: {
0.1: 'purple',
0.2: 'cyan',
0.3: '#2b83ba',
0.4: 'green',
0.6: 'yellow',
0.8: 'orange',
0.9: '#d7191c',
1: 'red'
}
});
map.addLayer(heat);
};