Skip to content

Interactive Legends

Pre-release
Pre-release
Compare
Choose a tag to compare
@lewin lewin released this 10 Jun 23:55
· 7944 commits to master since this release

http://palantir.github.io/plottable/examples/release/interactiveLegend.html
image

This release introduces some new functionality to legends to enable them to listen to both click and hover events.

Toggle events :
If click interactions are enabled, the legend will apply the class "toggled-on" or "toggled-off" to each individual legend row. Initially, everything will be toggled on. Clicking on a row will toggle its state.

Hover events :
If hover interactions are enabled, the legend will apply the class "hover" to every legend row, and the class "focus" to the row that is being hovered over.

These classes allow you to style the rows however you would like. The default styling hides
toggled-off" entries, and lowers the opacities of entries with only the "hover" class.

To turn these on, call .toggleCallback(function(datum, newState)) and .hoverCallback(function(datum)) on the legend. The argument is a callback that will be called when a legend row is clicked or moused over. For an example of how to do this, see examples/release/interactiveLegend.html

This release also fixes a bug #537 so category axis now returns sensible values for requestedSpace if the domain is empty.

Release Song

Deadmau5, Seeya