NorthSide
NorthSide

Reputation: 1499

dc.js - onClick to grab key value

I'm trying to get the key value when clicking on a bar chart in dc.js (I want to use this value when opening a new page) I've used the following (commented out bits!) but cannot get the key value I'm after, I thought it would be d.key? What am I missing?

 chart.renderlet(function(chart) {
   chart.selectAll('rect').on("click", function(d) {
     console.log("click!", d);
     //   return d.key;
     // id=d.key;
     // window.location = "information.php?id="+id;
   });
 });

Upvotes: 0

Views: 884

Answers (1)

Mark
Mark

Reputation: 108537

Not famililar with dc.js, but looking at the source to this, tt would be:

d.data.key

Example here.

Upvotes: 2

Related Questions