@tetacom/svg-charts 1.1.21 → 1.1.24
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/chart/chart.component.d.ts +3 -3
- package/chart/chart-container/series/block-area-series/block-area-series.component.d.ts +1 -0
- package/chart/chart-container/series/block-series/block-series.component.d.ts +1 -0
- package/chart/directives/zoomable.directive.d.ts +2 -1
- package/esm2020/chart/chart/chart.component.mjs +6 -6
- package/esm2020/chart/chart-container/series/block-area-series/block-area-series.component.mjs +9 -11
- package/esm2020/chart/chart-container/series/block-series/block-series.component.mjs +8 -10
- package/esm2020/chart/chart-container/tooltip/tooltip.component.mjs +8 -2
- package/esm2020/chart/core/axis/axis.mjs +2 -2
- package/esm2020/chart/directives/brushable.directive.mjs +4 -2
- package/esm2020/chart/directives/zoomable.directive.mjs +118 -72
- package/esm2020/chart/service/chart.service.mjs +3 -1
- package/fesm2015/tetacom-svg-charts.mjs +148 -98
- package/fesm2015/tetacom-svg-charts.mjs.map +1 -1
- package/fesm2020/tetacom-svg-charts.mjs +146 -95
- package/fesm2020/tetacom-svg-charts.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -217,8 +217,8 @@ class ChartService {
|
|
|
217
217
|
config.yAxis = config.yAxis.map(defaultConfig(defaultAxisConfig));
|
|
218
218
|
config.series = config.series.map(defaultConfig(defaultSeriesConfig()));
|
|
219
219
|
config.series = config.series.map((_, index) => {
|
|
220
|
-
var _a;
|
|
221
|
-
return Object.assign(Object.assign({}, _), {
|
|
220
|
+
var _a, _b;
|
|
221
|
+
return Object.assign(Object.assign({}, _), { data: (_a = _.data) !== null && _a !== void 0 ? _a : [], id: (_b = _.id) !== null && _b !== void 0 ? _b : index });
|
|
222
222
|
});
|
|
223
223
|
const oppositeYCount = (_a = config.yAxis) === null || _a === void 0 ? void 0 : _a.filter((_) => _.opposite);
|
|
224
224
|
const oppositeXCount = (_b = config.xAxis) === null || _b === void 0 ? void 0 : _b.filter((_) => _.opposite);
|
|
@@ -237,6 +237,7 @@ class ChartService {
|
|
|
237
237
|
config.bounds.right = 0;
|
|
238
238
|
}
|
|
239
239
|
config.tooltip = Object.assign({}, defaultChartConfig().tooltip, config.tooltip);
|
|
240
|
+
config.zoom = Object.assign({}, defaultChartConfig().zoom, config.zoom);
|
|
240
241
|
config.zoom.syncChannel = (_f = (_e = config.zoom) === null || _e === void 0 ? void 0 : _e.syncChannel) !== null && _f !== void 0 ? _f : id;
|
|
241
242
|
return config;
|
|
242
243
|
}
|
|
@@ -373,7 +374,7 @@ class Axis {
|
|
|
373
374
|
this._extremes = [0, 0];
|
|
374
375
|
this.defaultFormatters = new Map()
|
|
375
376
|
.set(ScaleType.linear, d3.format(',.2f'))
|
|
376
|
-
.set(ScaleType.time, d3.timeFormat('%
|
|
377
|
+
.set(ScaleType.time, d3.timeFormat('%d.%m.%Y'))
|
|
377
378
|
.set(ScaleType.log, d3.format(',.2f'))
|
|
378
379
|
.set(ScaleType.pow, d3.format(',.2f'))
|
|
379
380
|
.set(ScaleType.sqrt, d3.format(',.2f'));
|
|
@@ -833,12 +834,17 @@ class TooltipComponent {
|
|
|
833
834
|
};
|
|
834
835
|
const defaultFormatter = (tooltips) => {
|
|
835
836
|
let html = '';
|
|
837
|
+
const format = d3.timeFormat('%d.%m.%Y');
|
|
836
838
|
tooltips.forEach((_) => {
|
|
837
839
|
var _a, _b, _c;
|
|
838
840
|
const indicatorStyle = `display:block; width: 10px; height: 2px; background-color: ${(_a = _ === null || _ === void 0 ? void 0 : _.series) === null || _a === void 0 ? void 0 : _a.color}`;
|
|
839
841
|
html += `<div class="display-flex align-center"><span class="margin-right-1" style="${indicatorStyle}"></span>
|
|
840
842
|
<span class="font-title-3">${_.series.name}
|
|
841
|
-
|
|
843
|
+
<span class="font-body-3">
|
|
844
|
+
x: ${_.point.x instanceof Date ? format(_.point.x) : (_b = _.point.x) === null || _b === void 0 ? void 0 : _b.toFixed(2)}
|
|
845
|
+
y: ${_.point.y instanceof Date ? format(_.point.y) : (_c = _.point.y) === null || _c === void 0 ? void 0 : _c.toFixed(2)}
|
|
846
|
+
</span>
|
|
847
|
+
</span></div>`;
|
|
842
848
|
});
|
|
843
849
|
return transformHtml(html);
|
|
844
850
|
};
|
|
@@ -1576,6 +1582,7 @@ class BlockSeriesComponent extends SeriesBaseComponent {
|
|
|
1576
1582
|
this.zoomService = zoomService;
|
|
1577
1583
|
this.element = element;
|
|
1578
1584
|
this.fillType = FillType;
|
|
1585
|
+
this.Math = Math;
|
|
1579
1586
|
this.id = (Date.now() + Math.random()).toString(36);
|
|
1580
1587
|
}
|
|
1581
1588
|
ngOnInit() {
|
|
@@ -1585,18 +1592,15 @@ class BlockSeriesComponent extends SeriesBaseComponent {
|
|
|
1585
1592
|
this.displayPoints = this.y.pipe(map((y) => {
|
|
1586
1593
|
return this.series.data.filter((point, index, arr) => {
|
|
1587
1594
|
var _a, _b, _c, _d;
|
|
1588
|
-
const height = Math.abs(y(point.y1) - y(point.y));
|
|
1589
1595
|
const [min, max] = y.domain();
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
((_b = arr[index + 1]) === null || _b === void 0 ? void 0 : _b.y1) >= min) &&
|
|
1596
|
+
return (point.y >= min ||
|
|
1597
|
+
point.y1 >= min ||
|
|
1598
|
+
((_a = arr[index + 1]) === null || _a === void 0 ? void 0 : _a.y) >= min ||
|
|
1599
|
+
((_b = arr[index + 1]) === null || _b === void 0 ? void 0 : _b.y1) >= min) &&
|
|
1595
1600
|
(point.y <= max ||
|
|
1596
1601
|
point.y1 <= max ||
|
|
1597
1602
|
((_c = arr[index - 1]) === null || _c === void 0 ? void 0 : _c.y) <= max ||
|
|
1598
1603
|
((_d = arr[index - 1]) === null || _d === void 0 ? void 0 : _d.y1) <= max);
|
|
1599
|
-
return visibleCondition;
|
|
1600
1604
|
});
|
|
1601
1605
|
}));
|
|
1602
1606
|
}
|
|
@@ -1616,10 +1620,10 @@ class BlockSeriesComponent extends SeriesBaseComponent {
|
|
|
1616
1620
|
}
|
|
1617
1621
|
}
|
|
1618
1622
|
BlockSeriesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BlockSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1619
|
-
BlockSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: BlockSeriesComponent, selector: "svg:svg[teta-block-series]", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"{\n y: y | async,\n x: x | async,\n points: displayPoints | async\n} as data\">\n <svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\n <svg:linearGradient [id]=\"'gradient-fill-' + id\" 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.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.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n <ng-container *ngFor=\"let point of data.points\">\n <svg:g (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"data.y(point.y1) - data.y(point.y)\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n width=\"100%\">\n </svg:rect>\n <svg:text *ngIf=\"point.text && data.y(point.y1) - data.y(point.y) > 8\"\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">{{ point.text }}\n </svg:text>\n <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y)\" [attr.y2]=\"data.y(point.y)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>\n <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y1)\" [attr.y2]=\"data.y(point.y1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>\n </svg:g>\n </ng-container>\n\n\n</ng-container>\n", styles: [""], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1623
|
+
BlockSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: BlockSeriesComponent, selector: "svg:svg[teta-block-series]", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"{\n y: y | async,\n x: x | async,\n points: displayPoints | async\n} as data\">\n <svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\n <svg:linearGradient [id]=\"'gradient-fill-' + id\" 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.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.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n <ng-container *ngFor=\"let point of data.points\">\n <svg:g (mouseenter)=\"mouseenter(point)\"\n (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]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n width=\"100%\">\n </svg:rect>\n <svg:text *ngIf=\"point.text && data.y(point.y1) - data.y(point.y) > 8\"\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">{{ point.text }}\n </svg:text>\n <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y)\" [attr.y2]=\"data.y(point.y)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>\n <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y1)\" [attr.y2]=\"data.y(point.y1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>\n </svg:g>\n </ng-container>\n\n\n</ng-container>\n", styles: [""], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1620
1624
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BlockSeriesComponent, decorators: [{
|
|
1621
1625
|
type: Component,
|
|
1622
|
-
args: [{ selector: 'svg:svg[teta-block-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n y: y | async,\n x: x | async,\n points: displayPoints | async\n} as data\">\n <svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\n <svg:linearGradient [id]=\"'gradient-fill-' + id\" 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.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.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n <ng-container *ngFor=\"let point of data.points\">\n <svg:g (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"data.y(point.y1) - data.y(point.y)\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n width=\"100%\">\n </svg:rect>\n <svg:text *ngIf=\"point.text && data.y(point.y1) - data.y(point.y) > 8\"\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">{{ point.text }}\n </svg:text>\n <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y)\" [attr.y2]=\"data.y(point.y)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>\n <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y1)\" [attr.y2]=\"data.y(point.y1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>\n </svg:g>\n </ng-container>\n\n\n</ng-container>\n", styles: [""] }]
|
|
1626
|
+
args: [{ selector: 'svg:svg[teta-block-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n y: y | async,\n x: x | async,\n points: displayPoints | async\n} as data\">\n <svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\n <svg:linearGradient [id]=\"'gradient-fill-' + id\" 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.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.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n <ng-container *ngFor=\"let point of data.points\">\n <svg:g (mouseenter)=\"mouseenter(point)\"\n (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]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n width=\"100%\">\n </svg:rect>\n <svg:text *ngIf=\"point.text && data.y(point.y1) - data.y(point.y) > 8\"\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">{{ point.text }}\n </svg:text>\n <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y)\" [attr.y2]=\"data.y(point.y)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>\n <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y1)\" [attr.y2]=\"data.y(point.y1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>\n </svg:g>\n </ng-container>\n\n\n</ng-container>\n", styles: [""] }]
|
|
1623
1627
|
}], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; } });
|
|
1624
1628
|
|
|
1625
1629
|
class BlockAreaSeriesComponent extends SeriesBaseComponent {
|
|
@@ -1631,27 +1635,25 @@ class BlockAreaSeriesComponent extends SeriesBaseComponent {
|
|
|
1631
1635
|
this.zoomService = zoomService;
|
|
1632
1636
|
this.element = element;
|
|
1633
1637
|
this.fillType = FillType;
|
|
1638
|
+
this.Math = Math;
|
|
1634
1639
|
this.id = (Date.now() + Math.random()).toString(36);
|
|
1635
1640
|
}
|
|
1636
1641
|
ngOnInit() {
|
|
1637
|
-
const defaultVisiblePixels =
|
|
1642
|
+
const defaultVisiblePixels = 0;
|
|
1638
1643
|
this.x = this.scaleService.xScaleMap.pipe(map((_) => _.get(this.series.xAxisIndex)));
|
|
1639
1644
|
this.y = this.scaleService.yScaleMap.pipe(map((_) => _.get(this.series.yAxisIndex)));
|
|
1640
1645
|
this.displayPoints = this.y.pipe(map((y) => {
|
|
1641
1646
|
return this.series.data.filter((point, index, arr) => {
|
|
1642
1647
|
var _a, _b, _c, _d;
|
|
1643
|
-
const height = Math.abs(y(point.y1) - y(point.y));
|
|
1644
1648
|
const [min, max] = y.domain();
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
((_b = arr[index + 1]) === null || _b === void 0 ? void 0 : _b.y1) >= min) &&
|
|
1649
|
+
return (point.y >= min ||
|
|
1650
|
+
point.y1 >= min ||
|
|
1651
|
+
((_a = arr[index + 1]) === null || _a === void 0 ? void 0 : _a.y) >= min ||
|
|
1652
|
+
((_b = arr[index + 1]) === null || _b === void 0 ? void 0 : _b.y1) >= min) &&
|
|
1650
1653
|
(point.y <= max ||
|
|
1651
1654
|
point.y1 <= max ||
|
|
1652
1655
|
((_c = arr[index - 1]) === null || _c === void 0 ? void 0 : _c.y) <= max ||
|
|
1653
1656
|
((_d = arr[index - 1]) === null || _d === void 0 ? void 0 : _d.y1) <= max);
|
|
1654
|
-
return visibleCondition;
|
|
1655
1657
|
});
|
|
1656
1658
|
}));
|
|
1657
1659
|
}
|
|
@@ -1671,10 +1673,10 @@ class BlockAreaSeriesComponent extends SeriesBaseComponent {
|
|
|
1671
1673
|
}
|
|
1672
1674
|
}
|
|
1673
1675
|
BlockAreaSeriesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BlockAreaSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1674
|
-
BlockAreaSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: BlockAreaSeriesComponent, selector: "svg:svg[teta-block-area-series]", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"{\n y: y | async,\n x: x | async,\n points: displayPoints | async\n} as data\">\n <svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\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.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.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n <ng-container *ngFor=\"let point of data.points\">\n <svg:g (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n *ngIf=\"!!config.inverted\"\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]=\"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.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\">\n </svg:rect>\n <svg:rect\n *ngIf=\"!config.inverted\"\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"data.y(0)\"\n [attr.height]=\"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]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\">\n </svg:rect>\n <svg:text *ngIf=\"point.text\"\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">{{ point.text }}\n </svg:text>\n\n <!-- <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y)\" [attr.y2]=\"data.y(point.y)\" [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>-->\n <!-- <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y1)\" [attr.y2]=\"data.y(point.y1)\" [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>-->\n\n </svg:g>\n </ng-container>\n\n\n</ng-container>\n", styles: [""], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1676
|
+
BlockAreaSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: BlockAreaSeriesComponent, selector: "svg:svg[teta-block-area-series]", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"{\n y: y | async,\n x: x | async,\n points: displayPoints | async\n} as data\">\n <svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\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.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.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n <ng-container *ngFor=\"let point of data.points\">\n <svg:g (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n *ngIf=\"!!config.inverted\"\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.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\">\n </svg:rect>\n <svg:rect\n *ngIf=\"!config.inverted\"\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]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\">\n </svg:rect>\n <svg:text *ngIf=\"point.text\"\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">{{ point.text }}\n </svg:text>\n\n <!-- <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y)\" [attr.y2]=\"data.y(point.y)\" [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>-->\n <!-- <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y1)\" [attr.y2]=\"data.y(point.y1)\" [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>-->\n\n </svg:g>\n </ng-container>\n\n\n</ng-container>\n", styles: [""], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1675
1677
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BlockAreaSeriesComponent, decorators: [{
|
|
1676
1678
|
type: Component,
|
|
1677
|
-
args: [{ selector: 'svg:svg[teta-block-area-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n y: y | async,\n x: x | async,\n points: displayPoints | async\n} as data\">\n <svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\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.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.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n <ng-container *ngFor=\"let point of data.points\">\n <svg:g (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n *ngIf=\"!!config.inverted\"\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]=\"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.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\">\n </svg:rect>\n <svg:rect\n *ngIf=\"!config.inverted\"\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"data.y(0)\"\n [attr.height]=\"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]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\">\n </svg:rect>\n <svg:text *ngIf=\"point.text\"\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">{{ point.text }}\n </svg:text>\n\n <!-- <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y)\" [attr.y2]=\"data.y(point.y)\" [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>-->\n <!-- <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y1)\" [attr.y2]=\"data.y(point.y1)\" [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>-->\n\n </svg:g>\n </ng-container>\n\n\n</ng-container>\n", styles: [""] }]
|
|
1679
|
+
args: [{ selector: 'svg:svg[teta-block-area-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n y: y | async,\n x: x | async,\n points: displayPoints | async\n} as data\">\n <svg:defs *ngIf=\"series?.fillType === fillType.gradient\">\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.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.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n <ng-container *ngFor=\"let point of data.points\">\n <svg:g (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n *ngIf=\"!!config.inverted\"\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.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\">\n </svg:rect>\n <svg:rect\n *ngIf=\"!config.inverted\"\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]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\">\n </svg:rect>\n <svg:text *ngIf=\"point.text\"\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">{{ point.text }}\n </svg:text>\n\n <!-- <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y)\" [attr.y2]=\"data.y(point.y)\" [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>-->\n <!-- <svg:line x1=\"0\" x2=\"100%\" [attr.y1]=\"data.y(point.y1)\" [attr.y2]=\"data.y(point.y1)\" [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.color\"></svg:line>-->\n\n </svg:g>\n </ng-container>\n\n\n</ng-container>\n", styles: [""] }]
|
|
1678
1680
|
}], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; } });
|
|
1679
1681
|
|
|
1680
1682
|
class AreaSeriesComponent extends LinearSeriesBase {
|
|
@@ -1852,6 +1854,7 @@ class ZoomableDirective {
|
|
|
1852
1854
|
this.zoomable = false;
|
|
1853
1855
|
this.alive = true;
|
|
1854
1856
|
this.currentTransform = zoomIdentity;
|
|
1857
|
+
this.wheelIdle = true;
|
|
1855
1858
|
this.zoomed = (event) => {
|
|
1856
1859
|
var _a, _b, _c;
|
|
1857
1860
|
if (event.sourceEvent) {
|
|
@@ -1860,14 +1863,14 @@ class ZoomableDirective {
|
|
|
1860
1863
|
return;
|
|
1861
1864
|
}
|
|
1862
1865
|
const origin = this.brushScale.copy().domain(this.zoomAxis.extremes);
|
|
1863
|
-
let domain = ((_a = this.config.zoom) === null || _a === void 0 ? void 0 : _a.type) === ZoomType.y
|
|
1864
|
-
event.transform.rescaleY(origin).domain()
|
|
1865
|
-
event.transform.rescaleX(origin).domain();
|
|
1866
|
+
let domain = ((_a = this.config.zoom) === null || _a === void 0 ? void 0 : _a.type) === ZoomType.y
|
|
1867
|
+
? event.transform.rescaleY(origin).domain()
|
|
1868
|
+
: event.transform.rescaleX(origin).domain();
|
|
1866
1869
|
const message = new ZoomMessage({
|
|
1867
1870
|
event,
|
|
1868
1871
|
axis: this.zoomAxis,
|
|
1869
1872
|
brushDomain: domain,
|
|
1870
|
-
chartId: this.config.id
|
|
1873
|
+
chartId: this.config.id,
|
|
1871
1874
|
});
|
|
1872
1875
|
this.broadcastService.broadcastZoom({
|
|
1873
1876
|
channel: (_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.zoom) === null || _c === void 0 ? void 0 : _c.syncChannel,
|
|
@@ -1876,7 +1879,7 @@ class ZoomableDirective {
|
|
|
1876
1879
|
}
|
|
1877
1880
|
this.zoomService.setZoom({
|
|
1878
1881
|
event,
|
|
1879
|
-
target: this.zoomAxis
|
|
1882
|
+
target: this.zoomAxis,
|
|
1880
1883
|
});
|
|
1881
1884
|
this.currentTransform = event.transform;
|
|
1882
1885
|
}
|
|
@@ -1890,122 +1893,167 @@ class ZoomableDirective {
|
|
|
1890
1893
|
}
|
|
1891
1894
|
ngAfterViewInit() {
|
|
1892
1895
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
1893
|
-
const enable = ((_b = (_a = this.axis) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.zoom) && ((_c = this.axis) === null || _c === void 0 ? void 0 : _c.options.visible) !== false
|
|
1896
|
+
const enable = (((_b = (_a = this.axis) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.zoom) && ((_c = this.axis) === null || _c === void 0 ? void 0 : _c.options.visible) !== false) ||
|
|
1897
|
+
((_e = (_d = this.config) === null || _d === void 0 ? void 0 : _d.zoom) === null || _e === void 0 ? void 0 : _e.enable);
|
|
1894
1898
|
if (!enable) {
|
|
1895
1899
|
return;
|
|
1896
1900
|
}
|
|
1897
1901
|
this._element = d3.select(this.elementRef.nativeElement);
|
|
1898
|
-
this.zoom = d3
|
|
1899
|
-
.zoom()
|
|
1900
|
-
.extent([
|
|
1902
|
+
this.zoom = d3.zoom().extent([
|
|
1901
1903
|
[0, 0],
|
|
1902
1904
|
[this.size.width, this.size.height],
|
|
1903
1905
|
]);
|
|
1904
1906
|
if ((_f = this.config.zoom) === null || _f === void 0 ? void 0 : _f.limitTranslateByData) {
|
|
1905
|
-
this.zoom.translateExtent([
|
|
1907
|
+
this.zoom.translateExtent([
|
|
1908
|
+
[0, 0],
|
|
1909
|
+
[this.size.width, this.size.height],
|
|
1910
|
+
]);
|
|
1906
1911
|
}
|
|
1907
|
-
const commonZoomAxis = Axis.createAxis(((_g = this.config) === null || _g === void 0 ? void 0 : _g.zoom.type) === ZoomType.x
|
|
1912
|
+
const commonZoomAxis = Axis.createAxis(((_g = this.config) === null || _g === void 0 ? void 0 : _g.zoom.type) === ZoomType.x
|
|
1913
|
+
? AxisOrientation.x
|
|
1914
|
+
: AxisOrientation.y, this.config, 0, true);
|
|
1908
1915
|
this.zoomAxis = (_h = this.axis) !== null && _h !== void 0 ? _h : commonZoomAxis;
|
|
1909
1916
|
if (enable) {
|
|
1910
|
-
const maxZoom = ((_j = this.config.zoom) === null || _j === void 0 ? void 0 : _j.max)
|
|
1911
|
-
|
|
1917
|
+
const maxZoom = ((_j = this.config.zoom) === null || _j === void 0 ? void 0 : _j.max)
|
|
1918
|
+
? (this.zoomAxis.extremes[1] - this.zoomAxis.extremes[0]) /
|
|
1919
|
+
((_k = this.config.zoom) === null || _k === void 0 ? void 0 : _k.max)
|
|
1920
|
+
: ((_l = this.config.zoom) === null || _l === void 0 ? void 0 : _l.limitZoomByData)
|
|
1921
|
+
? 1
|
|
1922
|
+
: 0;
|
|
1923
|
+
const minZoom = ((_m = this.config.zoom) === null || _m === void 0 ? void 0 : _m.min)
|
|
1924
|
+
? (this.zoomAxis.extremes[1] - this.zoomAxis.extremes[0]) /
|
|
1925
|
+
((_o = this.config.zoom) === null || _o === void 0 ? void 0 : _o.min)
|
|
1926
|
+
: Infinity;
|
|
1912
1927
|
this.zoom.scaleExtent([maxZoom, minZoom]);
|
|
1913
1928
|
this.zoom.on('start zoom end', this.zoomed);
|
|
1914
1929
|
this._element.call(this.zoom).on('dblclick.zoom', null);
|
|
1915
1930
|
if (((_q = (_p = this.config) === null || _p === void 0 ? void 0 : _p.zoom) === null || _q === void 0 ? void 0 : _q.zoomBehavior) === ZoomBehaviorType.wheel) {
|
|
1916
|
-
let wheeling;
|
|
1917
1931
|
let type = 'start';
|
|
1918
|
-
|
|
1932
|
+
let wheeling;
|
|
1919
1933
|
this.zoom
|
|
1920
|
-
.filter((event) => event.ctrlKey && event.type === 'wheel')
|
|
1934
|
+
.filter((event) => (event.ctrlKey && event.type === 'wheel') ||
|
|
1935
|
+
Boolean(window.TouchEvent))
|
|
1921
1936
|
.wheelDelta((event) => {
|
|
1922
1937
|
var _a;
|
|
1923
|
-
const delta = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.zoom.type) === ZoomType.x
|
|
1938
|
+
const delta = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.zoom.type) === ZoomType.x
|
|
1939
|
+
? -event.deltaX
|
|
1940
|
+
: -event.deltaY;
|
|
1924
1941
|
return delta * 0.002;
|
|
1925
1942
|
});
|
|
1943
|
+
const emit = (type, event) => {
|
|
1944
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1945
|
+
const origin = this.brushScale.copy().domain(this.zoomAxis.extremes);
|
|
1946
|
+
let transform = zoomIdentity;
|
|
1947
|
+
const delta = type === 'end'
|
|
1948
|
+
? 0
|
|
1949
|
+
: ((_a = this.config.zoom) === null || _a === void 0 ? void 0 : _a.type) === ZoomType.y
|
|
1950
|
+
? event.deltaY
|
|
1951
|
+
: event.deltaX;
|
|
1952
|
+
if (((_b = this.config.zoom) === null || _b === void 0 ? void 0 : _b.type) === ZoomType.y) {
|
|
1953
|
+
transform = transform.translate(0, this.currentTransform.y - delta / 2);
|
|
1954
|
+
}
|
|
1955
|
+
if (((_c = this.config.zoom) === null || _c === void 0 ? void 0 : _c.type) === ZoomType.x) {
|
|
1956
|
+
transform = transform.translate(this.currentTransform.x - delta / 2, 0);
|
|
1957
|
+
}
|
|
1958
|
+
transform = transform.scale(this.currentTransform.k);
|
|
1959
|
+
let domain = ((_d = this.config.zoom) === null || _d === void 0 ? void 0 : _d.type) === ZoomType.y
|
|
1960
|
+
? transform.rescaleY(origin).domain()
|
|
1961
|
+
: transform.rescaleX(origin).domain();
|
|
1962
|
+
const message = new ZoomMessage({
|
|
1963
|
+
event: {
|
|
1964
|
+
sourceEvent: event,
|
|
1965
|
+
transform,
|
|
1966
|
+
type,
|
|
1967
|
+
},
|
|
1968
|
+
axis: this.zoomAxis,
|
|
1969
|
+
brushDomain: domain,
|
|
1970
|
+
chartId: this.config.id,
|
|
1971
|
+
});
|
|
1972
|
+
this.zoomService.setZoom({
|
|
1973
|
+
event: {
|
|
1974
|
+
sourceEvent: event,
|
|
1975
|
+
transform,
|
|
1976
|
+
type,
|
|
1977
|
+
},
|
|
1978
|
+
target: this.zoomAxis,
|
|
1979
|
+
});
|
|
1980
|
+
this._element.call(this.zoom.transform, transform);
|
|
1981
|
+
this.currentTransform = transform;
|
|
1982
|
+
this.broadcastService.broadcastZoom({
|
|
1983
|
+
channel: (_f = (_e = this.config) === null || _e === void 0 ? void 0 : _e.zoom) === null || _f === void 0 ? void 0 : _f.syncChannel,
|
|
1984
|
+
message,
|
|
1985
|
+
});
|
|
1986
|
+
};
|
|
1926
1987
|
this._element.on('wheel', (event) => {
|
|
1927
1988
|
event.preventDefault();
|
|
1928
1989
|
if (event.ctrlKey) {
|
|
1929
1990
|
return;
|
|
1930
1991
|
}
|
|
1931
|
-
const emit = (type) => {
|
|
1932
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1933
|
-
let transform = zoomIdentity;
|
|
1934
|
-
const delta = type === 'end' ? 0 : ((_a = this.config.zoom) === null || _a === void 0 ? void 0 : _a.type) === ZoomType.y ? event.deltaY : event.deltaX;
|
|
1935
|
-
if (((_b = this.config.zoom) === null || _b === void 0 ? void 0 : _b.type) === ZoomType.y) {
|
|
1936
|
-
transform = transform.translate(0, this.currentTransform.y - delta / 2);
|
|
1937
|
-
}
|
|
1938
|
-
if (((_c = this.config.zoom) === null || _c === void 0 ? void 0 : _c.type) === ZoomType.x) {
|
|
1939
|
-
transform = transform.translate(this.currentTransform.x - delta / 2, 0);
|
|
1940
|
-
}
|
|
1941
|
-
transform = transform.scale(this.currentTransform.k);
|
|
1942
|
-
let domain = ((_d = this.config.zoom) === null || _d === void 0 ? void 0 : _d.type) === ZoomType.y ?
|
|
1943
|
-
transform.rescaleY(origin).domain() :
|
|
1944
|
-
transform.rescaleX(origin).domain();
|
|
1945
|
-
const message = new ZoomMessage({
|
|
1946
|
-
event: {
|
|
1947
|
-
sourceEvent: event,
|
|
1948
|
-
transform,
|
|
1949
|
-
type
|
|
1950
|
-
},
|
|
1951
|
-
axis: this.zoomAxis,
|
|
1952
|
-
brushDomain: domain,
|
|
1953
|
-
chartId: this.config.id
|
|
1954
|
-
});
|
|
1955
|
-
this.zoomService.setZoom({
|
|
1956
|
-
event: {
|
|
1957
|
-
sourceEvent: event,
|
|
1958
|
-
transform,
|
|
1959
|
-
type
|
|
1960
|
-
},
|
|
1961
|
-
target: this.zoomAxis
|
|
1962
|
-
});
|
|
1963
|
-
this.broadcastService.broadcastZoom({
|
|
1964
|
-
channel: (_f = (_e = this.config) === null || _e === void 0 ? void 0 : _e.zoom) === null || _f === void 0 ? void 0 : _f.syncChannel,
|
|
1965
|
-
message,
|
|
1966
|
-
});
|
|
1967
|
-
this._element.call(this.zoom.transform, transform);
|
|
1968
|
-
this.currentTransform = transform;
|
|
1969
|
-
};
|
|
1970
1992
|
this.zone.runOutsideAngular(() => {
|
|
1971
1993
|
clearTimeout(wheeling);
|
|
1972
|
-
emit(type);
|
|
1994
|
+
emit(type, event);
|
|
1973
1995
|
type = 'zoom';
|
|
1996
|
+
this.wheelIdle = false;
|
|
1974
1997
|
wheeling = setTimeout(() => {
|
|
1975
1998
|
type = 'end';
|
|
1976
|
-
emit(type);
|
|
1999
|
+
emit(type, event);
|
|
2000
|
+
this.wheelIdle = true;
|
|
1977
2001
|
type = 'start';
|
|
1978
|
-
},
|
|
2002
|
+
}, 150);
|
|
1979
2003
|
});
|
|
1980
2004
|
});
|
|
1981
2005
|
}
|
|
1982
2006
|
}
|
|
1983
2007
|
// Subscribe to zoom events
|
|
1984
|
-
this.broadcastService
|
|
2008
|
+
this.broadcastService
|
|
2009
|
+
.subscribeToZoom((_r = this.config) === null || _r === void 0 ? void 0 : _r.zoom.syncChannel)
|
|
2010
|
+
.pipe(takeWhile((_) => this.alive), filter((m) => m.message.event.sourceEvent instanceof MouseEvent ||
|
|
2011
|
+
m.message.event.sourceEvent instanceof WheelEvent ||
|
|
2012
|
+
(window.TouchEvent &&
|
|
2013
|
+
m.message.event.sourceEvent instanceof TouchEvent)), filter((m) => {
|
|
1985
2014
|
var _a, _b, _c, _d;
|
|
1986
|
-
return this.zoomAxis.index === ((_b = (_a = m.message) === null || _a === void 0 ? void 0 : _a.axis) === null || _b === void 0 ? void 0 : _b.index) &&
|
|
2015
|
+
return (this.zoomAxis.index === ((_b = (_a = m.message) === null || _a === void 0 ? void 0 : _a.axis) === null || _b === void 0 ? void 0 : _b.index) &&
|
|
2016
|
+
this.zoomAxis.orientation === ((_d = (_c = m.message) === null || _c === void 0 ? void 0 : _c.axis) === null || _d === void 0 ? void 0 : _d.orientation));
|
|
1987
2017
|
}), tap$1((m) => {
|
|
1988
2018
|
if (this.config.id !== m.message.chartId) {
|
|
2019
|
+
this.wheelIdle = false;
|
|
2020
|
+
if (m.message.event.type === 'end') {
|
|
2021
|
+
this.wheelIdle = true;
|
|
2022
|
+
}
|
|
1989
2023
|
this._element.call(this.zoom.transform, m.message.event.transform, null, {});
|
|
1990
2024
|
}
|
|
1991
2025
|
else {
|
|
1992
|
-
if (m.message.axis.isFake && !this.zoomAxis.isFake ||
|
|
2026
|
+
if ((m.message.axis.isFake && !this.zoomAxis.isFake) ||
|
|
2027
|
+
(!m.message.axis.isFake && this.zoomAxis.isFake)) {
|
|
1993
2028
|
this._element.call(this.zoom.transform, m.message.event.transform);
|
|
1994
2029
|
}
|
|
1995
2030
|
}
|
|
1996
|
-
}))
|
|
2031
|
+
}))
|
|
2032
|
+
.subscribe();
|
|
1997
2033
|
// Subscribe to brush events x or y
|
|
1998
|
-
if ((((_s = this.config.brush) === null || _s === void 0 ? void 0 : _s.type) === BrushType.x &&
|
|
1999
|
-
|
|
2000
|
-
|
|
2034
|
+
if ((((_s = this.config.brush) === null || _s === void 0 ? void 0 : _s.type) === BrushType.x &&
|
|
2035
|
+
this.zoomAxis.orientation === AxisOrientation.x) ||
|
|
2036
|
+
(((_t = this.config.brush) === null || _t === void 0 ? void 0 : _t.type) === BrushType.y &&
|
|
2037
|
+
this.zoomAxis.orientation === AxisOrientation.y)) {
|
|
2038
|
+
combineLatest([
|
|
2039
|
+
this.broadcastService.subscribeToBrush((_u = this.config) === null || _u === void 0 ? void 0 : _u.zoom.syncChannel),
|
|
2040
|
+
this.chartService.size,
|
|
2041
|
+
])
|
|
2042
|
+
.pipe(takeWhile((_) => this.alive), debounceTime(150), filter((data) => Boolean(data[0].message.selection)), tap$1((data) => {
|
|
2001
2043
|
const [m] = data;
|
|
2044
|
+
if (!this.wheelIdle) {
|
|
2045
|
+
return;
|
|
2046
|
+
}
|
|
2002
2047
|
const currentTransform = d3.zoomTransform(this._element.node());
|
|
2003
|
-
if (!m.message.event &&
|
|
2048
|
+
if (!m.message.event &&
|
|
2049
|
+
this.currentSelection &&
|
|
2050
|
+
currentTransform.k !== 1) {
|
|
2004
2051
|
return;
|
|
2005
2052
|
}
|
|
2006
|
-
this.currentSelection = m.message.selection;
|
|
2007
2053
|
this.updateZoom(m);
|
|
2008
|
-
|
|
2054
|
+
this.currentSelection = m.message.selection;
|
|
2055
|
+
}))
|
|
2056
|
+
.subscribe();
|
|
2009
2057
|
}
|
|
2010
2058
|
}
|
|
2011
2059
|
ngOnDestroy() {
|
|
@@ -2063,7 +2111,9 @@ class BrushableDirective {
|
|
|
2063
2111
|
if (changes.hasOwnProperty('config')) {
|
|
2064
2112
|
this.brushService.clearPreviousSelection();
|
|
2065
2113
|
}
|
|
2066
|
-
|
|
2114
|
+
if (this.config.brush.enable) {
|
|
2115
|
+
this.brushService.applyBrush(this.element, this.config, this.brushScale);
|
|
2116
|
+
}
|
|
2067
2117
|
}
|
|
2068
2118
|
}
|
|
2069
2119
|
BrushableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BrushableDirective, deps: [{ token: BrushService }, { token: ChartService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -2272,10 +2322,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
2272
2322
|
}] } });
|
|
2273
2323
|
|
|
2274
2324
|
class ChartComponent {
|
|
2275
|
-
constructor(chartService,
|
|
2325
|
+
constructor(chartService, zoomService, scaleService) {
|
|
2276
2326
|
this.chartService = chartService;
|
|
2277
|
-
this.
|
|
2278
|
-
this.
|
|
2327
|
+
this.zoomService = zoomService;
|
|
2328
|
+
this.scaleService = scaleService;
|
|
2279
2329
|
this.pointerMove = new EventEmitter();
|
|
2280
2330
|
this.plotBandsMove = new EventEmitter();
|
|
2281
2331
|
this.plotBandClick = new EventEmitter();
|
|
@@ -2298,7 +2348,7 @@ class ChartComponent {
|
|
|
2298
2348
|
}
|
|
2299
2349
|
ngOnInit() {
|
|
2300
2350
|
this.chartService.pointerMove
|
|
2301
|
-
.pipe(takeWhile(() => this._alive), withLatestFrom(this.
|
|
2351
|
+
.pipe(takeWhile(() => this._alive), withLatestFrom(this.scaleService.xScaleMap, this.scaleService.yScaleMap, this.chartService.config))
|
|
2302
2352
|
.subscribe((data) => {
|
|
2303
2353
|
var _a;
|
|
2304
2354
|
const [event, x, y, config] = data;
|
|
@@ -2374,7 +2424,7 @@ class ChartComponent {
|
|
|
2374
2424
|
ngOnDestroy() {
|
|
2375
2425
|
var _a;
|
|
2376
2426
|
this._alive = false;
|
|
2377
|
-
(_a = this.
|
|
2427
|
+
(_a = this.zoomService.broadcastSubscription) === null || _a === void 0 ? void 0 : _a.forEach((sub) => {
|
|
2378
2428
|
sub.unsubscribe();
|
|
2379
2429
|
});
|
|
2380
2430
|
}
|