-
Chris ParsonsMarch 1, 2017 at 2:46 am #7373
Is it possible to change the Halo template to show the tooltip on click rather than mouseover?
vizulyMarch 1, 2017 at 7:41 am #7380Hello Chris,
Yes, this is pretty straightforward.
The file currently dispatches a “node click” event that you can listen for like this.
viz.on("nodeclick",function (d) { //do something cool });
If you want to add an additional event for clicking on the outer arcs you would need to modify two lines in the src/viz/halo.js code (and make sure you are referencing this code in the script tag of your HTML page.)
At line 43 modify it to look like this
var customEvents = ["linkover","nodeover","arcover","linkout","nodeout","arcout","nodeclick","arcclick"];
At line 194, add this to the event block
var haloGroup = haloPlot.selectAll(".vz-halo-arc").data(haloLayout(haloArcs)); haloGroup.enter().append("path") .attr("class",function(d) { return "vz-halo-arc " + "halo-key_" + d.data.key }) .on("mouseover",function (d,i) { scope.dispatch.arcover(this,d,i) }) .on("mouseout",function (d,i) { scope.dispatch.arcout(this,d,i) }); .on("click",function (d,i) { scope.dispatch.arcclick(this,d,i) }); haloGroup.exit().remove(); haloGroup.attr("d",function (d,i) { return haloArc(d,i);
});
You can then reference this like such:
viz.on("arcclick",function (d) { //do something cool });
I hope that helps.
– Tom
-
|
You must be logged in to reply to this topic.