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
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#