Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
chartjs-plugin-zoom
Advanced tools
Plugin that enables zoom and pan functionality in Chart.js charts.
The chartjs-plugin-zoom package is a plugin for Chart.js that enables zooming and panning functionalities for charts. It allows users to interact with charts by zooming in and out, as well as panning across the chart area to explore data in more detail.
Zooming
This feature allows users to zoom in and out of the chart using the mouse wheel or pinch gestures. The 'mode' option can be set to 'x', 'y', or 'xy' to control the zooming direction.
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
plugins: {
zoom: {
zoom: {
wheel: {
enabled: true
},
pinch: {
enabled: true
},
mode: 'xy'
}
}
}
}
});
Panning
This feature allows users to pan across the chart area by clicking and dragging. The 'mode' option can be set to 'x', 'y', or 'xy' to control the panning direction.
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
plugins: {
zoom: {
pan: {
enabled: true,
mode: 'xy'
}
}
}
}
});
Reset Zoom
This feature allows users to reset the zoom level to the original state. A button can be added to the UI to trigger the resetZoom method.
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
plugins: {
zoom: {
zoom: {
wheel: {
enabled: true
},
pinch: {
enabled: true
},
mode: 'xy'
}
}
}
}
});
// Reset zoom button
const resetZoomButton = document.getElementById('resetZoom');
resetZoomButton.addEventListener('click', function() {
chart.resetZoom();
});
The chartjs-plugin-dragdata package allows users to drag data points on a Chart.js chart to update the data values. While it provides interactivity similar to chartjs-plugin-zoom, it focuses on modifying data points rather than zooming and panning.
The chartjs-plugin-annotation package enables the addition of annotations to Chart.js charts. It allows users to highlight specific areas or points on the chart. While it enhances chart interactivity, it does not provide zooming or panning functionalities like chartjs-plugin-zoom.
The chartjs-plugin-crosshair package adds a crosshair to Chart.js charts, allowing users to see the exact values of data points as they hover over the chart. It enhances data exploration but does not offer zooming or panning capabilities.
A zoom and pan plugin for Chart.js >= 3.0.0
For Chart.js 2.6.0 to 2.9.x support, use version 0.7.7 of this plugin.
Panning can be done via the mouse or with a finger. Zooming is done via the mouse wheel or via a pinch gesture. Hammer.js is used for gesture recognition.
You can find documentation for chartjs-plugin-zoom at www.chartjs.org/chartjs-plugin-zoom.
Prior to v0.4.0, this plugin was known as 'Chart.Zoom.js'. Old versions are still available on npm under that name.
Before submitting an issue or a pull request to the project, please take a moment to look over the contributing guidelines first.
chartjs-plugin-zoom.js is available under the MIT license.
FAQs
Plugin that enables zoom and pan functionality in Chart.js charts.
The npm package chartjs-plugin-zoom receives a total of 124,094 weekly downloads. As such, chartjs-plugin-zoom popularity was classified as popular.
We found that chartjs-plugin-zoom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.