mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 12:48:29 +00:00
Adjust onZoom callback to not trigger on chart.zoomScale introduced in v2.1.0 of the chartjs zoom plugin
Signed-off-by: yubiuser <github@yubiuser.dev>
This commit is contained in:
@@ -515,7 +515,12 @@ $(function () {
|
||||
enabled: true,
|
||||
},
|
||||
mode: "y",
|
||||
onZoom: function ({ chart }) {
|
||||
onZoom: function ({ chart, trigger }) {
|
||||
if (trigger === "api") {
|
||||
// Ignore onZoom triggered by the chart.zoomScale api call below
|
||||
return;
|
||||
}
|
||||
|
||||
// The first time the chart is zoomed, save the maximum initial scale bound
|
||||
if (!chart.absMax) chart.absMax = chart.getInitialScaleBounds().y.max;
|
||||
// Calculate the maximum value to be shown for the current zoom level
|
||||
|
||||
Reference in New Issue
Block a user