@tetacom/svg-charts 1.7.10 → 1.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,12 @@ import { ZoomService } from '../service/zoom.service';
3
3
  import { IChartConfig } from '../model/i-chart-config';
4
4
  import { Axis } from '../core/axis/axis';
5
5
  import { D3ZoomEvent } from 'd3';
6
- import { ChartService } from '../service/chart.service';
6
+ import { ScaleService } from '../service/scale.service';
7
7
  import * as i0 from "@angular/core";
8
8
  export declare class ZoomableDirective implements OnDestroy, AfterViewInit {
9
9
  private elementRef;
10
10
  private zoomService;
11
- private chartService;
11
+ private scaleService;
12
12
  private zone;
13
13
  config: IChartConfig;
14
14
  axis: Axis;
@@ -21,7 +21,7 @@ export declare class ZoomableDirective implements OnDestroy, AfterViewInit {
21
21
  mouseenter(): void;
22
22
  mouseleave(): void;
23
23
  private currentTransform;
24
- constructor(elementRef: ElementRef, zoomService: ZoomService, chartService: ChartService, zone: NgZone);
24
+ constructor(elementRef: ElementRef, zoomService: ZoomService, scaleService: ScaleService, zone: NgZone);
25
25
  ngOnInit(): void;
26
26
  ngAfterViewInit(): void;
27
27
  ngOnDestroy(): void;
@@ -119,7 +119,7 @@ const defaultChartConfig = () => ({
119
119
  enable: true,
120
120
  },
121
121
  controls: {
122
- enable: true,
122
+ enable: false,
123
123
  },
124
124
  tooltip: {
125
125
  enable: true,
@@ -1231,7 +1231,6 @@ class ZoomableDirective {
1231
1231
  mouseenter() {
1232
1232
  this.zoom?.on('start zoom end', this.zoomed);
1233
1233
  this._element?.call(this.zoom).on('dblclick.zoom', null);
1234
- // Run wheel event listener
1235
1234
  if (this.config?.zoom?.zoomBehavior === ZoomBehaviorType.wheel) {
1236
1235
  this.runWheelTranslate();
1237
1236
  }
@@ -1240,10 +1239,10 @@ class ZoomableDirective {
1240
1239
  this.zoom?.on('start zoom end', null);
1241
1240
  this._element?.on('wheel', null);
1242
1241
  }
1243
- constructor(elementRef, zoomService, chartService, zone) {
1242
+ constructor(elementRef, zoomService, scaleService, zone) {
1244
1243
  this.elementRef = elementRef;
1245
1244
  this.zoomService = zoomService;
1246
- this.chartService = chartService;
1245
+ this.scaleService = scaleService;
1247
1246
  this.zone = zone;
1248
1247
  this.zoomable = false;
1249
1248
  this.crosshair = false;
@@ -1301,20 +1300,21 @@ class ZoomableDirective {
1301
1300
  this.alive = false;
1302
1301
  }
1303
1302
  initZoomSync() {
1304
- this.zoomService.zoomed.pipe(takeWhile(() => this.alive)).subscribe((zoomed) => {
1303
+ combineLatest([this.scaleService.scales, this.zoomService.zoomed]).pipe(takeWhile(() => this.alive)).subscribe((data) => {
1304
+ const [scales, zoomed] = data;
1305
1305
  if (this._element &&
1306
- this.elementRef !== zoomed?.element &&
1307
1306
  zoomed?.axis?.index === this.axis.index &&
1308
1307
  zoomed?.axis?.orientation === this.axis.orientation) {
1309
- const scale = this.axis.scale.copy().domain(this.axis.originDomain);
1308
+ const axis = this.axis.orientation === AxisOrientation.x ? scales.x.get(this.axis.index) : scales.y.get(this.axis.index);
1309
+ const scale = axis.scale.copy().domain(this.axis.originDomain);
1310
1310
  let transform;
1311
1311
  if (zoomed.domain === null) {
1312
1312
  transform = zoomIdentity;
1313
1313
  }
1314
1314
  else {
1315
- transform = this.zoomService.getD3Transform(zoomed.domain, this.axis.originDomain, scale, this.axis.orientation, this.axis.options.inverted);
1315
+ transform = this.zoomService.getD3Transform(zoomed.domain, axis.originDomain, scale, axis.orientation, axis.options.inverted);
1316
1316
  }
1317
- this._element.call(this.zoom.transform, transform);
1317
+ this.elementRef.nativeElement.__zoom = transform;
1318
1318
  this.currentTransform = transform;
1319
1319
  }
1320
1320
  });
@@ -1408,7 +1408,7 @@ class ZoomableDirective {
1408
1408
  domain,
1409
1409
  chartId: this.config.id,
1410
1410
  });
1411
- this._element?.call(this.zoom.transform, transform);
1411
+ this.elementRef.nativeElement.__zoom = transform;
1412
1412
  this.zoomService.fireZoom(message);
1413
1413
  this.zoomService.broadcastZoom(message);
1414
1414
  this.currentTransform = transform;
@@ -1429,7 +1429,7 @@ class ZoomableDirective {
1429
1429
  });
1430
1430
  });
1431
1431
  }
1432
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ZoomableDirective, deps: [{ token: i0.ElementRef }, { token: ZoomService }, { token: ChartService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
1432
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ZoomableDirective, deps: [{ token: i0.ElementRef }, { token: ZoomService }, { token: ScaleService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
1433
1433
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: ZoomableDirective, isStandalone: true, selector: "[tetaZoomable]", inputs: { config: "config", axis: "axis", size: "size" }, host: { listeners: { "mouseenter": "mouseenter()", "mouseleave": "mouseleave()" }, properties: { "class.zoomable": "this.zoomable", "class.crosshair": "this.crosshair" } }, ngImport: i0 }); }
1434
1434
  }
1435
1435
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ZoomableDirective, decorators: [{
@@ -1438,7 +1438,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
1438
1438
  selector: '[tetaZoomable]',
1439
1439
  standalone: true,
1440
1440
  }]
1441
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ZoomService }, { type: ChartService }, { type: i0.NgZone }], propDecorators: { config: [{
1441
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ZoomService }, { type: ScaleService }, { type: i0.NgZone }], propDecorators: { config: [{
1442
1442
  type: Input
1443
1443
  }], axis: [{
1444
1444
  type: Input