mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #705 from bpezan/bettermap
better performance when adding thousands of markers to bettermap.
This commit is contained in:
commit
3f80ef0dcb
@ -213,14 +213,18 @@ function (angular, app, _, L, localRequire) {
|
||||
layerGroup.clearLayers();
|
||||
}
|
||||
|
||||
var markerList = [];
|
||||
|
||||
_.each(scope.data, function(p) {
|
||||
if(!_.isUndefined(p.tooltip) && p.tooltip !== '') {
|
||||
layerGroup.addLayer(L.marker(p.coordinates).bindLabel(p.tooltip));
|
||||
markerList.push(L.marker(p.coordinates).bindLabel(p.tooltip));
|
||||
} else {
|
||||
layerGroup.addLayer(L.marker(p.coordinates));
|
||||
markerList.push(L.marker(p.coordinates));
|
||||
}
|
||||
});
|
||||
|
||||
layerGroup.addLayers(markerList);
|
||||
|
||||
layerGroup.addTo(map);
|
||||
|
||||
map.fitBounds(_.pluck(scope.data,'coordinates'));
|
||||
|
Loading…
Reference in New Issue
Block a user