diff --git a/examples/zoom_out.html b/examples/zoom_out.html
new file mode 100644
index 0000000..8c601fe
--- /dev/null
+++ b/examples/zoom_out.html
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/index.ts b/src/index.ts
index 925b516..168b37a 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -443,7 +443,17 @@ class LinePod extends ChartwerkPod {
x: xAxisMiddleValue,
y: yAxisMiddleValue
}
- this.options.callbackZoomOut(centers);
+
+ // TODO: refactor core not to take _options explicitly
+ if(
+ this.options._options.eventsCallbacks !== undefined &&
+ this.options._options.eventsCallbacks.zoomOut !== undefined
+ ) {
+ this.options._options.eventsCallbacks.zoomOut(
+ centers,
+ [this.state.xValueRange, this.state.yValueRange]
+ );
+ }
}
}
diff --git a/src/types.ts b/src/types.ts
index 379763f..d094767 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -1,4 +1,5 @@
import { Serie, Options } from '@chartwerk/core';
+import { AxisRange } from '@chartwerk/core/dist/types';
type LineTimeSerieParams = {
maxLength: number,
@@ -10,7 +11,14 @@ type LineTimeSerieParams = {
}
export type LineTimeSerie = Serie & Partial;
-export type LineOptions = Options;
+export type LineOptions = Options & {
+ eventsCallbacks? : {
+ zoomOut?: (centers: {
+ x: number;
+ y: number;
+ }, range: AxisRange[]) => void;
+ }
+}
export type MouseObj = {
x: number,