@tetacom/svg-charts 1.7.0 → 1.7.2

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 (24) hide show
  1. package/chart/base/series-base.component.d.ts +13 -13
  2. package/chart/chart-container/chart-container.component.d.ts +0 -3
  3. package/chart/chart-container/series/area-series/area-series.component.d.ts +6 -18
  4. package/chart/chart-container/series/bar/bar-series.component.d.ts +5 -21
  5. package/chart/chart-container/series/block-area-series/block-area-series.component.d.ts +3 -21
  6. package/chart/chart-container/series/block-horizontal-series/block-horizontal-series.component.d.ts +4 -21
  7. package/chart/chart-container/series/block-series/block-series.component.d.ts +4 -21
  8. package/chart/chart-container/series/line/line-series.component.d.ts +3 -12
  9. package/chart/chart-container/series/linear-series-base.component.d.ts +20 -0
  10. package/chart/chart-container/series/public-api.d.ts +1 -1
  11. package/chart/chart-container/series/scatter-series/scatter-series.component.d.ts +1 -21
  12. package/chart/chart-container/series-controls/series-controls.component.d.ts +23 -0
  13. package/chart/chart-container/series-host/series-host.component.d.ts +5 -6
  14. package/chart/legend/legend.component.d.ts +3 -3
  15. package/chart/model/i-chart-config.d.ts +4 -1
  16. package/chart/model/series.d.ts +1 -0
  17. package/chart/service/chart.service.d.ts +4 -3
  18. package/fesm2022/tetacom-svg-charts.mjs +352 -422
  19. package/fesm2022/tetacom-svg-charts.mjs.map +1 -1
  20. package/index.d.ts +0 -1
  21. package/package.json +3 -2
  22. package/chart/chart-container/series/linear-series-base.d.ts +0 -35
  23. package/observable/public-api.d.ts +0 -1
  24. package/observable/zoneObservable.d.ts +0 -5
@@ -1,11 +1,15 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Component, Input, ElementRef, ChangeDetectionStrategy, ViewChild, Directive, HostBinding, HostListener, EventEmitter, Output, ChangeDetectorRef } from '@angular/core';
3
- import { ReplaySubject, filter, BehaviorSubject, Subject, of, withLatestFrom, map, shareReplay, lastValueFrom, take, combineLatest, tap, takeWhile, Observable, pipe, observeOn, animationFrameScheduler } from 'rxjs';
2
+ import { Injectable, input, inject, ChangeDetectorRef, ElementRef, computed, Component, ChangeDetectionStrategy, Input, ViewChild, Directive, HostBinding, HostListener, signal, EventEmitter, Output, ViewContainerRef, effect } from '@angular/core';
3
+ import { ReplaySubject, filter, BehaviorSubject, Subject, of, withLatestFrom, map, shareReplay, merge, lastValueFrom, take, combineLatest, tap, takeWhile, observeOn, animationFrameScheduler } from 'rxjs';
4
4
  import * as d3 from 'd3';
5
5
  import { zoomIdentity } from 'd3';
6
6
  import { maxIndex } from 'd3-array';
7
+ import { toSignal } from '@angular/core/rxjs-interop';
7
8
  import * as i3 from '@angular/platform-browser';
8
9
  import { AsyncPipe, NgTemplateOutlet, KeyValuePipe, NgStyle } from '@angular/common';
10
+ import { Align as Align$1, ButtonComponent, DropdownComponent, DropdownContentDirective, DropdownHeadDirective, IconComponent, AccordionComponent, AccordionHeadComponent, AccordionItemComponent, AccordionContentDirective, CheckboxComponent, ColorInputComponent, SelectComponent, SelectOptionDirective, SelectValueDirective } from '@tetacom/ng-components';
11
+ import * as i1 from '@angular/forms';
12
+ import { FormsModule } from '@angular/forms';
9
13
 
