Chartjs-Unable to plot JSON to chartJS

1👍

You have configured your chart to be of type “line”. The documentation for this type specifies that a dataset’s data can be an Array of Numbers or an Array of Points, where a Point is an Object with a x property and a y property.

Your data is a JSON stringified Array of objects, each with a close property.

You need to map your prices Array into an Array of Numbers. In JavaScript, this could be done as:

prices.map(function (price) {
    return price.close;
});

I have created a fiddle as an example.

Leave a comment