Skip to content

Instantly share code, notes, and snippets.

@jescalan
Created January 21, 2012 18:33
Show Gist options
  • Save jescalan/1653520 to your computer and use it in GitHub Desktop.
Save jescalan/1653520 to your computer and use it in GitHub Desktop.
jQuery-style css selector for d3 library
// D3: a data visualization library for javascript --http://mbostock.github.com/d3/
// Allows you to set multiple css properties at once
// Add this into the d3 source. Use like this d3.select('p').css({ color: 'red', 'font-size': '24px' });
d3_selectionPrototype.css = function(args) {
for (var key in args) {
var val = args[key]
this.style(key, val)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment