Your JSON results should be same structure as chardata, and then you make this
var charData =
{
labels = [\\months]
datasets: data.datasets
}
in case that your response (in my case data.datasets) has sam structure like is hardcoded in those examples.