Printing chart, resize don't work
- Dominant language
- JavaScript
- Stars
- 67.7k
- Forks
- 11.9k
- Avg merge
- 7h 39m
- Merged PRs (30d)
- 5
Description
I have a problem when I try to print a chart who are responsive, the problem have already been reported but the solution don't work.
Like it's write in the doc at https://www.chartjs.org/docs/latest/general/responsive.html (bottom of the page), I have create an handler for "onbeforeprint" event, with a function who try to resize the chart before printing, but they doesn't work with the last version of chart.js and chrome or firefox. The event fire well, but the resize take too much time to be execute, and the chart keep the width of the browser before the print.
here an example :
`
function beforePrintHandler()
{
for(var id in Chart.instances)
{
Chart.instances[id].resize();
}
}
window.onbeforeprint = beforePrintHandler;`
So I think we need a solution for the resize function work, if you have an idea ?
Thanks
Related subject :
https://github.com/chartjs/Chart.js/issues/1350
https://github.com/chartjs/Chart.js/issues/5206
https://www.chartjs.org/docs/latest/general/responsive.html
https://stackoverflow.com/questions/41674976/resize-chart-js-canvas-for-printing
https://stackoverflow.com/questions/52754926/chartjs-responsive-resize-for-print-not-working-in-firefox-ie11-edge
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.