We supply an initial dataset to the PieChart.
The dataset has two levels of subvalues, which gives us one zoom level.
{
subvalues: [
{
name: "sweden",
value: "2"
"subvalues": [
{
name: "export",
value: "86"
},
{
name: "import",
value: "16"
}
]
}, {
name: "canada",
value: "4"
"subvalues": [
{
name: "transportation",
value: "12"
},
{
name: "sea",
value: "3"
}
]
}
]
}
We then click one of the pie slices to zoom into that slice.
Now our users can replace the contents of the zoomed in sub group.
Say thay want to replace the subvalues of "sweden" with the amount of rain each year.
To replace the data, we use the replaceData(newData)
api function.
{
subvalues: [
{
name: "sweden",
value: "2"
"subvalues": [
{
name: "spring",
value: "234"
},
{
name: "summer",
value: "32"
},
{
name: "autumn",
value: "654"
},
{
name: "winter",
value: "465"
}
]
}
// "canada" looks the same
]
}
When we do this, in some instances we get an error saying Uncaught Error: Invalid Id: 5
.
Are we approaching the replacing of data whilst zoomed in the wrong way?
(Here is the full stack trace of the error)
Uncaught Error: Invalid Id: 5
i.requestPieData @ zoomcharts.js?v=2010-04-12 10:50:00:60
i.getForwardCount @ zoomcharts.js?v=2010-04-12 10:50:00:62
i.updatePie @ zoomcharts.js?v=2010-04-12 10:50:00:62
n.updatePie @ zoomcharts.js?v=2010-04-12 10:50:00:62
i.onSceneChange @ zoomcharts.js?v=2010-04-12 10:50:00:61
i.animateFrame @ zoomcharts.js?v=2010-04-12 10:50:00:41
i.paintScene @ zoomcharts.js?v=2010-04-12 10:50:00:50
(anonymous function) @ zoomcharts.js?v=2010-04-12 10:50:00:50
onError.js:19 Uncaught TypeError: Cannot read property 'apply' of nullwindow.onerror @ onError.js:19