Custom Mouse Events

The mouse events for any visualization in d3plus are accessible through the visualization’s on method. The functionality mirrors the way that d3-selection handles events, in that you pass 2 variables: the typename of the event and an anonymous function that is provided the data point associated with the current event:

var data = [
  {id: "alpha", value: 29},
  {id: "beta", value: 10},
  {id: "gamma", value: 2},
  {id: "delta", value: 29},
  {id: "eta", value: 25}
];

new d3plus.Treemap()
  .data(data)
  .on("click", function(d) {
    alert(d.id + " has been clicked!");
  })
  .render();