Permalink
Browse files

Enabling chart hover states based on table interaction.

  • Loading branch information...
1 parent d02722d commit 2a4a91a7d7ff724b465e468c3013090322318255 @matthewhudson matthewhudson committed Apr 12, 2013
Showing with 16 additions and 0 deletions.
  1. +16 −0 sixpack/static/js/experiment.js
@@ -41,6 +41,22 @@ $(function () {
});
my.el.append(my.template(data));
+ $('table tr').hover(
+ function () {
+ var alt_name = $(this).attr('class');
+ if (!alt_name) return;
+
+ $(this).addClass('highlight');
+
+ var line = d3.select("#" + alt_name);
+ line.attr('class', line.attr('class') + " line-hover")
+ },
+ function () {
+ $(this).removeClass('highlight');
+ d3.select('#' + $(this).attr('class')).attr('class', 'line');
+ }
+ );
+
var chart = new Chart(my.name, data);
chart.draw();
my.callback();

0 comments on commit 2a4a91a

Please sign in to comment.