73
rated 0 times
[
76]
[
3]
/ answers: 1 / hits: 69873
/ 12 Years ago, thu, june 7, 2012, 12:00:00
I am learning d3. There are certain ways of loading the data in d3 js. But all of them seem to make a HTTP GET. In my scenario, I already have the json data in a string. How can I use this string instead of making another http request? I tried to look for documentation for this but found none.
This works:
d3.json(/path/flare.json, function(json) {
//rendering logic here
}
Now, if I have:
//assume this json comes from a server (on SAME DOMAIN)
var myjson = '{name: flare,children: [{name: analytics,children: [{name: cluster,children: [{name: MergeEdge, size: 10 }]}]}]}';
How do I use already computed 'myjson' in d3 & avoid a async call to server? Thanks.
More From » json