d3 js - loading json without a http get

前端 未结 3 1384
无人共我
无人共我 2020-11-29 18:57

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

3条回答
  •  悲哀的现实
    2020-11-29 19:33

    The answer from chumkiu worked great for me but needed a couple of tweaks - in the latest version of the d3 bubble chart, you need to define root rather than json, as in

     root = JSON.parse( myjson );
    

    Alternatively, you could replace "root" with "json" in the rest of the code of course. :-)

    For anyone coming to this answer with questions about d3 node-link trees that utilize local data sets, this answer worked great for me - many thanks to the contributors on this page.

提交回复
热议问题