0👍
your width is always 800. justify it to window size and do the math to make it nest in your box as you want.
width : window.innerWidth,
see this link and write a better code. the way you wrote has performance issue.
JQuery: How to call RESIZE event only once it's FINISHED resizing?
- Chartjs-How to change chart.js chart's grid color?
- Chartjs-How to set responsive width and height of canvas?
Source:stackexchange.com