@tetacom/svg-charts 1.3.1 → 1.3.3

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.
@@ -404,24 +404,10 @@ class ZoomService {
404
404
  }
405
405
  }
406
406
  setBroadcastChannel(channel) {
407
- var _a, _b;
408
- if (this.broadcastSub) {
409
- (_a = this.broadcastSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
410
- }
411
407
  this.broadcastChannel = channel;
412
- if ((_b = this.broadcastChannel) === null || _b === void 0 ? void 0 : _b.length) {
413
- this.broadcastSub = combineLatest([this._broadcast.subscribeToZoom(this.broadcastChannel), this._chart.config])
414
- .pipe(filter(([zoom, config]) => {
415
- var _a;
416
- return ((_a = zoom.message) === null || _a === void 0 ? void 0 : _a.chartId) !== config.id;
417
- }))
418
- .subscribe(([zoom, config]) => {
419
- this.fireZoom(zoom.message);
420
- });
421
- }
422
408
  }
423
409
  getD3Transform(targetDomain, originalDomain, scale, orientation, inverted) {
424
- const zoomScale = Math.abs(originalDomain[1] - originalDomain[0]) / Math.abs(targetDomain[1] - targetDomain[0]);
410
+ const zoomScale = Math.abs(scale(originalDomain[1]) - scale(originalDomain[0])) / Math.abs(scale(targetDomain[1]) - scale(targetDomain[0]));
425
411
  let transform = zoomIdentity.scale(zoomScale);
426
412
  if (orientation === AxisOrientation.x) {
427
413
  if (!!inverted) {
@@ -441,10 +427,6 @@ class ZoomService {
441
427
  }
442
428
  return transform;
443
429
  }
444
- ngOnDestroy() {
445
- var _a;
446
- (_a = this.broadcastSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
447
- }
448
430
  }
449
431
  ZoomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ZoomService, deps: [{ token: BroadcastService }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Injectable });
450
432
  ZoomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ZoomService, providedIn: 'root' });
