@tetacom/svg-charts 1.1.13 → 1.1.16

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.
Files changed (36) hide show
  1. package/chart/chart-container/chart-container.component.d.ts +0 -2
  2. package/chart/chart-container/gridlines/gridlines.component.d.ts +15 -11
  3. package/chart/chart.module.d.ts +2 -1
  4. package/chart/directives/brushable.directive.d.ts +2 -3
  5. package/chart/directives/zoomable.directive.d.ts +7 -5
  6. package/chart/model/enum/public-api.d.ts +1 -0
  7. package/chart/model/enum/zoom-behavior-type.d.ts +4 -0
  8. package/chart/model/i-broadcast-message.d.ts +4 -2
  9. package/chart/model/i-chart-config.d.ts +5 -0
  10. package/chart/model/tooltip-options.d.ts +4 -0
  11. package/chart/service/chart.service.d.ts +1 -0
  12. package/esm2020/chart/chart-container/chart-container.component.mjs +16 -16
  13. package/esm2020/chart/chart-container/gridlines/gridlines.component.mjs +18 -22
  14. package/esm2020/chart/chart-container/series/area-series/area-series.component.mjs +4 -3
  15. package/esm2020/chart/chart-container/series/line/line-series.component.mjs +5 -4
  16. package/esm2020/chart/chart-container/series/linear-series-base.mjs +5 -2
  17. package/esm2020/chart/chart-container/tooltip/tooltip.component.mjs +3 -3
  18. package/esm2020/chart/chart.module.mjs +5 -4
  19. package/esm2020/chart/default/default-chart-config.mjs +7 -1
  20. package/esm2020/chart/directives/brushable.directive.mjs +3 -5
  21. package/esm2020/chart/directives/zoomable.directive.mjs +92 -22
  22. package/esm2020/chart/legend/legend.component.mjs +2 -1
  23. package/esm2020/chart/model/chart-bounds.mjs +2 -2
  24. package/esm2020/chart/model/enum/public-api.mjs +2 -1
  25. package/esm2020/chart/model/enum/zoom-behavior-type.mjs +6 -0
  26. package/esm2020/chart/model/i-broadcast-message.mjs +2 -1
  27. package/esm2020/chart/model/i-chart-config.mjs +1 -1
  28. package/esm2020/chart/model/tooltip-options.mjs +1 -1
  29. package/esm2020/chart/service/brush.service.mjs +22 -19
  30. package/esm2020/chart/service/chart.service.mjs +7 -5
  31. package/esm2020/chart/service/scale.service.mjs +7 -1
  32. package/fesm2015/tetacom-svg-charts.mjs +189 -100
  33. package/fesm2015/tetacom-svg-charts.mjs.map +1 -1
  34. package/fesm2020/tetacom-svg-charts.mjs +179 -93
  35. package/fesm2020/tetacom-svg-charts.mjs.map +1 -1
  36. package/package.json +1 -1
@@ -2,12 +2,14 @@ import * as i0 from '@angular/core';
2
2
  import { Injectable, Component, ChangeDetectionStrategy, Input, ViewChild, HostListener, ChangeDetectorRef, Directive, HostBinding, EventEmitter, Output, NgModule } from '@angular/core';
3
3
  import * as i4 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
- import { BehaviorSubject, Subject, map, shareReplay, filter, combineLatest, withLatestFrom, ReplaySubject, animationFrameScheduler, tap, takeWhile } from 'rxjs';
5
+ import { BehaviorSubject, Subject, of, withLatestFrom, map, shareReplay, filter, combineLatest, ReplaySubject, animationFrameScheduler, tap, takeWhile } from 'rxjs';
6
6
  import * as d3 from 'd3';
7
7
  import { zoomIdentity } from 'd3';
8
8
  import { maxIndex } from 'd3-array';
9
- import { throttleTime, debounceTime, tap as tap$1 } from 'rxjs/operators';
9
+ import { throttleTime, tap as tap$1, debounceTime } from 'rxjs/operators';
10
10
  import * as i3 from '@angular/platform-browser';
11
+ import * as i4$1 from '@taiga-ui/cdk';
12
+ import { TuiLetModule } from '@taiga-ui/cdk';
11
13
 
12
14
  var ZoomType;