10
14
  class BroadcastService {
11
15
  constructor() {
@@ -114,6 +118,9 @@ const defaultChartConfig = () => ({
114
118
  legend: {
115
119
  enable: true,
116
120
  },
121
+ controls: {
122
+ enable: true,
123
+ },
117
124
  tooltip: {
118
125
  enable: true,
119
126
  showMarkers: true,
@@ -168,13 +175,15 @@ const defaultSeriesConfig = () => ({
168
175
  fillType: FillType.default,
169
176
  color: 'coral',
170
177
  visible: true,
178
+ enabled: true,
171
179
  clipPointsDirection: ClipPointsDirection.x,
172
180
  });
173
181
 
174
182
  class ChartService {
175
- static { this._hiddenSeriesPostfix = 'hidden_series'; }
183
+ static { this._hiddenSeriesPostfix = 'series_config'; }
176
184
  constructor() {
177
185
  this.config$ = new BehaviorSubject(defaultChartConfig());
186
+ this.configUpdates$ = new Subject();
178
187
  this.size$ = new BehaviorSubject(null);
179
188
  this.pointerMove$ = new Subject();
180
189
  this.tooltips$ = new BehaviorSubject(new Map());
@@ -186,7 +195,11 @@ class ChartService {
186
195
  this.annotationEvent$ = new Subject();
187
196
  this.annotationMove$ = new Subject();
188
197
  this.id = of((Date.now() + Math.random()).toString(36));
189
- this.config = this.config$.asObservable().pipe(withLatestFrom(this.id), map(this.setDefaults), map(this.setPreparationData), map(this.restoreLocalStorage), shareReplay({
198
+ const initialConfig = this.config$.asObservable().pipe(withLatestFrom(this.id), map(this.setDefaults), map(this.setPreparationData), map(this.restoreLocalStorage), shareReplay({
199
+ bufferSize: 1,
200
+ refCount: true,
201
+ }));
202
+ this.config = merge(initialConfig, this.configUpdates$).pipe(shareReplay({
190
203
  bufferSize: 1,
191
204
  refCount: true,
192
205
  }));
@@ -205,8 +218,6 @@ class ChartService {
205
218
  this.annotationMove = this.annotationMove$.asObservable();
206
219
  this.plotBandClick = this.plotBandEvent$.asObservable().pipe(filter((_) => _?.event?.type === 'click'));
207
220
  this.plotBandContextMenu = this.plotBandEvent$.asObservable().pipe(filter((_) => _?.event?.type === 'contextmenu'));
208
- // this.zoomInstance = this.zoomInstance$.asObservable();
209
- // this.brushInstance = this.brushInstance$.asObservable();
210
221
  }
211
222
  setConfig(config) {
212
223
  this.clearTooltips();
@@ -231,26 +242,20 @@ class ChartService {
231
242
  clearTooltips() {
232
243
  this.tooltips$.next(new Map());
233
244
  }
234
- async toggleVisibilitySeries(seriesIndex, visible) {
235
- if (seriesIndex?.length === 0) {
245
+ async updateSeries(series, visible) {
246
+ const currentConfig = await lastValueFrom(this.config.pipe(take(1)));
247
+ const currentSeriesIndex = currentConfig.series.findIndex((_) => _.id === series.id);
248
+ if (currentSeriesIndex === -1) {
236
249
  return;
237
250
  }
238
- const currentConfig = await lastValueFrom(this.config.pipe(take(1)));
239
- seriesIndex.forEach((serieIndex) => {
240
- const currentSerieIndex = currentConfig.series.findIndex((_) => _.id === serieIndex);
241
- if (currentSerieIndex === -1) {
242
- return;
243
- }
244
- currentConfig.series[currentSerieIndex].visible =
245
- visible !== undefined ? visible : !currentConfig.series[currentSerieIndex].visible;
246
- const seriesLinkCount = currentConfig.series.filter((_) => _.yAxisIndex === currentConfig.series[currentSerieIndex].yAxisIndex && _.visible === true).length;
247
- currentConfig.yAxis[currentConfig.series[currentSerieIndex].yAxisIndex].visible = seriesLinkCount !== 0;
248
- });
251
+ currentConfig.series = [...currentConfig.series];
252
+ const seriesLinkCount = currentConfig.series.filter((_) => _.yAxisIndex === currentConfig.series[currentSeriesIndex].yAxisIndex && _.visible === true).length;
253
+ currentConfig.yAxis[currentConfig.series[currentSeriesIndex].yAxisIndex].visible = seriesLinkCount !== 0;
249
254
  try {
250
255
  this.saveCookie(currentConfig);
251
256
  }
252
257
  finally {
253
- this.config$.next(currentConfig);
258
+ this.configUpdates$.next({ ...currentConfig });
254
259
  }
255
260
  }
256
261
  emitMoveAnnotation(event) {
@@ -259,10 +264,10 @@ class ChartService {
259
264
  emitAnnotation(event) {
260
265
  this.annotationEvent$.next(event);
261
266
  }
262
- emitPlotband(event) {
267
+ emitPlotBand(event) {
263
268
  this.plotBandEvent$.next(event);
264
269
  }
265
- emitPlotline(event) {
270
+ emitPlotLine(event) {
266
271
  this.plotLineMove$.next(event);
267
272
  }
268
273
  emitPoint(event) {
@@ -274,31 +279,46 @@ class ChartService {
274
279
  emitChartContextMenu(event) {
275
280
  this.chartContextMenu$.next(event);
276
281
  }
277
- // public emitZoomInstance(event: ZoomService) {
278
- // this.zoomInstance$.next(event);
279
- // }
280
- //
281
- // public emitZoomInstance(event: ZoomService) {
282
- // this.zoomInstance$.next(event);
283
- // }
284
282
  saveCookie(config) {
285
283
  if (!config.name)
286
284
  return;
287
- const hiddenSeries = config.series?.filter((_) => !_.visible).map((_) => _.id);
288
- localStorage.setItem(`${config.name}_${ChartService._hiddenSeriesPostfix}`, JSON.stringify(hiddenSeries));
285
+ const series = config.series?.map((_) => {
286
+ return {
287
+ id: _.id,
288
+ visible: _.visible,
289
+ enabled: _.enabled,
290
+ color: _.color,
291
+ strokeDasharray: _.style?.strokeDasharray,
292
+ strokeWidth: _.style?.strokeWidth,
293
+ };
294
+ });
295
+ localStorage.setItem(`${config.name}_${ChartService._hiddenSeriesPostfix}`, JSON.stringify(series));
289
296
  }
290
297
  restoreLocalStorage(config) {
291
298
  if (!config.name)
292
299
  return config;
293
- const hiddenSeries = localStorage.getItem(`${config.name}_${ChartService._hiddenSeriesPostfix}`);
294
- if (hiddenSeries) {
295
- const json = JSON.parse(hiddenSeries);
300
+ const seriesConfig = localStorage.getItem(`${config.name}_${ChartService._hiddenSeriesPostfix}`);
301
+ if (seriesConfig) {
302
+ const json = JSON.parse(seriesConfig);
296
303
  config.series = config.series.map((serie, index) => {
297
- serie.visible = !json.includes(serie.id);
304
+ const found = json.find((_) => _.id === serie.id);
305
+ if (found) {
306
+ serie.visible = found.visible ?? serie.visible;
307
+ serie.enabled = found.enabled ?? serie.enabled;
308
+ serie.color = found.color ?? serie.color;
309
+ if (!serie.style) {
310
+ serie.style = {};
311
+ }
312
+ serie.style.strokeWidth = found.strokeWidth ?? serie.style.strokeWidth;
313
+ serie.style.strokeDasharray = found.strokeDasharray ?? serie.style.strokeDasharray;
314
+ }
298
315
  const currentSerieIndex = config.series.findIndex((_) => _.id === serie.id);
299
316
  if (currentSerieIndex !== -1) {
300
317
  const seriesLinkCount = config.series.filter((_) => _.yAxisIndex === config.series[currentSerieIndex].yAxisIndex && _.visible === true).length;
301
- config.yAxis[config.series[currentSerieIndex].yAxisIndex].visible = seriesLinkCount !== 0;
318
+ const yAxis = config.yAxis[config.series[currentSerieIndex].yAxisIndex];
319
+ if (yAxis) {
320
+ yAxis.visible = seriesLinkCount !== 0;
321
+ }
302
322
  }
303
323
  return serie;
304
324
  });
@@ -877,29 +897,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
877
897
  }], ctorParameters: () => [{ type: ChartService }, { type: ZoomService }] });
878
898
 
879
899
  class SeriesBaseComponent {
880
- set config(config) {
881
- this._config = config;
882
- }
883
- get config() {
884
- return this._config;
885
- }
886
- set series(series) {
887
- this._series = series;
900
+ constructor() {
901
+ this.config = input();
902
+ this.series = input();
903
+ this.svc = inject(ChartService);
904
+ this.cdr = inject(ChangeDetectorRef);
905
+ this.scaleService = inject(ScaleService);
906
+ this.zoomService = inject(ZoomService);
907
+ this.element = inject(ElementRef);
908
+ this.id = (Date.now() + Math.random()).toString(36);
909
+ this.xScales = toSignal(this.scaleService.scales.pipe(map((_) => _.x)));
910
+ this.yScales = toSignal(this.scaleService.scales.pipe(map((_) => _.y)));
911
+ this.x = computed(() => {
912
+ return this.xScales().get(this.series().xAxisIndex)?.scale;
913
+ });
914
+ this.y = computed(() => {
915
+ return this.yScales().get(this.series().yAxisIndex)?.scale;
916
+ });
888
917
  }
889
- get series() {
890
- return this._series;
918
+ mouseenter(point) {
919
+ this.svc.setTooltip({
920
+ point: point,
921
+ series: this.series(),
922
+ });
891
923
  }
892
- constructor(svc, cdr, scaleService, zoomService, element, zone) {
893
- this.svc = svc;
894
- this.cdr = cdr;
895
- this.scaleService = scaleService;
896
- this.zoomService = zoomService;
897
- this.element = element;
898
- this.zone = zone;
924
+ mouseleave(point) {
925
+ this.svc.setTooltip({
926
+ point: null,
927
+ series: this.series(),
928
+ });
899
929
  }
900
- ngOnInit() { }
901
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesBaseComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
902
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: SeriesBaseComponent, isStandalone: true, selector: "ng-component", inputs: { config: "config", series: "series" }, ngImport: i0, template: '', isInline: true }); }
930
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
931
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.5", type: SeriesBaseComponent, isStandalone: true, selector: "ng-component", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '', isInline: true }); }
903
932
  }
904
933
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesBaseComponent, decorators: [{
905
934
  type: Component,
@@ -907,11 +936,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
907
936
  template: '',
908
937
  standalone: true,
909
938
  }]
910
- }], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }, { type: i0.NgZone }], propDecorators: { config: [{
911
- type: Input
912
- }], series: [{
913
- type: Input
914
- }] } });
939
+ }] });
915
940
 
916
941
  var BrushType;
917
942
  (function (BrushType) {
@@ -1194,11 +1219,11 @@ class XAxisComponent {
1194
1219
  }
1195
1220
  }
1196
1221
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: XAxisComponent, deps: [{ token: ScaleService }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Component }); }
1197
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: XAxisComponent, isStandalone: true, selector: "[teta-x-axis]", inputs: { axis: "axis", size: "size" }, usesOnChanges: true, ngImport: i0, template: "@if ({ x: x | async, ticks: ticks | async }; as data) {\n @for (tick of data.ticks; track tick) {\n <svg:g text-anchor=\"middle\" [attr.transform]=\"'translate(' + data.x(tick) + ', 0)'\">\n <text\n fill=\"var(--color-text-70)\"\n [attr.dy]=\"axis.options.opposite ? '-0.71em' : '0.71em'\"\n [attr.y]=\"axis.options.opposite ? 0 : 9\"\n >\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </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\">\n {{ axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1222
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: XAxisComponent, isStandalone: true, selector: "[teta-x-axis]", inputs: { axis: "axis", size: "size" }, usesOnChanges: true, ngImport: i0, template: "@if ({ x: x | async, ticks: ticks | async }; as data) {\n @for (tick of data.ticks; track $index) {\n <svg:g text-anchor=\"middle\" [attr.transform]=\"'translate(' + data.x(tick) + ', 0)'\">\n <text\n fill=\"var(--color-text-70)\"\n [attr.dy]=\"axis.options.opposite ? '-0.71em' : '0.71em'\"\n [attr.y]=\"axis.options.opposite ? 0 : 9\"\n >\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </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\">\n {{ axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1198
1223
  }
1199
1224
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: XAxisComponent, decorators: [{
1200
1225
  type: Component,
1201
- args: [{ selector: '[teta-x-axis]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ x: x | async, ticks: ticks | async }; as data) {\n @for (tick of data.ticks; track tick) {\n <svg:g text-anchor=\"middle\" [attr.transform]=\"'translate(' + data.x(tick) + ', 0)'\">\n <text\n fill=\"var(--color-text-70)\"\n [attr.dy]=\"axis.options.opposite ? '-0.71em' : '0.71em'\"\n [attr.y]=\"axis.options.opposite ? 0 : 9\"\n >\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </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\">\n {{ axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"] }]
1226
+ args: [{ selector: '[teta-x-axis]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ x: x | async, ticks: ticks | async }; as data) {\n @for (tick of data.ticks; track $index) {\n <svg:g text-anchor=\"middle\" [attr.transform]=\"'translate(' + data.x(tick) + ', 0)'\">\n <text\n fill=\"var(--color-text-70)\"\n [attr.dy]=\"axis.options.opposite ? '-0.71em' : '0.71em'\"\n [attr.y]=\"axis.options.opposite ? 0 : 9\"\n >\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </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\">\n {{ axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"] }]
1202
1227
  }], ctorParameters: () => [{ type: ScaleService }, { type: ChartService }], propDecorators: { axis: [{
1203
1228
  type: Input
1204
1229
  }], size: [{
@@ -1453,11 +1478,11 @@ class YAxisComponent {
1453
1478
  return `translate(${this.axis.options.opposite ? this.axis.selfSize : -this.axis.selfSize}, ${this.size.height / 2}) rotate(-90)`;
1454
1479
  }
1455
1480
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: YAxisComponent, deps: [{ token: ScaleService }], target: i0.ɵɵFactoryTarget.Component }); }
1456
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: YAxisComponent, isStandalone: true, selector: "[teta-y-axis]", inputs: { axis: "axis", size: "size" }, ngImport: i0, template: "@if (y | async; as scale) {\n @for (tick of scale.ticks(); track tick) {\n <svg:g\n [attr.text-anchor]=\"axis.options.opposite ? 'start' : 'end'\"\n [attr.transform]=\"'translate(0, ' + scale(tick) + ')'\"\n >\n <text fill=\"var(--color-text-70)\" dy=\"0.32em\" [attr.x]=\"axis.options.opposite ? 10 : -9\">\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.x2]=\"axis.options.opposite ? 6 : -6\"></line>\n </svg:g>\n }\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text\n [attr.dy]=\"axis.options.opposite ? '-4px' : '4px'\"\n text-anchor=\"middle\"\n [attr.dominant-baseline]=\"axis.options.opposite ? 'auto' : 'hanging'\"\n >\n {{ axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host{shape-rendering:crispEdges}:host .label-axis{fill:var(--color-text-70)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1481
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: YAxisComponent, isStandalone: true, selector: "[teta-y-axis]", inputs: { axis: "axis", size: "size" }, ngImport: i0, template: "@if (y | async; as scale) {\n @for (tick of scale.ticks(); track $index) {\n <svg:g\n [attr.text-anchor]=\"axis.options.opposite ? 'start' : 'end'\"\n [attr.transform]=\"'translate(0, ' + scale(tick) + ')'\"\n >\n <text fill=\"var(--color-text-70)\" dy=\"0.32em\" [attr.x]=\"axis.options.opposite ? 10 : -9\">\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.x2]=\"axis.options.opposite ? 6 : -6\"></line>\n </svg:g>\n }\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text\n [attr.dy]=\"axis.options.opposite ? '-4px' : '4px'\"\n text-anchor=\"middle\"\n [attr.dominant-baseline]=\"axis.options.opposite ? 'auto' : 'hanging'\"\n >\n {{ axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host{shape-rendering:crispEdges}:host .label-axis{fill:var(--color-text-70)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1457
1482
  }
1458
1483
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: YAxisComponent, decorators: [{
1459
1484
  type: Component,
1460
- args: [{ selector: '[teta-y-axis]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if (y | async; as scale) {\n @for (tick of scale.ticks(); track tick) {\n <svg:g\n [attr.text-anchor]=\"axis.options.opposite ? 'start' : 'end'\"\n [attr.transform]=\"'translate(0, ' + scale(tick) + ')'\"\n >\n <text fill=\"var(--color-text-70)\" dy=\"0.32em\" [attr.x]=\"axis.options.opposite ? 10 : -9\">\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.x2]=\"axis.options.opposite ? 6 : -6\"></line>\n </svg:g>\n }\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text\n [attr.dy]=\"axis.options.opposite ? '-4px' : '4px'\"\n text-anchor=\"middle\"\n [attr.dominant-baseline]=\"axis.options.opposite ? 'auto' : 'hanging'\"\n >\n {{ axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host{shape-rendering:crispEdges}:host .label-axis{fill:var(--color-text-70)}\n"] }]
1485
+ args: [{ selector: '[teta-y-axis]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if (y | async; as scale) {\n @for (tick of scale.ticks(); track $index) {\n <svg:g\n [attr.text-anchor]=\"axis.options.opposite ? 'start' : 'end'\"\n [attr.transform]=\"'translate(0, ' + scale(tick) + ')'\"\n >\n <text fill=\"var(--color-text-70)\" dy=\"0.32em\" [attr.x]=\"axis.options.opposite ? 10 : -9\">\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.x2]=\"axis.options.opposite ? 6 : -6\"></line>\n </svg:g>\n }\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text\n [attr.dy]=\"axis.options.opposite ? '-4px' : '4px'\"\n text-anchor=\"middle\"\n [attr.dominant-baseline]=\"axis.options.opposite ? 'auto' : 'hanging'\"\n >\n {{ axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host{shape-rendering:crispEdges}:host .label-axis{fill:var(--color-text-70)}\n"] }]
1461
1486
  }], ctorParameters: () => [{ type: ScaleService }], propDecorators: { axis: [{
1462
1487
  type: Input
1463
1488
  }], size: [{
@@ -1526,7 +1551,7 @@ class PlotBandComponent {
1526
1551
  };
1527
1552
  }
1528
1553
  emit(event) {
1529
- this.chartService.emitPlotband(event);
1554
+ this.chartService.emitPlotBand(event);
1530
1555
  }
1531
1556
  ngAfterViewInit() {
1532
1557
  const plotbandElement = d3.select(this.element.nativeElement).select('.plotband');
@@ -1651,34 +1676,59 @@ class GridlinesComponent {
1651
1676
  }
1652
1677
  ngAfterViewInit() { }
1653
1678
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: GridlinesComponent, deps: [{ token: ScaleService }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Component }); }
1654
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: GridlinesComponent, isStandalone: true, selector: "[teta-gridlines]", inputs: { size: "size" }, ngImport: i0, template: "@if (\n { xValues: tickXValues | async, yValues: tickYValues | async, x: x | async, y: y | async, config: config | async };\n as data\n) {\n @if (data.y && data.config.gridLines?.showY !== false) {\n @for (tick of data.yValues; track tick) {\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"data.y(tick) || 1\"\n [attr.x2]=\"size?.width\"\n [attr.y2]=\"data.y(tick) || 1\"\n ></svg:line>\n }\n }\n @if (data.x && data.config.gridLines?.showX !== false) {\n @for (tick of data.xValues; track tick) {\n <svg:line\n [attr.x1]=\"data.x(tick) || 1\"\n [attr.y1]=\"0\"\n [attr.x2]=\"data.x(tick) || 1\"\n [attr.y2]=\"size?.height\"\n ></svg:line>\n }\n }\n}\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke:var(--color-text-5)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1679
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: GridlinesComponent, isStandalone: true, selector: "[teta-gridlines]", inputs: { size: "size" }, ngImport: i0, template: "@if (\n { xValues: tickXValues | async, yValues: tickYValues | async, x: x | async, y: y | async, config: config | async };\n as data\n) {\n @if (data.y && data.config.gridLines?.showY !== false) {\n @for (tick of data.yValues; track $index) {\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"data.y(tick) || 1\"\n [attr.x2]=\"size?.width\"\n [attr.y2]=\"data.y(tick) || 1\"\n ></svg:line>\n }\n }\n @if (data.x && data.config.gridLines?.showX !== false) {\n @for (tick of data.xValues; track $index) {\n <svg:line\n [attr.x1]=\"data.x(tick) || 1\"\n [attr.y1]=\"0\"\n [attr.x2]=\"data.x(tick) || 1\"\n [attr.y2]=\"size?.height\"\n ></svg:line>\n }\n }\n}\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke:var(--color-text-5)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1655
1680
  }
1656
1681
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: GridlinesComponent, decorators: [{
1657
1682
  type: Component,
1658
- args: [{ selector: '[teta-gridlines]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if (\n { xValues: tickXValues | async, yValues: tickYValues | async, x: x | async, y: y | async, config: config | async };\n as data\n) {\n @if (data.y && data.config.gridLines?.showY !== false) {\n @for (tick of data.yValues; track tick) {\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"data.y(tick) || 1\"\n [attr.x2]=\"size?.width\"\n [attr.y2]=\"data.y(tick) || 1\"\n ></svg:line>\n }\n }\n @if (data.x && data.config.gridLines?.showX !== false) {\n @for (tick of data.xValues; track tick) {\n <svg:line\n [attr.x1]=\"data.x(tick) || 1\"\n [attr.y1]=\"0\"\n [attr.x2]=\"data.x(tick) || 1\"\n [attr.y2]=\"size?.height\"\n ></svg:line>\n }\n }\n}\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke:var(--color-text-5)}\n"] }]
1683
+ args: [{ selector: '[teta-gridlines]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if (\n { xValues: tickXValues | async, yValues: tickYValues | async, x: x | async, y: y | async, config: config | async };\n as data\n) {\n @if (data.y && data.config.gridLines?.showY !== false) {\n @for (tick of data.yValues; track $index) {\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"data.y(tick) || 1\"\n [attr.x2]=\"size?.width\"\n [attr.y2]=\"data.y(tick) || 1\"\n ></svg:line>\n }\n }\n @if (data.x && data.config.gridLines?.showX !== false) {\n @for (tick of data.xValues; track $index) {\n <svg:line\n [attr.x1]=\"data.x(tick) || 1\"\n [attr.y1]=\"0\"\n [attr.x2]=\"data.x(tick) || 1\"\n [attr.y2]=\"size?.height\"\n ></svg:line>\n }\n }\n}\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke:var(--color-text-5)}\n"] }]
1659
1684
  }], ctorParameters: () => [{ type: ScaleService }, { type: ChartService }], propDecorators: { size: [{
1660
1685
  type: Input
1661
1686
  }] } });
1662
1687
 
1663
- class LinearSeriesBase extends SeriesBaseComponent {
1664
- set series(series) {
1665
- this.__series = series;
1666
- this.markers = this.__series.data?.filter((_) => _?.marker && _?.x !== undefined && _?.y !== undefined && _?.x !== null && _?.y !== null);
1667
- }
1668
- get series() {
1669
- return this.__series;
1670
- }
1671
- constructor(svc, cdr, scaleService, zoomService, element) {
1672
- super(svc, cdr, scaleService, zoomService, element);
1673
- this.svc = svc;
1674
- this.cdr = cdr;
1675
- this.scaleService = scaleService;
1676
- this.zoomService = zoomService;
1677
- this.element = element;
1688
+ class LinearSeriesBaseComponent extends SeriesBaseComponent {
1689
+ constructor() {
1690
+ super();
1691
+ this.pointerMove = toSignal(this.svc.pointerMove);
1692
+ this.transform = computed(() => {
1693
+ const event = this.pointerMove();
1694
+ return this.getTransform(event, this.x(), this.y());
1695
+ });
1678
1696
  this.defaultClipPointsMapping = new Map();
1679
- this._update = new BehaviorSubject(null);
1680
- }
1681
- ngOnInit() {
1697
+ this.markers = computed(() => {
1698
+ return this.series().data?.filter((_) => _?.marker && _?.x !== undefined && _?.y !== undefined && _?.x !== null && _?.y !== null);
1699
+ });
1700
+ this.path = computed(() => {
1701
+ this.update();
1702
+ if (!this.x() || !this.y()) {
1703
+ return '';
1704
+ }
1705
+ const filter = this.defaultClipPointsMapping.get(this.series().clipPointsDirection);
1706
+ const line = d3
1707
+ .line()
1708
+ .defined((point) => point.x !== null &&
1709
+ point.y !== null &&
1710
+ point.x !== undefined &&
1711
+ point.y !== undefined &&
1712
+ !isNaN(point.x) &&
1713
+ !isNaN(point.y))
1714
+ .x((point) => this.x()(point.x))
1715
+ .y((point) => this.y()(point.y));
1716
+ let filteredData = this.series().data;
1717
+ if (this.series().clipPointsDirection === ClipPointsDirection.x) {
1718
+ let [min, max] = this.x().domain();
1719
+ min = min instanceof Date ? min.getTime() : min;
1720
+ max = max instanceof Date ? max.getTime() : max;
1721
+ filteredData = filteredData?.filter(filter(min, max));
1722
+ }
1723
+ if (this.series().clipPointsDirection === ClipPointsDirection.y) {
1724
+ let [min, max] = this.y().domain();
1725
+ min = min instanceof Date ? min.getTime() : min;
1726
+ max = max instanceof Date ? max.getTime() : max;
1727
+ filteredData = filteredData?.filter(filter(min, max));
1728
+ }
1729
+ return line(filteredData);
1730
+ });
1731
+ this.update = signal(null);
1682
1732
  const filterX = (min, max) => (point, idx, arr) => {
1683
1733
  const bigger = min > max ? min : max;
1684
1734
  const smaller = min > max ? max : min;
@@ -1705,69 +1755,31 @@ class LinearSeriesBase extends SeriesBaseComponent {
1705
1755
  };
1706
1756
  this.defaultClipPointsMapping.set(ClipPointsDirection.x, filterX);
1707
1757
  this.defaultClipPointsMapping.set(ClipPointsDirection.y, filterY);
1708
- this.transform = this.svc.pointerMove.pipe(withLatestFrom(this.scaleService.scales), map((data) => {
1709
- const [event, { x, y }] = data;
1710
- return this.getTransform(event, x.get(this.series.xAxisIndex).scale, y.get(this.series.yAxisIndex).scale);
1711
- }), tap(() => setTimeout(() => this.cdr.detectChanges())));
1712
- this.path = combineLatest([this.scaleService.scales, this._update]).pipe(map(([data]) => {
1713
- const { x, y } = data;
1714
- this.x = x.get(this.series.xAxisIndex)?.scale;
1715
- this.y = y.get(this.series.yAxisIndex)?.scale;
1716
- if (!this.x || !this.y) {
1717
- return '';
1718
- }
1719
- const filter = this.defaultClipPointsMapping.get(this.series.clipPointsDirection);
1720
- const line = d3
1721
- .line()
1722
- .defined((point) => point.x !== null &&
1723
- point.y !== null &&
1724
- point.x !== undefined &&
1725
- point.y !== undefined &&
1726
- !isNaN(point.x) &&
1727
- !isNaN(point.y))
1728
- .x((point) => this.x(point.x))
1729
- .y((point) => this.y(point.y));
1730
- let filteredData = this.series.data;
1731
- if (this.series.clipPointsDirection === ClipPointsDirection.x) {
1732
- let [min, max] = this.x.domain();
1733
- min = min instanceof Date ? min.getTime() : min;
1734
- max = max instanceof Date ? max.getTime() : max;
1735
- filteredData = filteredData?.filter(filter(min, max));
1736
- }
1737
- if (this.series.clipPointsDirection === ClipPointsDirection.y) {
1738
- let [min, max] = this.y.domain();
1739
- min = min instanceof Date ? min.getTime() : min;
1740
- max = max instanceof Date ? max.getTime() : max;
1741
- filteredData = filteredData?.filter(filter(min, max));
1742
- }
1743
- return line(filteredData);
1744
- }));
1745
1758
  }
1746
1759
  ngOnDestroy() {
1747
1760
  this.svc.setTooltip({
1748
1761
  point: null,
1749
- series: this.series,
1762
+ series: this.series(),
1750
1763
  });
1751
1764
  }
1752
- ngAfterViewInit() { }
1753
1765
  getTransform(event, scaleX, scaleY) {
1754
- if (event.type === 'mouseleave') {
1766
+ if (!scaleX || !scaleY) {
1767
+ return null;
1768
+ }
1769
+ if (event && event.type === 'mouseleave') {
1755
1770
  return null;
1756
1771
  }
1757
1772
  const mouse = [event?.offsetX, event?.offsetY];
1758
- const tooltipTracking = this.config?.tooltip?.tracking;
1773
+ const tooltipTracking = this.config()?.tooltip?.tracking;
1759
1774
  const lineIntersection = (p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y) => {
1760
1775
  const rV = {};
1761
- let s1_x, s1_y, s2_x, s2_y;
1762
- s1_x = p1_x - p0_x;
1763
- s1_y = p1_y - p0_y;
1764
- s2_x = p3_x - p2_x;
1765
- s2_y = p3_y - p2_y;
1766
- let s, t;
1767
- s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / (-s2_x * s1_y + s1_x * s2_y);
1768
- t = (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / (-s2_x * s1_y + s1_x * s2_y);
1776
+ const s1_x = p1_x - p0_x;
1777
+ const s1_y = p1_y - p0_y;
1778
+ const s2_x = p3_x - p2_x;
1779
+ const s2_y = p3_y - p2_y;
1780
+ const s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / (-s2_x * s1_y + s1_x * s2_y);
1781
+ const t = (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / (-s2_x * s1_y + s1_x * s2_y);
1769
1782
  if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
1770
- // Collision detected
1771
1783
  rV.x = p0_x + t * s1_x;
1772
1784
  rV.y = p0_y + t * s1_y;
1773
1785
  }
@@ -1780,9 +1792,9 @@ class LinearSeriesBase extends SeriesBaseComponent {
1780
1792
  if (x0 instanceof Date) {
1781
1793
  x0 = x0.getTime();
1782
1794
  }
1783
- const rightId = bisect(this.series.data, x0);
1795
+ const rightId = bisect(this.series().data, x0);
1784
1796
  const range = scaleY.range();
1785
- const intersect = lineIntersection(pointer, range[0], pointer, Number.MAX_SAFE_INTEGER, scaleX(this.series.data[rightId - 1]?.x), scaleY(this.series.data[rightId - 1]?.y), scaleX(this.series.data[rightId]?.x), scaleY(this.series.data[rightId]?.y));
1797
+ const intersect = lineIntersection(pointer, range[0], pointer, Number.MAX_SAFE_INTEGER, scaleX(this.series().data[rightId - 1]?.x), scaleY(this.series().data[rightId - 1]?.y), scaleX(this.series().data[rightId]?.x), scaleY(this.series().data[rightId]?.y));
1786
1798
  const x = scaleX.invert(intersect.x);
1787
1799
  const y = scaleY.invert(intersect.y);
1788
1800
  if (x !== null && x !== undefined && !isNaN(x) && y !== null && y !== undefined && !isNaN(y)) {
@@ -1791,13 +1803,13 @@ class LinearSeriesBase extends SeriesBaseComponent {
1791
1803
  x: scaleX.invert(intersect.x),
1792
1804
  y: scaleY.invert(intersect.y),
1793
1805
  },
1794
- series: this.series,
1806
+ series: this.series(),
1795
1807
  });
1796
1808
  }
1797
1809
  else {
1798
1810
  this.svc.setTooltip({
1799
1811
  point: null,
1800
- series: this.series,
1812
+ series: this.series(),
1801
1813
  });
1802
1814
  }
1803
1815
  return {
@@ -1811,9 +1823,9 @@ class LinearSeriesBase extends SeriesBaseComponent {
1811
1823
  if (y0 instanceof Date) {
1812
1824
  y0 = y0.getTime();
1813
1825
  }
1814
- const rightId = bisect(this.series.data, y0);
1826
+ const rightId = bisect(this.series().data, y0);
1815
1827
  const range = scaleX.range();
1816
- const intersect = lineIntersection(range[0], mouse[1], Number.MAX_SAFE_INTEGER, mouse[1], scaleX(this.series.data[rightId - 1]?.x), scaleY(this.series.data[rightId - 1]?.y), scaleX(this.series.data[rightId]?.x), scaleY(this.series.data[rightId]?.y));
1828
+ const intersect = lineIntersection(range[0], mouse[1], Number.MAX_SAFE_INTEGER, mouse[1], scaleX(this.series().data[rightId - 1]?.x), scaleY(this.series().data[rightId - 1]?.y), scaleX(this.series().data[rightId]?.x), scaleY(this.series().data[rightId]?.y));
1817
1829
  const x = scaleX.invert(intersect.x);
1818
1830
  const y = scaleY.invert(intersect.y);
1819
1831
  if (x !== null && x !== undefined && !isNaN(x) && y !== null && y !== undefined && !isNaN(y)) {
@@ -1822,13 +1834,13 @@ class LinearSeriesBase extends SeriesBaseComponent {
1822
1834
  x: scaleX.invert(intersect.x),
1823
1835
  y: scaleY.invert(intersect.y),
1824
1836
  },
1825
- series: this.series,
1837
+ series: this.series(),
1826
1838
  });
1827
1839
  }
1828
1840
  else {
1829
1841
  this.svc.setTooltip({
1830
1842
  point: null,
1831
- series: this.series,
1843
+ series: this.series(),
1832
1844
  });
1833
1845
  }
1834
1846
  return {
@@ -1838,18 +1850,16 @@ class LinearSeriesBase extends SeriesBaseComponent {
1838
1850
  }
1839
1851
  return null;
1840
1852
  }
1841
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinearSeriesBase, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
1842
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: LinearSeriesBase, isStandalone: true, selector: "ng-component", inputs: { series: "series" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
1853
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinearSeriesBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1854
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: LinearSeriesBaseComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
1843
1855
  }
1844
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinearSeriesBase, decorators: [{
1856
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinearSeriesBaseComponent, decorators: [{
1845
1857
  type: Component,
1846
1858
  args: [{
1847
1859
  template: '',
1848
1860
  standalone: true,
1849
1861
  }]
1850
- }], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }], propDecorators: { series: [{
1851
- type: Input
1852
- }] } });
1862
+ }], ctorParameters: () => [] });
1853
1863
 
1854
1864
  var DragPointType;
1855
1865
  (function (DragPointType) {
@@ -1999,33 +2009,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
1999
2009
  args: ['window:touchmove', ['$event']]
2000
2010
  }] } });
2001
2011
 
2002
- class LineSeriesComponent extends LinearSeriesBase {
2003
- constructor(svc, cdr, scaleService, zoomService, element) {
2004
- super(svc, cdr, scaleService, zoomService, element);
2005
- this.svc = svc;
2006
- this.cdr = cdr;
2007
- this.scaleService = scaleService;
2008
- this.zoomService = zoomService;
2009
- this.element = element;
2012
+ class LineSeriesComponent extends LinearSeriesBaseComponent {
2013
+ constructor() {
2014
+ super(...arguments);
2010
2015
  this.allowDrag = (point) => {
2011
2016
  return (newPoint) => {
2012
2017
  if (point.marker.minX !== null && point.marker.minX !== undefined) {
2013
- if (this.x.invert(this.x(this.start.x) + newPoint.deltaX) < point.marker.minX) {
2018
+ if (this.x().invert(this.x()(this.start.x) + newPoint.deltaX) < point.marker.minX) {
2014
2019
  return false;
2015
2020
  }
2016
2021
  }
2017
2022
  if (point.marker.maxX !== null && point.marker.maxX !== undefined) {
2018
- if (this.x.invert(this.x(this.start.x) + newPoint.deltaX) > point.marker.maxX) {
2023
+ if (this.x().invert(this.x()(this.start.x) + newPoint.deltaX) > point.marker.maxX) {
2019
2024
  return false;
2020
2025
  }
2021
2026
  }
2022
2027
  if (point.marker.minY !== null && point.marker.minY !== undefined) {
2023
- if (this.y.invert(this.y(this.start.y) + newPoint.deltaY) < point.marker.minY) {
2028
+ if (this.y().invert(this.y()(this.start.y) + newPoint.deltaY) < point.marker.minY) {
2024
2029
  return false;
2025
2030
  }
2026
2031
  }
2027
2032
  if (point.marker.maxY !== null && point.marker.maxY !== undefined) {
2028
- if (this.y.invert(this.y(this.start.y) + newPoint.deltaY) > point.marker.maxY) {
2033
+ if (this.y().invert(this.y()(this.start.y) + newPoint.deltaY) > point.marker.maxY) {
2029
2034
  return false;
2030
2035
  }
2031
2036
  }
@@ -2037,32 +2042,32 @@ class LineSeriesComponent extends LinearSeriesBase {
2037
2042
  this.start = { x: point.x, y: point.y };
2038
2043
  }
2039
2044
  moveEnd(event, point) {
2040
- point.x = this.x.invert(this.x(this.start.x) + event.deltaX);
2041
- point.y = this.y.invert(this.y(this.start.y) + event.deltaY);
2042
- this._update.next();
2045
+ point.x = this.x().invert(this.x()(this.start.x) + event.deltaX);
2046
+ point.y = this.y().invert(this.y()(this.start.y) + event.deltaY);
2047
+ this.update.set({});
2043
2048
  const emitEvent = {
2044
2049
  type: 'end',
2045
2050
  sourceEvent: event,
2046
2051
  };
2047
2052
  this.svc.emitPoint({
2048
2053
  target: {
2049
- series: this.series,
2054
+ series: this.series(),
2050
2055
  point: point,
2051
2056
  },
2052
2057
  event: emitEvent,
2053
2058
  });
2054
2059
  }
2055
2060
  moveProcess(event, point) {
2056
- point.x = this.x.invert(this.x(this.start.x) + event.deltaX);
2057
- point.y = this.y.invert(this.y(this.start.y) + event.deltaY);
2058
- this._update.next();
2061
+ point.x = this.x().invert(this.x()(this.start.x) + event.deltaX);
2062
+ point.y = this.y().invert(this.y()(this.start.y) + event.deltaY);
2063
+ this.update.set({});
2059
2064
  const emitEvent = {
2060
2065
  type: 'drag',
2061
2066
  sourceEvent: event,
2062
2067
  };
2063
2068
  this.svc.emitPoint({
2064
2069
  target: {
2065
- series: this.series,
2070
+ series: this.series(),
2066
2071
  point: point,
2067
2072
  },
2068
2073
  event: emitEvent,
@@ -2075,235 +2080,140 @@ class LineSeriesComponent extends LinearSeriesBase {
2075
2080
  label.dx = this.labelStart.dx + event.deltaX;
2076
2081
  label.dy = this.labelStart.dy + event.deltaY;
2077
2082
  }
2078
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LineSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2079
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: LineSeriesComponent, isStandalone: true, selector: "svg:svg[teta-line-series]", usesInheritance: true, ngImport: i0, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\"\n></svg:path>\n@if (transform | async; as t) {\n @if (t?.x != null && t?.y != null) {\n <svg:circle r=\"3\" [attr.fill]=\"series.color\" [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n }\n}\n@if (markers; as draggablePoints) {\n @if (x && y) {\n @for (point of draggablePoints; track point) {\n <svg:g [attr.transform]=\"'translate(' + x(point.x) + ',' + y(point.y) + ')'\">\n <svg:g\n [tetaDraggablePoint]=\"point.marker.draggable\"\n [dragDirection]=\"point.marker.dragType\"\n [allowDrag]=\"allowDrag(point)\"\n #dragPoint=\"tetaDraggablePoint\"\n (moveStart)=\"moveStart($event, point)\"\n (moveEnd)=\"moveEnd($event, point); dragPoint.resetTransform()\"\n (moveProcess)=\"moveProcess($event, point); dragPoint.resetTransform()\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n >\n <svg:circle\n class=\"marker\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"0\"\n [attr.cy]=\"0\"\n ></svg:circle>\n @if (point.marker.label?.text) {\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"0\"\n [attr.x2]=\"point.marker.label?.dx\"\n [attr.y2]=\"point.marker.label?.dy\"\n [attr.stroke]=\"point.marker.label?.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"point.marker.label?.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"point.marker.label?.style?.strokeDasharray ?? null\"\n ></svg:line>\n <svg:foreignObject\n [tetaDraggablePoint]=\"point.marker.label?.draggable\"\n [dragDirection]=\"point.marker.label.dragType\"\n #labelPoint=\"tetaDraggablePoint\"\n (moveStart)=\"startLabel($event, point.marker.label)\"\n (moveProcess)=\"moveLabel($event, point.marker.label); labelPoint.resetTransform()\"\n (moveEnd)=\"labelPoint.resetTransform()\"\n [attr.width]=\"annotationNode?.offsetWidth ?? 0\"\n [attr.height]=\"annotationNode?.offsetHeight ?? 0\"\n [attr.x]=\"point.marker.label?.dx\"\n [attr.y]=\"point.marker.label?.dy\"\n class=\"position-absolute\"\n >\n <div\n #annotationNode\n class=\"shadow-2 padding-2\"\n [style.color]=\"'var(--color-text-90)'\"\n [style.background-color]=\"'var(--color-global-bgcard)'\"\n [style.cursor]=\"'move'\"\n style=\"border-radius: 2px; display: inline-block\"\n >\n {{ point.marker.label?.text }}\n </div>\n </svg:foreignObject>\n }\n </svg:g>\n </svg:g>\n }\n }\n}\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: DraggablePointDirective, selector: "[tetaDraggablePoint]", inputs: ["tetaDraggablePoint", "dragDirection", "allowDrag"], outputs: ["moveStart", "moveProcess", "moveEnd"], exportAs: ["tetaDraggablePoint"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2083
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LineSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2084
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: LineSeriesComponent, isStandalone: true, selector: "svg:svg[teta-line-series]", usesInheritance: true, ngImport: i0, template: "@if (series(); as series) {\n <svg:path\n class=\"line\"\n [attr.d]=\"path()\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\"\n ></svg:path>\n @if (transform(); as t) {\n @if (t?.x !== null && t?.x !== undefined && t?.y !== null && t?.y !== undefined) {\n <svg:circle r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n }\n }\n @if (markers(); as draggablePoints) {\n @if (x() && y()) {\n @for (point of draggablePoints; track point) {\n <svg:g [attr.transform]=\"'translate(' + x()(point.x) + ',' + y()(point.y) + ')'\">\n <svg:g [tetaDraggablePoint]=\"point.marker.draggable\"\n [dragDirection]=\"point.marker.dragType\"\n [allowDrag]=\"allowDrag(point)\"\n #dragPoint=\"tetaDraggablePoint\"\n (moveStart)=\"moveStart($event, point)\"\n (moveEnd)=\"moveEnd($event, point); dragPoint.resetTransform()\"\n (moveProcess)=\"moveProcess($event, point); dragPoint.resetTransform()\"\n [class.draggable-marker]=\"point?.marker?.draggable\">\n <svg:circle class=\"marker\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"0\"\n [attr.cy]=\"0\"></svg:circle>\n @if (point.marker.label?.text) {\n <svg:line [attr.x1]=\"0\"\n [attr.y1]=\"0\"\n [attr.x2]=\"point.marker.label?.dx\"\n [attr.y2]=\"point.marker.label?.dy\"\n [attr.stroke]=\"point.marker.label?.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"point.marker.label?.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"point.marker.label?.style?.strokeDasharray ?? null\"></svg:line>\n <svg:foreignObject [tetaDraggablePoint]=\"point.marker.label?.draggable\"\n [dragDirection]=\"point.marker.label.dragType\"\n #labelPoint=\"tetaDraggablePoint\"\n (moveStart)=\"startLabel($event, point.marker.label)\"\n (moveProcess)=\"moveLabel($event, point.marker.label); labelPoint.resetTransform()\"\n (moveEnd)=\"labelPoint.resetTransform()\"\n [attr.width]=\"annotationNode?.offsetWidth ?? 0\"\n [attr.height]=\"annotationNode?.offsetHeight ?? 0\"\n [attr.x]=\"point.marker.label?.dx\"\n [attr.y]=\"point.marker.label?.dy\"\n class=\"position-absolute\">\n <div #annotationNode\n class=\"shadow-2 padding-2\"\n [style.color]=\"'var(--color-text-90)'\"\n [style.background-color]=\"'var(--color-global-bgcard)'\"\n [style.cursor]=\"'move'\"\n style=\"border-radius: 2px; display: inline-block\">\n {{ point.marker.label?.text }}\n </div>\n </svg:foreignObject>\n }\n </svg:g>\n </svg:g>\n }\n }\n }\n}\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"], dependencies: [{ kind: "directive", type: DraggablePointDirective, selector: "[tetaDraggablePoint]", inputs: ["tetaDraggablePoint", "dragDirection", "allowDrag"], outputs: ["moveStart", "moveProcess", "moveEnd"], exportAs: ["tetaDraggablePoint"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2080
2085
  }
2081
2086
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LineSeriesComponent, decorators: [{
2082
2087
  type: Component,
2083
- args: [{ selector: 'svg:svg[teta-line-series]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe, DraggablePointDirective], template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\"\n></svg:path>\n@if (transform | async; as t) {\n @if (t?.x != null && t?.y != null) {\n <svg:circle r=\"3\" [attr.fill]=\"series.color\" [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n }\n}\n@if (markers; as draggablePoints) {\n @if (x && y) {\n @for (point of draggablePoints; track point) {\n <svg:g [attr.transform]=\"'translate(' + x(point.x) + ',' + y(point.y) + ')'\">\n <svg:g\n [tetaDraggablePoint]=\"point.marker.draggable\"\n [dragDirection]=\"point.marker.dragType\"\n [allowDrag]=\"allowDrag(point)\"\n #dragPoint=\"tetaDraggablePoint\"\n (moveStart)=\"moveStart($event, point)\"\n (moveEnd)=\"moveEnd($event, point); dragPoint.resetTransform()\"\n (moveProcess)=\"moveProcess($event, point); dragPoint.resetTransform()\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n >\n <svg:circle\n class=\"marker\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"0\"\n [attr.cy]=\"0\"\n ></svg:circle>\n @if (point.marker.label?.text) {\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"0\"\n [attr.x2]=\"point.marker.label?.dx\"\n [attr.y2]=\"point.marker.label?.dy\"\n [attr.stroke]=\"point.marker.label?.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"point.marker.label?.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"point.marker.label?.style?.strokeDasharray ?? null\"\n ></svg:line>\n <svg:foreignObject\n [tetaDraggablePoint]=\"point.marker.label?.draggable\"\n [dragDirection]=\"point.marker.label.dragType\"\n #labelPoint=\"tetaDraggablePoint\"\n (moveStart)=\"startLabel($event, point.marker.label)\"\n (moveProcess)=\"moveLabel($event, point.marker.label); labelPoint.resetTransform()\"\n (moveEnd)=\"labelPoint.resetTransform()\"\n [attr.width]=\"annotationNode?.offsetWidth ?? 0\"\n [attr.height]=\"annotationNode?.offsetHeight ?? 0\"\n [attr.x]=\"point.marker.label?.dx\"\n [attr.y]=\"point.marker.label?.dy\"\n class=\"position-absolute\"\n >\n <div\n #annotationNode\n class=\"shadow-2 padding-2\"\n [style.color]=\"'var(--color-text-90)'\"\n [style.background-color]=\"'var(--color-global-bgcard)'\"\n [style.cursor]=\"'move'\"\n style=\"border-radius: 2px; display: inline-block\"\n >\n {{ point.marker.label?.text }}\n </div>\n </svg:foreignObject>\n }\n </svg:g>\n </svg:g>\n }\n }\n}\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
2084
- }], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
2088
+ args: [{ selector: 'svg:svg[teta-line-series]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe, DraggablePointDirective], template: "@if (series(); as series) {\n <svg:path\n class=\"line\"\n [attr.d]=\"path()\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\"\n ></svg:path>\n @if (transform(); as t) {\n @if (t?.x !== null && t?.x !== undefined && t?.y !== null && t?.y !== undefined) {\n <svg:circle r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n }\n }\n @if (markers(); as draggablePoints) {\n @if (x() && y()) {\n @for (point of draggablePoints; track point) {\n <svg:g [attr.transform]=\"'translate(' + x()(point.x) + ',' + y()(point.y) + ')'\">\n <svg:g [tetaDraggablePoint]=\"point.marker.draggable\"\n [dragDirection]=\"point.marker.dragType\"\n [allowDrag]=\"allowDrag(point)\"\n #dragPoint=\"tetaDraggablePoint\"\n (moveStart)=\"moveStart($event, point)\"\n (moveEnd)=\"moveEnd($event, point); dragPoint.resetTransform()\"\n (moveProcess)=\"moveProcess($event, point); dragPoint.resetTransform()\"\n [class.draggable-marker]=\"point?.marker?.draggable\">\n <svg:circle class=\"marker\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"0\"\n [attr.cy]=\"0\"></svg:circle>\n @if (point.marker.label?.text) {\n <svg:line [attr.x1]=\"0\"\n [attr.y1]=\"0\"\n [attr.x2]=\"point.marker.label?.dx\"\n [attr.y2]=\"point.marker.label?.dy\"\n [attr.stroke]=\"point.marker.label?.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"point.marker.label?.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"point.marker.label?.style?.strokeDasharray ?? null\"></svg:line>\n <svg:foreignObject [tetaDraggablePoint]=\"point.marker.label?.draggable\"\n [dragDirection]=\"point.marker.label.dragType\"\n #labelPoint=\"tetaDraggablePoint\"\n (moveStart)=\"startLabel($event, point.marker.label)\"\n (moveProcess)=\"moveLabel($event, point.marker.label); labelPoint.resetTransform()\"\n (moveEnd)=\"labelPoint.resetTransform()\"\n [attr.width]=\"annotationNode?.offsetWidth ?? 0\"\n [attr.height]=\"annotationNode?.offsetHeight ?? 0\"\n [attr.x]=\"point.marker.label?.dx\"\n [attr.y]=\"point.marker.label?.dy\"\n class=\"position-absolute\">\n <div #annotationNode\n class=\"shadow-2 padding-2\"\n [style.color]=\"'var(--color-text-90)'\"\n [style.background-color]=\"'var(--color-global-bgcard)'\"\n [style.cursor]=\"'move'\"\n style=\"border-radius: 2px; display: inline-block\">\n {{ point.marker.label?.text }}\n </div>\n </svg:foreignObject>\n }\n </svg:g>\n </svg:g>\n }\n }\n }\n}\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
2089
+ }] });
2085
2090
 
2086
2091
  class BarSeriesComponent extends SeriesBaseComponent {
2087
- constructor(svc, cdr, scaleService, zoomService, element) {
2088
- super(svc, cdr, scaleService, zoomService, element);
2089
- this.svc = svc;
2090
- this.cdr = cdr;
2091
- this.scaleService = scaleService;
2092
- this.zoomService = zoomService;
2093
- this.element = element;
2094
- this.Math = Math;
2095
- }
2096
- ngOnInit() {
2097
- this.barSeriesCount = this.svc.config.pipe(map((_) => {
2098
- const count = _.series.filter((_) => _.type === SeriesType.bar && _.xAxisIndex === this.series.xAxisIndex);
2099
- return count.length;
2100
- }));
2101
- this.x1 = this.scaleService.scales.pipe(map((_) => {
2102
- const x = _.x.get(this.series.xAxisIndex)?.scale;
2092
+ constructor() {
2093
+ super(...arguments);
2094
+ this.x1 = computed(() => {
2095
+ const x = this.xScales().get(this.series().xAxisIndex)?.scale;
2103
2096
  const range = x.range();
2104
- const domain = this.series.data.map((_) => _.x);
2097
+ const domain = this.series().data.map((_) => _.x);
2105
2098
  return d3.scaleBand().range([0, range[1]]).domain(domain).padding(0.1);
2106
- }));
2107
- this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex)?.scale));
2108
- this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex)?.scale));
2109
- }
2110
- mouseenter(point) {
2111
- this.svc.setTooltip({
2112
- point: point,
2113
- series: this.series,
2114
2099
  });
2115
- }
2116
- mouseleave(point) {
2117
- this.svc.setTooltip({
2118
- point: null,
2119
- series: this.series,
2100
+ this.barSeriesCount = computed(() => {
2101
+ const count = this.config().series.filter((_) => _.type === SeriesType.bar && _.xAxisIndex === this.series().xAxisIndex);
2102
+ return count.length;
2120
2103
  });
2104
+ this.Math = Math;
2105
+ this.Number = Number;
2121
2106
  }
2122
- ngOnChanges(changes) { }
2123
2107
  isNumber(value) {
2124
2108
  return typeof value === 'number';
2125
2109
  }
2126
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BarSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2127
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: BarSeriesComponent, isStandalone: true, selector: "svg:svg[teta-bar-series]", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "@if ({ x: x | async, x1: x1 | async, y: y | async, barSeriesCount: barSeriesCount | async }; as data) {\n @if (data.x && data.y) {\n @if (data.barSeriesCount > 1) {\n @for (point of series.data; track point) {\n <svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"\n data.x(point.x) + ((isNumber(series.id) ? series.id : 0) * data.x1.bandwidth()) / data.barSeriesCount\n \"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth() / data.barSeriesCount\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"series.color\"\n ></svg:rect>\n }\n }\n @if (data.barSeriesCount === 1) {\n @for (point of series.data; track point) {\n <svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth()\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"point.color ?? series.color\"\n ></svg:rect>\n }\n }\n }\n}\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2110
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BarSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2111
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: BarSeriesComponent, isStandalone: true, selector: "svg:svg[teta-bar-series]", usesInheritance: true, ngImport: i0, template: "@if ({ x: x(), x1: x1(), y: y(), barSeriesCount: barSeriesCount() }; as data) {\n @if (data.x && data.y) {\n @if (data.barSeriesCount > 1) {\n @for (point of series().data; track point) {\n <svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"\n data.x(point.x) + ((isNumber(series().id) ? Number(series().id) : 0) * data.x1.bandwidth()) / data.barSeriesCount\n \"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth() / data.barSeriesCount\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"series().color\"\n ></svg:rect>\n }\n }\n @if (data.barSeriesCount === 1) {\n @for (point of series().data; track point) {\n <svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth()\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"point.color ?? series().color\"\n ></svg:rect>\n }\n }\n }\n}\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2128
2112
  }
2129
2113
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BarSeriesComponent, decorators: [{
2130
2114
  type: Component,
2131
- args: [{ selector: 'svg:svg[teta-bar-series]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ x: x | async, x1: x1 | async, y: y | async, barSeriesCount: barSeriesCount | async }; as data) {\n @if (data.x && data.y) {\n @if (data.barSeriesCount > 1) {\n @for (point of series.data; track point) {\n <svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"\n data.x(point.x) + ((isNumber(series.id) ? series.id : 0) * data.x1.bandwidth()) / data.barSeriesCount\n \"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth() / data.barSeriesCount\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"series.color\"\n ></svg:rect>\n }\n }\n @if (data.barSeriesCount === 1) {\n @for (point of series.data; track point) {\n <svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth()\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"point.color ?? series.color\"\n ></svg:rect>\n }\n }\n }\n}\n" }]
2132
- }], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
2115
+ args: [{ selector: 'svg:svg[teta-bar-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if ({ x: x(), x1: x1(), y: y(), barSeriesCount: barSeriesCount() }; as data) {\n @if (data.x && data.y) {\n @if (data.barSeriesCount > 1) {\n @for (point of series().data; track point) {\n <svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"\n data.x(point.x) + ((isNumber(series().id) ? Number(series().id) : 0) * data.x1.bandwidth()) / data.barSeriesCount\n \"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth() / data.barSeriesCount\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"series().color\"\n ></svg:rect>\n }\n }\n @if (data.barSeriesCount === 1) {\n @for (point of series().data; track point) {\n <svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth()\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"point.color ?? series().color\"\n ></svg:rect>\n }\n }\n }\n}\n" }]
2116
+ }] });
2133
2117
 
2134
2118
  class ScatterSeriesComponent extends SeriesBaseComponent {
2135
- constructor(svc, cdr, scaleService, zoomService, element) {
2136
- super(svc, cdr, scaleService, zoomService, element);
2137
- this.svc = svc;
2138
- this.cdr = cdr;
2139
- this.scaleService = scaleService;
2140
- this.zoomService = zoomService;
2141
- this.element = element;
2142
- }
2143
- ngOnInit() {
2144
- this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex)?.scale));
2145
- this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex)?.scale));
2146
- }
2147
- ngAfterViewInit() { }
2148
- mouseenter(point) {
2149
- this.svc.setTooltip({
2150
- point: point,
2151
- series: this.series,
2152
- });
2153
- }
2154
- mouseleave(point) {
2155
- this.svc.setTooltip({
2156
- point: null,
2157
- series: this.series,
2158
- });
2159
- }
2160
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScatterSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2161
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ScatterSeriesComponent, isStandalone: true, selector: "svg:svg[teta-scatter-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y | async, x: x | async }; as scales) {\n @if (scales.x && scales.y) {\n @for (point of series.data; track point) {\n <svg:circle\n class=\"line\"\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.cx]=\"scales.x(point.x)\"\n [attr.cy]=\"scales.y(point.y)\"\n [attr.r]=\"series.style?.radius ?? 1\"\n [attr.stroke]=\"point.color ?? series.color\"\n [attr.fill]=\"point.color ?? series.color\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n ></svg:circle>\n }\n }\n}\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2119
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScatterSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2120
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ScatterSeriesComponent, isStandalone: true, selector: "svg:svg[teta-scatter-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y(), x: x() }; as scales) {\n @if (scales.x && scales.y) {\n @for (point of series().data; track point) {\n <svg:circle\n class=\"line\"\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.cx]=\"scales.x(point.x)\"\n [attr.cy]=\"scales.y(point.y)\"\n [attr.r]=\"series().style?.radius ?? 1\"\n [attr.stroke]=\"point.color ?? series().color\"\n [attr.fill]=\"point.color ?? series().color\"\n [attr.stroke-width]=\"series().style?.strokeWidth\"\n ></svg:circle>\n }\n }\n}\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2162
2121
  }
2163
2122
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScatterSeriesComponent, decorators: [{
2164
2123
  type: Component,
2165
- args: [{ selector: 'svg:svg[teta-scatter-series]', imports: [AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if ({ y: y | async, x: x | async }; as scales) {\n @if (scales.x && scales.y) {\n @for (point of series.data; track point) {\n <svg:circle\n class=\"line\"\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.cx]=\"scales.x(point.x)\"\n [attr.cy]=\"scales.y(point.y)\"\n [attr.r]=\"series.style?.radius ?? 1\"\n [attr.stroke]=\"point.color ?? series.color\"\n [attr.fill]=\"point.color ?? series.color\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n ></svg:circle>\n }\n }\n}\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
2166
- }], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
2124
+ args: [{ selector: 'svg:svg[teta-scatter-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if ({ y: y(), x: x() }; as scales) {\n @if (scales.x && scales.y) {\n @for (point of series().data; track point) {\n <svg:circle\n class=\"line\"\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.cx]=\"scales.x(point.x)\"\n [attr.cy]=\"scales.y(point.y)\"\n [attr.r]=\"series().style?.radius ?? 1\"\n [attr.stroke]=\"point.color ?? series().color\"\n [attr.fill]=\"point.color ?? series().color\"\n [attr.stroke-width]=\"series().style?.strokeWidth\"\n ></svg:circle>\n }\n }\n}\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
2125
+ }] });
2167
2126
 
2168
2127
  class BlockSeriesComponent extends SeriesBaseComponent {
2169
- constructor(svc, cdr, scaleService, zoomService, element) {
2170
- super(svc, cdr, scaleService, zoomService, element);
2171
- this.svc = svc;
2172
- this.cdr = cdr;
2173
- this.scaleService = scaleService;
2174
- this.zoomService = zoomService;
2175
- this.element = element;
2176
- this.fillType = FillType;
2177
- this.Math = Math;
2178
- this.id = (Date.now() + Math.random()).toString(36);
2179
- }
2180
- ngOnInit() {
2181
- this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex)?.scale));
2182
- this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex)?.scale));
2183
- this.displayPoints = this.y.pipe(filter((y) => y), map((y) => {
2184
- return this.series.data.filter((point, index, arr) => {
2185
- const [min, max] = y.domain();
2128
+ constructor() {
2129
+ super(...arguments);
2130
+ this.displayPoints = computed(() => {
2131
+ return this.series().data.filter((point, index, arr) => {
2132
+ const [min, max] = this.y().domain();
2186
2133
  return ((point.y >= min || point.y1 >= min || arr[index + 1]?.y >= min || arr[index + 1]?.y1 >= min) &&
2187
2134
  (point.y <= max || point.y1 <= max || arr[index - 1]?.y <= max || arr[index - 1]?.y1 <= max));
2188
2135
  });
2189
- }));
2190
- }
2191
- mouseenter(point) {
2192
- this.svc.setTooltip({
2193
- point: point,
2194
- series: this.series,
2195
- });
2196
- }
2197
- mouseleave(point) {
2198
- this.svc.setTooltip({
2199
- point: null,
2200
- series: this.series,
2201
2136
  });
2137
+ this.Math = Math;
2138
+ this.FillType = FillType;
2202
2139
  }
2203
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2204
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: BlockSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) {\n @if (series?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series.style?.fill ?? series.color)\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n width=\"100%\"\n ></svg:rect>\n @if (point.text && data.y(point.y1) - data.y(point.y) > 8) {\n <svg:text\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y)\"\n [attr.y2]=\"data.y(point.y)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series.style?.stroke ?? series.color)\"\n ></svg:line>\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y1)\"\n [attr.y2]=\"data.y(point.y1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series.style?.stroke ?? series.color)\"\n ></svg:line>\n </svg:g>\n }\n }\n}\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2140
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2141
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: BlockSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y(), x: x(), points: displayPoints() }; as data) {\n @if (series()?.fillType === FillType.gradient) {\n <svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config()?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config()?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.fill]=\"\n series().fillType === FillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series().style?.fill ?? series().color)\n \"\n [attr.fill-opacity]=\"series().style?.fillOpacity\"\n width=\"100%\"\n ></svg:rect>\n @if (point.text && data.y(point.y1) - data.y(point.y) > 8) {\n <svg:text\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y)\"\n [attr.y2]=\"data.y(point.y)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series().style?.stroke ?? series().color)\"\n ></svg:line>\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y1)\"\n [attr.y2]=\"data.y(point.y1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series().style?.stroke ?? series().color)\"\n ></svg:line>\n </svg:g>\n }\n }\n}\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2205
2142
  }
2206
2143
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockSeriesComponent, decorators: [{
2207
2144
  type: Component,
2208
- args: [{ selector: 'svg:svg[teta-block-series]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) {\n @if (series?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series.style?.fill ?? series.color)\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n width=\"100%\"\n ></svg:rect>\n @if (point.text && data.y(point.y1) - data.y(point.y) > 8) {\n <svg:text\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y)\"\n [attr.y2]=\"data.y(point.y)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series.style?.stroke ?? series.color)\"\n ></svg:line>\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y1)\"\n [attr.y2]=\"data.y(point.y1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series.style?.stroke ?? series.color)\"\n ></svg:line>\n </svg:g>\n }\n }\n}\n" }]
2209
- }], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
2145
+ args: [{ selector: 'svg:svg[teta-block-series]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ y: y(), x: x(), points: displayPoints() }; as data) {\n @if (series()?.fillType === FillType.gradient) {\n <svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config()?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config()?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.fill]=\"\n series().fillType === FillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series().style?.fill ?? series().color)\n \"\n [attr.fill-opacity]=\"series().style?.fillOpacity\"\n width=\"100%\"\n ></svg:rect>\n @if (point.text && data.y(point.y1) - data.y(point.y) > 8) {\n <svg:text\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y)\"\n [attr.y2]=\"data.y(point.y)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series().style?.stroke ?? series().color)\"\n ></svg:line>\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y1)\"\n [attr.y2]=\"data.y(point.y1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series().style?.stroke ?? series().color)\"\n ></svg:line>\n </svg:g>\n }\n }\n}\n" }]
2146
+ }] });
2210
2147
 
2211
2148
  class BlockAreaSeriesComponent extends SeriesBaseComponent {
2212
- constructor(svc, cdr, scaleService, zoomService, element) {
2213
- super(svc, cdr, scaleService, zoomService, element);
2214
- this.svc = svc;
2215
- this.cdr = cdr;
2216
- this.scaleService = scaleService;
2217
- this.zoomService = zoomService;
2218
- this.element = element;
2219
- this.fillType = FillType;
2220
- this.Math = Math;
2221
- this.id = (Date.now() + Math.random()).toString(36);
2222
- }
2223
- ngOnInit() {
2224
- this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex)?.scale));
2225
- this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex)?.scale));
2226
- this.displayPoints = this.y.pipe(filter((y) => y), map((y) => {
2227
- return this.series.data.filter((point, index, arr) => {
2228
- const [min, max] = y.domain();
2149
+ constructor() {
2150
+ super(...arguments);
2151
+ this.displayPoints = computed(() => {
2152
+ return this.series().data.filter((point, index, arr) => {
2153
+ const [min, max] = this.y().domain();
2229
2154
  return ((point.y >= min || point.y1 >= min || arr[index + 1]?.y >= min || arr[index + 1]?.y1 >= min) &&
2230
2155
  (point.y <= max || point.y1 <= max || arr[index - 1]?.y <= max || arr[index - 1]?.y1 <= max));
2231
2156
  });
2232
- }));
2233
- }
2234
- ngAfterViewInit() { }
2235
- mouseenter(point) {
2236
- this.svc.setTooltip({
2237
- point: point,
2238
- series: this.series,
2239
- });
2240
- }
2241
- mouseleave(point) {
2242
- this.svc.setTooltip({
2243
- point: null,
2244
- series: this.series,
2245
2157
  });
2158
+ this.fillType = FillType;
2159
+ this.Math = Math;
2246
2160
  }
2247
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockAreaSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2248
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: BlockAreaSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-area-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) {\n @if (series?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n @if (!!config.inverted) {\n <svg:rect\n [attr.x]=\"data.x(0) < data.x(point.x) ? data.x(0) : data.x(point.x)\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.width]=\"data.x(0) < data.x(point.x) ? data.x(point.x) - data.x(0) : data.x(0) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : (point.color ?? series.style?.stroke ?? series.color)\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series.style?.fill ?? series.color)\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n ></svg:rect>\n } @else {\n <svg:rect\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"data.y(0)\"\n [attr.height]=\"Math.abs(data.y(0) - data.y(point.y))\"\n [attr.width]=\"data.x(point.x1) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : (point.color ?? series.color)\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series.color)\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n ></svg:rect>\n }\n @if (point.text) {\n <svg:text\n x=\"50%\"\n fill=\"var(--color-text-50)\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n </svg:g>\n }\n }\n}\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2161
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockAreaSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2162
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: BlockAreaSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-area-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y(), x: x(), points: displayPoints() }; as data) {\n @if (series()?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config()?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config()?.inverted ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series().style?.fill ?? series().color\"\n stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n @if (!!config().inverted) {\n <svg:rect [attr.x]=\"data.x(0) < data.x(point.x) ? data.x(0) : data.x(point.x)\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.width]=\"data.x(0) < data.x(point.x) ? data.x(point.x) - data.x(0) : data.x(0) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : (point.color ?? series().style?.stroke ?? series().color)\"\n [attr.stroke-dasharray]=\"series().style?.strokeDasharray\"\n [attr.stroke-width]=\"series().style?.strokeWidth\"\n [attr.fill]=\"\n series().fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series().style?.fill ?? series().color)\n \"\n [attr.fill-opacity]=\"series().style?.fillOpacity\"></svg:rect>\n } @else {\n <svg:rect [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"data.y(0)\"\n [attr.height]=\"Math.abs(data.y(0) - data.y(point.y))\"\n [attr.width]=\"data.x(point.x1) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : (point.color ?? series().color)\"\n [attr.stroke-dasharray]=\"series().style?.strokeDasharray\"\n [attr.stroke-width]=\"series().style?.strokeWidth\"\n [attr.fill]=\"\n series().fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series().color)\n \"\n [attr.fill-opacity]=\"series().style?.fillOpacity\"></svg:rect>\n }\n @if (point.text) {\n <svg:text x=\"50%\"\n fill=\"var(--color-text-50)\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">\n {{ point.text }}\n </svg:text>\n }\n </svg:g>\n }\n }\n}\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2249
2163
  }
2250
2164
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockAreaSeriesComponent, decorators: [{
2251
2165
  type: Component,
2252
- args: [{ selector: 'svg:svg[teta-block-area-series]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) {\n @if (series?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n @if (!!config.inverted) {\n <svg:rect\n [attr.x]=\"data.x(0) < data.x(point.x) ? data.x(0) : data.x(point.x)\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.width]=\"data.x(0) < data.x(point.x) ? data.x(point.x) - data.x(0) : data.x(0) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : (point.color ?? series.style?.stroke ?? series.color)\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series.style?.fill ?? series.color)\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n ></svg:rect>\n } @else {\n <svg:rect\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"data.y(0)\"\n [attr.height]=\"Math.abs(data.y(0) - data.y(point.y))\"\n [attr.width]=\"data.x(point.x1) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : (point.color ?? series.color)\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series.color)\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n ></svg:rect>\n }\n @if (point.text) {\n <svg:text\n x=\"50%\"\n fill=\"var(--color-text-50)\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n </svg:g>\n }\n }\n}\n" }]
2253
- }], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
2166
+ args: [{ selector: 'svg:svg[teta-block-area-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if ({ y: y(), x: x(), points: displayPoints() }; as data) {\n @if (series()?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config()?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config()?.inverted ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series().style?.fill ?? series().color\"\n stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n @if (!!config().inverted) {\n <svg:rect [attr.x]=\"data.x(0) < data.x(point.x) ? data.x(0) : data.x(point.x)\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.width]=\"data.x(0) < data.x(point.x) ? data.x(point.x) - data.x(0) : data.x(0) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : (point.color ?? series().style?.stroke ?? series().color)\"\n [attr.stroke-dasharray]=\"series().style?.strokeDasharray\"\n [attr.stroke-width]=\"series().style?.strokeWidth\"\n [attr.fill]=\"\n series().fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series().style?.fill ?? series().color)\n \"\n [attr.fill-opacity]=\"series().style?.fillOpacity\"></svg:rect>\n } @else {\n <svg:rect [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"data.y(0)\"\n [attr.height]=\"Math.abs(data.y(0) - data.y(point.y))\"\n [attr.width]=\"data.x(point.x1) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : (point.color ?? series().color)\"\n [attr.stroke-dasharray]=\"series().style?.strokeDasharray\"\n [attr.stroke-width]=\"series().style?.strokeWidth\"\n [attr.fill]=\"\n series().fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series().color)\n \"\n [attr.fill-opacity]=\"series().style?.fillOpacity\"></svg:rect>\n }\n @if (point.text) {\n <svg:text x=\"50%\"\n fill=\"var(--color-text-50)\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">\n {{ point.text }}\n </svg:text>\n }\n </svg:g>\n }\n }\n}\n" }]
2167
+ }] });
2254
2168
 
2255
- class AreaSeriesComponent extends LinearSeriesBase {
2256
- constructor(svc, cdr, scaleService, zoomService, element) {
2257
- super(svc, cdr, scaleService, zoomService, element);
2258
- this.svc = svc;
2259
- this.cdr = cdr;
2260
- this.scaleService = scaleService;
2261
- this.zoomService = zoomService;
2262
- this.element = element;
2263
- this.fillDirection = FillDirection;
2264
- this.fillType = FillType;
2265
- this.id = (Date.now() + Math.random()).toString(36);
2266
- }
2267
- ngOnInit() {
2268
- super.ngOnInit();
2269
- this.areaPath = this.scaleService.scales.pipe(map((data) => {
2270
- const { x, y } = data;
2271
- this.x = x.get(this.series.xAxisIndex)?.scale;
2272
- this.y = y.get(this.series.yAxisIndex)?.scale;
2273
- if (!this.x || !this.y) {
2169
+ class AreaSeriesComponent extends LinearSeriesBaseComponent {
2170
+ constructor() {
2171
+ super(...arguments);
2172
+ this.areaPath = computed(() => {
2173
+ if (!this.x() || !this.y()) {
2274
2174
  return '';
2275
2175
  }
2276
2176
  const area = d3
2277
2177
  .area()
2278
2178
  .defined((point) => point.x !== null && point.y !== null && !isNaN(point.x) && !isNaN(point.y));
2279
- area
2280
- .x1((_) => (_.x1 !== null && _.x1 !== undefined ? this.x(_.x1) : this.x(0)))
2281
- .x0((_) => this.x(_.x))
2282
- .y((_) => this.y(_.y));
2283
- const filter = this.defaultClipPointsMapping.get(this.series.clipPointsDirection);
2284
- let filteredData = this.series.data;
2285
- if (this.series.clipPointsDirection === ClipPointsDirection.x) {
2286
- let [min, max] = this.x.domain();
2179
+ if (this.config().inverted) {
2180
+ area
2181
+ .x1((_) => (_.x1 !== null && _.x1 !== undefined ? this.x()(_.x1) : this.x()(0)))
2182
+ .x0((_) => this.x()(_.x))
2183
+ .y((_) => this.y()(_.y));
2184
+ }
2185
+ else {
2186
+ area
2187
+ .y1((_) => (_.y1 !== null && _.y1 !== undefined ? this.y()(_.y1) : this.y()(0)))
2188
+ .y0((_) => this.y()(_.y))
2189
+ .x((_) => this.x()(_.x));
2190
+ }
2191
+ const filter = this.defaultClipPointsMapping.get(this.series().clipPointsDirection);
2192
+ let filteredData = this.series().data;
2193
+ if (this.series().clipPointsDirection === ClipPointsDirection.x) {
2194
+ let [min, max] = this.x().domain();
2287
2195
  min = min instanceof Date ? min.getTime() : min;
2288
2196
  max = max instanceof Date ? max.getTime() : max;
2289
2197
  filteredData = filteredData?.filter(filter(min, max));
2290
2198
  }
2291
- if (this.series.clipPointsDirection === ClipPointsDirection.y) {
2292
- let [min, max] = this.y.domain();
2199
+ if (this.series().clipPointsDirection === ClipPointsDirection.y) {
2200
+ let [min, max] = this.y().domain();
2293
2201
  min = min instanceof Date ? min.getTime() : min;
2294
2202
  max = max instanceof Date ? max.getTime() : max;
2295
2203
  filteredData = filteredData?.filter(filter(min, max));
2296
2204
  }
2297
2205
  return area(filteredData);
2298
- }));
2206
+ });
2207
+ this.FillType = FillType;
2208
+ this.FillDirection = FillDirection;
2299
2209
  }
2300
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AreaSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2301
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: AreaSeriesComponent, isStandalone: true, selector: "svg:svg[teta-area-series]", usesInheritance: true, ngImport: i0, template: "@if (series?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.8\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n}\n<svg:path\n class=\"area\"\n [attr.d]=\"areaPath | async\"\n [attr.stroke-width]=\"0\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n [attr.fill]=\"\n series.fillType === fillType.gradient ? 'url(#gradient-fill-' + id + ')' : (series.style?.fill ?? series.color)\n \"\n></svg:path>\n<svg:path\n class=\"area\"\n fill=\"none\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n></svg:path>\n@if (transform | async; as t) {\n @if (t?.x != null && t?.y != null) {\n <svg:circle r=\"3\" [attr.fill]=\"series.color\" [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n }\n}\n@if (markers; as draggablePoints) {\n @for (point of draggablePoints; track point) {\n <svg:circle\n class=\"marker\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n ></svg:circle>\n }\n}\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2210
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AreaSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2211
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: AreaSeriesComponent, isStandalone: true, selector: "svg:svg[teta-area-series]", usesInheritance: true, ngImport: i0, template: "@if (series()?.fillType === FillType.gradient) {\n <svg:defs>\n <svg:linearGradient [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config()?.inverted || series()?.fillDirection === FillDirection.y ? '0%' : '100%'\"\n [attr.x2]=\"config()?.inverted || series()?.fillDirection === FillDirection.y ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series().color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series().color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series().color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series().color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series().color\" stop-opacity=\"0.8\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n}\n<svg:path class=\"area\"\n [attr.d]=\"areaPath()\"\n [attr.stroke-width]=\"0\"\n [attr.fill-opacity]=\"series().style?.fillOpacity\"\n [attr.fill]=\"series().fillType === FillType.gradient ? 'url(#gradient-fill-' + id + ')' : (series().style?.fill ?? series().color)\"></svg:path>\n<svg:path class=\"area\"\n fill=\"none\"\n [attr.d]=\"path()\"\n [attr.stroke]=\"series().color\"\n [attr.stroke-dasharray]=\"series().style?.strokeDasharray\"\n [attr.stroke-width]=\"series().style?.strokeWidth\"></svg:path>\n@if (transform(); as t) {\n @if (t?.x !== null && t?.x !== undefined && t?.y !== null && t?.y !== undefined) {\n <svg:circle r=\"3\"\n [attr.fill]=\"series().color\"\n [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n }\n}\n@if (markers(); as draggablePoints) {\n @for (point of draggablePoints; track point) {\n <svg:circle class=\"marker\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x()(point.x)\"\n [attr.cy]=\"y()(point.y)\"\n ></svg:circle>\n }\n}\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2302
2212
  }
2303
2213
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AreaSeriesComponent, decorators: [{
2304
2214
  type: Component,
2305
- args: [{ selector: 'svg:svg[teta-area-series]', imports: [AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (series?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.8\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n}\n<svg:path\n class=\"area\"\n [attr.d]=\"areaPath | async\"\n [attr.stroke-width]=\"0\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n [attr.fill]=\"\n series.fillType === fillType.gradient ? 'url(#gradient-fill-' + id + ')' : (series.style?.fill ?? series.color)\n \"\n></svg:path>\n<svg:path\n class=\"area\"\n fill=\"none\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n></svg:path>\n@if (transform | async; as t) {\n @if (t?.x != null && t?.y != null) {\n <svg:circle r=\"3\" [attr.fill]=\"series.color\" [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n }\n}\n@if (markers; as draggablePoints) {\n @for (point of draggablePoints; track point) {\n <svg:circle\n class=\"marker\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n ></svg:circle>\n }\n}\n" }]
2306
- }], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
2215
+ args: [{ selector: 'svg:svg[teta-area-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (series()?.fillType === FillType.gradient) {\n <svg:defs>\n <svg:linearGradient [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config()?.inverted || series()?.fillDirection === FillDirection.y ? '0%' : '100%'\"\n [attr.x2]=\"config()?.inverted || series()?.fillDirection === FillDirection.y ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series().color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series().color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series().color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series().color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series().color\" stop-opacity=\"0.8\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n}\n<svg:path class=\"area\"\n [attr.d]=\"areaPath()\"\n [attr.stroke-width]=\"0\"\n [attr.fill-opacity]=\"series().style?.fillOpacity\"\n [attr.fill]=\"series().fillType === FillType.gradient ? 'url(#gradient-fill-' + id + ')' : (series().style?.fill ?? series().color)\"></svg:path>\n<svg:path class=\"area\"\n fill=\"none\"\n [attr.d]=\"path()\"\n [attr.stroke]=\"series().color\"\n [attr.stroke-dasharray]=\"series().style?.strokeDasharray\"\n [attr.stroke-width]=\"series().style?.strokeWidth\"></svg:path>\n@if (transform(); as t) {\n @if (t?.x !== null && t?.x !== undefined && t?.y !== null && t?.y !== undefined) {\n <svg:circle r=\"3\"\n [attr.fill]=\"series().color\"\n [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n }\n}\n@if (markers(); as draggablePoints) {\n @for (point of draggablePoints; track point) {\n <svg:circle class=\"marker\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x()(point.x)\"\n [attr.cy]=\"y()(point.y)\"\n ></svg:circle>\n }\n}\n" }]
2216
+ }] });
2307
2217
 
2308
2218
  const defaultSeriesTypeMapping = new Map()
2309
2219
  .set(SeriesType.line, LineSeriesComponent)
@@ -2314,31 +2224,29 @@ const defaultSeriesTypeMapping = new Map()
2314
2224
  .set(SeriesType.blockArea, BlockAreaSeriesComponent);
2315
2225
 
2316
2226
  class SeriesHostComponent {
2317
- constructor(viewContainerRef) {
2318
- this.viewContainerRef = viewContainerRef;
2227
+ constructor() {
2228
+ this.viewContainerRef = inject(ViewContainerRef);
2229
+ this.config = input();
2230
+ this.series = input();
2319
2231
  this._init = false;
2232
+ effect(() => {
2233
+ this._componentRef.setInput('config', this.config());
2234
+ });
2235
+ effect(() => {
2236
+ this._componentRef.setInput('series', this.series());
2237
+ });
2320
2238
  }
2321
2239
  ngOnInit() {
2322
- if (!SeriesBaseComponent.isPrototypeOf(this.series.component)) {
2323
- this.series.component = defaultSeriesTypeMapping.get(this.series.type) || LineSeriesComponent;
2240
+ if (!Object.prototype.isPrototypeOf.call(SeriesBaseComponent, this.series().component)) {
2241
+ this.series().component = defaultSeriesTypeMapping.get(this.series().type) || LineSeriesComponent;
2324
2242
  }
2325
- this._componentRef = this.viewContainerRef.createComponent(this.series.component);
2326
- this._componentRef.instance.config = this.config;
2327
- this._componentRef.instance.series = this.series;
2328
- this._init = true;
2243
+ this._componentRef = this.viewContainerRef.createComponent(this.series().component);
2329
2244
  }
2330
2245
  ngOnDestroy() {
2331
2246
  this._componentRef.destroy();
2332
2247
  }
2333
- ngOnChanges(changes) {
2334
- if (this._init && (changes.hasOwnProperty('series') || changes.hasOwnProperty('config'))) {
2335
- this._componentRef.instance.config = this.config;
2336
- this._componentRef.instance.series = this.series;
2337
- this._componentRef.injector.get(ChangeDetectorRef).detectChanges();
2338
- }
2339
- }
2340
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesHostComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
2341
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: SeriesHostComponent, isStandalone: true, selector: "[teta-series-host]", inputs: { config: "config", series: "series" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2248
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2249
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.5", type: SeriesHostComponent, isStandalone: true, selector: "[teta-series-host]", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2342
2250
  }
2343
2251
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesHostComponent, decorators: [{
2344
2252
  type: Component,
@@ -2348,11 +2256,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
2348
2256
  standalone: true,
2349
2257
  changeDetection: ChangeDetectionStrategy.OnPush,
2350
2258
  }]
2351
- }], ctorParameters: () => [{ type: i0.ViewContainerRef }], propDecorators: { config: [{
2352
- type: Input
2353
- }], series: [{
2354
- type: Input
2355
- }] } });
2259
+ }], ctorParameters: () => [] });
2356
2260
 
2357
2261
  class PlotLine {
2358
2262
  constructor(options) {
@@ -2413,7 +2317,7 @@ class PlotlineComponent {
2413
2317
  this.dragElements.on('start drag end', null);
2414
2318
  }
2415
2319
  emit(event) {
2416
- this.chartService.emitPlotline(event);
2320
+ this.chartService.emitPlotLine(event);
2417
2321
  }
2418
2322
  get value() {
2419
2323
  return this.scale(this.plotLine.value);
@@ -2680,19 +2584,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
2680
2584
  type: Input
2681
2585
  }] } });
2682
2586
 
2683
- function tetaZoneFull(ngZone) {
2684
- return (source) => new Observable((subscriber) => source.subscribe({
2685
- next: (value) => ngZone.run(() => subscriber.next(value)),
2686
- error: (error) => ngZone.run(() => subscriber.error(error)),
2687
- complete: () => ngZone.run(() => subscriber.complete()),
2688
- }));
2689
- }
2690
- function tetaZoneFree(ngZone) {
2691
- return (source) => new Observable((subscriber) => ngZone.runOutsideAngular(() => source.subscribe(subscriber)));
2692
- }
2693
- function tetaZoneOptimized(ngZone) {
2694
- return pipe(tetaZoneFree(ngZone), tetaZoneFull(ngZone));
2587
+ class SeriesControlsComponent {
2588
+ constructor() {
2589
+ this.chartService = inject(ChartService);
2590
+ this.Align = Align$1;
2591
+ this.series = input();
2592
+ this.strokeWidth = [
2593
+ { id: 1, value: 1 },
2594
+ { id: 2, value: 2 },
2595
+ { id: 3, value: 3 },
2596
+ { id: 4, value: 4 },
2597
+ { id: 5, value: 6 },
2598
+ ];
2599
+ this.strokeArray = [
2600
+ { id: '', value: 'solid' },
2601
+ { id: '4, 8', value: 'dashed' },
2602
+ { id: '2, 2', value: 'dotted' },
2603
+ ];
2604
+ }
2605
+ setSeriesEnabled(series, value) {
2606
+ series.enabled = value;
2607
+ this.chartService.updateSeries(series);
2608
+ }
2609
+ setSeriesColor(series, value) {
2610
+ series.color = value;
2611
+ this.chartService.updateSeries(series);
2612
+ }
2613
+ setSeriesStrokeWidth(series, value) {
2614
+ if (!series.style) {
2615
+ series.style = {};
2616
+ }
2617
+ series.style.strokeWidth = value;
2618
+ this.chartService.updateSeries(series);
2619
+ }
2620
+ setSeriesStrokeDasharray(series, value) {
2621
+ if (!series.style) {
2622
+ series.style = {};
2623
+ }
2624
+ series.style.strokeDasharray = value;
2625
+ this.chartService.updateSeries(series);
2626
+ }
2627
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesControlsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2628
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: SeriesControlsComponent, isStandalone: true, selector: "teta-series-controls", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<teta-dropdown [align]=\"Align.right\"\n #dropdown=\"dropdown\"\n [appendToBody]=\"true\">\n <button teta-button\n tetaDropdownHead\n [class.active]=\"dropdown.open\"\n [palette]=\"'text'\"\n [view]=\"'ghost'\">\n <teta-icon [name]=\"'gear'\"></teta-icon>\n </button>\n <div tetaDropdownContent class=\"column shadow-2\" style=\"min-width: 200px;\">\n <teta-accordion>\n @for (seriesItem of series(); track $index) {\n <teta-accordion-item [viewType]=\"'rounded'\" [divider]=\"true\">\n <teta-accordion-head>\n <div class=\"row align-center gap-12\">\n <div class=\"row align-center\" (click)=\"$event.stopPropagation()\">\n <teta-checkbox [ngModel]=\"seriesItem.enabled\"\n (ngModelChange)=\"setSeriesEnabled(seriesItem, $event)\"\n [binary]=\"true\"></teta-checkbox>\n <teta-color-input [ngModel]=\"seriesItem.color\"\n (ngModelChange)=\"setSeriesColor(seriesItem, $event)\"></teta-color-input>\n </div>\n {{ seriesItem.name }}\n </div>\n </teta-accordion-head>\n <ng-template tetaAccordionContent>\n <div class=\"column gap-8\">\n <teta-select [options]=\"strokeWidth\"\n [ngModel]=\"seriesItem.style?.strokeWidth ?? 1\"\n [valueRef]=\"'id'\"\n (ngModelChange)=\"setSeriesStrokeWidth(seriesItem, $event)\"\n [allowNull]=\"false\">\n <ng-template tetaSelectOption let-option>\n <div style=\"width: 50px;\"\n [style.height.px]=\"option.id\"\n [style.background-color]=\"seriesItem.color\"></div>\n </ng-template>\n <ng-template tetaSelectValue let-value>\n <div style=\"width: 50px;\"\n [style.height.px]=\"value?.id\"\n [style.background-color]=\"seriesItem.color\"></div>\n </ng-template>\n </teta-select>\n <teta-select [options]=\"strokeArray\"\n [ngModel]=\"seriesItem.style?.strokeDasharray ?? ''\"\n [valueRef]=\"'id'\"\n (ngModelChange)=\"setSeriesStrokeDasharray(seriesItem, $event)\"\n [allowNull]=\"false\">\n <ng-template tetaSelectOption let-option>\n <div style=\"width: 50px;border:0;border-top: 2px;\"\n [style.border-style]=\"option.value\"\n [style.border-color]=\"seriesItem.color\"></div>\n </ng-template>\n <ng-template tetaSelectValue let-value>\n <div style=\"width: 50px;border:0;border-top: 2px;\"\n [style.border-style]=\"value?.value\"\n [style.border-color]=\"seriesItem.color\"></div>\n </ng-template>\n </teta-select>\n </div>\n </ng-template>\n </teta-accordion-item>\n }\n </teta-accordion>\n </div>\n</teta-dropdown>\n", styles: [""], dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[teta-button], teta-button", inputs: ["palette", "class", "view", "square", "viewType", "size"] }, { kind: "component", type: DropdownComponent, selector: "teta-dropdown", exportAs: ["dropdown"] }, { kind: "directive", type: DropdownContentDirective, selector: "[tetaDropdownContent]" }, { kind: "directive", type: DropdownHeadDirective, selector: "[tetaDropdownHead]" }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "component", type: AccordionComponent, selector: "teta-accordion" }, { kind: "component", type: AccordionHeadComponent, selector: "teta-accordion-head", inputs: ["showToggle"] }, { kind: "component", type: AccordionItemComponent, selector: "teta-accordion-item", inputs: ["open", "disabled", "divider", "viewType"] }, { kind: "directive", type: AccordionContentDirective, selector: "[tetaAccordionContent]" }, { kind: "component", type: CheckboxComponent, selector: "teta-checkbox", inputs: ["class", "palette", "noLabel", "disabled", "value", "binary", "labelPosition", "allowNull"] }, { kind: "component", type: ColorInputComponent, selector: "teta-color-input", inputs: ["disabled"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: SelectComponent, selector: "teta-select", inputs: ["multiple", "options", "invalid", "align", "verticalAlign", "autoClose", "autoCloseIgnore", "disabled", "itemSize", "virtual", "icon", "placeholder", "appendToBody", "allowNull", "viewType", "notFoundText", "valueRef", "textRef", "searchRef"] }, { kind: "directive", type: SelectOptionDirective, selector: "[tetaSelectOption]" }, { kind: "directive", type: SelectValueDirective, selector: "[tetaSelectValue]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2695
2629
  }
2630
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesControlsComponent, decorators: [{
2631
+ type: Component,
2632
+ args: [{ selector: 'teta-series-controls', imports: [
2633
+ ButtonComponent,
2634
+ DropdownComponent,
2635
+ DropdownContentDirective,
2636
+ DropdownHeadDirective,
2637
+ IconComponent,
2638
+ AccordionComponent,
2639
+ AccordionHeadComponent,
2640
+ AccordionItemComponent,
2641
+ AccordionContentDirective,
2642
+ CheckboxComponent,
2643
+ ColorInputComponent,
2644
+ FormsModule,
2645
+ SelectComponent,
2646
+ SelectOptionDirective,
2647
+ SelectValueDirective,
2648
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<teta-dropdown [align]=\"Align.right\"\n #dropdown=\"dropdown\"\n [appendToBody]=\"true\">\n <button teta-button\n tetaDropdownHead\n [class.active]=\"dropdown.open\"\n [palette]=\"'text'\"\n [view]=\"'ghost'\">\n <teta-icon [name]=\"'gear'\"></teta-icon>\n </button>\n <div tetaDropdownContent class=\"column shadow-2\" style=\"min-width: 200px;\">\n <teta-accordion>\n @for (seriesItem of series(); track $index) {\n <teta-accordion-item [viewType]=\"'rounded'\" [divider]=\"true\">\n <teta-accordion-head>\n <div class=\"row align-center gap-12\">\n <div class=\"row align-center\" (click)=\"$event.stopPropagation()\">\n <teta-checkbox [ngModel]=\"seriesItem.enabled\"\n (ngModelChange)=\"setSeriesEnabled(seriesItem, $event)\"\n [binary]=\"true\"></teta-checkbox>\n <teta-color-input [ngModel]=\"seriesItem.color\"\n (ngModelChange)=\"setSeriesColor(seriesItem, $event)\"></teta-color-input>\n </div>\n {{ seriesItem.name }}\n </div>\n </teta-accordion-head>\n <ng-template tetaAccordionContent>\n <div class=\"column gap-8\">\n <teta-select [options]=\"strokeWidth\"\n [ngModel]=\"seriesItem.style?.strokeWidth ?? 1\"\n [valueRef]=\"'id'\"\n (ngModelChange)=\"setSeriesStrokeWidth(seriesItem, $event)\"\n [allowNull]=\"false\">\n <ng-template tetaSelectOption let-option>\n <div style=\"width: 50px;\"\n [style.height.px]=\"option.id\"\n [style.background-color]=\"seriesItem.color\"></div>\n </ng-template>\n <ng-template tetaSelectValue let-value>\n <div style=\"width: 50px;\"\n [style.height.px]=\"value?.id\"\n [style.background-color]=\"seriesItem.color\"></div>\n </ng-template>\n </teta-select>\n <teta-select [options]=\"strokeArray\"\n [ngModel]=\"seriesItem.style?.strokeDasharray ?? ''\"\n [valueRef]=\"'id'\"\n (ngModelChange)=\"setSeriesStrokeDasharray(seriesItem, $event)\"\n [allowNull]=\"false\">\n <ng-template tetaSelectOption let-option>\n <div style=\"width: 50px;border:0;border-top: 2px;\"\n [style.border-style]=\"option.value\"\n [style.border-color]=\"seriesItem.color\"></div>\n </ng-template>\n <ng-template tetaSelectValue let-value>\n <div style=\"width: 50px;border:0;border-top: 2px;\"\n [style.border-style]=\"value?.value\"\n [style.border-color]=\"seriesItem.color\"></div>\n </ng-template>\n </teta-select>\n </div>\n </ng-template>\n </teta-accordion-item>\n }\n </teta-accordion>\n </div>\n</teta-dropdown>\n" }]
2649
+ }] });
2696
2650
 
2697
2651
  class ChartContainerComponent {
2698
2652
  constructor(_svc, _scaleService, _elementRef, _zone) {
@@ -2707,7 +2661,7 @@ class ChartContainerComponent {
2707
2661
  this.sumSize = (acc, curr) => acc + curr.selfSize;
2708
2662
  this.config = this._svc.config;
2709
2663
  this.size = this._svc.size;
2710
- this.scales = this._scaleService.scales.pipe(observeOn(animationFrameScheduler), tetaZoneFull(this._zone), shareReplay({
2664
+ this.scales = this._scaleService.scales.pipe(observeOn(animationFrameScheduler), shareReplay({
2711
2665
  bufferSize: 1,
2712
2666
  refCount: true,
2713
2667
  }));
@@ -2756,7 +2710,7 @@ class ChartContainerComponent {
2756
2710
  width: size.width - left - right - config.bounds?.left - config.bounds?.right,
2757
2711
  height: size.height - top - bottom - config.bounds?.top - config.bounds?.bottom,
2758
2712
  };
2759
- }), tetaZoneFull(this._zone), shareReplay({
2713
+ }), shareReplay({
2760
2714
  bufferSize: 1,
2761
2715
  refCount: true,
2762
2716
  }));
@@ -2837,11 +2791,8 @@ class ChartContainerComponent {
2837
2791
  mouseLeave(event) {
2838
2792
  this._svc.setPointerMove(event);
2839
2793
  }
2840
- trackSerie(index, item) {
2841
- return item.name?.length ? item.name : index;
2842
- }
2843
2794
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ChartContainerComponent, deps: [{ token: ChartService }, { token: ScaleService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
2844
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ChartContainerComponent, isStandalone: true, selector: "teta-chart-container", ngImport: i0, template: "@if (\n {\n size: size | async,\n config: config | async,\n scales: scales | async,\n plotBands: plotBands | async,\n visibleRect: visibleRect | async,\n };\n as data\n) {\n @if (data.config?.tooltip?.enable) {\n <teta-tooltip [size]=\"data.size\" [config]=\"data.config\"></teta-tooltip>\n }\n @if (\n data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length\n ) {\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n @for (item of data.scales.y | keyvalue; track item.value.index) {\n @if (\n item.value.selfSize > 0 && item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0\n ) {\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\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\"\n ></rect>\n }\n }\n </g>\n <g class=\"x-axis-container\">\n @for (item of data.scales.x | keyvalue; track item.value.index) {\n @if (item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\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\"\n ></rect>\n }\n }\n </g>\n </svg>\n }\n @if (\n data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length\n ) {\n <svg\n tetaZoomable\n tetaBrushable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\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 @if (data.config.gridLines?.enable !== false) {\n <g class=\"gridlines\" teta-gridlines [size]=\"data.size\"></g>\n }\n <g class=\"x-axis-plotband-container\">\n @for (plotBand of data.plotBands; track $index) {\n <g\n teta-plot-band\n [plotBand]=\"plotBand.plotBand\"\n [scale]=\"plotBand.axis.scale\"\n [size]=\"data.visibleRect\"\n [axis]=\"plotBand.axis\"\n ></g>\n }\n </g>\n <g class=\"series-container\">\n @for (series of data.config.series; track series) {\n @if (series.visible) {\n <g teta-series-host [config]=\"data.config\" [series]=\"series\"></g>\n }\n }\n </g>\n <g class=\"x-axis-plotline-container\">\n @for (axis of data.config.xAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g\n teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"\n ></g>\n }\n }\n </g>\n <g class=\"y-axis-plotline-container\">\n @for (axis of data.config.yAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g\n teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.get(i)\"\n ></g>\n }\n }\n </g>\n <g class=\"annotations\">\n @for (annotation of data.config.annotations; track annotation) {\n <g teta-annotation [visibleRect]=\"data.visibleRect\" [annotation]=\"annotation\"></g>\n }\n </g>\n @if (data.config.tooltip?.showCrosshair) {\n <g class=\"crosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></g>\n </g>\n }\n </svg>\n }\n}\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: "component", type: TooltipComponent, selector: "teta-tooltip", inputs: ["size", "config"] }, { kind: "directive", type: ZoomableDirective, selector: "[tetaZoomable]", inputs: ["config", "axis", "size"] }, { kind: "component", type: XAxisComponent, selector: "[teta-x-axis]", inputs: ["axis", "size"] }, { kind: "component", type: YAxisComponent, selector: "[teta-y-axis]", inputs: ["axis", "size"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "component", type: PlotBandComponent, selector: "[teta-plot-band]", inputs: ["plotBand", "axis", "scale", "size"] }, { kind: "component", type: GridlinesComponent, selector: "[teta-gridlines]", inputs: ["size"] }, { kind: "component", type: SeriesHostComponent, selector: "[teta-series-host]", inputs: ["config", "series"] }, { kind: "component", type: PlotlineComponent, selector: "[teta-plot-line]", inputs: ["plotLine", "size", "axis", "scale"] }, { kind: "component", type: AnnotationComponent, selector: "[teta-annotation]", inputs: ["visibleRect", "annotation"] }, { kind: "component", type: CrosshairComponent, selector: "[teta-crosshair]", inputs: ["size"] }, { kind: "directive", type: BrushableDirective, selector: "[tetaBrushable]", inputs: ["config", "axis"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2795
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ChartContainerComponent, isStandalone: true, selector: "teta-chart-container", ngImport: i0, template: "@if ({\n size: size | async,\n config: config | async,\n scales: scales | async,\n plotBands: plotBands | async,\n visibleRect: visibleRect | async,\n};\n as data) {\n @if (data.config?.tooltip?.enable) {\n <teta-tooltip [size]=\"data.size\" [config]=\"data.config\"></teta-tooltip>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n @for (item of data.scales.y | keyvalue; track item.value.index) {\n @if (item.value.selfSize > 0 && item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\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 }\n }\n </g>\n <g class=\"x-axis-container\">\n @for (item of data.scales.x | keyvalue; track item.value.index) {\n @if (item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\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 }\n }\n </g>\n </svg>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg\n tetaZoomable\n tetaBrushable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\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 @if (data.config.gridLines?.enable !== false) {\n <g class=\"gridlines\" teta-gridlines [size]=\"data.size\"></g>\n }\n <g class=\"x-axis-plotband-container\">\n @for (plotBand of data.plotBands; track $index) {\n <g teta-plot-band\n [plotBand]=\"plotBand.plotBand\"\n [scale]=\"plotBand.axis.scale\"\n [size]=\"data.visibleRect\"\n [axis]=\"plotBand.axis\"></g>\n }\n </g>\n <g class=\"series-container\">\n @for (series of data.config.series; track series) {\n @if (series.visible && series.enabled) {\n <g teta-series-host [config]=\"data.config\" [series]=\"series\"></g>\n }\n }\n </g>\n <g class=\"x-axis-plotline-container\">\n @for (axis of data.config.xAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n }\n }\n </g>\n <g class=\"y-axis-plotline-container\">\n @for (axis of data.config.yAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.get(i)\"></g>\n }\n }\n </g>\n <g class=\"annotations\">\n @for (annotation of data.config.annotations; track annotation) {\n <g teta-annotation [visibleRect]=\"data.visibleRect\" [annotation]=\"annotation\"></g>\n }\n </g>\n @if (data.config.tooltip?.showCrosshair) {\n <g class=\"crosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></g>\n </g>\n }\n </svg>\n @if (data.config.controls?.enable) {\n <teta-series-controls [series]=\"data.config.series\"\n class=\"position-absolute\"\n style=\"transform: translateX(-100%)\"\n [style.top.px]=\"data.visibleRect.y + 12\"\n [style.left.px]=\"data.visibleRect.width + data.visibleRect.x -12\">\n </teta-series-controls>\n }\n }\n}\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: "component", type: TooltipComponent, selector: "teta-tooltip", inputs: ["size", "config"] }, { kind: "directive", type: ZoomableDirective, selector: "[tetaZoomable]", inputs: ["config", "axis", "size"] }, { kind: "component", type: XAxisComponent, selector: "[teta-x-axis]", inputs: ["axis", "size"] }, { kind: "component", type: YAxisComponent, selector: "[teta-y-axis]", inputs: ["axis", "size"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "component", type: PlotBandComponent, selector: "[teta-plot-band]", inputs: ["plotBand", "axis", "scale", "size"] }, { kind: "component", type: GridlinesComponent, selector: "[teta-gridlines]", inputs: ["size"] }, { kind: "component", type: SeriesHostComponent, selector: "[teta-series-host]", inputs: ["config", "series"] }, { kind: "component", type: PlotlineComponent, selector: "[teta-plot-line]", inputs: ["plotLine", "size", "axis", "scale"] }, { kind: "component", type: AnnotationComponent, selector: "[teta-annotation]", inputs: ["visibleRect", "annotation"] }, { kind: "component", type: CrosshairComponent, selector: "[teta-crosshair]", inputs: ["size"] }, { kind: "directive", type: BrushableDirective, selector: "[tetaBrushable]", inputs: ["config", "axis"] }, { kind: "component", type: SeriesControlsComponent, selector: "teta-series-controls", inputs: ["series"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2845
2796
  }
2846
2797
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ChartContainerComponent, decorators: [{
2847
2798
  type: Component,
@@ -2859,7 +2810,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
2859
2810
  AnnotationComponent,
2860
2811
  CrosshairComponent,
2861
2812
  BrushableDirective,
2862
- ], template: "@if (\n {\n size: size | async,\n config: config | async,\n scales: scales | async,\n plotBands: plotBands | async,\n visibleRect: visibleRect | async,\n };\n as data\n) {\n @if (data.config?.tooltip?.enable) {\n <teta-tooltip [size]=\"data.size\" [config]=\"data.config\"></teta-tooltip>\n }\n @if (\n data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length\n ) {\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n @for (item of data.scales.y | keyvalue; track item.value.index) {\n @if (\n item.value.selfSize > 0 && item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0\n ) {\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\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\"\n ></rect>\n }\n }\n </g>\n <g class=\"x-axis-container\">\n @for (item of data.scales.x | keyvalue; track item.value.index) {\n @if (item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\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\"\n ></rect>\n }\n }\n </g>\n </svg>\n }\n @if (\n data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length\n ) {\n <svg\n tetaZoomable\n tetaBrushable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\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 @if (data.config.gridLines?.enable !== false) {\n <g class=\"gridlines\" teta-gridlines [size]=\"data.size\"></g>\n }\n <g class=\"x-axis-plotband-container\">\n @for (plotBand of data.plotBands; track $index) {\n <g\n teta-plot-band\n [plotBand]=\"plotBand.plotBand\"\n [scale]=\"plotBand.axis.scale\"\n [size]=\"data.visibleRect\"\n [axis]=\"plotBand.axis\"\n ></g>\n }\n </g>\n <g class=\"series-container\">\n @for (series of data.config.series; track series) {\n @if (series.visible) {\n <g teta-series-host [config]=\"data.config\" [series]=\"series\"></g>\n }\n }\n </g>\n <g class=\"x-axis-plotline-container\">\n @for (axis of data.config.xAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g\n teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"\n ></g>\n }\n }\n </g>\n <g class=\"y-axis-plotline-container\">\n @for (axis of data.config.yAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g\n teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.get(i)\"\n ></g>\n }\n }\n </g>\n <g class=\"annotations\">\n @for (annotation of data.config.annotations; track annotation) {\n <g teta-annotation [visibleRect]=\"data.visibleRect\" [annotation]=\"annotation\"></g>\n }\n </g>\n @if (data.config.tooltip?.showCrosshair) {\n <g class=\"crosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></g>\n </g>\n }\n </svg>\n }\n}\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"] }]
2813
+ SeriesControlsComponent,
2814
+ ], template: "@if ({\n size: size | async,\n config: config | async,\n scales: scales | async,\n plotBands: plotBands | async,\n visibleRect: visibleRect | async,\n};\n as data) {\n @if (data.config?.tooltip?.enable) {\n <teta-tooltip [size]=\"data.size\" [config]=\"data.config\"></teta-tooltip>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n @for (item of data.scales.y | keyvalue; track item.value.index) {\n @if (item.value.selfSize > 0 && item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\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 }\n }\n </g>\n <g class=\"x-axis-container\">\n @for (item of data.scales.x | keyvalue; track item.value.index) {\n @if (item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\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 }\n }\n </g>\n </svg>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg\n tetaZoomable\n tetaBrushable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\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 @if (data.config.gridLines?.enable !== false) {\n <g class=\"gridlines\" teta-gridlines [size]=\"data.size\"></g>\n }\n <g class=\"x-axis-plotband-container\">\n @for (plotBand of data.plotBands; track $index) {\n <g teta-plot-band\n [plotBand]=\"plotBand.plotBand\"\n [scale]=\"plotBand.axis.scale\"\n [size]=\"data.visibleRect\"\n [axis]=\"plotBand.axis\"></g>\n }\n </g>\n <g class=\"series-container\">\n @for (series of data.config.series; track series) {\n @if (series.visible && series.enabled) {\n <g teta-series-host [config]=\"data.config\" [series]=\"series\"></g>\n }\n }\n </g>\n <g class=\"x-axis-plotline-container\">\n @for (axis of data.config.xAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n }\n }\n </g>\n <g class=\"y-axis-plotline-container\">\n @for (axis of data.config.yAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.get(i)\"></g>\n }\n }\n </g>\n <g class=\"annotations\">\n @for (annotation of data.config.annotations; track annotation) {\n <g teta-annotation [visibleRect]=\"data.visibleRect\" [annotation]=\"annotation\"></g>\n }\n </g>\n @if (data.config.tooltip?.showCrosshair) {\n <g class=\"crosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></g>\n </g>\n }\n </svg>\n @if (data.config.controls?.enable) {\n <teta-series-controls [series]=\"data.config.series\"\n class=\"position-absolute\"\n style=\"transform: translateX(-100%)\"\n [style.top.px]=\"data.visibleRect.y + 12\"\n [style.left.px]=\"data.visibleRect.width + data.visibleRect.x -12\">\n </teta-series-controls>\n }\n }\n}\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"] }]
2863
2815
  }], ctorParameters: () => [{ type: ChartService }, { type: ScaleService }, { type: i0.ElementRef }, { type: i0.NgZone }] });
2864
2816
 
2865
2817
  class LegendComponent {
@@ -2872,23 +2824,23 @@ class LegendComponent {
2872
2824
  .set(SeriesType.area, 2)
2873
2825
  .set(SeriesType.block, 12)
2874
2826
  .set(SeriesType.blockArea, 2);
2827
+ this.series = input();
2875
2828
  this.classLegend = true;
2876
2829
  }
2877
2830
  getHeight(serie) {
2878
2831
  return this.sizeMapping.get(serie.type ?? SeriesType.line);
2879
2832
  }
2880
- click(serie) {
2881
- this.chartService.toggleVisibilitySeries([serie.id]);
2833
+ click(series, visible) {
2834
+ series.visible = visible;
2835
+ this.chartService.updateSeries(series);
2882
2836
  }
2883
2837
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LegendComponent, deps: [{ token: ChartService }], target: i0.ɵɵFactoryTarget.Component }); }
2884
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: LegendComponent, isStandalone: true, selector: "teta-legend", inputs: { series: "series" }, host: { properties: { "class.padding-bottom-4": "this.classLegend" } }, ngImport: i0, template: "@for (serie of series; track serie.id) {\n @if (serie?.showInLegend !== false) {\n <div>\n <div class=\"legend-item cursor-pointer\" (click)=\"click(serie)\">\n <div\n class=\"legend-icon-form\"\n [style.height.px]=\"getHeight(serie)\"\n [style.border-top-color]=\"serie.visible ? serie.color : 'var(--color-text-30)'\"\n [style.border-top-style]=\"serie.style?.strokeDasharray ? 'dashed' : 'solid'\"\n [style.border-width.px]=\"serie.style?.strokeDasharray ? 1 : 2\"\n ></div>\n <div\n class=\"legend-label\"\n style=\"user-select: none\"\n [style.text-decoration]=\"serie.visible ? 'none' : 'line-through'\"\n >\n {{ serie.name }}\n </div>\n </div>\n </div>\n }\n}\n", styles: [":host{display:flex;grid-gap:8px;flex-wrap:wrap;align-items:center;justify-content:space-evenly}:host .legend-item{display:flex;align-items:center}:host .legend-icon-form{width:12px}:host .legend-label{margin-left:5px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2838
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: LegendComponent, isStandalone: true, selector: "teta-legend", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.padding-bottom-4": "this.classLegend" } }, ngImport: i0, template: "@for (seriesItem of series(); track seriesItem.id) {\n @if (seriesItem?.showInLegend !== false && seriesItem.enabled) {\n <div>\n <div class=\"legend-item cursor-pointer\" (click)=\"click(seriesItem, !seriesItem.visible)\">\n <div class=\"legend-icon-form\"\n [style.height.px]=\"getHeight(seriesItem)\"\n [style.border-top-color]=\"seriesItem.visible ? seriesItem.color : 'var(--color-text-30)'\"\n [style.border-top-style]=\"seriesItem.style?.strokeDasharray ? 'dashed' : 'solid'\"\n [style.border-width.px]=\"seriesItem.style?.strokeDasharray ? 1 : 2\"></div>\n <div class=\"legend-label\"\n style=\"user-select: none\"\n [style.text-decoration]=\"seriesItem.visible ? 'none' : 'line-through'\">\n {{ seriesItem.name }}\n </div>\n </div>\n </div>\n }\n}\n", styles: [":host{display:flex;grid-gap:8px;flex-wrap:wrap;align-items:center;justify-content:space-evenly}:host .legend-item{display:flex;align-items:center}:host .legend-icon-form{width:12px}:host .legend-label{margin-left:5px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2885
2839
  }
2886
2840
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LegendComponent, decorators: [{
2887
2841
  type: Component,
2888
- args: [{ selector: 'teta-legend', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (serie of series; track serie.id) {\n @if (serie?.showInLegend !== false) {\n <div>\n <div class=\"legend-item cursor-pointer\" (click)=\"click(serie)\">\n <div\n class=\"legend-icon-form\"\n [style.height.px]=\"getHeight(serie)\"\n [style.border-top-color]=\"serie.visible ? serie.color : 'var(--color-text-30)'\"\n [style.border-top-style]=\"serie.style?.strokeDasharray ? 'dashed' : 'solid'\"\n [style.border-width.px]=\"serie.style?.strokeDasharray ? 1 : 2\"\n ></div>\n <div\n class=\"legend-label\"\n style=\"user-select: none\"\n [style.text-decoration]=\"serie.visible ? 'none' : 'line-through'\"\n >\n {{ serie.name }}\n </div>\n </div>\n </div>\n }\n}\n", styles: [":host{display:flex;grid-gap:8px;flex-wrap:wrap;align-items:center;justify-content:space-evenly}:host .legend-item{display:flex;align-items:center}:host .legend-icon-form{width:12px}:host .legend-label{margin-left:5px}\n"] }]
2889
- }], ctorParameters: () => [{ type: ChartService }], propDecorators: { series: [{
2890
- type: Input
2891
- }], classLegend: [{
2842
+ args: [{ selector: 'teta-legend', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (seriesItem of series(); track seriesItem.id) {\n @if (seriesItem?.showInLegend !== false && seriesItem.enabled) {\n <div>\n <div class=\"legend-item cursor-pointer\" (click)=\"click(seriesItem, !seriesItem.visible)\">\n <div class=\"legend-icon-form\"\n [style.height.px]=\"getHeight(seriesItem)\"\n [style.border-top-color]=\"seriesItem.visible ? seriesItem.color : 'var(--color-text-30)'\"\n [style.border-top-style]=\"seriesItem.style?.strokeDasharray ? 'dashed' : 'solid'\"\n [style.border-width.px]=\"seriesItem.style?.strokeDasharray ? 1 : 2\"></div>\n <div class=\"legend-label\"\n style=\"user-select: none\"\n [style.text-decoration]=\"seriesItem.visible ? 'none' : 'line-through'\">\n {{ seriesItem.name }}\n </div>\n </div>\n </div>\n }\n}\n", styles: [":host{display:flex;grid-gap:8px;flex-wrap:wrap;align-items:center;justify-content:space-evenly}:host .legend-item{display:flex;align-items:center}:host .legend-icon-form{width:12px}:host .legend-label{margin-left:5px}\n"] }]
2843
+ }], ctorParameters: () => [{ type: ChartService }], propDecorators: { classLegend: [{
2892
2844
  type: HostBinding,
2893
2845
  args: ['class.padding-bottom-4']
2894
2846
  }] } });
@@ -3029,47 +2981,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
3029
2981
  }] } });
3030
2982
 
3031
2983
  class BlockHorizontalSeriesComponent extends SeriesBaseComponent {
3032
- constructor(svc, cdr, scaleService, zoomService, element) {
3033
- super(svc, cdr, scaleService, zoomService, element);
3034
- this.svc = svc;
3035
- this.cdr = cdr;
3036
- this.scaleService = scaleService;
3037
- this.zoomService = zoomService;
3038
- this.element = element;
3039
- this.fillType = FillType;
3040
- this.Math = Math;
3041
- this.id = (Date.now() + Math.random()).toString(36);
3042
- }
3043
- ngOnInit() {
3044
- this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex)?.scale));
3045
- this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex)?.scale));
3046
- this.displayPoints = this.x.pipe(filter((y) => y), map((y) => {
3047
- return this.series.data.filter((point, index, arr) => {
3048
- const [min, max] = y.domain();
2984
+ constructor() {
2985
+ super(...arguments);
2986
+ this.displayPoints = computed(() => {
2987
+ return this.series().data.filter((point, index, arr) => {
2988
+ const [min, max] = this.x().domain();
3049
2989
  return ((point.x >= min || point.x1 >= min || arr[index + 1]?.x >= min || arr[index + 1]?.x1 >= min) &&
3050
2990
  (point.x <= max || point.x1 <= max || arr[index - 1]?.x <= max || arr[index - 1]?.x1 <= max));
3051
2991
  });
3052
- }));
3053
- }
3054
- mouseenter(point) {
3055
- this.svc.setTooltip({
3056
- point: point,
3057
- series: this.series,
3058
- });
3059
- }
3060
- mouseleave(point) {
3061
- this.svc.setTooltip({
3062
- point: null,
3063
- series: this.series,
3064
2992
  });
2993
+ this.Math = Math;
2994
+ this.FillType = FillType;
3065
2995
  }
3066
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockHorizontalSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
3067
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: BlockHorizontalSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-horizontal-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) {\n @if (series?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.x]=\"data.x(point.x)\"\n [attr.width]=\"Math.abs(data.x(point.x1) - data.x(point.x))\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series.style?.fill ?? series.color)\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n height=\"100%\"\n ></svg:rect>\n @if (point.text && data.x(point.x1) - data.x(point.x) > 8) {\n <svg:text\n [attr.transform]=\"'rotate(270)'\"\n [ngStyle]=\"{ 'transform-origin': (data.x(point.x1) + data.x(point.x)) / 2 + 'px 50%' }\"\n y=\"50%\"\n [attr.x]=\"(data.x(point.x1) + data.x(point.x)) / 2\"\n text-anchor=\"middle\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n <svg:line\n y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x)\"\n [attr.x2]=\"data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series.style?.stroke ?? series.color)\"\n ></svg:line>\n <svg:line\n y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x1)\"\n [attr.x2]=\"data.x(point.x1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series.style?.stroke ?? series.color)\"\n ></svg:line>\n </svg:g>\n }\n }\n}\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2996
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockHorizontalSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2997
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: BlockHorizontalSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-horizontal-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y(), x: x(), points: displayPoints() }; as data) {\n @if (series()?.fillType === FillType.gradient) {\n <svg:defs>\n <svg:linearGradient [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config()?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config()?.inverted ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series().style?.fill ?? series().color\"\n stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect x=\"0\"\n [attr.x]=\"data.x(point.x)\"\n [attr.width]=\"Math.abs(data.x(point.x1) - data.x(point.x))\"\n [attr.fill]=\"series().fillType === FillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series().style?.fill ?? series().color)\"\n [attr.fill-opacity]=\"series().style?.fillOpacity\"\n height=\"100%\"\n ></svg:rect>\n @if (point.text && data.x(point.x1) - data.x(point.x) > 8) {\n <svg:text [attr.transform]=\"'rotate(270)'\"\n [ngStyle]=\"{ 'transform-origin': (data.x(point.x1) + data.x(point.x)) / 2 + 'px 50%' }\"\n y=\"50%\"\n [attr.x]=\"(data.x(point.x1) + data.x(point.x)) / 2\"\n text-anchor=\"middle\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">\n {{ point.text }}\n </svg:text>\n }\n <svg:line y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x)\"\n [attr.x2]=\"data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series().style?.stroke ?? series().color)\"></svg:line>\n <svg:line y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x1)\"\n [attr.x2]=\"data.x(point.x1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series().style?.stroke ?? series().color)\"></svg:line>\n </svg:g>\n }\n }\n}\n", styles: [""], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3068
2998
  }
3069
2999
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockHorizontalSeriesComponent, decorators: [{
3070
3000
  type: Component,
3071
- args: [{ selector: 'svg:svg[teta-block-horizontal-series]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe, NgStyle], template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) {\n @if (series?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.x]=\"data.x(point.x)\"\n [attr.width]=\"Math.abs(data.x(point.x1) - data.x(point.x))\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series.style?.fill ?? series.color)\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n height=\"100%\"\n ></svg:rect>\n @if (point.text && data.x(point.x1) - data.x(point.x) > 8) {\n <svg:text\n [attr.transform]=\"'rotate(270)'\"\n [ngStyle]=\"{ 'transform-origin': (data.x(point.x1) + data.x(point.x)) / 2 + 'px 50%' }\"\n y=\"50%\"\n [attr.x]=\"(data.x(point.x1) + data.x(point.x)) / 2\"\n text-anchor=\"middle\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n <svg:line\n y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x)\"\n [attr.x2]=\"data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series.style?.stroke ?? series.color)\"\n ></svg:line>\n <svg:line\n y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x1)\"\n [attr.x2]=\"data.x(point.x1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series.style?.stroke ?? series.color)\"\n ></svg:line>\n </svg:g>\n }\n }\n}\n" }]
3072
- }], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
3001
+ args: [{ selector: 'svg:svg[teta-block-horizontal-series]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgStyle], template: "@if ({ y: y(), x: x(), points: displayPoints() }; as data) {\n @if (series()?.fillType === FillType.gradient) {\n <svg:defs>\n <svg:linearGradient [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config()?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config()?.inverted ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series().style?.fill ?? series().color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series().style?.fill ?? series().color\"\n stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect x=\"0\"\n [attr.x]=\"data.x(point.x)\"\n [attr.width]=\"Math.abs(data.x(point.x1) - data.x(point.x))\"\n [attr.fill]=\"series().fillType === FillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : (point.color ?? series().style?.fill ?? series().color)\"\n [attr.fill-opacity]=\"series().style?.fillOpacity\"\n height=\"100%\"\n ></svg:rect>\n @if (point.text && data.x(point.x1) - data.x(point.x) > 8) {\n <svg:text [attr.transform]=\"'rotate(270)'\"\n [ngStyle]=\"{ 'transform-origin': (data.x(point.x1) + data.x(point.x)) / 2 + 'px 50%' }\"\n y=\"50%\"\n [attr.x]=\"(data.x(point.x1) + data.x(point.x)) / 2\"\n text-anchor=\"middle\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">\n {{ point.text }}\n </svg:text>\n }\n <svg:line y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x)\"\n [attr.x2]=\"data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series().style?.stroke ?? series().color)\"></svg:line>\n <svg:line y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x1)\"\n [attr.x2]=\"data.x(point.x1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : (point.color ?? series().style?.stroke ?? series().color)\"></svg:line>\n </svg:g>\n }\n }\n}\n" }]
3002
+ }] });
3073
3003
 
3074
3004
  /*
3075
3005
  * Public API Surface of chart
@@ -3079,5 +3009,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
3079
3009
  * Generated bundle index. Do not edit.
3080
3010
  */
3081
3011
 
3082
- export { AreaSeriesComponent, Axis, AxisOrientation, BarSeriesComponent, BlockAreaSeriesComponent, BlockHorizontalSeriesComponent, BlockSeriesComponent, BroadcastService, BrushMessage, BrushService, BrushType, ChartBounds, ChartComponent, ChartService, ClipPointsDirection, DragPointType, FillDirection, FillType, LegendComponent, LineSeriesComponent, LinearSeriesBase, PlotBand, PlotLine, ScaleService, ScaleType, ScatterSeriesComponent, SeriesBaseComponent, SeriesType, TooltipTracking, ZoomBehaviorType, ZoomMessage, ZoomService, ZoomType, generateTicks, getTextWidth, tetaZoneFree, tetaZoneFull, tetaZoneOptimized };
3012
+ export { AreaSeriesComponent, Axis, AxisOrientation, BarSeriesComponent, BlockAreaSeriesComponent, BlockHorizontalSeriesComponent, BlockSeriesComponent, BroadcastService, BrushMessage, BrushService, BrushType, ChartBounds, ChartComponent, ChartService, ClipPointsDirection, DragPointType, FillDirection, FillType, LegendComponent, LineSeriesComponent, LinearSeriesBaseComponent, PlotBand, PlotLine, ScaleService, ScaleType, ScatterSeriesComponent, SeriesBaseComponent, SeriesType, TooltipTracking, ZoomBehaviorType, ZoomMessage, ZoomService, ZoomType, generateTicks, getTextWidth };
3083
3013
  //# sourceMappingURL=tetacom-svg-charts.mjs.map