Skip to content

JavaScript to download a ChartJS chart in high resolution

Notifications You must be signed in to change notification settings

BurninLeo/ChartJS-high-resolution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ChartJS-high-resolution

JavaScript to download a ChartJS chart in high resolution.

Are you using ChartJS charts in your web application, and your customer asked if you could also download the charts? Of course, you can, but the screen resolution is usually insufficient. And when settings a larger width and height to the canvas and scale it down via CSS (setting the ChartJS option responsive: false), the mouseovers from ChartJS will not work properly and more.

Here is a little solution the will create a copy of the Chart in a larger <canvas>, resize the font size and line widths, and provide a download button.

Usage

<script src="highres.js"></script>
<script type="text/javascript">
var canvas = document.getElementById("screenOutput");
var chart = new Chart(canvas, ...);
  
new ChartHighRes(chart, canvas);
</script>

Licence

Please consider this repository public domain.

About

JavaScript to download a ChartJS chart in high resolution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published