Get json data in d3 from lift snippet

依然范特西╮ 提交于 2019-12-06 10:50:00

You could move your json data retrieval to REST API.

object MyGraphApi extends RestHelper {
   serve {
     case Req("graph" :: Nil, _, GetRequest)  => {
       JsonResponse(myGraphObject)
     }
   }
}

Then you can ajax pull it inside page using /graph url.

The solution of Lukasz, using the REST API works totally fine. During my research I also found out that my problem was just a javascript issue: I didn't need to use d3.json(...).

So I just had to remove the function d3.json(...) and put all that was inside outside of it. Then just call mygraph.nodes for example instead of json.nodes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!