Browse Source

Merge pull request 'use events instead of eventsCallbacks' (#53) from core-0.6.23 into main

Reviewed-on: #53
0.6.18
Coin de Gamma 8 months ago
parent
commit
ee08db2f54
  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" }, zoom: { isActive: true, orientation: "horizontal" },
pan: { isActive: false }, pan: { isActive: false },
}}, }},
eventsCallbacks: { events: {
zoomOut: function(centers, ranges) { zoomOut: function(centers, ranges) {
console.log('zoomOut', centers, ranges); console.log('zoomOut', centers, ranges);
} }

2
package.json

@ -19,7 +19,7 @@
"author": "CorpGlory", "author": "CorpGlory",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@chartwerk/core": "^0.6.21" "@chartwerk/core": "^0.6.23"
}, },
"devDependencies": { "devDependencies": {
"copy-webpack-plugin": "^11.0.0", "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 // TODO: refactor core not to take _options explicitly
if( if(
this.options._options.eventsCallbacks !== undefined && this.options._options.events !== undefined &&
this.options._options.eventsCallbacks.zoomOut !== undefined this.options._options.events.zoomOut !== undefined
) { ) {
this.options._options.eventsCallbacks.zoomOut( this.options._options.events.zoomOut(
centers, centers,
[this.state.xValueRange, this.state.yValueRange] [this.state.xValueRange, this.state.yValueRange]
); );

2
src/types.ts

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

10
yarn.lock

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

Loading…
Cancel
Save