mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
add formatter and update bindPopup method
This commit is contained in:
parent
d822ea1147
commit
fd46874eac
1 changed files with 18 additions and 10 deletions
|
@ -34,6 +34,8 @@ define(function (require) {
|
||||||
// track the map objects
|
// track the map objects
|
||||||
this.maps = [];
|
this.maps = [];
|
||||||
|
|
||||||
|
this.tooltipFormatter = chartData.tooltipFormatter;
|
||||||
|
|
||||||
this.events = new Dispatch(handler);
|
this.events = new Dispatch(handler);
|
||||||
|
|
||||||
// add allmin and allmax to geoJson
|
// add allmin and allmax to geoJson
|
||||||
|
@ -541,18 +543,24 @@ define(function (require) {
|
||||||
* return {undefined}
|
* return {undefined}
|
||||||
*/
|
*/
|
||||||
TileMap.prototype.bindPopup = function (feature, layer) {
|
TileMap.prototype.bindPopup = function (feature, layer) {
|
||||||
var props = feature.properties;
|
|
||||||
var popup = L.popup({
|
var self = this;
|
||||||
className: 'leaflet-popup-kibana',
|
var lat = feature.geometry.coordinates[1];
|
||||||
autoPan: false
|
var lng = feature.geometry.coordinates[0];
|
||||||
})
|
var latLng = L.latLng(lat, lng);
|
||||||
.setContent(
|
|
||||||
'Geohash: ' + props.geohash + '<br>' +
|
var popup = L.popup({autoPan: false})
|
||||||
'Center: ' + props.center[1].toFixed(1) + ', ' + props.center[0].toFixed(1) + '<br>' +
|
.setLatLng(latLng);
|
||||||
props.valueLabel + ': ' + props.count
|
|
||||||
);
|
|
||||||
layer.bindPopup(popup)
|
layer.bindPopup(popup)
|
||||||
.on('mouseover', function (e) {
|
.on('mouseover', function (e) {
|
||||||
|
var content = self.tooltipFormatter(feature);
|
||||||
|
console.log(content);
|
||||||
|
if (!content) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
popup.setContent(content);
|
||||||
layer.openPopup();
|
layer.openPopup();
|
||||||
})
|
})
|
||||||
.on('mouseout', function (e) {
|
.on('mouseout', function (e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue