Interact with Chart Widget

How can I interact with a chart widget using javascript? So I can call something like chart.resetZoom()?
4 Replies
Lara Zeus
Lara Zeusβ€’3mo ago
is resetZoom an option, dont remember. you can pass it I think on the $options like this: https://filamentglow.com/trick/hide-grids-in-chart-widgets-18382e72
Florian Langer
Florian LangerOPβ€’3mo ago
I installed this plugin: https://www.chartjs.org/chartjs-plugin-zoom/latest/guide/ And I want to have a button that calls chart.resetZoom But it seems like, it's not that easy to access the charts in filament via JS, right?
Getting Started | chartjs-plugin-zoom
A zoom and pan plugin for Chart.js >= 3.0.0
Lara Zeus
Lara Zeusβ€’3mo ago
no sure 100% but these are options
options: {
plugins: {
zoom: {
zoom: {
wheel: {
enabled: true,
},
pinch: {
enabled: true
},
mode: 'xy',
}
}
}
}
options: {
plugins: {
zoom: {
zoom: {
wheel: {
enabled: true,
},
pinch: {
enabled: true
},
mode: 'xy',
}
}
}
}
you can pass them as a php array and I think the plugin will add the button, test and see πŸ™‚
Florian Langer
Florian LangerOPβ€’3mo ago
no, the plugin will not add the button. In ChartJS it's pretty common to do things like chart.someMethod() and call it via JS. That's why I'm asking how I can access this.
Want results from more Discord servers?
Add your server