Advertisement
Guest User

Untitled

a guest
May 27th, 2015
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. class csser
  2. constructor: (@style...,@selection) ->
  3. @json2style()
  4.  
  5. json2style: () =>
  6. ###
  7. Apply an object of styles to a selection
  8. ###
  9. if @style
  10. @selection.style @style[0]
  11.  
  12. style2json: () =>
  13. ###
  14. Requires CSSJSON
  15. Return an object
  16. ###
  17. CSSJSON.toJSON @selection.attr 'style'
  18.  
  19. clear: () =>
  20. ###
  21. clear the style on the current selection
  22. ###
  23. @selection.attr 'style', null
  24.  
  25.  
  26. d3.selection.prototype.css = (style)->
  27. style = d3.functor style
  28. @.each (d,i) ->
  29. new csser style(d,i), d3.select(@)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement