0
我迷失了圖形創建中的錯誤,任何人都可以幫助我嗎? 我試圖創建此圖表: http://bl.ocks.org/wvengen/cab9b01816490edb7083d3圖表sankey json錯誤
但是,每當發生錯誤和瀏覽器崩潰。 發生此錯誤是因爲我的json中的一些項目,但我不知道錯誤的正確原因。
文檔實例的JSON是這樣的:
https://rawgit.com/q-m/d3.chart.sankey/master/example/data/product.json
我的JSON是這樣的:
{
"nodes":[
{
"name":"Biblioteca",
"hotspot":169,
"id":"biblioteca_score"
},
{
"name":"Parque da Cidade",
"hotspot":171,
"id":"parque_da_cidade_score"
},
{
"name":"Term. Vila Arens",
"hotspot":172,
"id":"term_vila_arens_score"
},
{
"name":"Term. Cecap",
"hotspot":175,
"id":"term_cecap_score"
},
{
"name":"Term. Central",
"hotspot":177,
"id":"term_central_score"
},
{
"name":"Term. Vila Rami",
"hotspot":178,
"id":"term_vila_rami_score"
},
{
"name":"Term. Hortolandia",
"hotspot":180,
"id":"term_hortolandia_score"
},
{
"name":"Term. Colonia",
"hotspot":181,
"id":"term_colonia_score"
}
],
"links":[
{
"value":1,
"source":2,
"target":0
},
{
"value":1,
"source":3,
"target":0
},
{
"value":1,
"source":2,
"target":1
},
{
"value":3,
"source":3,
"target":2
},
{
"value":7,
"source":3,
"target":2
}
],
"colors":{
"biblioteca":"#d0b011",
"parque_da_cidade":"#c46be7",
"term__cecap":"#3d64e5",
"term__central":"#171daf",
"term__vila_rami":"#fec7ea",
"term__hortolandia":"#af2dfd",
"term__colonia":"#dad439"
}
}
所有數據的JSON產生一個錯誤,但如果我只留下下面的數據它的工作原理:
{
"nodes":[
{
"name":"Biblioteca",
"hotspot":169,
"id":"biblioteca_score"
},
{
"name":"Parque da Cidade",
"hotspot":171,
"id":"parque_da_cidade_score"
},
{
"name":"Term. Vila Arens",
"hotspot":172,
"id":"term_vila_arens_score"
},
{
"name":"Term. Cecap",
"hotspot":175,
"id":"term_cecap_score"
},
{
"name":"Term. Central",
"hotspot":177,
"id":"term_central_score"
},
{
"name":"Term. Vila Rami",
"hotspot":178,
"id":"term_vila_rami_score"
},
{
"name":"Term. Hortolandia",
"hotspot":180,
"id":"term_hortolandia_score"
},
{
"name":"Term. Colonia",
"hotspot":181,
"id":"term_colonia_score"
}
],
"links":[
{
"value":1,
"source":2,
"target":0
},
{
"value":1,
"source":3,
"target":0
},
{
"value":1,
"source":2,
"target":1
},
{
"value":3,
"source":3,
"target":2
},
{
"value":7,
"source":3,
"target":2
}
],
"colors":{
"biblioteca":"#d0b011",
"parque_da_cidade":"#c46be7",
"term__cecap":"#3d64e5",
"term__central":"#171daf",
"term__vila_rami":"#fec7ea",
"term__hortolandia":"#af2dfd",
"term__colonia":"#dad439"
}
}
有沒有人有任何想法爲什麼?
例如,您可以分享一些代碼?而你說「因爲我的json有幾件東西」。你確定了哪些項目? – blm