@@ -864,7 +846,7 @@ class LinearSeriesBase extends SeriesBaseComponent {
864
846
  set series(series) {
865
847
  var _a;
866
848
  this.__series = series;
867
- this.markers = (_a = this.__series.data) === null || _a === void 0 ? void 0 : _a.filter((_) => (_ === null || _ === void 0 ? void 0 : _.marker) && (_ === null || _ === void 0 ? void 0 : _.x) !== undefined && (_ === null || _ === void 0 ? void 0 : _.y) !== undefined);
849
+ this.markers = (_a = this.__series.data) === null || _a === void 0 ? void 0 : _a.filter((_) => (_ === null || _ === void 0 ? void 0 : _.marker) && (_ === null || _ === void 0 ? void 0 : _.x) !== undefined && (_ === null || _ === void 0 ? void 0 : _.y) !== undefined && (_ === null || _ === void 0 ? void 0 : _.x) !== null && (_ === null || _ === void 0 ? void 0 : _.y) !== null);
868
850
  }
869
851
  get series() {
870
852
  return this.__series;
@@ -1599,13 +1581,14 @@ class XAxisComponent {
1599
1581
  constructor(scaleService, _svc) {
1600
1582
  this.scaleService = scaleService;
1601
1583
  this._svc = _svc;
1584
+ this.update$ = new BehaviorSubject(null);
1602
1585
  this._alive = true;
1603
1586
  this.x = this.scaleService.scales.pipe(map((_) => {
1604
1587
  var _a;
1605
1588
  return (_a = _.x.get(this.axis.index)) === null || _a === void 0 ? void 0 : _a.scale;
1606
1589
  }));
1607
- this.ticks = this.x.pipe(withLatestFrom(this._svc.size), map((_) => {
1608
- const [x, size] = _;
1590
+ this.ticks = combineLatest([this.x, this.update$]).pipe(withLatestFrom(this._svc.size), map((_) => {
1591
+ const [[x], size] = _;
1609
1592
  const tickSize = x.ticks().map((_) => getTextWidth(this.axis.options.tickFormat ? this.axis.options.tickFormat(_) : this.axis.defaultFormatter()(_), 0.45, 11));
1610
1593
  return x.ticks(size.width / parseInt(d3.max(tickSize), 10) / 10);
1611
1594
  }));
@@ -1618,9 +1601,14 @@ class XAxisComponent {
1618
1601
  ngOnDestroy() {
1619
1602
  this._alive = false;
1620
1603
  }
1604
+ ngOnChanges(changes) {
1605
+ if (changes.hasOwnProperty('axis')) {
1606
+ this.update$.next();
1607
+ }
1608
+ }
1621
1609
  }
1622
1610
  XAxisComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: XAxisComponent, deps: [{ token: ScaleService }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Component });
1623
- 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: x | async, ticks: ticks | async} as data\">\n <svg:g text-anchor=\"middle\" *ngFor=\"let tick of data.ticks\" [attr.transform]=\"'translate('+ data.x(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 });
1611
+ XAxisComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: XAxisComponent, selector: "[teta-x-axis]", inputs: { axis: "axis", size: "size" }, usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"{x: x | async, ticks: ticks | async} as data\">\n <svg:g text-anchor=\"middle\" *ngFor=\"let tick of data.ticks\" [attr.transform]=\"'translate('+ data.x(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 });
1624
1612
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: XAxisComponent, decorators: [{
1625
1613
  type: Component,
1626
1614
  args: [{ selector: '[teta-x-axis]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{x: x | async, ticks: ticks | async} as data\">\n <svg:g text-anchor=\"middle\" *ngFor=\"let tick of data.ticks\" [attr.transform]=\"'translate('+ data.x(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"] }]
@@ -1996,37 +1984,41 @@ class BrushMessage {
1996
1984
  }
1997
1985
 
1998
1986
  class ZoomableDirective {
1999
- constructor(elementRef, zoomService, chartService, zone) {
1987
+ constructor(elementRef, zoomService, chartService, broadcast, zone) {
2000
1988
  this.elementRef = elementRef;
2001
1989
  this.zoomService = zoomService;
2002
1990
  this.chartService = chartService;
1991
+ this.broadcast = broadcast;
2003
1992
  this.zone = zone;
2004
1993
  this.zoomable = false;
2005
1994
  this.crosshair = false;
2006
1995
  this.alive = true;
2007
1996
  this.currentTransform = zoomIdentity;
2008
1997
  this.zoomed = (event) => {
2009
- if (event.sourceEvent) {
2010
- if (Object.keys(event.sourceEvent).length !== 0) {
2011
- const origin = this.axis.scale.copy().domain(this.axis.originDomain);
2012
- let domain = this.axis.orientation === AxisOrientation.y
2013
- ? event.transform.rescaleY(origin).domain()
2014
- : event.transform.rescaleX(origin).domain();
2015
- const message = new ZoomMessage({
2016
- eventType: event.type,
2017
- axis: {
2018
- index: this.axis.index,
2019
- orientation: this.axis.orientation,
2020
- },
2021
- element: this.elementRef,
2022
- domain: domain,
2023
- chartId: this.config.id
2024
- });
2025
- this.zoomService.fireZoom(message);
2026
- this.zoomService.broadcastZoom(message);
2027
- }
2028
- this.currentTransform = event.transform;
1998
+ if (!event.sourceEvent)
1999
+ return;
2000
+ const origin = this.axis.scale.copy().domain(this.axis.originDomain);
2001
+ let domain = this.axis.orientation === AxisOrientation.y
2002
+ ? event.transform.rescaleY(origin).domain()
2003
+ : event.transform.rescaleX(origin).domain();
2004
+ const message = new ZoomMessage({
2005
+ eventType: event.type,
2006
+ axis: {
2007
+ index: this.axis.index,
2008
+ orientation: this.axis.orientation,
2009
+ },
2010
+ element: this.elementRef,
2011
+ domain: domain,
2012
+ chartId: this.config.id
2013
+ });
2014
+ if (event.sourceEvent.type === 'broadcast') {
2015
+ this.zoomService.fireZoom(message);
2029
2016
  }
2017
+ if (event.sourceEvent.type === 'wheeling' || event.sourceEvent instanceof MouseEvent || (window.TouchEvent && event.sourceEvent instanceof TouchEvent)) {
2018
+ this.zoomService.fireZoom(message);
2019
+ this.zoomService.broadcastZoom(message);
2020
+ }
2021
+ this.currentTransform = event.transform;
2030
2022
  };
2031
2023
  }
2032
2024
  ngOnInit() {
@@ -2051,7 +2043,7 @@ class ZoomableDirective {
2051
2043
  var _a, _b, _c;
2052
2044
  if (this._element && this.elementRef !== (zoomed === null || zoomed === void 0 ? void 0 : zoomed.element)
2053
2045
  && ((_a = zoomed === null || zoomed === void 0 ? void 0 : zoomed.axis) === null || _a === void 0 ? void 0 : _a.index) === this.axis.index
2054
- && ((_b = zoomed === null || zoomed === void 0 ? void 0 : zoomed.axis) === null || _b === void 0 ? void 0 : _b.orientation) === this.axis.orientation) {
2046
+ && ((_b = zoomed === null || zoomed === void 0 ? void 0 : zoomed.axis) === null || _b === void 0 ? void 0 : _b.orientation) === this.axis.orientation && zoomed.eventType === 'end') {
2055
2047
  const scale = this.axis.scale.copy().domain(this.axis.originDomain);
2056
2048
  let transform;
2057
2049
  if (zoomed.domain === null) {
@@ -2072,7 +2064,7 @@ class ZoomableDirective {
2072
2064
  });
2073
2065
  }
2074
2066
  initZoomListeners() {
2075
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
2067
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
2076
2068
  const enable = (((_b = (_a = this.axis) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.zoom) && ((_c = this.axis) === null || _c === void 0 ? void 0 : _c.options.visible) !== false) ||
2077
2069
  ((_e = (_d = this.config) === null || _d === void 0 ? void 0 : _d.zoom) === null || _e === void 0 ? void 0 : _e.enable);
2078
2070
  if (!enable) {
@@ -2083,31 +2075,55 @@ class ZoomableDirective {
2083
2075
  [0, 0],
2084
2076
  [this.size.width, this.size.height],
2085
2077
  ]);
2086
- if ((_f = this.config.zoom) === null || _f === void 0 ? void 0 : _f.limitTranslateByData) {
2078
+ const min = ((_g = (_f = this.config) === null || _f === void 0 ? void 0 : _f.zoom) === null || _g === void 0 ? void 0 : _g.minTranslate)
2079
+ ? this.axis.scale((_j = (_h = this.config) === null || _h === void 0 ? void 0 : _h.zoom) === null || _j === void 0 ? void 0 : _j.minTranslate)
2080
+ : 0;
2081
+ const max = ((_l = (_k = this.config) === null || _k === void 0 ? void 0 : _k.zoom) === null || _l === void 0 ? void 0 : _l.maxTranslate)
2082
+ ? this.axis.scale((_o = (_m = this.config) === null || _m === void 0 ? void 0 : _m.zoom) === null || _o === void 0 ? void 0 : _o.maxTranslate)
2083
+ : this.axis.orientation === AxisOrientation.x ? this.size.width : this.size.height;
2084
+ if (this.axis.orientation === AxisOrientation.x && ((_p = this.config.zoom) === null || _p === void 0 ? void 0 : _p.type) === ZoomType.x) {
2087
2085
  this.zoom.translateExtent([
2088
- [0, 0],
2089
- [this.size.width, this.size.height],
2086
+ [min, 0],
2087
+ [max, this.size.height],
2090
2088
  ]);
2091
2089
  }
2092
- if ((_g = this.config.zoom) === null || _g === void 0 ? void 0 : _g.wheelDelta) {
2093
- this.zoom.wheelDelta((_h = this.config.zoom) === null || _h === void 0 ? void 0 : _h.wheelDelta);
2090
+ if (this.axis.orientation === AxisOrientation.y && ((_q = this.config.zoom) === null || _q === void 0 ? void 0 : _q.type) === ZoomType.y) {
2091
+ this.zoom.translateExtent([
2092
+ [0, min],
2093
+ [this.size.width, max],
2094
+ ]);
2094
2095
  }
2095
- const maxZoom = ((_j = this.config.zoom) === null || _j === void 0 ? void 0 : _j.max)
2096
- ? (this.axis.extremes[1] - this.axis.extremes[0]) /
2097
- ((_k = this.config.zoom) === null || _k === void 0 ? void 0 : _k.max)
2098
- : ((_l = this.config.zoom) === null || _l === void 0 ? void 0 : _l.limitZoomByData)
2099
- ? 1
2100
- : 0;
2101
- const minZoom = ((_m = this.config.zoom) === null || _m === void 0 ? void 0 : _m.min)
2096
+ if ((_r = this.config.zoom) === null || _r === void 0 ? void 0 : _r.wheelDelta) {
2097
+ this.zoom.wheelDelta((_s = this.config.zoom) === null || _s === void 0 ? void 0 : _s.wheelDelta);
2098
+ }
2099
+ const maxZoom = ((_t = this.config.zoom) === null || _t === void 0 ? void 0 : _t.max)
2100
+ ? (this.axis.extremes[1] - this.axis.extremes[0]) / ((_u = this.config.zoom) === null || _u === void 0 ? void 0 : _u.max) : ((_v = this.config.zoom) === null || _v === void 0 ? void 0 : _v.limitZoomByData) ? 1 : 0;
2101
+ if ((_w = this.config.zoom) === null || _w === void 0 ? void 0 : _w.wheelDelta) {
2102
+ this.zoom.wheelDelta((_x = this.config.zoom) === null || _x === void 0 ? void 0 : _x.wheelDelta);
2103
+ }
2104
+ const minZoom = ((_y = this.config.zoom) === null || _y === void 0 ? void 0 : _y.min)
2102
2105
  ? (this.axis.extremes[1] - this.axis.extremes[0]) /
2103
- ((_o = this.config.zoom) === null || _o === void 0 ? void 0 : _o.min)
2106
+ ((_z = this.config.zoom) === null || _z === void 0 ? void 0 : _z.min)
2104
2107
  : Infinity;
2105
2108
  this.zoom.scaleExtent([maxZoom, minZoom]);
2106
2109
  this.zoom.on('zoom end', this.zoomed);
2107
- this._element.call(this.zoom).on('dblclick.zoom', null); // Disable dbclick zoom
2108
- if (((_q = (_p = this.config) === null || _p === void 0 ? void 0 : _p.zoom) === null || _q === void 0 ? void 0 : _q.zoomBehavior) === ZoomBehaviorType.wheel) {
2110
+ this._element.call(this.zoom).on('dblclick.zoom', null);
2111
+ if (((_1 = (_0 = this.config) === null || _0 === void 0 ? void 0 : _0.zoom) === null || _1 === void 0 ? void 0 : _1.zoomBehavior) === ZoomBehaviorType.wheel) {
2109
2112
  this.runWheelTranslate();
2110
2113
  }
2114
+ this.broadcast.subscribeToZoom((_2 = this.config) === null || _2 === void 0 ? void 0 : _2.zoom.syncChannel).subscribe((zoom) => {
2115
+ var _a, _b;
2116
+ if (zoom.message.chartId !== ((_a = this.config) === null || _a === void 0 ? void 0 : _a.id) && zoom.message.axis.orientation === this.axis.orientation && zoom.message.axis.index === this.axis.index) {
2117
+ const scale = this.axis.scale.copy().domain(this.axis.originDomain);
2118
+ const transform = this.zoomService.getD3Transform(zoom.message.domain, this.axis.originDomain, scale, this.axis.orientation, this.axis.options.inverted);
2119
+ if ((_b = zoom.message.style) === null || _b === void 0 ? void 0 : _b.transition) {
2120
+ this._element.transition().duration(300).call(this.zoom.transform, transform, null, { type: 'broadcast' });
2121
+ }
2122
+ else {
2123
+ this._element.call(this.zoom.transform, transform, null, { type: 'broadcast' });
2124
+ }
2125
+ }
2126
+ });
2111
2127
  }
2112
2128
  runWheelTranslate() {
2113
2129
  let type = 'start';
@@ -2126,7 +2142,6 @@ class ZoomableDirective {
2126
2142
  });
2127
2143
  const emit = (type, event) => {
2128
2144
  var _a;
2129
- const origin = this.axis.scale.copy().domain(this.axis.originDomain);
2130
2145
  let transform = zoomIdentity;
2131
2146
  const delta = type === 'end'
2132
2147
  ? 0
@@ -2140,22 +2155,7 @@ class ZoomableDirective {
2140
2155
  transform = transform.translate(this.currentTransform.x - delta / 2, 0);
2141
2156
  }
2142
2157
  transform = transform.scale(this.currentTransform.k);
2143
- let domain = this.axis.orientation === AxisOrientation.y
2144
- ? transform.rescaleY(origin).domain()
2145
- : transform.rescaleX(origin).domain();
2146
- const message = new ZoomMessage({
2147
- eventType: type,
2148
- element: this.elementRef,
2149
- axis: {
2150
- index: this.axis.index,
2151
- orientation: this.axis.orientation
2152
- },
2153
- domain,
2154
- chartId: this.config.id,
2155
- });
2156
- (_a = this._element) === null || _a === void 0 ? void 0 : _a.call(this.zoom.transform, transform);
2157
- this.zoomService.fireZoom(message);
2158
- this.zoomService.broadcastZoom(message);
2158
+ (_a = this._element) === null || _a === void 0 ? void 0 : _a.call(this.zoom.transform, transform, null, { type: 'wheeling' });
2159
2159
  this.currentTransform = transform;
2160
2160
  };
2161
2161
  this._element.on('wheel', (event) => {
@@ -2175,14 +2175,14 @@ class ZoomableDirective {
2175
2175
  });
2176
2176
  }
2177
2177
  }
2178
- ZoomableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ZoomableDirective, deps: [{ token: i0.ElementRef }, { token: ZoomService }, { token: ChartService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
2178
+ ZoomableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ZoomableDirective, deps: [{ token: i0.ElementRef }, { token: ZoomService }, { token: ChartService }, { token: BroadcastService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
2179
2179
  ZoomableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.2", type: ZoomableDirective, selector: "[tetaZoomable]", inputs: { config: "config", axis: "axis", size: "size" }, host: { properties: { "class.zoomable": "this.zoomable", "class.crosshair": "this.crosshair" } }, ngImport: i0 });
2180
2180
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ZoomableDirective, decorators: [{
2181
2181
  type: Directive,
2182
2182
  args: [{
2183
2183
  selector: '[tetaZoomable]',
2184
2184
  }]
2185
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ZoomService }, { type: ChartService }, { type: i0.NgZone }]; }, propDecorators: { config: [{
2185
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ZoomService }, { type: ChartService }, { type: BroadcastService }, { type: i0.NgZone }]; }, propDecorators: { config: [{
2186
2186
  type: Input
2187
2187
  }], axis: [{
2188
2188
  type: Input
@@ -2220,6 +2220,14 @@ class BrushableDirective {
2220
2220
  this._alive = false;
2221
2221
  }
2222
2222
  ngAfterViewInit() {
2223
+ var _a, _b, _c, _d;
2224
+ if ((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.brush) === null || _b === void 0 ? void 0 : _b.enable) {
2225
+ const brushMessage = new BrushMessage({
2226
+ chartId: this.config.id,
2227
+ selection: [(_c = this.config.brush) === null || _c === void 0 ? void 0 : _c.from, (_d = this.config.brush) === null || _d === void 0 ? void 0 : _d.to],
2228
+ });
2229
+ this.brushService.setBrush(brushMessage);
2230
+ }
2223
2231
  }
2224
2232
  ngOnChanges(changes) {
2225
2233
  var _a, _b;
@@ -2313,7 +2321,7 @@ class BrushableDirective {
2313
2321
  }
2314
2322
  this._container.call(this.brush.move, this.selection
2315
2323
  ? this.selection.map(brushScale)
2316
- : domain.map(brushScale), {});
2324
+ : domain.map(brushScale));
2317
2325
  }, 0);
2318
2326
  });
2319
2327
  }
@@ -2415,8 +2423,6 @@ class CrosshairComponent {
2415
2423
  }
2416
2424
  ngOnInit() {
2417
2425
  this.transform = this.chartService.pointerMove.pipe(map((event) => {
2418
- const composedPath = event.composedPath();
2419
- const classes = composedPath.map((_) => { var _a; return (_a = _.classList) === null || _a === void 0 ? void 0 : _a.contains('crosshair'); }).filter((_) => _);
2420
2426
  return {
2421
2427
  x: event.type === 'mouseleave' ? -9999 : event.offsetX,
2422
2428
  y: event.type === 'mouseleave' ? -9999 : event.offsetY