Skip to content

Instantly share code, notes, and snippets.

@valbeat
Created January 15, 2015 06:50
Show Gist options
  • Save valbeat/a0ce86a31e59db5accfd to your computer and use it in GitHub Desktop.
Save valbeat/a0ce86a31e59db5accfd to your computer and use it in GitHub Desktop.
d3Visualizer
# 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