Attempting to work with Json for the first time has proven to be challenging. The issue lies with the controller not returning the necessary data in the correct format.
The desired JSON output should look like:
[
{"ID":1,"month":"september","sale":120},
{"ID":2,"month":"september","sale":122}
]
The chart requires data structured as follows:
data: [
['Firefox', 45.0],
['IE', 26.8],
{
name: 'Chrome',
y: 12.8,
}]
How can we transform the controller's output into the required chart format?
The current attempted solution is not effective:
var data=[];
var uri = 'api/chartapi';
/* $(function () {
$.getJSON(uri)
.done(function (json) {
$.each(data, function (name, score) { {
data.push({
name: name,
y: score
});
}
});
});
});