Scoping D3 to your Backbone view
Recently I used D3 in combination with Backbone.js. Normally when inside a backbone view, you only access the dom elements inside the template you have rendered
var $bar = this.$el.find('.bar')
When selecting objects with D3 instead of jQuery or whatever, I needed to scope my selector to within the Backbone view's scope
var bar = d3.select(this.el).select('.bar')
Written by David Morrow
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Backbone
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#