Created
January 15, 2015 06:50
-
-
Save valbeat/a0ce86a31e59db5accfd to your computer and use it in GitHub Desktop.
d3Visualizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# d3のビジュアライザー | |
class Visualizer | |
el: 'svg' | |
dom: null | |
constructor : (selector)-> | |
selection = d3.select('selector') | |
@dom = selection.append(@el) | |
@initialize() | |
initialize: -> | |
this | |
# domにattrを加える | |
setAttr : (attributes)-> | |
return unless attributes | |
@dom.attr(attributes) | |
this | |
# domにイベントを設定 | |
setEvents : (events)-> | |
return unless events | |
for key, value of events | |
@dom.on(key, value) | |
this | |
module.exports = Visualizer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment