@tetacom/svg-charts 1.2.2 → 1.2.5

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 (39) hide show
  1. package/chart/chart/chart.component.d.ts +2 -1
  2. package/chart/chart-container/chart-container.component.d.ts +3 -5
  3. package/chart/chart-container/series/linear-series-base.d.ts +1 -1
  4. package/chart/chart-container/series/scatter-series/scatter-series.component.d.ts +0 -1
  5. package/chart/chart-container/x-axis/x-axis.component.d.ts +2 -4
  6. package/chart/core/axis/axis.d.ts +3 -0
  7. package/chart/model/i-broadcast-message.d.ts +2 -2
  8. package/chart/model/i-scales-map.d.ts +5 -0
  9. package/chart/model/public-api.d.ts +1 -0
  10. package/chart/service/chart.service.d.ts +4 -0
  11. package/chart/service/scale.service.d.ts +2 -5
  12. package/esm2020/chart/chart/chart.component.mjs +14 -6
  13. package/esm2020/chart/chart-container/annotation/annotation.component.mjs +3 -3
  14. package/esm2020/chart/chart-container/chart-container.component.mjs +16 -25
  15. package/esm2020/chart/chart-container/gridlines/gridlines.component.mjs +11 -5
  16. package/esm2020/chart/chart-container/series/area-series/area-series.component.mjs +6 -9
  17. package/esm2020/chart/chart-container/series/bar/bar-series.component.mjs +5 -5
  18. package/esm2020/chart/chart-container/series/block-area-series/block-area-series.component.mjs +3 -3
  19. package/esm2020/chart/chart-container/series/block-series/block-series.component.mjs +3 -3
  20. package/esm2020/chart/chart-container/series/linear-series-base.mjs +21 -26
  21. package/esm2020/chart/chart-container/series/scatter-series/scatter-series.component.mjs +3 -3
  22. package/esm2020/chart/chart-container/x-axis/x-axis.component.mjs +3 -27
  23. package/esm2020/chart/chart-container/y-axis/y-axis.component.mjs +3 -3
  24. package/esm2020/chart/core/axis/axis.mjs +7 -1
  25. package/esm2020/chart/default/default-axis-config.mjs +2 -2
  26. package/esm2020/chart/directives/brushable.directive.mjs +1 -1
  27. package/esm2020/chart/directives/zoomable.directive.mjs +27 -7
  28. package/esm2020/chart/model/i-broadcast-message.mjs +2 -2
  29. package/esm2020/chart/model/i-scales-map.mjs +2 -0
  30. package/esm2020/chart/model/public-api.mjs +2 -1
  31. package/esm2020/chart/service/brush.service.mjs +20 -17
  32. package/esm2020/chart/service/chart.service.mjs +6 -1
  33. package/esm2020/chart/service/scale.service.mjs +37 -65
  34. package/esm2020/chart/service/zoom.service.mjs +2 -2
  35. package/fesm2015/tetacom-svg-charts.mjs +177 -197
  36. package/fesm2015/tetacom-svg-charts.mjs.map +1 -1
  37. package/fesm2020/tetacom-svg-charts.mjs +168 -190
  38. package/fesm2020/tetacom-svg-charts.mjs.map +1 -1
  39. package/package.json +1 -1
@@ -8,9 +8,9 @@ import * as d3 from 'd3';
8
8
  import { zoomIdentity } from 'd3';
9
9
  import objectHash from 'object-hash';
10
10
  import { maxIndex } from 'd3-array';
11
+ import { debounceTime, tap as tap$1 } from 'rxjs/operators';
11
12
  import { tetaZoneFull } from '@tetacom/ng-components';
12
13
  import * as i3 from '@angular/platform-browser';
13
- import { tap as tap$1, debounceTime } from 'rxjs/operators';
14
14
 
15
15
  var ZoomType;
16
16
  (function (ZoomType) {
@@ -95,7 +95,7 @@ const defaultAxisConfig = {
95
95
  scaleType: {
96
96
  type: ScaleType.linear,
97
97
  },
98
- niceTicks: true,
98
+ niceTicks: false,
99
99
  };
100
100
 
101
101
  var SeriesType;
@@ -149,6 +149,7 @@ class ChartService {
149
149
  this.chartContextMenu$ = new Subject();
150
150
  this.annotationEvent$ = new Subject();
151
151
  this.annotationMove$ = new Subject();
152
+ this.zoomInstance$ = new Subject();
152
153
  this.id = of((Date.now() + Math.random()).toString(36));
153
154
  this.config = this.config$.asObservable().pipe(withLatestFrom(this.id), map(this.setDefaults), map(this.setPreparationData), map(this.restoreLocalStorage), shareReplay({
154
155
  bufferSize: 1,
@@ -175,6 +176,7 @@ class ChartService {
175
176
  this.plotBandContextMenu = this.plotBandEvent$
176
177
  .asObservable()
177
178
  .pipe(filter((_) => { var _a; return ((_a = _ === null || _ === void 0 ? void 0 : _.event) === null || _a === void 0 ? void 0 : _a.type) === 'contextmenu'; }));
179
+ this.zoomInstance = this.zoomInstance$.asObservable();
178
180
  }
179
181
  setConfig(config) {
180
182
  this.clearTooltips();
@@ -243,6 +245,9 @@ class ChartService {
243
245
  emitChartContextMenu(event) {
244
246
  this.chartContextMenu$.next(event);
245
247
  }
248
+ emitZoomInstance(event) {
249
+ this.zoomInstance$.next(event);
250
+ }
246
251
  saveCookie(config) {
247
252
  var _a;
248
253
  if (!config.name)
@@ -355,7 +360,7 @@ class ZoomService {
355
360
  this.scaleHashMap = new Map();
356
361
  this.elementHashMap = new Map();
357
362
  this.zoomHashMap = new Map();
358
- this.zoomed$ = new BehaviorSubject(null);
363
+ this.zoomed$ = new BehaviorSubject({});
359
364
  this.zoomed = this.zoomed$.asObservable().pipe(shareReplay({
360
365
  bufferSize: 1,
361
366
  refCount: true
@@ -562,6 +567,9 @@ class Axis {
562
567
  setOriginDomain(domain) {
563
568
  this._originDomain = domain;
564
569
  }
570
+ setScale(scale) {
571
+ this._scale = scale;
572
+ }
565
573
  setSelfSize() {
566
574
  this._selfSize = new AxisSizeBuilder().build(this);
567
575
  }
@@ -574,6 +582,9 @@ class Axis {
574
582
  : this.chartConfig.yAxis[this.index];
575
583
  this._options = options;
576
584
  }
585
+ get scale() {
586
+ return this._scale;
587
+ }
577
588
  get extremes() {
578
589
  return this._extremes;
579
590
  }
@@ -617,50 +628,30 @@ class ScaleService {
617
628
  .set(ScaleType.symlog, d3.scaleSymlog)
618
629
  .set(ScaleType.pow, d3.scalePow)
619
630
  .set(ScaleType.sqrt, d3.scaleSqrt);
620
- this.xAxisMap = combineLatest([
621
- this.chartService.size,
622
- this.chartService.config,
623
- ]).pipe(map((data) => {
624
- const [, config] = data;
625
- const map = new Map();
626
- config.xAxis.map((_, index) => {
627
- map.set(index, Axis.createAxis(AxisOrientation.x, config, index));
628
- });
629
- return map;
630
- }), shareReplay({
631
- bufferSize: 1,
632
- refCount: true,
633
- }));
634
- this.yAxisMap = combineLatest([
631
+ this.scales = combineLatest([
635
632
  this.chartService.size,
636
633
  this.chartService.config,
634
+ this.zoomService.zoomed,
637
635
  ]).pipe(map((data) => {
638
- const [, config] = data;
639
- const map = new Map();
636
+ var _a, _b, _c, _d;
637
+ const [size, config, zoom] = data;
638
+ const xAxisMap = new Map();
639
+ const yAxisMap = new Map();
640
640
  config.yAxis.map((_, index) => {
641
- map.set(index, Axis.createAxis(AxisOrientation.y, config, index));
641
+ yAxisMap.set(index, Axis.createAxis(AxisOrientation.y, config, index));
642
642
  });
643
- return map;
644
- }), shareReplay({
645
- bufferSize: 1,
646
- refCount: true,
647
- }));
648
- this.xScaleMap = combineLatest([
649
- this.chartService.size,
650
- this.chartService.config,
651
- this.zoomService.zoomed,
652
- ]).pipe(withLatestFrom(this.yAxisMap, this.xAxisMap), map((data) => {
653
- var _a;
654
- const [[size, config, zoom], yAxes, xAxes] = data;
655
- const map = new Map();
656
- const left = [...yAxes.values()]
643
+ config.xAxis.map((_, index) => {
644
+ xAxisMap.set(index, Axis.createAxis(AxisOrientation.x, config, index));
645
+ });
646
+ // Generate x scales
647
+ const left = Array.from(yAxisMap.values())
657
648
  .filter((_) => { var _a, _b; return ((_a = _.options) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = _.options) === null || _b === void 0 ? void 0 : _b.opposite); })
658
649
  .reduce((acc, cur) => acc + cur.selfSize, 0);
659
- const right = [...yAxes.values()]
650
+ const right = Array.from(yAxisMap.values())
660
651
  .filter((_) => { var _a, _b; return ((_a = _.options) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = _.options) === null || _b === void 0 ? void 0 : _b.opposite) !== true; })
661
652
  .reduce((acc, cur) => acc + cur.selfSize, 0);
662
653
  const finalWidth = (size.width || 0) - left - right;
663
- xAxes.forEach((axis) => {
654
+ xAxisMap.forEach((axis) => {
664
655
  var _a, _b;
665
656
  let domain = axis.extremes;
666
657
  if (axis === null || axis === void 0 ? void 0 : axis.options.inverted) {
@@ -676,53 +667,41 @@ class ScaleService {
676
667
  if (axis.options.scaleType.type === ScaleType.log) {
677
668
  scale.base(axis.options.scaleType.base);
678
669
  }
679
- map.set(axis.index, scale);
670
+ axis.setScale(scale);
680
671
  axis.setOriginDomain(scale.domain());
681
672
  const hasCache = this.transformCacheX.has(axis.index);
682
673
  const shouldRestore = ((_a = zoom === null || zoom === void 0 ? void 0 : zoom.target) === null || _a === void 0 ? void 0 : _a.orientation) !== AxisOrientation.x ||
683
674
  ((_b = zoom.target) === null || _b === void 0 ? void 0 : _b.index) !== axis.index;
684
675
  if (hasCache && shouldRestore) {
685
676
  const restoredTransform = this.transformCacheX.get(axis.index);
686
- map.set(axis.index, restoredTransform.rescaleX(scale));
677
+ axis.setScale(restoredTransform.rescaleX(scale));
687
678
  }
688
679
  });
689
680
  if (zoom) {
690
681
  const event = zoom.event;
691
682
  if (((_a = zoom.target) === null || _a === void 0 ? void 0 : _a.orientation) === AxisOrientation.x) {
692
- if (map.has(zoom.target.index)) {
693
- const currentScale = map.get(zoom.target.index);
694
- const rescaled = event.transform.rescaleX(currentScale);
695
- map.set(zoom.target.index, rescaled);
696
- const axis = xAxes.get(zoom.target.index);
683
+ if (xAxisMap.has(zoom.target.index)) {
684
+ const x = xAxisMap.get(zoom.target.index);
685
+ const rescaled = event.transform.rescaleX(x.scale);
686
+ x.setScale(rescaled);
687
+ const axis = xAxisMap.get(zoom.target.index);
697
688
  this.transformCacheX.set(axis.index, event.transform);
698
689
  }
699
690
  }
700
691
  }
701
- return map;
702
- }), shareReplay({
703
- bufferSize: 1,
704
- refCount: true,
705
- }));
706
- this.yScaleMap = combineLatest([
707
- this.chartService.size,
708
- this.chartService.config,
709
- this.zoomService.zoomed,
710
- ]).pipe(withLatestFrom(this.yAxisMap, this.xAxisMap), map((data) => {
711
- var _a, _b, _c;
712
- const [[size, config, zoom], yAxes, xAxes] = data;
713
- const map = new Map();
714
- const top = [...xAxes.values()]
692
+ // Generate y axis
693
+ const top = Array.from(xAxisMap.values())
715
694
  .filter((_) => { var _a, _b; return ((_a = _.options) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = _.options) === null || _b === void 0 ? void 0 : _b.opposite); })
716
695
  .reduce((acc, cur) => acc + cur.selfSize, 0);
717
- const bottom = [...xAxes.values()]
696
+ const bottom = Array.from(xAxisMap.values())
718
697
  .filter((_) => { var _a, _b; return ((_a = _.options) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = _.options) === null || _b === void 0 ? void 0 : _b.opposite) !== true; })
719
698
  .reduce((acc, cur) => acc + cur.selfSize, 0);
720
699
  const finalHeight = (size.height || 0) -
721
700
  top -
722
701
  bottom -
723
- ((_a = config === null || config === void 0 ? void 0 : config.bounds) === null || _a === void 0 ? void 0 : _a.top) -
724
- ((_b = config.bounds) === null || _b === void 0 ? void 0 : _b.bottom);
725
- yAxes.forEach((axis) => {
702
+ ((_b = config === null || config === void 0 ? void 0 : config.bounds) === null || _b === void 0 ? void 0 : _b.top) -
703
+ ((_c = config.bounds) === null || _c === void 0 ? void 0 : _c.bottom);
704
+ yAxisMap.forEach((axis) => {
726
705
  var _a, _b;
727
706
  let domain = axis.extremes;
728
707
  if (axis.orientation === AxisOrientation.y) {
@@ -741,29 +720,32 @@ class ScaleService {
741
720
  if (axis.options.scaleType.type === ScaleType.log) {
742
721
  scale.base(axis.options.scaleType.base);
743
722
  }
744
- map.set(axis.index, scale);
723
+ axis.setScale(scale);
745
724
  axis.setOriginDomain(scale.domain());
746
725
  const hasCache = this.transformCacheY.has(axis.index);
747
726
  const shouldRestore = ((_a = zoom === null || zoom === void 0 ? void 0 : zoom.target) === null || _a === void 0 ? void 0 : _a.orientation) !== AxisOrientation.y ||
748
727
  ((_b = zoom.target) === null || _b === void 0 ? void 0 : _b.index) !== axis.index;
749
728
  if (hasCache && shouldRestore) {
750
729
  const restoredTransform = this.transformCacheY.get(axis.index);
751
- map.set(axis.index, restoredTransform.rescaleY(scale));
730
+ axis.setScale(restoredTransform.rescaleY(scale));
752
731
  }
753
732
  });
754
733
  if (zoom) {
755
734
  const event = zoom.event;
756
- if (((_c = zoom.target) === null || _c === void 0 ? void 0 : _c.orientation) === AxisOrientation.y) {
757
- if (map.has(zoom.target.index)) {
758
- const currentScale = map.get(zoom.target.index);
759
- const rescaled = event.transform.rescaleY(currentScale);
760
- map.set(zoom.target.index, rescaled);
761
- const axis = yAxes.get(zoom.target.index);
735
+ if (((_d = zoom.target) === null || _d === void 0 ? void 0 : _d.orientation) === AxisOrientation.y) {
736
+ if (yAxisMap.has(zoom.target.index)) {
737
+ const y = yAxisMap.get(zoom.target.index);
738
+ const rescaled = event.transform.rescaleY(y.scale);
739
+ y.setScale(rescaled);
740
+ const axis = yAxisMap.get(zoom.target.index);
762
741
  this.transformCacheY.set(axis.index, event.transform);
763
742
  }
764
743
  }
765
744
  }
766
- return map;
745
+ return {
746
+ x: xAxisMap,
747
+ y: yAxisMap
748
+ };
767
749
  }), shareReplay({
768
750
  bufferSize: 1,
769
751
  refCount: true,
@@ -790,7 +772,7 @@ class ZoomMessage {
790
772
  constructor(options) {
791
773
  this.event = options === null || options === void 0 ? void 0 : options.event;
792
774
  this.axis = options === null || options === void 0 ? void 0 : options.axis;
793
- this.brushDomain = options.brushDomain;
775
+ this.domain = options.domain;
794
776
  this.chartId = options === null || options === void 0 ? void 0 : options.chartId;
795
777
  this.style = options === null || options === void 0 ? void 0 : options.style;
796
778
  }
@@ -947,30 +929,33 @@ class BrushService {
947
929
  (window.TouchEvent &&
948
930
  m.message.event.sourceEvent instanceof TouchEvent));
949
931
  }), tap((m) => {
950
- var _a, _b, _c, _d, _e, _f, _g, _h;
951
- const { message: { brushDomain }, } = m;
932
+ var _a, _b, _c, _d, _e;
933
+ const { message: { domain }, } = m;
952
934
  if ((((_a = m.message) === null || _a === void 0 ? void 0 : _a.axis.index) === 0 &&
953
935
  ((_b = m.message) === null || _b === void 0 ? void 0 : _b.axis.orientation) === AxisOrientation.y &&
954
936
  ((_c = config.brush) === null || _c === void 0 ? void 0 : _c.type) === BrushType.y) ||
955
937
  (((_d = m.message) === null || _d === void 0 ? void 0 : _d.axis.orientation) === AxisOrientation.x &&
956
938
  ((_e = config.brush) === null || _e === void 0 ? void 0 : _e.type) === BrushType.x)) {
957
939
  container.call(this.brush.move, [
958
- brushScale(brushDomain[0]),
959
- brushScale(brushDomain[1]),
940
+ brushScale(domain[0]),
941
+ brushScale(domain[1]),
960
942
  ]);
961
- if (m.message.event.type === 'end') {
962
- const brushMessage = new BrushMessage({
963
- event: null,
964
- selection: brushDomain,
965
- brushType: (_g = (_f = config === null || config === void 0 ? void 0 : config.brush) === null || _f === void 0 ? void 0 : _f.type) !== null && _g !== void 0 ? _g : BrushType.x,
966
- brushScale,
967
- });
968
- this.broadcastService.broadcastBrush({
969
- channel: (_h = config === null || config === void 0 ? void 0 : config.zoom) === null || _h === void 0 ? void 0 : _h.syncChannel,
970
- message: brushMessage,
971
- });
972
- }
973
- this.selection = brushDomain;
943
+ this.selection = domain;
944
+ }
945
+ }), debounceTime(30), tap((m) => {
946
+ var _a, _b, _c;
947
+ const { message: { domain }, } = m;
948
+ if (m.message.event.type === 'zoom') {
949
+ const brushMessage = new BrushMessage({
950
+ event: null,
951
+ selection: domain,
952
+ brushType: (_b = (_a = config === null || config === void 0 ? void 0 : config.brush) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : BrushType.x,
953
+ brushScale,
954
+ });
955
+ this.broadcastService.broadcastBrush({
956
+ channel: (_c = config === null || config === void 0 ? void 0 : config.zoom) === null || _c === void 0 ? void 0 : _c.syncChannel,
957
+ message: brushMessage,
958
+ });
974
959
  }
975
960
  }))
976
961
  .subscribe();
@@ -1069,17 +1054,14 @@ class LinearSeriesBase extends SeriesBaseComponent {
1069
1054
  };
1070
1055
  this.defaultClipPointsMapping.set(ClipPointsDirection.x, filterX);
1071
1056
  this.defaultClipPointsMapping.set(ClipPointsDirection.y, filterY);
1072
- this.transform = this.svc.pointerMove.pipe(withLatestFrom(this.scaleService.xScaleMap, this.scaleService.yScaleMap), map((data) => {
1073
- const [event, x, y] = data;
1074
- return this.getTransform(event, x, y);
1057
+ this.transform = this.svc.pointerMove.pipe(withLatestFrom(this.scaleService.scales), map((data) => {
1058
+ const [event, { x, y }] = data;
1059
+ return this.getTransform(event, x.get(this.series.xAxisIndex).scale, y.get(this.series.yAxisIndex).scale);
1075
1060
  }), tap(() => setTimeout(() => this.cdr.detectChanges())));
1076
- this.path = combineLatest([
1077
- this.scaleService.xScaleMap,
1078
- this.scaleService.yScaleMap,
1079
- ]).pipe(map((data) => {
1080
- const [x, y] = data;
1081
- this.x = x.get(this.series.xAxisIndex);
1082
- this.y = y.get(this.series.yAxisIndex);
1061
+ this.path = this.scaleService.scales.pipe(map((data) => {
1062
+ const { x, y } = data;
1063
+ this.x = x.get(this.series.xAxisIndex).scale;
1064
+ this.y = y.get(this.series.yAxisIndex).scale;
1083
1065
  const filter = this.defaultClipPointsMapping.get(this.series.clipPointsDirection);
1084
1066
  const line = d3
1085
1067
  .line()
@@ -1167,8 +1149,6 @@ class LinearSeriesBase extends SeriesBaseComponent {
1167
1149
  return null;
1168
1150
  }
1169
1151
  const mouse = [event === null || event === void 0 ? void 0 : event.offsetX, event === null || event === void 0 ? void 0 : event.offsetY];
1170
- const foundX = scaleX.get(this.series.xAxisIndex);
1171
- const foundY = scaleY.get(this.series.yAxisIndex);
1172
1152
  const tooltipTracking = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.tooltip) === null || _b === void 0 ? void 0 : _b.tracking;
1173
1153
  const lineIntersection = (p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y) => {
1174
1154
  const rV = {};
@@ -1194,18 +1174,18 @@ class LinearSeriesBase extends SeriesBaseComponent {
1194
1174
  if (tooltipTracking === TooltipTracking.x) {
1195
1175
  const bisect = d3.bisector((_) => _.x).right;
1196
1176
  const pointer = mouse[0];
1197
- let x0 = foundX.invert(pointer);
1177
+ let x0 = scaleX.invert(pointer);
1198
1178
  if (x0 instanceof Date) {
1199
1179
  x0 = x0.getTime();
1200
1180
  }
1201
1181
  const rightId = bisect(this.series.data, x0);
1202
- const range = foundY.range();
1203
- const intersect = lineIntersection(pointer, range[0], pointer, range[1], foundX((_c = this.series.data[rightId - 1]) === null || _c === void 0 ? void 0 : _c.x), foundY((_d = this.series.data[rightId - 1]) === null || _d === void 0 ? void 0 : _d.y), foundX((_e = this.series.data[rightId]) === null || _e === void 0 ? void 0 : _e.x), foundY((_f = this.series.data[rightId]) === null || _f === void 0 ? void 0 : _f.y));
1204
- const x = foundX.invert(intersect.x);
1205
- const y = foundY.invert(intersect.y);
1182
+ const range = scaleY.range();
1183
+ const intersect = lineIntersection(pointer, range[0], pointer, range[1], scaleX((_c = this.series.data[rightId - 1]) === null || _c === void 0 ? void 0 : _c.x), scaleY((_d = this.series.data[rightId - 1]) === null || _d === void 0 ? void 0 : _d.y), scaleX((_e = this.series.data[rightId]) === null || _e === void 0 ? void 0 : _e.x), scaleY((_f = this.series.data[rightId]) === null || _f === void 0 ? void 0 : _f.y));
1184
+ const x = scaleX.invert(intersect.x);
1185
+ const y = scaleY.invert(intersect.y);
1206
1186
  if (x !== null && x !== undefined && !isNaN(x) && y !== null && y !== undefined && !isNaN(y)) {
1207
1187
  this.svc.setTooltip({
1208
- point: { x: foundX.invert(intersect.x), y: foundY.invert(intersect.y) },
1188
+ point: { x: scaleX.invert(intersect.x), y: scaleY.invert(intersect.y) },
1209
1189
  series: this.series,
1210
1190
  });
1211
1191
  }
@@ -1222,18 +1202,18 @@ class LinearSeriesBase extends SeriesBaseComponent {
1222
1202
  }
1223
1203
  if (tooltipTracking === TooltipTracking.y) {
1224
1204
  const bisect = d3.bisector((_) => _.y).right;
1225
- let y0 = foundY.invert(mouse[1]);
1205
+ let y0 = scaleY.invert(mouse[1]);
1226
1206
  if (y0 instanceof Date) {
1227
1207
  y0 = y0.getTime();
1228
1208
  }
1229
1209
  const rightId = bisect(this.series.data, y0);
1230
- const range = foundX.range();
1231
- const intersect = lineIntersection(range[0], mouse[1], range[1], mouse[1], foundX((_g = this.series.data[rightId - 1]) === null || _g === void 0 ? void 0 : _g.x), foundY((_h = this.series.data[rightId - 1]) === null || _h === void 0 ? void 0 : _h.y), foundX((_j = this.series.data[rightId]) === null || _j === void 0 ? void 0 : _j.x), foundY((_k = this.series.data[rightId]) === null || _k === void 0 ? void 0 : _k.y));
1232
- const x = foundX.invert(intersect.x);
1233
- const y = foundY.invert(intersect.y);
1210
+ const range = scaleX.range();
1211
+ const intersect = lineIntersection(range[0], mouse[1], range[1], mouse[1], scaleX((_g = this.series.data[rightId - 1]) === null || _g === void 0 ? void 0 : _g.x), scaleY((_h = this.series.data[rightId - 1]) === null || _h === void 0 ? void 0 : _h.y), scaleX((_j = this.series.data[rightId]) === null || _j === void 0 ? void 0 : _j.x), scaleY((_k = this.series.data[rightId]) === null || _k === void 0 ? void 0 : _k.y));
1212
+ const x = scaleX.invert(intersect.x);
1213
+ const y = scaleY.invert(intersect.y);
1234
1214
  if (x !== null && x !== undefined && !isNaN(x) && y !== null && y !== undefined && !isNaN(y)) {
1235
1215
  this.svc.setTooltip({
1236
- point: { x: foundX.invert(intersect.x), y: foundY.invert(intersect.y) },
1216
+ point: { x: scaleX.invert(intersect.x), y: scaleY.invert(intersect.y) },
1237
1217
  series: this.series,
1238
1218
  });
1239
1219
  }
@@ -1291,8 +1271,8 @@ class BarSeriesComponent extends SeriesBaseComponent {
1291
1271
  const count = _.series.filter((_) => _.type === SeriesType.bar && _.xAxisIndex === this.series.xAxisIndex);
1292
1272
  return count.length;
1293
1273
  }));
1294
- this.x1 = this.scaleService.xScaleMap.pipe(map((_) => {
1295
- const x = _.get(this.series.xAxisIndex);
1274
+ this.x1 = this.scaleService.scales.pipe(map((_) => {
1275
+ const x = _.x.get(this.series.xAxisIndex).scale;
1296
1276
  const range = x.range();
1297
1277
  const domain = this.series.data.map((_) => _.x);
1298
1278
  return d3
@@ -1301,8 +1281,8 @@ class BarSeriesComponent extends SeriesBaseComponent {
1301
1281
  .domain(domain)
1302
1282
  .padding(0.1);
1303
1283
  }));
1304
- this.x = this.scaleService.xScaleMap.pipe(map((_) => _.get(this.series.xAxisIndex)));
1305
- this.y = this.scaleService.yScaleMap.pipe(map((_) => _.get(this.series.yAxisIndex)));
1284
+ this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex).scale));
1285
+ this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex).scale));
1306
1286
  }
1307
1287
  mouseenter(point) {
1308
1288
  this.svc.setTooltip({
@@ -1335,8 +1315,8 @@ class ScatterSeriesComponent extends SeriesBaseComponent {
1335
1315
  this.element = element;
1336
1316
  }
1337
1317
  ngOnInit() {
1338
- this.x = this.scaleService.xScaleMap.pipe(map(_ => _.get(this.series.xAxisIndex)));
1339
- this.y = this.scaleService.yScaleMap.pipe(map(_ => _.get(this.series.yAxisIndex)));
1318
+ this.x = this.scaleService.scales.pipe(map(_ => _.x.get(this.series.xAxisIndex).scale));
1319
+ this.y = this.scaleService.scales.pipe(map(_ => _.y.get(this.series.yAxisIndex).scale));
1340
1320
  }
1341
1321
  ngAfterViewInit() {
1342
1322
  }
@@ -1374,8 +1354,8 @@ class BlockSeriesComponent extends SeriesBaseComponent {
1374
1354
  }
1375
1355
  ngOnInit() {
1376
1356
  const defaultVisiblePixels = 0;
1377
- this.x = this.scaleService.xScaleMap.pipe(map((_) => _.get(this.series.xAxisIndex)));
1378
- this.y = this.scaleService.yScaleMap.pipe(map((_) => _.get(this.series.yAxisIndex)));
1357
+ this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex).scale));
1358
+ this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex).scale));
1379
1359
  this.displayPoints = this.y.pipe(map((y) => {
1380
1360
  return this.series.data.filter((point, index, arr) => {
1381
1361
  var _a, _b, _c, _d;
@@ -1427,8 +1407,8 @@ class BlockAreaSeriesComponent extends SeriesBaseComponent {
1427
1407
  }
1428
1408
  ngOnInit() {
1429
1409
  const defaultVisiblePixels = 0;
1430
- this.x = this.scaleService.xScaleMap.pipe(map((_) => _.get(this.series.xAxisIndex)));
1431
- this.y = this.scaleService.yScaleMap.pipe(map((_) => _.get(this.series.yAxisIndex)));
1410
+ this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex).scale));
1411
+ this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex).scale));
1432
1412
  this.displayPoints = this.y.pipe(map((y) => {
1433
1413
  return this.series.data.filter((point, index, arr) => {
1434
1414
  var _a, _b, _c, _d;
@@ -1480,13 +1460,10 @@ class AreaSeriesComponent extends LinearSeriesBase {
1480
1460
  }
1481
1461
  ngOnInit() {
1482
1462
  super.ngOnInit();
1483
- this.areaPath = combineLatest([
1484
- this.scaleService.xScaleMap,
1485
- this.scaleService.yScaleMap,
1486
- ]).pipe(map((data) => {
1487
- const [x, y] = data;
1488
- this.x = x.get(this.series.xAxisIndex);
1489
- this.y = y.get(this.series.yAxisIndex);
1463
+ this.areaPath = this.scaleService.scales.pipe(map((data) => {
1464
+ const { x, y } = data;
1465
+ this.x = x.get(this.series.xAxisIndex).scale;
1466
+ this.y = y.get(this.series.yAxisIndex).scale;
1490
1467
  const area = d3
1491
1468
  .area()
1492
1469
  .defined((point) => point.x !== null &&
@@ -1576,10 +1553,16 @@ class GridlinesComponent {
1576
1553
  this.svc = svc;
1577
1554
  this.chartService = chartService;
1578
1555
  this.config = this.chartService.config;
1579
- this.tickYValues = this.svc.yScaleMap.pipe(map((_) => _.get(0).ticks()));
1580
- this.tickXValues = this.svc.xScaleMap.pipe(map((_) => _.get(0).ticks()));
1581
- this.y = this.svc.yScaleMap.pipe(map((_) => _.get(0)));
1582
- this.x = this.svc.xScaleMap.pipe(map((_) => _.get(0)));
1556
+ this.tickYValues = this.svc.scales.pipe(map((_) => {
1557
+ const ratio = this.size.height / 40;
1558
+ return _.y.get(0).scale.ticks(ratio);
1559
+ }));
1560
+ this.tickXValues = this.svc.scales.pipe(map((_) => {
1561
+ const ratio = this.size.width / 40;
1562
+ return _.x.get(0).scale.ticks(ratio);
1563
+ }));
1564
+ this.y = this.svc.scales.pipe(map((_) => _.y.get(0).scale));
1565
+ this.x = this.svc.scales.pipe(map((_) => _.x.get(0).scale));
1583
1566
  }
1584
1567
  ngAfterViewInit() {
1585
1568
  }
@@ -1597,8 +1580,9 @@ class XAxisComponent {
1597
1580
  constructor(scaleService) {
1598
1581
  this.scaleService = scaleService;
1599
1582
  this._alive = true;
1600
- this.x = this.scaleService.xScaleMap.pipe(map((_) => {
1601
- return _.get(this.axis.index);
1583
+ this.x = this.scaleService.scales.pipe(map((_) => {
1584
+ var _a;
1585
+ return (_a = _.x.get(this.axis.index)) === null || _a === void 0 ? void 0 : _a.scale;
1602
1586
  }));
1603
1587
  }
1604
1588
  getLabelTransform() {
@@ -1608,30 +1592,6 @@ class XAxisComponent {
1608
1592
  ngOnDestroy() {
1609
1593
  this._alive = false;
1610
1594
  }
1611
- ngAfterViewInit() {
1612
- // this.draw();
1613
- }
1614
- draw() {
1615
- // if (!this.node || !this.axis) {
1616
- // return;
1617
- // }
1618
- //
1619
- // const axis = this.axis.options.opposite
1620
- // ? d3
1621
- // .axisTop(this.scale)
1622
- // .tickFormat(
1623
- // this.axis.options.tickFormat ?? this.axis.defaultFormatter()
1624
- // )
1625
- // : d3
1626
- // .axisBottom(this.scale)
1627
- // .tickFormat(
1628
- // this.axis.options.tickFormat ?? this.axis.defaultFormatter()
1629
- // );
1630
- //
1631
- // d3.select(this.node.nativeElement)
1632
- // .call(axis)
1633
- // .call((_) => _.select('.domain').remove());
1634
- }
1635
1595
  }
1636
1596
  XAxisComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: XAxisComponent, deps: [{ token: ScaleService }], target: i0.ɵɵFactoryTarget.Component });
1637
1597
  XAxisComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: XAxisComponent, selector: "[teta-x-axis]", inputs: { axis: "axis", size: "size" }, ngImport: i0, template: "<ng-container *ngIf=\"x | async as scale\">\n <svg:g text-anchor=\"middle\" *ngFor=\"let tick of scale.ticks()\" [attr.transform]=\"'translate('+ scale(tick) +', 0)'\">\n <text fill=\"var(--color-text-70)\" [attr.dy]=\"axis.options.opposite ? '-0.71em' : '0.71em'\" [attr.y]=\"axis.options.opposite ? 0 : 9\">{{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}</text>\n <line stroke=\"var(--color-text-30)\" [attr.y2]=\"axis.options.opposite ? -6 : 6\"></line>\n </svg:g>\n\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text fill=\"var(--color-text-70)\" text-anchor=\"middle\" dominant-baseline=\"middle\">{{ axis.options.title }}</text>\n </svg:g>\n</ng-container>\n\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -1648,8 +1608,9 @@ class YAxisComponent {
1648
1608
  constructor(scaleService) {
1649
1609
  this.scaleService = scaleService;
1650
1610
  this._alive = true;
1651
- this.y = this.scaleService.yScaleMap.pipe(map((_) => {
1652
- return _.get(this.axis.index);
1611
+ this.y = this.scaleService.scales.pipe(map((_) => {
1612
+ var _a;
1613
+ return (_a = _.y.get(this.axis.index)) === null || _a === void 0 ? void 0 : _a.scale;
1653
1614
  }));
1654
1615
  }
1655
1616
  ngOnInit() { }
@@ -2011,7 +1972,7 @@ class ZoomableDirective {
2011
1972
  const message = new ZoomMessage({
2012
1973
  event,
2013
1974
  axis: this.axis,
2014
- brushDomain: domain,
1975
+ domain,
2015
1976
  chartId: this.config.id,
2016
1977
  });
2017
1978
  this.broadcastService.broadcastZoom({
@@ -2080,6 +2041,7 @@ class ZoomableDirective {
2080
2041
  this.zoom.scaleExtent([maxZoom, minZoom]);
2081
2042
  this.zoom.on('zoom end', this.zoomed);
2082
2043
  this._element.call(this.zoom).on('dblclick.zoom', null); // Disable dbclick zoom
2044
+ this.chartService.emitZoomInstance(this.zoomService);
2083
2045
  if (((_p = (_o = this.config) === null || _o === void 0 ? void 0 : _o.zoom) === null || _p === void 0 ? void 0 : _p.zoomBehavior) === ZoomBehaviorType.wheel) {
2084
2046
  this.runWheelZoom();
2085
2047
  }
@@ -2101,9 +2063,28 @@ class ZoomableDirective {
2101
2063
  return (this.axis.index === ((_b = (_a = m.message) === null || _a === void 0 ? void 0 : _a.axis) === null || _b === void 0 ? void 0 : _b.index) &&
2102
2064
  this.axis.orientation === ((_d = (_c = m.message) === null || _c === void 0 ? void 0 : _c.axis) === null || _d === void 0 ? void 0 : _d.orientation));
2103
2065
  }), tap$1((m) => {
2104
- var _a;
2066
+ var _a, _b, _c, _d, _e, _f, _g;
2105
2067
  if (this.config.id !== ((_a = m.message) === null || _a === void 0 ? void 0 : _a.chartId)) {
2106
- this._element.call(this.zoom.transform, m.message.event.transform, null, {});
2068
+ this.brushScale.domain(this.axis.originDomain);
2069
+ const scale = Math.abs(this.axis.originDomain[1] - this.axis.originDomain[0]) / Math.abs(m.message.domain[1] - m.message.domain[0]);
2070
+ let transform = zoomIdentity.scale(scale);
2071
+ if (((_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.zoom) === null || _c === void 0 ? void 0 : _c.type) === ZoomType.x) {
2072
+ if ((_d = this.config.xAxis[0]) === null || _d === void 0 ? void 0 : _d.inverted) {
2073
+ transform = transform.translate(-this.brushScale(m.message.domain[0]), 0);
2074
+ }
2075
+ else {
2076
+ transform = transform.translate(this.brushScale(-m.message.domain[1]), 0);
2077
+ }
2078
+ }
2079
+ if (((_f = (_e = this.config) === null || _e === void 0 ? void 0 : _e.zoom) === null || _f === void 0 ? void 0 : _f.type) === ZoomType.y) {
2080
+ if ((_g = this.config.yAxis[0]) === null || _g === void 0 ? void 0 : _g.inverted) {
2081
+ transform = transform.translate(0, -this.brushScale(m.message.domain[0]));
2082
+ }
2083
+ else {
2084
+ transform = transform.translate(0, -this.brushScale(m.message.domain[1]));
2085
+ }
2086
+ }
2087
+ this._element.call(this.zoom.transform, transform, null, {});
2107
2088
  }
2108
2089
  }))
2109
2090
  .subscribe();
@@ -2116,7 +2097,7 @@ class ZoomableDirective {
2116
2097
  .pipe(combineLatestWith(this.chartService.size), takeWhile((_) => this.alive), filter((data) => {
2117
2098
  const [m] = data;
2118
2099
  return Boolean(m.message.selection);
2119
- }), debounceTime(150), tap$1((data) => {
2100
+ }), tap$1((data) => {
2120
2101
  var _a, _b, _c, _d, _e, _f;
2121
2102
  const [m] = data;
2122
2103
  const currentTransform = d3.zoomTransform(this._element.node());
@@ -2204,7 +2185,7 @@ class ZoomableDirective {
2204
2185
  type,
2205
2186
  },
2206
2187
  axis: this.axis,
2207
- brushDomain: domain,
2188
+ domain,
2208
2189
  chartId: this.config.id,
2209
2190
  });
2210
2191
  this.zoomService.fireZoom({
@@ -2300,8 +2281,8 @@ class AnnotationComponent {
2300
2281
  this.scaleService = scaleService;
2301
2282
  this.cdr = cdr;
2302
2283
  this.chartService = chartService;
2303
- this.x = this.scaleService.xScaleMap.pipe(map((_) => { var _a; return _.get((_a = this.annotation.xAxisIndex) !== null && _a !== void 0 ? _a : 0); }));
2304
- this.y = this.scaleService.yScaleMap.pipe(map((_) => { var _a; return _.get((_a = this.annotation.yAxisIndex) !== null && _a !== void 0 ? _a : 0); }));
2284
+ this.x = this.scaleService.scales.pipe(map((_) => { var _a; return _.x.get((_a = this.annotation.xAxisIndex) !== null && _a !== void 0 ? _a : 0).scale; }));
2285
+ this.y = this.scaleService.scales.pipe(map((_) => { var _a; return _.y.get((_a = this.annotation.yAxisIndex) !== null && _a !== void 0 ? _a : 0).scale; }));
2305
2286
  this.drag = d3.drag();
2306
2287
  }
2307
2288
  set annotation(annotation) {
@@ -2415,32 +2396,23 @@ class ChartContainerComponent {
2415
2396
  this.sumSize = (acc, curr) => acc + curr.selfSize;
2416
2397
  this.config = this._svc.config;
2417
2398
  this.size = this._svc.size;
2418
- this.yAxisMap = this._scaleService.yAxisMap;
2419
- this.xAxisMap = this._scaleService.xAxisMap;
2420
- this.yScaleMap = this._scaleService.yScaleMap.pipe(observeOn(animationFrameScheduler, 10), tetaZoneFull(this._zone), shareReplay({
2421
- bufferSize: 1,
2422
- refCount: true,
2423
- }));
2424
- this.xScaleMap = this._scaleService.xScaleMap.pipe(observeOn(animationFrameScheduler, 10), tetaZoneFull(this._zone), shareReplay({
2399
+ this.scales = this._scaleService.scales.pipe(observeOn(animationFrameScheduler), tetaZoneFull(this._zone), shareReplay({
2425
2400
  bufferSize: 1,
2426
2401
  refCount: true,
2427
2402
  }));
2428
- this.brushScale = combineLatest([
2429
- this._scaleService.xScaleMap,
2430
- this._scaleService.yScaleMap,
2431
- ]).pipe(withLatestFrom(this.config), map((data) => {
2403
+ this.brushScale = this._scaleService.scales.pipe(withLatestFrom(this.config), map((data) => {
2432
2404
  var _a, _b;
2433
- const [[x, y], config] = data;
2434
- return ((_a = config.brush) === null || _a === void 0 ? void 0 : _a.type) === BrushType.x || ((_b = config === null || config === void 0 ? void 0 : config.zoom) === null || _b === void 0 ? void 0 : _b.type) === ZoomType.x ? x.get(0) : y.get(0);
2405
+ const [{ x, y }, config] = data;
2406
+ return ((_a = config.brush) === null || _a === void 0 ? void 0 : _a.type) === BrushType.x || ((_b = config === null || config === void 0 ? void 0 : config.zoom) === null || _b === void 0 ? void 0 : _b.type) === ZoomType.x ? x.get(0).scale : y.get(0).scale;
2435
2407
  }), shareReplay({
2436
2408
  bufferSize: 1,
2437
2409
  refCount: true,
2438
2410
  }));
2439
- this.visibleRect = this.size.pipe(combineLatestWith(this.xAxisMap, this.yAxisMap)).pipe(withLatestFrom(this.config), map((data) => {
2411
+ this.visibleRect = this.size.pipe(combineLatestWith(this.scales)).pipe(withLatestFrom(this.config), map((data) => {
2440
2412
  var _a, _b, _c, _d, _e, _f;
2441
- const [[size, x, y], config] = data;
2442
- const yAxesArray = [...y.values()];
2443
- const xAxesArray = [...x.values()];
2413
+ const [[size, { x, y }], config] = data;
2414
+ const yAxesArray = Array.from(y.values());
2415
+ const xAxesArray = Array.from(x.values());
2444
2416
  const left = yAxesArray
2445
2417
  .filter((_) => _.options.opposite !== true && _.options.visible)
2446
2418
  .reduce(this.sumSize, 0);
@@ -2492,11 +2464,11 @@ class ChartContainerComponent {
2492
2464
  this._observer.disconnect();
2493
2465
  }
2494
2466
  getTranslate(axis, size) {
2495
- return combineLatest([this.xAxisMap, this.yAxisMap]).pipe(withLatestFrom(this.config), map((data) => {
2467
+ return this.scales.pipe(withLatestFrom(this.config), map((data) => {
2496
2468
  var _a, _b;
2497
- const [[x, y], config] = data;
2498
- const xAxesArray = [...x.values()];
2499
- const yAxesArray = [...y.values()];
2469
+ const [{ x, y }, config] = data;
2470
+ const xAxesArray = Array.from(x.values());
2471
+ const yAxesArray = Array.from(y.values());
2500
2472
  const oppositeFilter = this.filterPositionMap.get(true);
2501
2473
  const nonOppositeFilter = this.filterPositionMap.get(false);
2502
2474
  const oppositeOffsetY = yAxesArray.filter(oppositeFilter(axis));
@@ -2559,10 +2531,10 @@ class ChartContainerComponent {
2559
2531
  }
2560
2532
  }
2561
2533
  ChartContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ChartContainerComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
2562
- ChartContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", 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; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.yScaleMap.get(item.key)\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.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; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible && data.xScaleMap && data.yScaleMap\">\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.xScaleMap.get(item.key)\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.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.visibleRect\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.brushScale\"\n [config]=\"data.config\"\n [axis]=\"data.config?.zoom?.type === zoomType.x ? data.xAxisMap.get(0) : data.yAxisMap.get(0)\"\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\"></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 <ng-container *ngFor=\"let series of data.config.series\">\n <g teta-series-host\n *ngIf=\"series.visible\"\n [config]=\"data.config\"\n [series]=\"series\"></g>\n </ng-container>\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 <g class=\"crosshair\" *ngIf=\"data.config.tooltip?.showCrosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></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}:host .crosshair{cursor:crosshair}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SeriesHostComponent, selector: "[teta-series-host]", inputs: ["config", "series"] }, { kind: "component", type: GridlinesComponent, selector: "[teta-gridlines]", inputs: ["size"] }, { kind: "component", type: XAxisComponent, selector: "[teta-x-axis]", inputs: ["axis", "size"] }, { kind: "component", type: YAxisComponent, selector: "[teta-y-axis]", inputs: ["axis", "size"] }, { kind: "component", type: PlotlineComponent, selector: "[teta-plot-line]", inputs: ["plotLine", "size", "axis", "scale"] }, { kind: "component", type: PlotBandComponent, selector: "[teta-plot-band]", inputs: ["plotBand", "axis", "scale", "size"] }, { kind: "component", type: TooltipComponent, selector: "teta-tooltip", inputs: ["size", "config"] }, { kind: "directive", type: ZoomableDirective, selector: "[tetaZoomable]", inputs: ["config", "axis", "size", "brushScale", "scale"] }, { kind: "directive", type: BrushableDirective, selector: "[tetaBrushable]", inputs: ["config", "brushScale"] }, { kind: "component", type: AnnotationComponent, selector: "[teta-annotation]", inputs: ["annotation"] }, { kind: "component", type: CrosshairComponent, selector: "[teta-crosshair]", inputs: ["size"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2534
+ ChartContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: ChartContainerComponent, selector: "teta-chart-container", ngImport: i0, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n scales: scales | 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.scales.x && data.scales.y\">\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n <ng-container *ngFor=\"let item of data.scales.y | keyvalue; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.scales.y.get(item.key).scale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.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.scales.x | keyvalue; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible && data.scales.x && data.scales.y\">\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.scales.x.get(item.key).scale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.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.scales.x && data.scales.y\">\n <svg\n tetaBrushable\n tetaZoomable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.brushScale\"\n [config]=\"data.config\"\n [axis]=\"data.config?.zoom?.type === zoomType.x ? data.scales.x.get(0) : data.scales.y.get(0)\"\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.scales.x, data.scales.y)\"\n (click)=\"click($event, data.scales.x, data.scales.y)\"\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\"></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.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.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.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.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.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.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.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"series-container\">\n <ng-container *ngFor=\"let series of data.config.series\">\n <g teta-series-host\n *ngIf=\"series.visible\"\n [config]=\"data.config\"\n [series]=\"series\"></g>\n </ng-container>\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 <g class=\"crosshair\" *ngIf=\"data.config.tooltip?.showCrosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></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}:host .crosshair{cursor:crosshair}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SeriesHostComponent, selector: "[teta-series-host]", inputs: ["config", "series"] }, { kind: "component", type: GridlinesComponent, selector: "[teta-gridlines]", inputs: ["size"] }, { kind: "component", type: XAxisComponent, selector: "[teta-x-axis]", inputs: ["axis", "size"] }, { kind: "component", type: YAxisComponent, selector: "[teta-y-axis]", inputs: ["axis", "size"] }, { kind: "component", type: PlotlineComponent, selector: "[teta-plot-line]", inputs: ["plotLine", "size", "axis", "scale"] }, { kind: "component", type: PlotBandComponent, selector: "[teta-plot-band]", inputs: ["plotBand", "axis", "scale", "size"] }, { kind: "component", type: TooltipComponent, selector: "teta-tooltip", inputs: ["size", "config"] }, { kind: "directive", type: ZoomableDirective, selector: "[tetaZoomable]", inputs: ["config", "axis", "size", "brushScale", "scale"] }, { kind: "directive", type: BrushableDirective, selector: "[tetaBrushable]", inputs: ["config", "brushScale"] }, { kind: "component", type: AnnotationComponent, selector: "[teta-annotation]", inputs: ["annotation"] }, { kind: "component", type: CrosshairComponent, selector: "[teta-crosshair]", inputs: ["size"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2563
2535
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ChartContainerComponent, decorators: [{
2564
2536
  type: Component,
2565
- 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; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.yScaleMap.get(item.key)\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.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; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible && data.xScaleMap && data.yScaleMap\">\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.xScaleMap.get(item.key)\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.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.visibleRect\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.brushScale\"\n [config]=\"data.config\"\n [axis]=\"data.config?.zoom?.type === zoomType.x ? data.xAxisMap.get(0) : data.yAxisMap.get(0)\"\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\"></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 <ng-container *ngFor=\"let series of data.config.series\">\n <g teta-series-host\n *ngIf=\"series.visible\"\n [config]=\"data.config\"\n [series]=\"series\"></g>\n </ng-container>\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 <g class=\"crosshair\" *ngIf=\"data.config.tooltip?.showCrosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></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}:host .crosshair{cursor:crosshair}\n"] }]
2537
+ args: [{ selector: 'teta-chart-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n scales: scales | 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.scales.x && data.scales.y\">\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n <ng-container *ngFor=\"let item of data.scales.y | keyvalue; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.scales.y.get(item.key).scale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.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.scales.x | keyvalue; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible && data.scales.x && data.scales.y\">\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.scales.x.get(item.key).scale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.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.scales.x && data.scales.y\">\n <svg\n tetaBrushable\n tetaZoomable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.brushScale\"\n [config]=\"data.config\"\n [axis]=\"data.config?.zoom?.type === zoomType.x ? data.scales.x.get(0) : data.scales.y.get(0)\"\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.scales.x, data.scales.y)\"\n (click)=\"click($event, data.scales.x, data.scales.y)\"\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\"></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.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.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.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.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.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.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.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"series-container\">\n <ng-container *ngFor=\"let series of data.config.series\">\n <g teta-series-host\n *ngIf=\"series.visible\"\n [config]=\"data.config\"\n [series]=\"series\"></g>\n </ng-container>\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 <g class=\"crosshair\" *ngIf=\"data.config.tooltip?.showCrosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></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}:host .crosshair{cursor:crosshair}\n"] }]
2566
2538
  }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }, { type: i0.NgZone }]; } });
2567
2539
 
2568
2540
  class LegendComponent {
@@ -2613,6 +2585,7 @@ class ChartComponent {
2613
2585
  this.annotationContextMenu = new EventEmitter();
2614
2586
  this.annotationClick = new EventEmitter();
2615
2587
  this.annotationMove = new EventEmitter();
2588
+ this.zoomServiceInstance = new EventEmitter();
2616
2589
  this._alive = true;
2617
2590
  this.svcConfig = this.chartService.config;
2618
2591
  this.hasSeriesData = this.svcConfig.pipe(map((_) => { var _a, _b; return ((_a = _.series) === null || _a === void 0 ? void 0 : _a.length) > 0 && ((_b = _.series) === null || _b === void 0 ? void 0 : _b.some((_) => { var _a; return ((_a = _.data) === null || _a === void 0 ? void 0 : _a.length) > 0; })); }));
@@ -2624,15 +2597,15 @@ class ChartComponent {
2624
2597
  }
2625
2598
  ngOnInit() {
2626
2599
  this.chartService.pointerMove
2627
- .pipe(takeWhile(() => this._alive), withLatestFrom(this.scaleService.xScaleMap, this.scaleService.yScaleMap, this.chartService.config))
2600
+ .pipe(takeWhile(() => this._alive), withLatestFrom(this.scaleService.scales, this.chartService.config))
2628
2601
  .subscribe((data) => {
2629
2602
  var _a;
2630
- const [event, x, y, config] = data;
2603
+ const [event, { x, y }, config] = data;
2631
2604
  const tooltipTracking = (_a = config === null || config === void 0 ? void 0 : config.tooltip) === null || _a === void 0 ? void 0 : _a.tracking;
2632
2605
  if (tooltipTracking === TooltipTracking.y) {
2633
2606
  const result = new Map();
2634
2607
  y.forEach((value, key) => {
2635
- result.set(key, value.invert(event.offsetY));
2608
+ result.set(key, value.scale.invert(event.offsetY));
2636
2609
  });
2637
2610
  this.pointerMove.emit({
2638
2611
  event: event,
@@ -2642,7 +2615,7 @@ class ChartComponent {
2642
2615
  else {
2643
2616
  const result = new Map();
2644
2617
  x.forEach((value, key) => {
2645
- result.set(key, value.invert(event.offsetX));
2618
+ result.set(key, value.scale.invert(event.offsetX));
2646
2619
  });
2647
2620
  this.pointerMove.emit({
2648
2621
  event: event,
@@ -2694,6 +2667,11 @@ class ChartComponent {
2694
2667
  .subscribe((_) => {
2695
2668
  this.annotationMove.emit(_);
2696
2669
  });
2670
+ this.chartService.zoomInstance
2671
+ .pipe(takeWhile(() => this._alive))
2672
+ .subscribe((_) => {
2673
+ this.zoomServiceInstance.emit(_);
2674
+ });
2697
2675
  }
2698
2676
  ngAfterViewInit() {
2699
2677
  }
@@ -2706,7 +2684,7 @@ class ChartComponent {
2706
2684
  }
2707
2685
  }
2708
2686
  ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ChartComponent, deps: [{ token: ChartService }, { token: ZoomService }, { token: ScaleService }], target: i0.ɵɵFactoryTarget.Component });
2709
- ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: ChartComponent, selector: "teta-svg-chart", inputs: { config: "config" }, outputs: { pointerMove: "pointerMove", plotBandsMove: "plotBandsMove", plotBandClick: "plotBandClick", plotBandContextMenu: "plotBandContextMenu", plotLinesMove: "plotLinesMove", pointMove: "pointMove", chartClick: "chartClick", chartContextMenu: "chartContextMenu", annotationContextMenu: "annotationContextMenu", annotationClick: "annotationClick", annotationMove: "annotationMove" }, providers: [ChartService, ZoomService, ScaleService, BrushService], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"{\n hasSeriesData: hasSeriesData | async,\n svcConfig: svcConfig | async\n} as data\">\n <ng-container *ngIf=\"data.hasSeriesData === true else noData\">\n <div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container position-relative\"></teta-chart-container>\n </div>\n <teta-legend *ngIf=\"data.svcConfig.legend?.enable === true\" [series]=\"data.svcConfig.series\"></teta-legend>\n </ng-container>\n</ng-container>\n<ng-template #noData>\n <div class=\"column column_auto align-center justify-content-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n </div>\n</ng-template>\n", styles: [":host{position:relative;display:flex;flex-direction:column;height:100%;width:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ChartContainerComponent, selector: "teta-chart-container" }, { kind: "component", type: LegendComponent, selector: "teta-legend", inputs: ["series"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2687
+ ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: ChartComponent, selector: "teta-svg-chart", inputs: { config: "config" }, outputs: { pointerMove: "pointerMove", plotBandsMove: "plotBandsMove", plotBandClick: "plotBandClick", plotBandContextMenu: "plotBandContextMenu", plotLinesMove: "plotLinesMove", pointMove: "pointMove", chartClick: "chartClick", chartContextMenu: "chartContextMenu", annotationContextMenu: "annotationContextMenu", annotationClick: "annotationClick", annotationMove: "annotationMove", zoomServiceInstance: "zoomServiceInstance" }, providers: [ChartService, ZoomService, ScaleService, BrushService], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"{\n hasSeriesData: hasSeriesData | async,\n svcConfig: svcConfig | async\n} as data\">\n <ng-container *ngIf=\"data.hasSeriesData === true else noData\">\n <div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container position-relative\"></teta-chart-container>\n </div>\n <teta-legend *ngIf=\"data.svcConfig.legend?.enable === true\" [series]=\"data.svcConfig.series\"></teta-legend>\n </ng-container>\n</ng-container>\n<ng-template #noData>\n <div class=\"column column_auto align-center justify-content-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n </div>\n</ng-template>\n", styles: [":host{position:relative;display:flex;flex-direction:column;height:100%;width:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ChartContainerComponent, selector: "teta-chart-container" }, { kind: "component", type: LegendComponent, selector: "teta-legend", inputs: ["series"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2710
2688
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ChartComponent, decorators: [{
2711
2689
  type: Component,
2712
2690
  args: [{ selector: 'teta-svg-chart', providers: [ChartService, ZoomService, ScaleService, BrushService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n hasSeriesData: hasSeriesData | async,\n svcConfig: svcConfig | async\n} as data\">\n <ng-container *ngIf=\"data.hasSeriesData === true else noData\">\n <div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container position-relative\"></teta-chart-container>\n </div>\n <teta-legend *ngIf=\"data.svcConfig.legend?.enable === true\" [series]=\"data.svcConfig.series\"></teta-legend>\n </ng-container>\n</ng-container>\n<ng-template #noData>\n <div class=\"column column_auto align-center justify-content-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n </div>\n</ng-template>\n", styles: [":host{position:relative;display:flex;flex-direction:column;height:100%;width:100%}\n"] }]
@@ -2732,6 +2710,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
2732
2710
  type: Output
2733
2711
  }], annotationMove: [{
2734
2712
  type: Output
2713
+ }], zoomServiceInstance: [{
2714
+ type: Output
2735
2715
  }], config: [{
2736
2716
  type: Input
2737
2717
  }] } });