On Fri, Jun 07, 2013 at 04:35:21AM -0700,
hai2...@gmail.com wrote:
> I would like to highlight a row in a table. For e.g when i click on a row,
> the row background color needs to be changed. How do i do that in d3?
You could define a "highlight" CSS class:
.highlight {
background: #f00;
}
Then, attach a "click" handler to each <tr> element (table row):
var tr = table.selectAll("tr")
.on("click", function() {
// Remove "highlight" class from all rows.
tr.classed("highlight", false);
// Add highlight class to this row.
d3.select(this).classed("highlight", true);
});
--
Jason Davies,
http://www.jasondavies.com/