@tetacom/svg-charts 1.7.1 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chart/base/series-base.component.d.ts +6 -2
- package/chart/chart-container/series/area-series/area-series.component.d.ts +6 -8
- package/chart/chart-container/series/bar/bar-series.component.d.ts +2 -4
- package/chart/chart-container/series/block-area-series/block-area-series.component.d.ts +1 -3
- package/chart/chart-container/series/block-horizontal-series/block-horizontal-series.component.d.ts +2 -4
- package/chart/chart-container/series/block-series/block-series.component.d.ts +2 -4
- package/chart/chart-container/series/line/line-series.component.d.ts +2 -2
- package/chart/chart-container/series/linear-series-base.component.d.ts +9 -11
- package/chart/chart-container/series/scatter-series/scatter-series.component.d.ts +0 -6
- package/fesm2022/tetacom-svg-charts.mjs +140 -147
- package/fesm2022/tetacom-svg-charts.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject, ChangeDetectorRef, ElementRef,
|
|
2
|
+
import { Injectable, input, inject, ChangeDetectorRef, ElementRef, computed, Component, ChangeDetectionStrategy, Input, ViewChild, Directive, HostBinding, HostListener, signal, EventEmitter, Output, ViewContainerRef, effect } from '@angular/core';
|
|
3
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';
|
|
9
|
-
import { Align as Align$1, ButtonComponent, DropdownComponent, DropdownContentDirective, DropdownHeadDirective, IconComponent, AccordionComponent, AccordionHeadComponent, AccordionItemComponent, AccordionContentDirective, CheckboxComponent, ColorInputComponent, SelectComponent, SelectOptionDirective, SelectValueDirective } from '@tetacom/ng-components';
|
|
10
|
+
import { Align as Align$1, ButtonComponent, DropdownComponent, DropdownContentDirective, DropdownHeadDirective, IconComponent, AccordionComponent, AccordionHeadComponent, AccordionItemComponent, AccordionContentDirective, CheckboxComponent, ColorInputComponent, SelectComponent, SelectOptionDirective, SelectValueDirective, ScrollableComponent } from '@tetacom/ng-components';
|
|
10
11
|
import * as i1 from '@angular/forms';
|
|
11
12
|
import { FormsModule } from '@angular/forms';
|
|
12
13
|
|
|
@@ -248,8 +249,10 @@ class ChartService {
|
|
|
248
249
|
return;
|
|
249
250
|
}
|
|
250
251
|
currentConfig.series = [...currentConfig.series];
|
|
251
|
-
const seriesLinkCount = currentConfig.series.filter(
|
|
252
|
-
|
|
252
|
+
// const seriesLinkCount = currentConfig.series.filter(
|
|
253
|
+
// (_) => _.yAxisIndex === currentConfig.series[currentSeriesIndex].yAxisIndex && _.visible === true,
|
|
254
|
+
// ).length;
|
|
255
|
+
// currentConfig.yAxis[currentConfig.series[currentSeriesIndex].yAxisIndex].visible = seriesLinkCount !== 0;
|
|
253
256
|
try {
|
|
254
257
|
this.saveCookie(currentConfig);
|
|
255
258
|
}
|
|
@@ -311,11 +314,16 @@ class ChartService {
|
|
|
311
314
|
serie.style.strokeWidth = found.strokeWidth ?? serie.style.strokeWidth;
|
|
312
315
|
serie.style.strokeDasharray = found.strokeDasharray ?? serie.style.strokeDasharray;
|
|
313
316
|
}
|
|
314
|
-
const currentSerieIndex = config.series.findIndex((_) => _.id === serie.id);
|
|
315
|
-
if (currentSerieIndex !== -1) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
// const currentSerieIndex = config.series.findIndex((_) => _.id === serie.id);
|
|
318
|
+
// if (currentSerieIndex !== -1) {
|
|
319
|
+
// const seriesLinkCount = config.series.filter(
|
|
320
|
+
// (_) => _.yAxisIndex === config.series[currentSerieIndex].yAxisIndex && _.visible === true,
|
|
321
|
+
// ).length;
|
|
322
|
+
// const yAxis = config.yAxis[config.series[currentSerieIndex].yAxisIndex];
|
|
323
|
+
// if (yAxis) {
|
|
324
|
+
// yAxis.visible = seriesLinkCount !== 0;
|
|
325
|
+
// }
|
|
326
|
+
// }
|
|
319
327
|
return serie;
|
|
320
328
|
});
|
|
321
329
|
return config;
|
|
@@ -894,14 +902,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
894
902
|
|
|
895
903
|
class SeriesBaseComponent {
|
|
896
904
|
constructor() {
|
|
905
|
+
this.config = input();
|
|
906
|
+
this.series = input();
|
|
897
907
|
this.svc = inject(ChartService);
|
|
898
908
|
this.cdr = inject(ChangeDetectorRef);
|
|
899
909
|
this.scaleService = inject(ScaleService);
|
|
900
910
|
this.zoomService = inject(ZoomService);
|
|
901
911
|
this.element = inject(ElementRef);
|
|
902
912
|
this.id = (Date.now() + Math.random()).toString(36);
|
|
903
|
-
this.
|
|
904
|
-
this.
|
|
913
|
+
this.xScales = toSignal(this.scaleService.scales.pipe(map((_) => _.x)));
|
|
914
|
+
this.yScales = toSignal(this.scaleService.scales.pipe(map((_) => _.y)));
|
|
915
|
+
this.x = computed(() => {
|
|
916
|
+
return this.xScales().get(this.series().xAxisIndex)?.scale;
|
|
917
|
+
});
|
|
918
|
+
this.y = computed(() => {
|
|
919
|
+
return this.yScales().get(this.series().yAxisIndex)?.scale;
|
|
920
|
+
});
|
|
905
921
|
}
|
|
906
922
|
mouseenter(point) {
|
|
907
923
|
this.svc.setTooltip({
|
|
@@ -1675,24 +1691,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1675
1691
|
|
|
1676
1692
|
class LinearSeriesBaseComponent extends SeriesBaseComponent {
|
|
1677
1693
|
constructor() {
|
|
1678
|
-
super(
|
|
1694
|
+
super();
|
|
1695
|
+
this.pointerMove = toSignal(this.svc.pointerMove);
|
|
1696
|
+
this.transform = computed(() => {
|
|
1697
|
+
const event = this.pointerMove();
|
|
1698
|
+
return this.getTransform(event, this.x(), this.y());
|
|
1699
|
+
});
|
|
1679
1700
|
this.defaultClipPointsMapping = new Map();
|
|
1680
1701
|
this.markers = computed(() => {
|
|
1681
1702
|
return this.series().data?.filter((_) => _?.marker && _?.x !== undefined && _?.y !== undefined && _?.x !== null && _?.y !== null);
|
|
1682
1703
|
});
|
|
1683
|
-
this.
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1704
|
+
this.path = computed(() => {
|
|
1705
|
+
this.update();
|
|
1706
|
+
if (!this.x() || !this.y()) {
|
|
1707
|
+
return '';
|
|
1708
|
+
}
|
|
1709
|
+
const filter = this.defaultClipPointsMapping.get(this.series().clipPointsDirection);
|
|
1710
|
+
const line = d3
|
|
1711
|
+
.line()
|
|
1712
|
+
.defined((point) => point.x !== null &&
|
|
1713
|
+
point.y !== null &&
|
|
1714
|
+
point.x !== undefined &&
|
|
1715
|
+
point.y !== undefined &&
|
|
1716
|
+
!isNaN(point.x) &&
|
|
1717
|
+
!isNaN(point.y))
|
|
1718
|
+
.x((point) => this.x()(point.x))
|
|
1719
|
+
.y((point) => this.y()(point.y));
|
|
1720
|
+
let filteredData = this.series().data;
|
|
1721
|
+
if (this.series().clipPointsDirection === ClipPointsDirection.x) {
|
|
1722
|
+
let [min, max] = this.x().domain();
|
|
1723
|
+
min = min instanceof Date ? min.getTime() : min;
|
|
1724
|
+
max = max instanceof Date ? max.getTime() : max;
|
|
1725
|
+
filteredData = filteredData?.filter(filter(min, max));
|
|
1726
|
+
}
|
|
1727
|
+
if (this.series().clipPointsDirection === ClipPointsDirection.y) {
|
|
1728
|
+
let [min, max] = this.y().domain();
|
|
1729
|
+
min = min instanceof Date ? min.getTime() : min;
|
|
1730
|
+
max = max instanceof Date ? max.getTime() : max;
|
|
1731
|
+
filteredData = filteredData?.filter(filter(min, max));
|
|
1732
|
+
}
|
|
1733
|
+
return line(filteredData);
|
|
1734
|
+
});
|
|
1735
|
+
this.update = signal(null);
|
|
1696
1736
|
const filterX = (min, max) => (point, idx, arr) => {
|
|
1697
1737
|
const bigger = min > max ? min : max;
|
|
1698
1738
|
const smaller = min > max ? max : min;
|
|
@@ -1719,43 +1759,6 @@ class LinearSeriesBaseComponent extends SeriesBaseComponent {
|
|
|
1719
1759
|
};
|
|
1720
1760
|
this.defaultClipPointsMapping.set(ClipPointsDirection.x, filterX);
|
|
1721
1761
|
this.defaultClipPointsMapping.set(ClipPointsDirection.y, filterY);
|
|
1722
|
-
this.transform = this.svc.pointerMove.pipe(withLatestFrom(this.scaleService.scales), map((data) => {
|
|
1723
|
-
const [event, { x, y }] = data;
|
|
1724
|
-
return this.getTransform(event, x.get(this.series().xAxisIndex).scale, y.get(this.series().yAxisIndex).scale);
|
|
1725
|
-
}), tap(() => setTimeout(() => this.cdr.detectChanges())));
|
|
1726
|
-
this.path = combineLatest([this.scaleService.scales, this._update]).pipe(map(([data]) => {
|
|
1727
|
-
const { x, y } = data;
|
|
1728
|
-
this.x = x.get(this.series().xAxisIndex)?.scale;
|
|
1729
|
-
this.y = y.get(this.series().yAxisIndex)?.scale;
|
|
1730
|
-
if (!this.x || !this.y) {
|
|
1731
|
-
return '';
|
|
1732
|
-
}
|
|
1733
|
-
const filter = this.defaultClipPointsMapping.get(this.series().clipPointsDirection);
|
|
1734
|
-
const line = d3
|
|
1735
|
-
.line()
|
|
1736
|
-
.defined((point) => point.x !== null &&
|
|
1737
|
-
point.y !== null &&
|
|
1738
|
-
point.x !== undefined &&
|
|
1739
|
-
point.y !== undefined &&
|
|
1740
|
-
!isNaN(point.x) &&
|
|
1741
|
-
!isNaN(point.y))
|
|
1742
|
-
.x((point) => this.x(point.x))
|
|
1743
|
-
.y((point) => this.y(point.y));
|
|
1744
|
-
let filteredData = this.series().data;
|
|
1745
|
-
if (this.series().clipPointsDirection === ClipPointsDirection.x) {
|
|
1746
|
-
let [min, max] = this.x.domain();
|
|
1747
|
-
min = min instanceof Date ? min.getTime() : min;
|
|
1748
|
-
max = max instanceof Date ? max.getTime() : max;
|
|
1749
|
-
filteredData = filteredData?.filter(filter(min, max));
|
|
1750
|
-
}
|
|
1751
|
-
if (this.series().clipPointsDirection === ClipPointsDirection.y) {
|
|
1752
|
-
let [min, max] = this.y.domain();
|
|
1753
|
-
min = min instanceof Date ? min.getTime() : min;
|
|
1754
|
-
max = max instanceof Date ? max.getTime() : max;
|
|
1755
|
-
filteredData = filteredData?.filter(filter(min, max));
|
|
1756
|
-
}
|
|
1757
|
-
return line(filteredData);
|
|
1758
|
-
}));
|
|
1759
1762
|
}
|
|
1760
1763
|
ngOnDestroy() {
|
|
1761
1764
|
this.svc.setTooltip({
|
|
@@ -1764,23 +1767,23 @@ class LinearSeriesBaseComponent extends SeriesBaseComponent {
|
|
|
1764
1767
|
});
|
|
1765
1768
|
}
|
|
1766
1769
|
getTransform(event, scaleX, scaleY) {
|
|
1767
|
-
if (
|
|
1770
|
+
if (!scaleX || !scaleY) {
|
|
1771
|
+
return null;
|
|
1772
|
+
}
|
|
1773
|
+
if (event && event.type === 'mouseleave') {
|
|
1768
1774
|
return null;
|
|
1769
1775
|
}
|
|
1770
1776
|
const mouse = [event?.offsetX, event?.offsetY];
|
|
1771
1777
|
const tooltipTracking = this.config()?.tooltip?.tracking;
|
|
1772
1778
|
const lineIntersection = (p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y) => {
|
|
1773
1779
|
const rV = {};
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / (-s2_x * s1_y + s1_x * s2_y);
|
|
1781
|
-
t = (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / (-s2_x * s1_y + s1_x * s2_y);
|
|
1780
|
+
const s1_x = p1_x - p0_x;
|
|
1781
|
+
const s1_y = p1_y - p0_y;
|
|
1782
|
+
const s2_x = p3_x - p2_x;
|
|
1783
|
+
const s2_y = p3_y - p2_y;
|
|
1784
|
+
const s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / (-s2_x * s1_y + s1_x * s2_y);
|
|
1785
|
+
const t = (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / (-s2_x * s1_y + s1_x * s2_y);
|
|
1782
1786
|
if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
|
|
1783
|
-
// Collision detected
|
|
1784
1787
|
rV.x = p0_x + t * s1_x;
|
|
1785
1788
|
rV.y = p0_y + t * s1_y;
|
|
1786
1789
|
}
|
|
@@ -1851,7 +1854,7 @@ class LinearSeriesBaseComponent extends SeriesBaseComponent {
|
|
|
1851
1854
|
}
|
|
1852
1855
|
return null;
|
|
1853
1856
|
}
|
|
1854
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinearSeriesBaseComponent, deps:
|
|
1857
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinearSeriesBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1855
1858
|
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 }); }
|
|
1856
1859
|
}
|
|
1857
1860
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinearSeriesBaseComponent, decorators: [{
|
|
@@ -1860,7 +1863,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1860
1863
|
template: '',
|
|
1861
1864
|
standalone: true,
|
|
1862
1865
|
}]
|
|
1863
|
-
}] });
|
|
1866
|
+
}], ctorParameters: () => [] });
|
|
1864
1867
|
|
|
1865
1868
|
var DragPointType;
|
|
1866
1869
|
(function (DragPointType) {
|
|
@@ -2016,22 +2019,22 @@ class LineSeriesComponent extends LinearSeriesBaseComponent {
|
|
|
2016
2019
|
this.allowDrag = (point) => {
|
|
2017
2020
|
return (newPoint) => {
|
|
2018
2021
|
if (point.marker.minX !== null && point.marker.minX !== undefined) {
|
|
2019
|
-
if (this.x.invert(this.x(this.start.x) + newPoint.deltaX) < point.marker.minX) {
|
|
2022
|
+
if (this.x().invert(this.x()(this.start.x) + newPoint.deltaX) < point.marker.minX) {
|
|
2020
2023
|
return false;
|
|
2021
2024
|
}
|
|
2022
2025
|
}
|
|
2023
2026
|
if (point.marker.maxX !== null && point.marker.maxX !== undefined) {
|
|
2024
|
-
if (this.x.invert(this.x(this.start.x) + newPoint.deltaX) > point.marker.maxX) {
|
|
2027
|
+
if (this.x().invert(this.x()(this.start.x) + newPoint.deltaX) > point.marker.maxX) {
|
|
2025
2028
|
return false;
|
|
2026
2029
|
}
|
|
2027
2030
|
}
|
|
2028
2031
|
if (point.marker.minY !== null && point.marker.minY !== undefined) {
|
|
2029
|
-
if (this.y.invert(this.y(this.start.y) + newPoint.deltaY) < point.marker.minY) {
|
|
2032
|
+
if (this.y().invert(this.y()(this.start.y) + newPoint.deltaY) < point.marker.minY) {
|
|
2030
2033
|
return false;
|
|
2031
2034
|
}
|
|
2032
2035
|
}
|
|
2033
2036
|
if (point.marker.maxY !== null && point.marker.maxY !== undefined) {
|
|
2034
|
-
if (this.y.invert(this.y(this.start.y) + newPoint.deltaY) > point.marker.maxY) {
|
|
2037
|
+
if (this.y().invert(this.y()(this.start.y) + newPoint.deltaY) > point.marker.maxY) {
|
|
2035
2038
|
return false;
|
|
2036
2039
|
}
|
|
2037
2040
|
}
|
|
@@ -2043,9 +2046,9 @@ class LineSeriesComponent extends LinearSeriesBaseComponent {
|
|
|
2043
2046
|
this.start = { x: point.x, y: point.y };
|
|
2044
2047
|
}
|
|
2045
2048
|
moveEnd(event, point) {
|
|
2046
|
-
point.x = this.x.invert(this.x(this.start.x) + event.deltaX);
|
|
2047
|
-
point.y = this.y.invert(this.y(this.start.y) + event.deltaY);
|
|
2048
|
-
this.
|
|
2049
|
+
point.x = this.x().invert(this.x()(this.start.x) + event.deltaX);
|
|
2050
|
+
point.y = this.y().invert(this.y()(this.start.y) + event.deltaY);
|
|
2051
|
+
this.update.set({});
|
|
2049
2052
|
const emitEvent = {
|
|
2050
2053
|
type: 'end',
|
|
2051
2054
|
sourceEvent: event,
|
|
@@ -2059,9 +2062,9 @@ class LineSeriesComponent extends LinearSeriesBaseComponent {
|
|
|
2059
2062
|
});
|
|
2060
2063
|
}
|
|
2061
2064
|
moveProcess(event, point) {
|
|
2062
|
-
point.x = this.x.invert(this.x(this.start.x) + event.deltaX);
|
|
2063
|
-
point.y = this.y.invert(this.y(this.start.y) + event.deltaY);
|
|
2064
|
-
this.
|
|
2065
|
+
point.x = this.x().invert(this.x()(this.start.x) + event.deltaX);
|
|
2066
|
+
point.y = this.y().invert(this.y()(this.start.y) + event.deltaY);
|
|
2067
|
+
this.update.set({});
|
|
2065
2068
|
const emitEvent = {
|
|
2066
2069
|
type: 'drag',
|
|
2067
2070
|
sourceEvent: event,
|
|
@@ -2082,28 +2085,26 @@ class LineSeriesComponent extends LinearSeriesBaseComponent {
|
|
|
2082
2085
|
label.dy = this.labelStart.dy + event.deltaY;
|
|
2083
2086
|
}
|
|
2084
2087
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LineSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2085
|
-
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
|
|
2088
|
+
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 }); }
|
|
2086
2089
|
}
|
|
2087
2090
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LineSeriesComponent, decorators: [{
|
|
2088
2091
|
type: Component,
|
|
2089
|
-
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
|
|
2092
|
+
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"] }]
|
|
2090
2093
|
}] });
|
|
2091
2094
|
|
|
2092
2095
|
class BarSeriesComponent extends SeriesBaseComponent {
|
|
2093
2096
|
constructor() {
|
|
2094
2097
|
super(...arguments);
|
|
2095
|
-
this.
|
|
2096
|
-
|
|
2097
|
-
this.x1 = this.scaleService.scales.pipe(map((_) => {
|
|
2098
|
-
const x = _.x.get(this.series().xAxisIndex)?.scale;
|
|
2098
|
+
this.x1 = computed(() => {
|
|
2099
|
+
const x = this.xScales().get(this.series().xAxisIndex)?.scale;
|
|
2099
2100
|
const range = x.range();
|
|
2100
2101
|
const domain = this.series().data.map((_) => _.x);
|
|
2101
2102
|
return d3.scaleBand().range([0, range[1]]).domain(domain).padding(0.1);
|
|
2102
|
-
})
|
|
2103
|
-
this.barSeriesCount =
|
|
2104
|
-
const count =
|
|
2103
|
+
});
|
|
2104
|
+
this.barSeriesCount = computed(() => {
|
|
2105
|
+
const count = this.config().series.filter((_) => _.type === SeriesType.bar && _.xAxisIndex === this.series().xAxisIndex);
|
|
2105
2106
|
return count.length;
|
|
2106
|
-
})
|
|
2107
|
+
});
|
|
2107
2108
|
this.Math = Math;
|
|
2108
2109
|
this.Number = Number;
|
|
2109
2110
|
}
|
|
@@ -2111,118 +2112,111 @@ class BarSeriesComponent extends SeriesBaseComponent {
|
|
|
2111
2112
|
return typeof value === 'number';
|
|
2112
2113
|
}
|
|
2113
2114
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BarSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2114
|
-
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
|
|
2115
|
+
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 }); }
|
|
2115
2116
|
}
|
|
2116
2117
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BarSeriesComponent, decorators: [{
|
|
2117
2118
|
type: Component,
|
|
2118
|
-
args: [{ selector: 'svg:svg[teta-bar-series]', changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2119
|
+
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" }]
|
|
2119
2120
|
}] });
|
|
2120
2121
|
|
|
2121
2122
|
class ScatterSeriesComponent extends SeriesBaseComponent {
|
|
2122
|
-
constructor() {
|
|
2123
|
-
super(...arguments);
|
|
2124
|
-
this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series().xAxisIndex)?.scale));
|
|
2125
|
-
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series().yAxisIndex)?.scale));
|
|
2126
|
-
}
|
|
2127
2123
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScatterSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2128
|
-
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
|
|
2124
|
+
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 }); }
|
|
2129
2125
|
}
|
|
2130
2126
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScatterSeriesComponent, decorators: [{
|
|
2131
2127
|
type: Component,
|
|
2132
|
-
args: [{ selector: 'svg:svg[teta-scatter-series]',
|
|
2128
|
+
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"] }]
|
|
2133
2129
|
}] });
|
|
2134
2130
|
|
|
2135
2131
|
class BlockSeriesComponent extends SeriesBaseComponent {
|
|
2136
2132
|
constructor() {
|
|
2137
2133
|
super(...arguments);
|
|
2138
|
-
this.
|
|
2139
|
-
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series().yAxisIndex)?.scale));
|
|
2140
|
-
this.displayPoints = this.y.pipe(filter((y) => y), map((y) => {
|
|
2134
|
+
this.displayPoints = computed(() => {
|
|
2141
2135
|
return this.series().data.filter((point, index, arr) => {
|
|
2142
|
-
const [min, max] = y.domain();
|
|
2136
|
+
const [min, max] = this.y().domain();
|
|
2143
2137
|
return ((point.y >= min || point.y1 >= min || arr[index + 1]?.y >= min || arr[index + 1]?.y1 >= min) &&
|
|
2144
2138
|
(point.y <= max || point.y1 <= max || arr[index - 1]?.y <= max || arr[index - 1]?.y1 <= max));
|
|
2145
2139
|
});
|
|
2146
|
-
})
|
|
2147
|
-
this.fillType = FillType;
|
|
2140
|
+
});
|
|
2148
2141
|
this.Math = Math;
|
|
2142
|
+
this.FillType = FillType;
|
|
2149
2143
|
}
|
|
2150
2144
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2151
|
-
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
|
|
2145
|
+
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 }); }
|
|
2152
2146
|
}
|
|
2153
2147
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockSeriesComponent, decorators: [{
|
|
2154
2148
|
type: Component,
|
|
2155
|
-
args: [{ selector: 'svg:svg[teta-block-series]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ y: y
|
|
2149
|
+
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" }]
|
|
2156
2150
|
}] });
|
|
2157
2151
|
|
|
2158
2152
|
class BlockAreaSeriesComponent extends SeriesBaseComponent {
|
|
2159
2153
|
constructor() {
|
|
2160
2154
|
super(...arguments);
|
|
2161
|
-
this.
|
|
2162
|
-
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series().yAxisIndex)?.scale));
|
|
2163
|
-
this.displayPoints = this.y.pipe(filter((y) => y), map((y) => {
|
|
2155
|
+
this.displayPoints = computed(() => {
|
|
2164
2156
|
return this.series().data.filter((point, index, arr) => {
|
|
2165
|
-
const [min, max] = y.domain();
|
|
2157
|
+
const [min, max] = this.y().domain();
|
|
2166
2158
|
return ((point.y >= min || point.y1 >= min || arr[index + 1]?.y >= min || arr[index + 1]?.y1 >= min) &&
|
|
2167
2159
|
(point.y <= max || point.y1 <= max || arr[index - 1]?.y <= max || arr[index - 1]?.y1 <= max));
|
|
2168
2160
|
});
|
|
2169
|
-
})
|
|
2161
|
+
});
|
|
2170
2162
|
this.fillType = FillType;
|
|
2171
2163
|
this.Math = Math;
|
|
2172
2164
|
}
|
|
2173
2165
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockAreaSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2174
|
-
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
|
|
2166
|
+
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 }); }
|
|
2175
2167
|
}
|
|
2176
2168
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockAreaSeriesComponent, decorators: [{
|
|
2177
2169
|
type: Component,
|
|
2178
|
-
args: [{ selector: 'svg:svg[teta-block-area-series]', changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2170
|
+
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" }]
|
|
2179
2171
|
}] });
|
|
2180
2172
|
|
|
2181
2173
|
class AreaSeriesComponent extends LinearSeriesBaseComponent {
|
|
2182
2174
|
constructor() {
|
|
2183
2175
|
super(...arguments);
|
|
2184
|
-
this.
|
|
2185
|
-
|
|
2186
|
-
}
|
|
2187
|
-
ngOnInit() {
|
|
2188
|
-
super.ngOnInit();
|
|
2189
|
-
this.areaPath = this.scaleService.scales.pipe(map((data) => {
|
|
2190
|
-
const { x, y } = data;
|
|
2191
|
-
this.x = x.get(this.series().xAxisIndex)?.scale;
|
|
2192
|
-
this.y = y.get(this.series().yAxisIndex)?.scale;
|
|
2193
|
-
if (!this.x || !this.y) {
|
|
2176
|
+
this.areaPath = computed(() => {
|
|
2177
|
+
if (!this.x() || !this.y()) {
|
|
2194
2178
|
return '';
|
|
2195
2179
|
}
|
|
2196
2180
|
const area = d3
|
|
2197
2181
|
.area()
|
|
2198
2182
|
.defined((point) => point.x !== null && point.y !== null && !isNaN(point.x) && !isNaN(point.y));
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2183
|
+
if (this.config().inverted) {
|
|
2184
|
+
area
|
|
2185
|
+
.x1((_) => (_.x1 !== null && _.x1 !== undefined ? this.x()(_.x1) : this.x()(0)))
|
|
2186
|
+
.x0((_) => this.x()(_.x))
|
|
2187
|
+
.y((_) => this.y()(_.y));
|
|
2188
|
+
}
|
|
2189
|
+
else {
|
|
2190
|
+
area
|
|
2191
|
+
.y1((_) => (_.y1 !== null && _.y1 !== undefined ? this.y()(_.y1) : this.y()(0)))
|
|
2192
|
+
.y0((_) => this.y()(_.y))
|
|
2193
|
+
.x((_) => this.x()(_.x));
|
|
2194
|
+
}
|
|
2203
2195
|
const filter = this.defaultClipPointsMapping.get(this.series().clipPointsDirection);
|
|
2204
2196
|
let filteredData = this.series().data;
|
|
2205
2197
|
if (this.series().clipPointsDirection === ClipPointsDirection.x) {
|
|
2206
|
-
let [min, max] = this.x.domain();
|
|
2198
|
+
let [min, max] = this.x().domain();
|
|
2207
2199
|
min = min instanceof Date ? min.getTime() : min;
|
|
2208
2200
|
max = max instanceof Date ? max.getTime() : max;
|
|
2209
2201
|
filteredData = filteredData?.filter(filter(min, max));
|
|
2210
2202
|
}
|
|
2211
2203
|
if (this.series().clipPointsDirection === ClipPointsDirection.y) {
|
|
2212
|
-
let [min, max] = this.y.domain();
|
|
2204
|
+
let [min, max] = this.y().domain();
|
|
2213
2205
|
min = min instanceof Date ? min.getTime() : min;
|
|
2214
2206
|
max = max instanceof Date ? max.getTime() : max;
|
|
2215
2207
|
filteredData = filteredData?.filter(filter(min, max));
|
|
2216
2208
|
}
|
|
2217
2209
|
return area(filteredData);
|
|
2218
|
-
})
|
|
2210
|
+
});
|
|
2211
|
+
this.FillType = FillType;
|
|
2212
|
+
this.FillDirection = FillDirection;
|
|
2219
2213
|
}
|
|
2220
2214
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AreaSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2221
|
-
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 ===
|
|
2215
|
+
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 }); }
|
|
2222
2216
|
}
|
|
2223
2217
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AreaSeriesComponent, decorators: [{
|
|
2224
2218
|
type: Component,
|
|
2225
|
-
args: [{ selector: 'svg:svg[teta-area-series]',
|
|
2219
|
+
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" }]
|
|
2226
2220
|
}] });
|
|
2227
2221
|
|
|
2228
2222
|
const defaultSeriesTypeMapping = new Map()
|
|
@@ -2635,7 +2629,7 @@ class SeriesControlsComponent {
|
|
|
2635
2629
|
this.chartService.updateSeries(series);
|
|
2636
2630
|
}
|
|
2637
2631
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesControlsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2638
|
-
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
|
|
2632
|
+
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-scrollable class=\"column column_auto\" [contentClass]=\"'column'\">\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 </teta-scrollable>\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]" }, { kind: "component", type: ScrollableComponent, selector: "teta-scrollable", inputs: ["direction", "showScrollbars", "contentClass"], outputs: ["scroll"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2639
2633
|
}
|
|
2640
2634
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesControlsComponent, decorators: [{
|
|
2641
2635
|
type: Component,
|
|
@@ -2655,7 +2649,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
2655
2649
|
SelectComponent,
|
|
2656
2650
|
SelectOptionDirective,
|
|
2657
2651
|
SelectValueDirective,
|
|
2658
|
-
|
|
2652
|
+
ScrollableComponent,
|
|
2653
|
+
], 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-scrollable class=\"column column_auto\" [contentClass]=\"'column'\">\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 </teta-scrollable>\n </div>\n</teta-dropdown>\n" }]
|
|
2659
2654
|
}] });
|
|
2660
2655
|
|
|
2661
2656
|
class ChartContainerComponent {
|
|
@@ -2993,24 +2988,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
2993
2988
|
class BlockHorizontalSeriesComponent extends SeriesBaseComponent {
|
|
2994
2989
|
constructor() {
|
|
2995
2990
|
super(...arguments);
|
|
2996
|
-
this.
|
|
2997
|
-
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series().yAxisIndex)?.scale));
|
|
2998
|
-
this.displayPoints = this.x.pipe(filter((y) => y), map((y) => {
|
|
2991
|
+
this.displayPoints = computed(() => {
|
|
2999
2992
|
return this.series().data.filter((point, index, arr) => {
|
|
3000
|
-
const [min, max] =
|
|
2993
|
+
const [min, max] = this.x().domain();
|
|
3001
2994
|
return ((point.x >= min || point.x1 >= min || arr[index + 1]?.x >= min || arr[index + 1]?.x1 >= min) &&
|
|
3002
2995
|
(point.x <= max || point.x1 <= max || arr[index - 1]?.x <= max || arr[index - 1]?.x1 <= max));
|
|
3003
2996
|
});
|
|
3004
|
-
})
|
|
3005
|
-
this.fillType = FillType;
|
|
2997
|
+
});
|
|
3006
2998
|
this.Math = Math;
|
|
2999
|
+
this.FillType = FillType;
|
|
3007
3000
|
}
|
|
3008
3001
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockHorizontalSeriesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3009
|
-
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
|
|
3002
|
+
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 }); }
|
|
3010
3003
|
}
|
|
3011
3004
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: BlockHorizontalSeriesComponent, decorators: [{
|
|
3012
3005
|
type: Component,
|
|
3013
|
-
args: [{ selector: 'svg:svg[teta-block-horizontal-series]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
3006
|
+
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" }]
|
|
3014
3007
|
}] });
|
|
3015
3008
|
|
|
3016
3009
|
/*
|