Home Forums Chart Support CanvasJS with vuejs using webpack Reply To: CanvasJS with vuejs using webpack


@manoj-mohan, unfortunately my project is huge and has private code from my client, so I will not be able to share it this time. What I can tell is that for CanvasJS work with Quasar.dev, I putted CanvasJS in a separate component and did the following:

Added canvasjs.min.js to /src/assets/canvasjs.min.js:

var CanvasJS = require('src/assets/canvasjs.min.js')

CanvasJS = CanvasJS.Chart ? CanvasJS : window.CanvasJS

Quasar automagically replaces ‘src/..’ with the correct path for webpack.

Also, I had to correct the canvasjs.min.js lint comments, as the linter requires spaces after /* and befor */. I suggest you guys test the lib on Quasar, as it is a more and more adopted framework.

Also, as a performance measure, I declared all Canvas variables outside of the “export default { }”, as they do not need to be reactive in my project, as my data source is an Axios service.

Apart from these measures, I followed your example above for Vue.js.