13
15
  (function (ZoomType) {
@@ -18,7 +20,7 @@ var ZoomType;
18
20
 
19
21
  class ChartBounds {
20
22
  constructor(options) {
21
- this.top = 0;
23
+ this.top = 30;
22
24
  this.right = 30;
23
25
  this.bottom = 0;
24
26
  this.left = 0;
@@ -35,10 +37,17 @@ var TooltipTracking;
35
37
  TooltipTracking[TooltipTracking["y"] = 1] = "y";
36
38
  })(TooltipTracking || (TooltipTracking = {}));
37
39
 
40
+ var ZoomBehaviorType;
41
+ (function (ZoomBehaviorType) {
42
+ ZoomBehaviorType[ZoomBehaviorType["move"] = 0] = "move";
43
+ ZoomBehaviorType[ZoomBehaviorType["wheel"] = 1] = "wheel";
44
+ })(ZoomBehaviorType || (ZoomBehaviorType = {}));
45
+
38
46
  const defaultChartConfig = () => ({
39
47
  zoom: {
40
48
  enable: true,
41
49
  type: ZoomType.x,
50
+ zoomBehavior: ZoomBehaviorType.move
42
51
  },
43
52
  bounds: new ChartBounds(),
44
53
  legend: {
@@ -48,6 +57,10 @@ const defaultChartConfig = () => ({
48
57
  enable: true,
49
58
  showMarkers: true,
50
59
  tracking: TooltipTracking.x,
60
+ padding: {
61
+ x: 16,
62
+ y: 16
63
+ }
51
64
  },
52
65
  xAxis: [],
53
66
  yAxis: [],
@@ -119,9 +132,10 @@ class ChartService {
119
132
  this.chartContextMenu$ = new Subject();
120
133
  this.annotationEvent$ = new Subject();
121
134
  this.annotationMove$ = new Subject();
135
+ this.id = of((Date.now() + Math.random()).toString(36));
122
136
  this.config = this.config$
123
137
  .asObservable()
124
- .pipe(map(this.setDefaults), map(this.setPreparationData), shareReplay({
138
+ .pipe(withLatestFrom(this.id), map(this.setDefaults), map(this.setPreparationData), shareReplay({
125
139
  bufferSize: 1,
126
140
  refCount: true
127
141
  }));
@@ -187,13 +201,15 @@ class ChartService {
187
201
  emitChartContextMenu(event) {
188
202
  this.chartContextMenu$.next(event);
189
203
  }
190
- setDefaults(config) {
204
+ setDefaults(data) {
205
+ let [config, id] = data;
191
206
  const defaultConfig = (defaultConfig) => {
192
207
  return (source) => {
193
208
  return Object.assign({}, defaultConfig, source);
194
209
  };
195
210
  };
196
211
  config = Object.assign({}, defaultChartConfig(), config);
212
+ config.id = id;
197
213
  config.xAxis = config.xAxis.map(defaultConfig(defaultAxisConfig));
198
214
  config.yAxis = config.yAxis.map(defaultConfig(defaultAxisConfig));
199
215
  config.series = config.series.map(defaultConfig(defaultSeriesConfig()));
@@ -204,7 +220,6 @@ class ChartService {
204
220
  };
205
221
  });
206
222
  config.tooltip = Object.assign({}, defaultChartConfig().tooltip, config.tooltip);
207
- const id = (Date.now() + Math.random()).toString(36);
208
223
  config.zoom.syncChannel = config.zoom?.syncChannel ?? id;
209
224
  return config;
210
225
  }
@@ -466,6 +481,9 @@ class ScaleService {
466
481
  map.set(index, Axis.createAxis(AxisOrientation.x, config, index));
467
482
  });
468
483
  return map;
484
+ }), shareReplay({
485
+ bufferSize: 1,
486
+ refCount: true
469
487
  }));
470
488
  this.yAxisMap = combineLatest([
471
489
  this.chartService.size,
@@ -477,6 +495,9 @@ class ScaleService {
477
495
  map.set(index, Axis.createAxis(AxisOrientation.y, config, index));
478
496
  });
479
497
  return map;
498
+ }), shareReplay({
499
+ bufferSize: 1,
500
+ refCount: true
480
501
  }));
481
502
  this.xScaleMap = combineLatest([
482
503
  this.chartService.size,
@@ -610,6 +631,7 @@ class ZoomMessage {
610
631
  this.event = options?.event;
611
632
  this.axis = options?.axis;
612
633
  this.brushDomain = options.brushDomain;
634
+ this.chartId = options?.chartId;
613
635
  }
614
636
  }
615
637
  class BrushMessage {
@@ -678,11 +700,11 @@ class BrushService {
678
700
  const halfBrushHeight = (selection[1] - selection[0]) / 2;
679
701
  const invertedSelection = [from - halfBrushHeight, to + halfBrushHeight].map(brushScale.invert);
680
702
  if (invertedSelection[1] - invertedSelection[0] > config.brush?.max) {
681
- container.call(this.brush.move, [invertedSelection[0], invertedSelection[0] + config.brush?.max].map(brushScale));
703
+ container.call(this.brush.move, [Math.floor(invertedSelection[0]), Math.floor(invertedSelection[0] + config.brush?.max)].map(brushScale));
682
704
  return;
683
705
  }
684
706
  if (invertedSelection[1] - invertedSelection[0] < config.brush?.min) {
685
- container.call(this.brush.move, [invertedSelection[0], invertedSelection[0] + config.brush?.min].map(brushScale));
707
+ container.call(this.brush.move, [Math.floor(invertedSelection[0]), Math.ceil(invertedSelection[0] + config.brush?.min)].map(brushScale));
686
708
  return;
687
709
  }
688
710
  container.call(this.brush.move, [from - halfBrushHeight, to + halfBrushHeight]);
@@ -728,23 +750,25 @@ class BrushService {
728
750
  return m.message.event.sourceEvent instanceof MouseEvent || m.message.event.sourceEvent instanceof WheelEvent;
729
751
  }), throttleTime(0, animationFrameScheduler, { trailing: true }), tap((m) => {
730
752
  const { message: { brushDomain } } = m;
731
- container.call(this.brush.move, [
732
- brushScale(brushDomain[0]),
733
- brushScale(brushDomain[1]),
734
- ]);
735
- if (m.message.event.type === 'end') {
736
- const brushMessage = new BrushMessage({
737
- event: null,
738
- selection: brushDomain,
739
- brushType: config?.brush?.type ?? BrushType.x,
740
- brushScale,
741
- });
742
- this.broadcastService.broadcastBrush({
743
- channel: config?.zoom?.syncChannel,
744
- message: brushMessage,
745
- });
753
+ if (m.message?.axis.index === 0 && m.message?.axis.orientation === AxisOrientation.y && config.brush?.type === BrushType.y || m.message?.axis.orientation === AxisOrientation.x && config.brush?.type === BrushType.x) {
754
+ container.call(this.brush.move, [
755
+ brushScale(brushDomain[0]),
756
+ brushScale(brushDomain[1]),
757
+ ]);
758
+ if (m.message.event.type === 'end') {
759
+ const brushMessage = new BrushMessage({
760
+ event: null,
761
+ selection: brushDomain,
762
+ brushType: config?.brush?.type ?? BrushType.x,
763
+ brushScale,
764
+ });
765
+ this.broadcastService.broadcastBrush({
766
+ channel: config?.zoom?.syncChannel,
767
+ message: brushMessage,
768
+ });
769
+ }
770
+ this.selection = brushDomain;
746
771
  }
747
- this.selection = brushDomain;
748
772
  })).subscribe();
749
773
  }
750
774
  }
@@ -808,12 +832,12 @@ class TooltipComponent {
808
832
  getPosition(event) {
809
833
  const centerX = this.size.width / 2;
810
834
  const centerY = this.size.height / 2;
811
- const padding = { x: 10, y: 10 };
835
+ const padding = this.config?.tooltip?.padding;
812
836
  const scene = {
813
837
  left: event.pageX > centerX ? 'initial' : `${event.pageX + padding.x}px`,
814
838
  top: event.pageY > centerY ? 'initial' : `${event.pageY + padding.y}px`,
815
839
  bottom: event.pageY > centerY
816
- ? `${window.innerHeight - event.pageY}px`
840
+ ? `${window.innerHeight - event.pageY + padding.y}px`
817
841
  : 'initial',
818
842
  right: event.pageX > centerX
819
843
  ? `${window.innerWidth - event.pageX + padding.x}px`
@@ -939,31 +963,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
939
963
  }] } });
940
964
 
941
965
  class GridlinesComponent {
942
- constructor() {
943
- }
944
- draw() {
945
- this.tickYValues = this.yScaleMap.get(0).ticks();
946
- this.tickXValues = this.xScaleMap.get(0).ticks();
966
+ constructor(svc, chartService) {
967
+ this.svc = svc;
968
+ this.chartService = chartService;
969
+ this.config = this.chartService.config;
970
+ this.tickYValues = this.svc.yScaleMap.pipe(map((_) => _.get(0).ticks()));
971
+ this.tickXValues = this.svc.xScaleMap.pipe(map((_) => _.get(0).ticks()));
972
+ this.y = this.svc.yScaleMap.pipe(map((_) => _.get(0)));
973
+ this.x = this.svc.xScaleMap.pipe(map((_) => _.get(0)));
947
974
  }
948
- ngOnChanges(changes) {
949
- if (changes.hasOwnProperty('xScaleMap') &&
950
- changes.hasOwnProperty('yScaleMap')) {
951
- this.draw();
952
- }
975
+ ngAfterViewInit() {
953
976
  }
954
977
  }
955
- GridlinesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GridlinesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
956
- GridlinesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: GridlinesComponent, selector: "[teta-gridlines]", inputs: { size: "size", xScaleMap: "xScaleMap", yScaleMap: "yScaleMap", config: "config" }, usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"config.gridLines?.showY !== false\" >\n <ng-container *ngFor=\"let tick of tickYValues\">\n <svg:line [attr.x1]=\"0\" stroke=\"red\"\n [attr.y1]=\"yScaleMap.get(0)(tick)\"\n [attr.x2]=\"size?.width\"\n [attr.y2]=\"yScaleMap.get(0)(tick)\"></svg:line>\n </ng-container>\n</ng-container>\n\n<ng-container *ngIf=\"config.gridLines?.showX !== false\" >\n <ng-container *ngFor=\"let tick of tickXValues\">\n <svg:line [attr.x1]=\"xScaleMap.get(0)(tick)\"\n stroke=\"red\"\n [attr.y1]=\"0\"\n [attr.x2]=\"xScaleMap.get(0)(tick)\"\n [attr.y2]=\"size?.height\"></svg:line>\n </ng-container>\n</ng-container>\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke-dasharray:1,4;stroke:var(--color-text-20)}\n"], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
978
+ GridlinesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GridlinesComponent, deps: [{ token: ScaleService }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Component });
979
+ GridlinesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: GridlinesComponent, selector: "[teta-gridlines]", inputs: { size: "size" }, ngImport: i0, template: "<ng-container *ngIf=\"{\n xValues: tickXValues | async,\n yValues: tickYValues | async,\n x: x | async,\n y: y | async,\n config: config | async\n} as data\">\n <ng-container *ngIf=\"data.config.gridLines?.showY !== false\">\n <ng-container *ngFor=\"let tick of data.yValues\">\n <svg:line [attr.x1]=\"0\"\n [attr.y1]=\"data.y(tick)\"\n [attr.x2]=\"size?.width\"\n [attr.y2]=\"data.y(tick)\"></svg:line>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"data.config.gridLines?.showX !== false\">\n <ng-container *ngFor=\"let tick of data.xValues\">\n <svg:line [attr.x1]=\"data.x(tick)\"\n [attr.y1]=\"0\"\n [attr.x2]=\"data.x(tick)\"\n [attr.y2]=\"size?.height\"></svg:line>\n </ng-container>\n </ng-container>\n\n</ng-container>\n\n\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke-dasharray:1,4;stroke:var(--color-text-20)}\n"], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
957
980
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GridlinesComponent, decorators: [{
958
981
  type: Component,
959
- args: [{ selector: '[teta-gridlines]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"config.gridLines?.showY !== false\" >\n <ng-container *ngFor=\"let tick of tickYValues\">\n <svg:line [attr.x1]=\"0\" stroke=\"red\"\n [attr.y1]=\"yScaleMap.get(0)(tick)\"\n [attr.x2]=\"size?.width\"\n [attr.y2]=\"yScaleMap.get(0)(tick)\"></svg:line>\n </ng-container>\n</ng-container>\n\n<ng-container *ngIf=\"config.gridLines?.showX !== false\" >\n <ng-container *ngFor=\"let tick of tickXValues\">\n <svg:line [attr.x1]=\"xScaleMap.get(0)(tick)\"\n stroke=\"red\"\n [attr.y1]=\"0\"\n [attr.x2]=\"xScaleMap.get(0)(tick)\"\n [attr.y2]=\"size?.height\"></svg:line>\n </ng-container>\n</ng-container>\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke-dasharray:1,4;stroke:var(--color-text-20)}\n"] }]
960
- }], ctorParameters: function () { return []; }, propDecorators: { size: [{
961
- type: Input
962
- }], xScaleMap: [{
963
- type: Input
964
- }], yScaleMap: [{
965
- type: Input
966
- }], config: [{
982
+ args: [{ selector: '[teta-gridlines]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n xValues: tickXValues | async,\n yValues: tickYValues | async,\n x: x | async,\n y: y | async,\n config: config | async\n} as data\">\n <ng-container *ngIf=\"data.config.gridLines?.showY !== false\">\n <ng-container *ngFor=\"let tick of data.yValues\">\n <svg:line [attr.x1]=\"0\"\n [attr.y1]=\"data.y(tick)\"\n [attr.x2]=\"size?.width\"\n [attr.y2]=\"data.y(tick)\"></svg:line>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"data.config.gridLines?.showX !== false\">\n <ng-container *ngFor=\"let tick of data.xValues\">\n <svg:line [attr.x1]=\"data.x(tick)\"\n [attr.y1]=\"0\"\n [attr.x2]=\"data.x(tick)\"\n [attr.y2]=\"size?.height\"></svg:line>\n </ng-container>\n </ng-container>\n\n</ng-container>\n\n\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke-dasharray:1,4;stroke:var(--color-text-20)}\n"] }]
983
+ }], ctorParameters: function () { return [{ type: ScaleService }, { type: ChartService }]; }, propDecorators: { size: [{
967
984
  type: Input
968
985
  }] } });
969
986
 
@@ -1246,7 +1263,7 @@ class LinearSeriesBase extends SeriesBaseComponent {
1246
1263
  this.transform = this.svc.pointerMove.pipe(withLatestFrom(this.scaleService.xScaleMap, this.scaleService.yScaleMap), map((data) => {
1247
1264
  const [event, x, y] = data;
1248
1265
  return this.getTransform(event, x, y);
1249
- }), tap(() => this.cdr.detectChanges()));
1266
+ }), tap(() => setTimeout(() => this.cdr.detectChanges())));
1250
1267
  this.path = combineLatest([
1251
1268
  this.scaleService.xScaleMap,
1252
1269
  this.scaleService.yScaleMap,
@@ -1318,6 +1335,9 @@ class LinearSeriesBase extends SeriesBaseComponent {
1318
1335
  return this.series.data?.filter((_) => _?.marker);
1319
1336
  }
1320
1337
  getTransform(event, scaleX, scaleY) {
1338
+ if (event.type === 'mouseleave') {
1339
+ return null;
1340
+ }
1321
1341
  const mouse = [event?.offsetX, event?.offsetY];
1322
1342
  const foundX = scaleX.get(this.series.xAxisIndex);
1323
1343
  const foundY = scaleY.get(this.series.yAxisIndex);
@@ -1422,10 +1442,10 @@ class LineSeriesComponent extends LinearSeriesBase {
1422
1442
  }
1423
1443
  }
1424
1444
  LineSeriesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: LineSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1425
- LineSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: LineSeriesComponent, selector: "svg:svg[teta-line-series]", usesInheritance: true, ngImport: i0, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n<ng-container *ngIf=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t.x !== undefined && t.y!== undefined\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n\n<ng-container *ngIf=\"getMarkers() as markers\">\n <svg:circle\n class=\"marker\"\n *ngFor=\"let point of markers\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n</ng-container>\n\n\n\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1445
+ LineSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: LineSeriesComponent, selector: "svg:svg[teta-line-series]", usesInheritance: true, ngImport: i0, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n<ng-container *tuiLet=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t?.x !=null && t?.y!=null\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n<ng-container *ngIf=\"getMarkers() as markers\">\n <svg:circle\n class=\"marker\"\n *ngFor=\"let point of markers\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n</ng-container>\n\n\n\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"], directives: [{ type: i4$1.TuiLetDirective, selector: "[tuiLet]", inputs: ["tuiLet"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1426
1446
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: LineSeriesComponent, decorators: [{
1427
1447
  type: Component,
1428
- args: [{ selector: 'svg:svg[teta-line-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n<ng-container *ngIf=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t.x !== undefined && t.y!== undefined\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n\n<ng-container *ngIf=\"getMarkers() as markers\">\n <svg:circle\n class=\"marker\"\n *ngFor=\"let point of markers\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n</ng-container>\n\n\n\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
1448
+ args: [{ selector: 'svg:svg[teta-line-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n<ng-container *tuiLet=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t?.x !=null && t?.y!=null\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n<ng-container *ngIf=\"getMarkers() as markers\">\n <svg:circle\n class=\"marker\"\n *ngFor=\"let point of markers\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n</ng-container>\n\n\n\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
1429
1449
  }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; } });
1430
1450
 
1431
1451
  class BarSeriesComponent extends SeriesBaseComponent {
@@ -1658,10 +1678,10 @@ class AreaSeriesComponent extends LinearSeriesBase {
1658
1678
  }
1659
1679
  }
1660
1680
  AreaSeriesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AreaSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1661
- AreaSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: AreaSeriesComponent, selector: "svg:svg[teta-area-series]", usesInheritance: true, ngImport: i0, template: "<svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\n <svg:linearGradient [id]=\"'gradient-fill-' + id\" gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.8\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n<svg:path\n class=\"area\"\n *ngIf=\"series?.fillType === fillType.gradient\"\n [attr.d]=\"areaPath | async\"\n [attr.stroke-width]=\"0\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : series.style.fill ?? series.color\">\n</svg:path>\n<svg:path\n class=\"area\"\n fill=\"none\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\">\n</svg:path>\n<ng-container *ngIf=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t.x !== undefined && t.y!== undefined\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n<ng-container *ngIf=\"getMarkers() as markers\">\n <svg:circle\n class=\"marker\"\n *ngFor=\"let point of markers\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n</ng-container>\n\n\n\n", styles: [""], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1681
+ AreaSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: AreaSeriesComponent, selector: "svg:svg[teta-area-series]", usesInheritance: true, ngImport: i0, template: "<svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\n <svg:linearGradient [id]=\"'gradient-fill-' + id\" gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.8\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n<svg:path\n class=\"area\"\n [attr.d]=\"areaPath | async\"\n [attr.stroke-width]=\"0\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : series.style.fill ?? series.color\">\n</svg:path>\n<svg:path\n class=\"area\"\n fill=\"none\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\">\n</svg:path>\n<ng-container *tuiLet=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t?.x !=null && t?.y !=null\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n<ng-container *ngIf=\"getMarkers() as markers\">\n <svg:circle\n class=\"marker\"\n *ngFor=\"let point of markers\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n</ng-container>\n\n\n\n", styles: [""], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$1.TuiLetDirective, selector: "[tuiLet]", inputs: ["tuiLet"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1662
1682
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AreaSeriesComponent, decorators: [{
1663
1683
  type: Component,
1664
- args: [{ selector: 'svg:svg[teta-area-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\n <svg:linearGradient [id]=\"'gradient-fill-' + id\" gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.8\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n<svg:path\n class=\"area\"\n *ngIf=\"series?.fillType === fillType.gradient\"\n [attr.d]=\"areaPath | async\"\n [attr.stroke-width]=\"0\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : series.style.fill ?? series.color\">\n</svg:path>\n<svg:path\n class=\"area\"\n fill=\"none\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\">\n</svg:path>\n<ng-container *ngIf=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t.x !== undefined && t.y!== undefined\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n<ng-container *ngIf=\"getMarkers() as markers\">\n <svg:circle\n class=\"marker\"\n *ngFor=\"let point of markers\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n</ng-container>\n\n\n\n", styles: [""] }]
1684
+ args: [{ selector: 'svg:svg[teta-area-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\n <svg:linearGradient [id]=\"'gradient-fill-' + id\" gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.8\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n<svg:path\n class=\"area\"\n [attr.d]=\"areaPath | async\"\n [attr.stroke-width]=\"0\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : series.style.fill ?? series.color\">\n</svg:path>\n<svg:path\n class=\"area\"\n fill=\"none\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\">\n</svg:path>\n<ng-container *tuiLet=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t?.x !=null && t?.y !=null\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n<ng-container *ngIf=\"getMarkers() as markers\">\n <svg:circle\n class=\"marker\"\n *ngFor=\"let point of markers\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n</ng-container>\n\n\n\n", styles: [""] }]
1665
1685
  }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; } });
1666
1686
 
1667
1687
  const defaultSeriesTypeMapping = new Map()
@@ -1786,10 +1806,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
1786
1806
  }] } });
1787
1807
 
1788
1808
  class ZoomableDirective {
1789
- constructor(elementRef, zoomService, broadcastService, zone) {
1809
+ constructor(elementRef, zoomService, broadcastService, chartService, zone) {
1790
1810
  this.elementRef = elementRef;
1791
1811
  this.zoomService = zoomService;
1792
1812
  this.broadcastService = broadcastService;
1813
+ this.chartService = chartService;
1793
1814
  this.zone = zone;
1794
1815
  this.zoomable = false;
1795
1816
  this.alive = true;
@@ -1807,7 +1828,8 @@ class ZoomableDirective {
1807
1828
  const message = new ZoomMessage({
1808
1829
  event,
1809
1830
  axis: this.zoomAxis,
1810
- brushDomain: domain
1831
+ brushDomain: domain,
1832
+ chartId: this.config.id
1811
1833
  });
1812
1834
  this.broadcastService.broadcastZoom({
1813
1835
  channel: this.config?.zoom?.syncChannel,
@@ -1828,7 +1850,7 @@ class ZoomableDirective {
1828
1850
  }
1829
1851
  }
1830
1852
  ngAfterViewInit() {
1831
- const enable = this.axis?.options?.zoom && this.axis?.options.visible || this.config?.zoom?.enable;
1853
+ const enable = this.axis?.options?.zoom && this.axis?.options.visible !== false || this.config?.zoom?.enable;
1832
1854
  if (!enable) {
1833
1855
  return;
1834
1856
  }
@@ -1839,44 +1861,110 @@ class ZoomableDirective {
1839
1861
  [0, 0],
1840
1862
  [this.size.width, this.size.height],
1841
1863
  ]);
1864
+ if (this.config.zoom?.limitTranslateByData) {
1865
+ this.zoom.translateExtent([[0, 0], [this.size.width, this.size.height]]);
1866
+ }
1842
1867
  const commonZoomAxis = Axis.createAxis(this.config?.zoom.type === ZoomType.x ? AxisOrientation.x : AxisOrientation.y, this.config, 0, true);
1843
1868
  this.zoomAxis = this.axis ?? commonZoomAxis;
1844
1869
  if (enable) {
1845
- const maxZoom = this.config.zoom?.max ? (this.zoomAxis.extremes[1] - this.zoomAxis.extremes[0]) / this.config.zoom?.max : 0;
1870
+ const maxZoom = this.config.zoom?.max ? (this.zoomAxis.extremes[1] - this.zoomAxis.extremes[0]) / this.config.zoom?.max : this.config.zoom?.limitZoomByData ? 1 : 0;
1846
1871
  const minZoom = this.config.zoom?.min ? (this.zoomAxis.extremes[1] - this.zoomAxis.extremes[0]) / this.config.zoom?.min : Infinity;
1847
1872
  this.zoom.scaleExtent([maxZoom, minZoom]);
1848
- console.log(this.zoom.scaleExtent());
1849
1873
  this.zoom.on('start zoom end', this.zoomed);
1850
- this._element.call(this.zoom);
1874
+ this._element.call(this.zoom)
1875
+ .on('dblclick.zoom', null);
1876
+ if (this.config?.zoom?.zoomBehavior === ZoomBehaviorType.wheel) {
1877
+ let wheeling;
1878
+ let type = 'start';
1879
+ this.zoom
1880
+ .filter((event) => event.ctrlKey)
1881
+ .wheelDelta((event) => {
1882
+ const delta = this.config?.zoom.type === ZoomType.x ? -event.deltaX : -event.deltaY;
1883
+ return delta * 0.002;
1884
+ });
1885
+ this._element.on('wheel', (event) => {
1886
+ event.preventDefault();
1887
+ if (event.ctrlKey) {
1888
+ return;
1889
+ }
1890
+ const emit = (type) => {
1891
+ let transform = zoomIdentity;
1892
+ const origin = this.brushScale.copy().domain(this.zoomAxis.extremes);
1893
+ if (this.config.zoom?.type === ZoomType.y) {
1894
+ transform = transform.translate(0, this.currentTransform.y - event.deltaY);
1895
+ }
1896
+ transform = transform.scale(this.currentTransform.k);
1897
+ let domain = this.config.zoom?.type === ZoomType.y ?
1898
+ transform.rescaleY(origin).domain() :
1899
+ transform.rescaleX(origin).domain();
1900
+ const message = new ZoomMessage({
1901
+ event: {
1902
+ sourceEvent: event,
1903
+ transform,
1904
+ type
1905
+ },
1906
+ axis: this.zoomAxis,
1907
+ brushDomain: domain,
1908
+ chartId: this.config.id
1909
+ });
1910
+ this.zoomService.setZoom({
1911
+ event: {
1912
+ sourceEvent: event,
1913
+ transform,
1914
+ type
1915
+ },
1916
+ target: this.zoomAxis
1917
+ });
1918
+ this.broadcastService.broadcastZoom({
1919
+ channel: this.config?.zoom?.syncChannel,
1920
+ message,
1921
+ });
1922
+ this._element.call(this.zoom.transform, transform);
1923
+ this.currentTransform = transform;
1924
+ };
1925
+ this.zone.runOutsideAngular(() => {
1926
+ clearTimeout(wheeling);
1927
+ emit(type);
1928
+ type = 'zoom';
1929
+ wheeling = setTimeout(() => {
1930
+ type = 'end';
1931
+ emit(type);
1932
+ type = 'start';
1933
+ }, 400);
1934
+ });
1935
+ });
1936
+ }
1851
1937
  }
1852
1938
  // Subscribe to zoom events
1853
- this.broadcastService.subscribeToZoom(this.config?.zoom.syncChannel).pipe(filter((m) => m.message.event.sourceEvent instanceof MouseEvent || m.message.event.sourceEvent instanceof WheelEvent), debounceTime(30), filter((m) => {
1939
+ this.broadcastService.subscribeToZoom(this.config?.zoom.syncChannel).pipe(takeWhile((_) => this.alive), filter((m) => m.message.event.sourceEvent instanceof MouseEvent || m.message.event.sourceEvent instanceof WheelEvent), filter((m) => {
1854
1940
  return this.zoomAxis.index === m.message?.axis?.index && this.zoomAxis.orientation === m.message?.axis?.orientation;
1855
1941
  }), tap$1((m) => {
1856
- const currentTransform = d3.zoomTransform(this.elementRef.nativeElement);
1857
- if (currentTransform !== m.message.event.transform) {
1942
+ if (this.config.id !== m.message.chartId) {
1858
1943
  this._element.call(this.zoom.transform, m.message.event.transform, null, {});
1859
1944
  }
1860
- }), takeWhile((_) => this.alive)).subscribe();
1945
+ else {
1946
+ if (m.message.axis.isFake && !this.zoomAxis.isFake || !m.message.axis.isFake && this.zoomAxis.isFake) {
1947
+ this._element.call(this.zoom.transform, m.message.event.transform);
1948
+ }
1949
+ }
1950
+ })).subscribe();
1861
1951
  // Subscribe to brush events x or y
1862
1952
  if ((this.config.brush?.type === BrushType.x && this.zoomAxis.orientation === AxisOrientation.x) ||
1863
1953
  (this.config.brush?.type === BrushType.y && this.zoomAxis.orientation === AxisOrientation.y)) {
1864
- this.broadcastService.subscribeToBrush(this.config?.zoom.syncChannel).pipe(debounceTime(30), filter((m) => Boolean(m.message.selection)), tap$1((m) => {
1865
- const currentTransform = d3.zoomTransform(this.elementRef.nativeElement);
1954
+ combineLatest([this.broadcastService.subscribeToBrush(this.config?.zoom.syncChannel), this.chartService.size]).pipe(takeWhile((_) => this.alive), debounceTime(150), filter((data) => Boolean(data[0].message.selection)), tap$1((data) => {
1955
+ const [m] = data;
1956
+ const currentTransform = d3.zoomTransform(this._element.node());
1866
1957
  if (!m.message.event && this.currentSelection && currentTransform.k !== 1) {
1867
1958
  return;
1868
1959
  }
1869
1960
  this.currentSelection = m.message.selection;
1870
- this.zone.runOutsideAngular(() => {
1871
- setTimeout(() => {
1872
- this.updateZoom(m);
1873
- }, 100);
1874
- });
1875
- }), takeWhile((_) => this.alive)).subscribe();
1961
+ this.updateZoom(m);
1962
+ })).subscribe();
1876
1963
  }
1877
1964
  }
1878
1965
  ngOnDestroy() {
1879
1966
  this.zoom?.on('start zoom end', null);
1967
+ this._element.on('wheel', null);
1880
1968
  this.alive = false;
1881
1969
  }
1882
1970
  updateZoom(m) {
@@ -1894,14 +1982,14 @@ class ZoomableDirective {
1894
1982
  this._element.transition().duration(150).call(this.zoom.transform, transform, null, {});
1895
1983
  }
1896
1984
  }
1897
- ZoomableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ZoomableDirective, deps: [{ token: i0.ElementRef }, { token: ZoomService }, { token: BroadcastService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
1985
+ ZoomableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ZoomableDirective, deps: [{ token: i0.ElementRef }, { token: ZoomService }, { token: BroadcastService }, { token: ChartService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
1898
1986
  ZoomableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: ZoomableDirective, selector: "[tetaZoomable]", inputs: { config: "config", axis: "axis", size: "size", brushScale: "brushScale" }, host: { properties: { "class.zoomable": "this.zoomable" } }, ngImport: i0 });
1899
1987
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ZoomableDirective, decorators: [{
1900
1988
  type: Directive,
1901
1989
  args: [{
1902
1990
  selector: '[tetaZoomable]',
1903
1991
  }]
1904
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ZoomService }, { type: BroadcastService }, { type: i0.NgZone }]; }, propDecorators: { config: [{
1992
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ZoomService }, { type: BroadcastService }, { type: ChartService }, { type: i0.NgZone }]; }, propDecorators: { config: [{
1905
1993
  type: Input
1906
1994
  }], axis: [{
1907
1995
  type: Input
@@ -1931,16 +2019,14 @@ class BrushableDirective {
1931
2019
  }
1932
2020
  }
1933
2021
  BrushableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BrushableDirective, deps: [{ token: BrushService }, { token: ChartService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1934
- BrushableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: BrushableDirective, selector: "svg:svg[tetaBrushable]", inputs: { config: "config", size: "size", brushScale: "brushScale" }, usesOnChanges: true, ngImport: i0 });
2022
+ BrushableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: BrushableDirective, selector: "[tetaBrushable]", inputs: { config: "config", brushScale: "brushScale" }, usesOnChanges: true, ngImport: i0 });
1935
2023
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BrushableDirective, decorators: [{
1936
2024
  type: Directive,
1937
2025
  args: [{
1938
- selector: 'svg:svg[tetaBrushable]',
2026
+ selector: '[tetaBrushable]',
1939
2027
  }]
1940
2028
  }], ctorParameters: function () { return [{ type: BrushService }, { type: ChartService }, { type: i0.ElementRef }]; }, propDecorators: { config: [{
1941
2029
  type: Input
1942
- }], size: [{
1943
- type: Input
1944
2030
  }], brushScale: [{
1945
2031
  type: Input
1946
2032
  }] } });
@@ -1962,8 +2048,14 @@ class ChartContainerComponent {
1962
2048
  this.size = this._svc.size;
1963
2049
  this.yAxisMap = this._scaleService.yAxisMap;
1964
2050
  this.xAxisMap = this._scaleService.xAxisMap;
1965
- this.yScaleMap = this._scaleService.yScaleMap;
1966
- this.xScaleMap = this._scaleService.xScaleMap;
2051
+ this.yScaleMap = this._scaleService.yScaleMap.pipe(throttleTime(0, animationFrameScheduler, { trailing: true }), tap(() => this._cdr.detectChanges()), shareReplay({
2052
+ bufferSize: 1,
2053
+ refCount: true
2054
+ }));
2055
+ this.xScaleMap = this._scaleService.xScaleMap.pipe(throttleTime(0, animationFrameScheduler, { trailing: true }), tap(() => this._cdr.detectChanges()), shareReplay({
2056
+ bufferSize: 1,
2057
+ refCount: true
2058
+ }));
1967
2059
  this.brushScale = combineLatest([
1968
2060
  this._scaleService.xScaleMap,
1969
2061
  this._scaleService.yScaleMap,
@@ -1979,9 +2071,8 @@ class ChartContainerComponent {
1979
2071
  this.visibleRect = combineLatest([
1980
2072
  this.size,
1981
2073
  this.xAxisMap,
1982
- this.yAxisMap,
1983
- this._zoomService.zoomed,
1984
- ]).pipe(map((data) => {
2074
+ this.yAxisMap
2075
+ ]).pipe(throttleTime(0, animationFrameScheduler, { trailing: true }), map((data) => {
1985
2076
  const [size, x, y] = data;
1986
2077
  const yAxesArray = [...y.values()];
1987
2078
  const xAxesArray = [...x.values()];
@@ -2003,12 +2094,9 @@ class ChartContainerComponent {
2003
2094
  width: size.width - left - right,
2004
2095
  height: size.height - top - bottom,
2005
2096
  };
2006
- }), tap((_) => {
2007
- this._cdr.detectChanges();
2008
- }));
2097
+ }), tap(() => setTimeout(() => this._cdr.detectChanges())));
2009
2098
  }
2010
2099
  ngOnInit() {
2011
- this.uniqId = (Date.now() + Math.random()).toString(36);
2012
2100
  this._observer = new ResizeObserver((entries) => {
2013
2101
  requestAnimationFrame(() => {
2014
2102
  if (!Array.isArray(entries) ||
@@ -2090,21 +2178,19 @@ class ChartContainerComponent {
2090
2178
  mouseLeave(event) {
2091
2179
  this._svc.setPointerMove(event);
2092
2180
  }
2093
- id() {
2094
- return this.uniqId;
2095
- }
2096
2181
  }
2097
2182
  ChartContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartContainerComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
2098
- ChartContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChartContainerComponent, selector: "teta-chart-container", ngImport: i0, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n xAxisMap: xAxisMap | async,\n yAxisMap: yAxisMap | async,\n xScaleMap: xScaleMap | async,\n yScaleMap: yScaleMap | async,\n visibleRect: visibleRect | async,\n brushScale: brushScale | async\n} as data\" xmlns:svg=\"http://www.w3.org/1999/html\">\n <teta-tooltip *ngIf=\"data.config?.tooltip?.enable\"\n [size]=\"data.size\"\n [config]=\"data.config\"></teta-tooltip>\n\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n <ng-container *ngFor=\"let item of data.yAxisMap | keyvalue;\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [scale]=\"data.yScaleMap.get(item.key)\"\n [size]=\"data.size\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.size\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.size.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n\n </ng-container>\n </g>\n <g class=\"x-axis-container\">\n <ng-container *ngFor=\"let item of data.xAxisMap | keyvalue;\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [scale]=\"data.xScaleMap.get(item.key)\"\n [size]=\"data.size\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.size\"\n [attr.x]=\"0\"\n [attr.y]=\"0\"\n [attr.width]=\"data.size.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n </ng-container>\n </g>\n </svg>\n <ng-container *ngIf=\"data.visibleRect?.width > 0 && data.visibleRect?.height > 0\">\n <svg\n tetaBrushable\n tetaZoomable\n [size]=\"data.size\"\n [brushScale]=\"data.brushScale\"\n [config]=\"data.config\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.transform]=\"'translate('+ data.visibleRect.x +', '+ data.visibleRect.y +')'\"\n [attr.viewBox]=\"'0 0 ' + data.visibleRect.width + ' ' + data.visibleRect.height\"\n (contextmenu)=\"contextMenu($event, data.xScaleMap, data.yScaleMap)\"\n (click)=\"click($event, data.xScaleMap, data.yScaleMap)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousemove)=\"mouseMove($event)\">\n <g class=\"gridlines\"\n teta-gridlines\n *ngIf=\"data.config.gridLines?.enable !== false\"\n [size]=\"data.size\"\n [config]=\"data.config\"\n [xScaleMap]=\"data.xScaleMap\"\n [yScaleMap]=\"data.yScaleMap\"></g>\n\n <g class=\"x-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.xScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.xAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.yScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.yAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"x-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.xScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.xAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.yScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.yAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"series-container\">\n <g teta-series-host\n *ngFor=\"let series of data.config.series\"\n [config]=\"data.config\"\n [series]=\"series\"></g>\n </g>\n <g class=\"annotations\">\n <g teta-annotation\n *ngFor=\"let annotation of data.config.annotations\"\n [annotation]=\"annotation\"></g>\n </g>\n </svg>\n\n </ng-container>\n</ng-container>\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-width:0;min-height:0}:host .zoomable:hover{cursor:grab}:host .zoomable:active{cursor:grabbing}\n"], components: [{ type: TooltipComponent, selector: "teta-tooltip", inputs: ["size", "config"] }, { type: YAxisComponent, selector: "[teta-y-axis]", inputs: ["axis", "scale", "size"] }, { type: XAxisComponent, selector: "[teta-x-axis]", inputs: ["axis", "scale", "size"] }, { type: GridlinesComponent, selector: "[teta-gridlines]", inputs: ["size", "xScaleMap", "yScaleMap", "config"] }, { type: PlotBandComponent, selector: "[teta-plot-band]", inputs: ["plotBand", "axis", "scale", "size"] }, { type: PlotlineComponent, selector: "[teta-plot-line]", inputs: ["plotLine", "size", "axis", "scale"] }, { type: SeriesHostComponent, selector: "[teta-series-host]", inputs: ["config", "series"] }, { type: AnnotationComponent, selector: "[teta-annotation]", inputs: ["annotation"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: ZoomableDirective, selector: "[tetaZoomable]", inputs: ["config", "axis", "size", "brushScale"] }, { type: BrushableDirective, selector: "svg:svg[tetaBrushable]", inputs: ["config", "size", "brushScale"] }], pipes: { "async": i4.AsyncPipe, "keyvalue": i4.KeyValuePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2183
+ ChartContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChartContainerComponent, selector: "teta-chart-container", ngImport: i0, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n xAxisMap: xAxisMap | async,\n yAxisMap: yAxisMap | async,\n xScaleMap: xScaleMap | async,\n yScaleMap: yScaleMap | async,\n visibleRect: visibleRect | async,\n brushScale: brushScale | async\n} as data\" xmlns:svg=\"http://www.w3.org/1999/html\">\n <teta-tooltip *ngIf=\"data.config?.tooltip?.enable\"\n [size]=\"data.size\"\n [config]=\"data.config\"></teta-tooltip>\n <ng-container *ngIf=\"data.visibleRect?.width > 0 && data.visibleRect?.height > 0 && data.xScaleMap && data.yScaleMap\">\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n <ng-container *ngFor=\"let item of data.yAxisMap | keyvalue;\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [scale]=\"data.yScaleMap.get(item.key)\"\n [size]=\"data.size\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.size\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.size.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n\n </ng-container>\n </g>\n <g class=\"x-axis-container\">\n <ng-container *ngFor=\"let item of data.xAxisMap | keyvalue;\">\n <ng-container *ngIf=\"item.value.options.visible && data.xScaleMap && data.yScaleMap\">\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [scale]=\"data.xScaleMap.get(item.key)\"\n [size]=\"data.size\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.size\"\n [attr.x]=\"0\"\n [attr.y]=\"0\"\n [attr.width]=\"data.size.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n </ng-container>\n </g>\n </svg>\n </ng-container>\n <ng-container *ngIf=\"data.visibleRect?.width > 0 && data.visibleRect?.height > 0 && data.xScaleMap && data.yScaleMap\">\n <svg\n tetaBrushable\n tetaZoomable\n class=\"position-absolute\"\n [size]=\"data.size\"\n [brushScale]=\"data.brushScale\"\n [config]=\"data.config\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.viewBox]=\"'0 0 ' + data.visibleRect.width + ' ' + data.visibleRect.height\"\n [style.transform]=\"'translate('+ data.visibleRect.x +'px, '+ data.visibleRect.y +'px)'\"\n (contextmenu)=\"contextMenu($event, data.xScaleMap, data.yScaleMap)\"\n (click)=\"click($event, data.xScaleMap, data.yScaleMap)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousemove)=\"mouseMove($event)\">\n\n <g class=\"gridlines\"\n teta-gridlines\n *ngIf=\"data.config.gridLines?.enable !== false\"\n [size]=\"data.size\"\n [config]=\"data.config\"></g>\n\n <g class=\"x-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.xScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.xAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.yScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.yAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"x-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.xScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.xAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.yScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.yAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"series-container\">\n <g teta-series-host\n *ngFor=\"let series of data.config.series\"\n [config]=\"data.config\"\n [series]=\"series\"></g>\n </g>\n <g class=\"annotations\">\n <g teta-annotation\n *ngFor=\"let annotation of data.config.annotations\"\n [annotation]=\"annotation\"></g>\n </g>\n </svg>\n\n </ng-container>\n</ng-container>\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-width:0;min-height:0}:host .zoomable:hover{cursor:grab}:host .zoomable:active{cursor:grabbing}\n"], components: [{ type: TooltipComponent, selector: "teta-tooltip", inputs: ["size", "config"] }, { type: YAxisComponent, selector: "[teta-y-axis]", inputs: ["axis", "scale", "size"] }, { type: XAxisComponent, selector: "[teta-x-axis]", inputs: ["axis", "scale", "size"] }, { type: GridlinesComponent, selector: "[teta-gridlines]", inputs: ["size"] }, { type: PlotBandComponent, selector: "[teta-plot-band]", inputs: ["plotBand", "axis", "scale", "size"] }, { type: PlotlineComponent, selector: "[teta-plot-line]", inputs: ["plotLine", "size", "axis", "scale"] }, { type: SeriesHostComponent, selector: "[teta-series-host]", inputs: ["config", "series"] }, { type: AnnotationComponent, selector: "[teta-annotation]", inputs: ["annotation"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: ZoomableDirective, selector: "[tetaZoomable]", inputs: ["config", "axis", "size", "brushScale"] }, { type: BrushableDirective, selector: "[tetaBrushable]", inputs: ["config", "brushScale"] }], pipes: { "async": i4.AsyncPipe, "keyvalue": i4.KeyValuePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2099
2184
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartContainerComponent, decorators: [{
2100
2185
  type: Component,
2101
- args: [{ selector: 'teta-chart-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n xAxisMap: xAxisMap | async,\n yAxisMap: yAxisMap | async,\n xScaleMap: xScaleMap | async,\n yScaleMap: yScaleMap | async,\n visibleRect: visibleRect | async,\n brushScale: brushScale | async\n} as data\" xmlns:svg=\"http://www.w3.org/1999/html\">\n <teta-tooltip *ngIf=\"data.config?.tooltip?.enable\"\n [size]=\"data.size\"\n [config]=\"data.config\"></teta-tooltip>\n\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n <ng-container *ngFor=\"let item of data.yAxisMap | keyvalue;\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [scale]=\"data.yScaleMap.get(item.key)\"\n [size]=\"data.size\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.size\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.size.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n\n </ng-container>\n </g>\n <g class=\"x-axis-container\">\n <ng-container *ngFor=\"let item of data.xAxisMap | keyvalue;\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [scale]=\"data.xScaleMap.get(item.key)\"\n [size]=\"data.size\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.size\"\n [attr.x]=\"0\"\n [attr.y]=\"0\"\n [attr.width]=\"data.size.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n </ng-container>\n </g>\n </svg>\n <ng-container *ngIf=\"data.visibleRect?.width > 0 && data.visibleRect?.height > 0\">\n <svg\n tetaBrushable\n tetaZoomable\n [size]=\"data.size\"\n [brushScale]=\"data.brushScale\"\n [config]=\"data.config\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.transform]=\"'translate('+ data.visibleRect.x +', '+ data.visibleRect.y +')'\"\n [attr.viewBox]=\"'0 0 ' + data.visibleRect.width + ' ' + data.visibleRect.height\"\n (contextmenu)=\"contextMenu($event, data.xScaleMap, data.yScaleMap)\"\n (click)=\"click($event, data.xScaleMap, data.yScaleMap)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousemove)=\"mouseMove($event)\">\n <g class=\"gridlines\"\n teta-gridlines\n *ngIf=\"data.config.gridLines?.enable !== false\"\n [size]=\"data.size\"\n [config]=\"data.config\"\n [xScaleMap]=\"data.xScaleMap\"\n [yScaleMap]=\"data.yScaleMap\"></g>\n\n <g class=\"x-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.xScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.xAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.yScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.yAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"x-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.xScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.xAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.yScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.yAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"series-container\">\n <g teta-series-host\n *ngFor=\"let series of data.config.series\"\n [config]=\"data.config\"\n [series]=\"series\"></g>\n </g>\n <g class=\"annotations\">\n <g teta-annotation\n *ngFor=\"let annotation of data.config.annotations\"\n [annotation]=\"annotation\"></g>\n </g>\n </svg>\n\n </ng-container>\n</ng-container>\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-width:0;min-height:0}:host .zoomable:hover{cursor:grab}:host .zoomable:active{cursor:grabbing}\n"] }]
2186
+ args: [{ selector: 'teta-chart-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n xAxisMap: xAxisMap | async,\n yAxisMap: yAxisMap | async,\n xScaleMap: xScaleMap | async,\n yScaleMap: yScaleMap | async,\n visibleRect: visibleRect | async,\n brushScale: brushScale | async\n} as data\" xmlns:svg=\"http://www.w3.org/1999/html\">\n <teta-tooltip *ngIf=\"data.config?.tooltip?.enable\"\n [size]=\"data.size\"\n [config]=\"data.config\"></teta-tooltip>\n <ng-container *ngIf=\"data.visibleRect?.width > 0 && data.visibleRect?.height > 0 && data.xScaleMap && data.yScaleMap\">\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n <ng-container *ngFor=\"let item of data.yAxisMap | keyvalue;\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [scale]=\"data.yScaleMap.get(item.key)\"\n [size]=\"data.size\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.size\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.size.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n\n </ng-container>\n </g>\n <g class=\"x-axis-container\">\n <ng-container *ngFor=\"let item of data.xAxisMap | keyvalue;\">\n <ng-container *ngIf=\"item.value.options.visible && data.xScaleMap && data.yScaleMap\">\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [scale]=\"data.xScaleMap.get(item.key)\"\n [size]=\"data.size\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.size\"\n [attr.x]=\"0\"\n [attr.y]=\"0\"\n [attr.width]=\"data.size.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n </ng-container>\n </g>\n </svg>\n </ng-container>\n <ng-container *ngIf=\"data.visibleRect?.width > 0 && data.visibleRect?.height > 0 && data.xScaleMap && data.yScaleMap\">\n <svg\n tetaBrushable\n tetaZoomable\n class=\"position-absolute\"\n [size]=\"data.size\"\n [brushScale]=\"data.brushScale\"\n [config]=\"data.config\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.viewBox]=\"'0 0 ' + data.visibleRect.width + ' ' + data.visibleRect.height\"\n [style.transform]=\"'translate('+ data.visibleRect.x +'px, '+ data.visibleRect.y +'px)'\"\n (contextmenu)=\"contextMenu($event, data.xScaleMap, data.yScaleMap)\"\n (click)=\"click($event, data.xScaleMap, data.yScaleMap)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousemove)=\"mouseMove($event)\">\n\n <g class=\"gridlines\"\n teta-gridlines\n *ngIf=\"data.config.gridLines?.enable !== false\"\n [size]=\"data.size\"\n [config]=\"data.config\"></g>\n\n <g class=\"x-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.xScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.xAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.yScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.yAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"x-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.xScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.xAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.yScaleMap.get(i)\"\n [size]=\"data.size\"\n [axis]=\"data.yAxisMap.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"series-container\">\n <g teta-series-host\n *ngFor=\"let series of data.config.series\"\n [config]=\"data.config\"\n [series]=\"series\"></g>\n </g>\n <g class=\"annotations\">\n <g teta-annotation\n *ngFor=\"let annotation of data.config.annotations\"\n [annotation]=\"annotation\"></g>\n </g>\n </svg>\n\n </ng-container>\n</ng-container>\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-width:0;min-height:0}:host .zoomable:hover{cursor:grab}:host .zoomable:active{cursor:grabbing}\n"] }]
2102
2187
  }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; } });
2103
2188
 
2104
2189
  class LegendComponent {
2105
2190
  constructor() {
2106
2191
  this.sizeMapping = new Map()
2107
2192
  .set(SeriesType.line, 2)
2193
+ .set(SeriesType.scatter, 12)
2108
2194
  .set(SeriesType.bar, 12)
2109
2195
  .set(SeriesType.area, 2)
2110
2196
  .set(SeriesType.block, 12)
@@ -2287,7 +2373,7 @@ ChartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "1
2287
2373
  ScatterSeriesComponent,
2288
2374
  BlockSeriesComponent,
2289
2375
  BlockAreaSeriesComponent,
2290
- AnnotationComponent], imports: [CommonModule], exports: [ChartComponent,
2376
+ AnnotationComponent], imports: [CommonModule, TuiLetModule], exports: [ChartComponent,
2291
2377
  LegendComponent,
2292
2378
  SeriesBaseComponent,
2293
2379
  LineSeriesComponent,
@@ -2296,7 +2382,7 @@ ChartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "1
2296
2382
  AreaSeriesComponent,
2297
2383
  BlockSeriesComponent,
2298
2384
  BlockAreaSeriesComponent] });
2299
- ChartModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, imports: [[CommonModule]] });
2385
+ ChartModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, imports: [[CommonModule, TuiLetModule]] });
2300
2386
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, decorators: [{
2301
2387
  type: NgModule,
2302
2388
  args: [{
@@ -2334,7 +2420,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
2334
2420
  BlockSeriesComponent,
2335
2421
  BlockAreaSeriesComponent,
2336
2422
  ],
2337
- imports: [CommonModule],
2423
+ imports: [CommonModule, TuiLetModule],
2338
2424
  }]
2339
2425
  }] });
2340
2426
 
@@ -2376,5 +2462,5 @@ class PlotLine {
2376
2462
  * Generated bundle index. Do not edit.
2377
2463
  */
2378
2464
 
2379
- export { AreaSeriesComponent, Axis, AxisOrientation, BarSeriesComponent, BlockAreaSeriesComponent, BlockSeriesComponent, BroadcastService, BrushMessage, BrushService, BrushType, ChartBounds, ChartComponent, ChartModule, ChartService, DragPointType, FillDirection, FillType, LegendComponent, LineSeriesComponent, PlotBand, PlotLine, ScaleService, ScaleType, ScatterSeriesComponent, SeriesBaseComponent, SeriesType, TooltipTracking, ZoomMessage, ZoomService, ZoomType };
2465
+ export { AreaSeriesComponent, Axis, AxisOrientation, BarSeriesComponent, BlockAreaSeriesComponent, BlockSeriesComponent, BroadcastService, BrushMessage, BrushService, BrushType, ChartBounds, ChartComponent, ChartModule, ChartService, DragPointType, FillDirection, FillType, LegendComponent, LineSeriesComponent, PlotBand, PlotLine, ScaleService, ScaleType, ScatterSeriesComponent, SeriesBaseComponent, SeriesType, TooltipTracking, ZoomBehaviorType, ZoomMessage, ZoomService, ZoomType };
2380
2466
  //# sourceMappingURL=tetacom-svg-charts.mjs.map