use events instead of eventsCallbacks #53

Merged
glitch4347 merged 1 commits from core-0.6.23 into main 9 months ago
  1. 2
      examples/zoom_out.html
  2. 2
      package.json
  3. 6
      src/index.ts
  4. 2
      src/types.ts
  5. 10
      yarn.lock

2
examples/zoom_out.html

@ -20,7 +20,7 @@
zoom: { isActive: true, orientation: "horizontal" },
pan: { isActive: false },
}},
eventsCallbacks: {
events: {
zoomOut: function(centers, ranges) {
console.log('zoomOut', centers, ranges);
}

2
package.json

@ -19,7 +19,7 @@
"author": "CorpGlory",
"license": "ISC",
"dependencies": {
"@chartwerk/core": "^0.6.21"
"@chartwerk/core": "^0.6.23"
},
"devDependencies": {
"copy-webpack-plugin": "^11.0.0",

6
src/index.ts

@ -446,10 +446,10 @@ class LinePod extends ChartwerkPod<LineTimeSerie, LineOptions> {
// TODO: refactor core not to take _options explicitly
if(
this.options._options.eventsCallbacks !== undefined &&
this.options._options.eventsCallbacks.zoomOut !== undefined
this.options._options.events !== undefined &&
this.options._options.events.zoomOut !== undefined
) {
this.options._options.eventsCallbacks.zoomOut(
this.options._options.events.zoomOut(
centers,
[this.state.xValueRange, this.state.yValueRange]
);

2
src/types.ts

@ -12,7 +12,7 @@ type LineTimeSerieParams = {
export type LineTimeSerie = Serie & Partial<LineTimeSerieParams>;
export type LineOptions = Options & {
eventsCallbacks? : {
events? : {
zoomOut?: (centers: {
x: number;
y: number;

10
yarn.lock

@ -5,13 +5,13 @@ __metadata:
version: 6
cacheKey: 8
"@chartwerk/core@npm:^0.6.21":
version: 0.6.21
resolution: "@chartwerk/core@npm:0.6.21"
"@chartwerk/core@npm:^0.6.23":
version: 0.6.23
resolution: "@chartwerk/core@npm:0.6.23"
dependencies:
d3: ^5.16.0
lodash: ^4.17.21
checksum: c536eca30241e775d4d4cfed4d54fd64c2f0299e792056166c90e50e11d9b698b1736b9c0dbf6ec6ea30fecd676f0012c774ff91a1d184eaee00c71b5d9e3925
checksum: 629b0438e8cea02914e12956069d318caa98e6b3e2dd2514aab267474fa87e0aa92c190c4ca0fe95ca8091f83be1e1897801f5632c3f11d9cb3be39fa89cca84
languageName: node
linkType: hard
@ -19,7 +19,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@chartwerk/line-pod@workspace:."
dependencies:
"@chartwerk/core": ^0.6.21
"@chartwerk/core": ^0.6.23
copy-webpack-plugin: ^11.0.0
css-loader: ^6.8.1
style-loader: ^3.3.3

Loading…
Cancel
Save