javascript - edit tooltip on a kartograph map -
i'm using kartograph on map adapt style/tooltip depending on data, follow showcase : http://kartograph.org/showcase/choropleth/
map.addlayer('layer_0', { styles: { 'stroke-width': 0.7, fill: function(d) { return color(stars[d["nuts-id"]]? stars[d["nuts-id"]].total_stars: 0); }, stroke: function(d) { return color(stars[d["nuts-id"]]? stars[d["nuts-id"]].total_stars: 0).darker(); }, }, tooltips: function(d) { return [d["nuts-id"], stars[d["nuts-id"]]? stars[d["nuts-id"]].total_stars: 0]; } });
the map good, want edit it.
for style did :
map.getlayer('layer_0').style('fill', function(d) { ... }); map.getlayer('layer_0').style('stroke', function(d) { ... });
but don't manage edit tooltip function...
i try solution : https://github.com/kartograph/kartograph.js/wiki/tooltips "map.tooltips not defined" error...
i found correct syntax :
map.getlayer('layer_0').tooltips(function(d) { ... });
Comments
Post a Comment