Mapviewer's buildlayer doesn't support tooltip
Summary
tooltip enabled and applied via buildLayer
doesn't apply
Steps to reproduce
- use
g1.mapviewer
and create a map viabuildLayer
--map.buildLayer('layername', layer_opts)
where map is ag1.mapviewer()
object andlayer_opts
are layer options - one of the attributes in
layer_opts
istooltip: function(d) { return d.value; }
What is the current bug behavior?
Tooltip doesn't show up
Possible fixes
In src/mapviewer.js
, do the below:
case 'topojson':
case 'geojson':
if() {
...
self.renderTooltip(layerName, layerConfig)
...
} else {
...
self.renderTooltip(layerName, layerConfig)
...
}
with this a developer can define
tooltip: function(d) {
// console.log(d)
return d[_map_data['metric']] !== undefined ? d[_map_data['metric']].toString() : d[_map_data['metric']];
},
tooltipOptions: {
direction: function (args) {
return args.centerPoint[1] > args.tooltipPoint.x[1] ? 'top' : 'bottom'
},
sticky: true
},
note that tooltipOptions
is optional
Edited by Bhanu K