3π
The Chart.js has the following two versions:
Stand-Alone Build
Files:
dist/Chart.js
dist/Chart.min.js
Bundled Build
Files:
dist/Chart.bundle.js
dist/Chart.bundle.min.js
The Stand-Alone Build does not include moment.js and you have to include it but the Bundled Build includes the moment.js.
Adding the bundled version will include and fix the problem:
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.bundle.min.js"></script>
1π
One way of getting around the CORS problem is requesting the data to the client side as padded JSON. Here is an npm package to do so: https://www.npmjs.com/package/fetch-jsonp
It will return your data as a promise and then you just have to call .json() on it to get back JSON without padding:
fetchJsonp('http://internal-address:5000/api/service_info/tt?severity=2')
.then(data => data.json())
.then(data => console.log(data))
Sounds like that might be a bandaid, but it could get you unstuck for now.
- [Chartjs]-How to change draw order by line property with chart.js
- [Chartjs]-Adding Image inside Linechart points in ChartJs
0π
Maybe try yarn add
instead of npm install
. Your issue reminds me of a similar one I had that was likely solved this way IIRC.
-1π
May be you can delete package-lock.json and do a npm install again, then build again and see if the problem still exists.
- [Chartjs]-Chart.js bar chart change color based on value
- [Chartjs]-Chartjs β Insert additional data into chart tooltip