http://opensoul.org/2012/05/16/the-plight-of-pinocchio/
text: $(this).find('textarea').val()
Instead, use a model
$('#statuses').append('<li>' + data.text + '</li>');
Instead, use a directive
$.ajax({url: '/statuses', success: function(data) {...}
Instead, use a route
50 lines of code
function bubbleChart() {
// Config variables
var margin = {top: 10, right: 10, bottom: 10, left: 10}, diameter = 400,
bubble = d3.layout.pack() ...,
function chart(selection) { selection.each(function(data) { // Build the chart, with reusability in mind (e.g. lifecycle events)
});
}
//Public methods
chart.margin = function(_) {...}
return chart;
}
var data = [get_some_data] var chart = bubbleChart() .margin({top: 0, right: 20, bottom: 0, left: 20});
d3.select('#demo') .datum(data) .call(chart);