qwwqwwq / rails_d3_seed

Seed for d3 visualizations inside a Rails app.
14 stars 14 forks source link

why don't you use d3.json? #4

Closed duhaime closed 8 years ago

duhaime commented 8 years ago

Out of curiosity, why don't you use d3.json() to fetch json in your example? Is there a reason to prefer jQuery's $.ajax()? I ask because I regularly use d3.json(), but would switch if there's a reason to prefer jQuery's json fetch.

qwwqwwq commented 8 years ago

Good question.. I would guess that because fetching data for visualization is such a common use case the d3 authors wanted to support it without making users depend on an external library (which would put pressure on them to make sure d3 is compatible with those external libraries). Not all apps will necessarily have jQuery available, and its a lot nicer if you can minimize the number of javascript libraries you depend on.

duhaime commented 8 years ago

Thanks @qwwqwwq, I was thinking the same thing! I'll close this thread.