Get started with chartjs-plugin-zoom CDN
MIT licensed
ChartJS-Plugin-Zoom is a Chart.js plugin that enables zooming and panning functionality for charts.
Tags:- chartjs
- plugin
- zoom
- pan
- mouse
Stable version
Copied!
How to start using chartjs-plugin-zoom CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with chartjs-plugin-zoom CDN - cdnhub.io</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"></script>
<script src="https://cdn.cdnhub.io/chartjs-plugin-zoom/2.0.1/chartjs-plugin-zoom.min.js"></script>
<style>
#myChart {
width: 400px;
height: 400px;
}
</style>
</head>
<body>
<canvas id="myChart"></canvas>
<script>
const ctx = document.getElementById('myChart').getContext('2d');
const myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
datasets: [{
label: 'Temperature (°C)',
data: [7, 9, 12, 15, 17, 18, 20],
borderColor: 'rgba(75, 192, 193, 1)',
fill: false
}]
},
options: {
plugins: {
zoom: {
pan: {
enabled: true,
mode: 'xy'
},
zoom: {
enabled: true,
mode: 'xy'
}
}
}
}
});
</script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!