@tetacom/svg-charts 1.7.3 → 1.7.6
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-container/chart-container.component.d.ts +2 -3
- package/chart/chart-container/series-controls/series-controls.component.d.ts +12 -1
- package/chart/chart-container/series-host/series-host.component.d.ts +4 -4
- package/chart/chart-container/x-axis/x-axis.component.d.ts +8 -18
- package/chart/chart-container/y-axis/y-axis.component.d.ts +7 -14
- package/chart/service/chart.service.d.ts +2 -0
- package/fesm2022/tetacom-svg-charts.mjs +101 -95
- package/fesm2022/tetacom-svg-charts.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, input, inject, ChangeDetectorRef, ElementRef, computed, Component, ChangeDetectionStrategy, Input, ViewChild, Directive, HostBinding, HostListener, signal, EventEmitter, Output, ViewContainerRef, effect } from '@angular/core';
|
|
3
|
-
import { ReplaySubject, filter, BehaviorSubject, Subject, of, withLatestFrom, map,
|
|
3
|
+
import { ReplaySubject, filter, BehaviorSubject, Subject, of, shareReplay, withLatestFrom, map, 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
7
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
8
8
|
import * as i3 from '@angular/platform-browser';
|
|
9
9
|
import { AsyncPipe, NgTemplateOutlet, KeyValuePipe, NgStyle } from '@angular/common';
|
|
10
|
-
import { Align as Align$1, ButtonComponent, DropdownComponent, DropdownContentDirective, DropdownHeadDirective, IconComponent, AccordionComponent, AccordionHeadComponent, AccordionItemComponent, AccordionContentDirective, CheckboxComponent, ColorInputComponent, SelectComponent, SelectOptionDirective, SelectValueDirective, ScrollableComponent } from '@tetacom/ng-components';
|
|
10
|
+
import { Align as Align$1, TetaSize, ButtonComponent, DropdownComponent, DropdownContentDirective, DropdownHeadDirective, IconComponent, AccordionComponent, AccordionHeadComponent, AccordionItemComponent, AccordionContentDirective, CheckboxComponent, ColorInputComponent, SelectComponent, SelectOptionDirective, SelectValueDirective, ScrollableComponent } from '@tetacom/ng-components';
|
|
11
11
|
import * as i1 from '@angular/forms';
|
|
12
12
|
import { FormsModule } from '@angular/forms';
|
|
13
13
|
|
|
@@ -172,7 +172,7 @@ const defaultSeriesConfig = () => ({
|
|
|
172
172
|
type: SeriesType.line,
|
|
173
173
|
xAxisIndex: 0,
|
|
174
174
|
yAxisIndex: 0,
|
|
175
|
-
fillType: FillType.
|
|
175
|
+
fillType: FillType.gradient,
|
|
176
176
|
color: 'coral',
|
|
177
177
|
visible: true,
|
|
178
178
|
enabled: true,
|
|
@@ -195,7 +195,11 @@ class ChartService {
|
|
|
195
195
|
this.annotationEvent$ = new Subject();
|
|
196
196
|
this.annotationMove$ = new Subject();
|
|
197
197
|
this.id = of((Date.now() + Math.random()).toString(36));
|
|
198
|
-
|
|
198
|
+
this.initialConfig = this.config$.asObservable().pipe(shareReplay({
|
|
199
|
+
bufferSize: 1,
|
|
200
|
+
refCount: true,
|
|
201
|
+
}));
|
|
202
|
+
const initialConfig = this.initialConfig.pipe(withLatestFrom(this.id), map(this.setDefaults), map(this.setPreparationData), map(this.restoreLocalStorage), shareReplay({
|
|
199
203
|
bufferSize: 1,
|
|
200
204
|
refCount: true,
|
|
201
205
|
}));
|
|
@@ -248,11 +252,9 @@ class ChartService {
|
|
|
248
252
|
if (currentSeriesIndex === -1) {
|
|
249
253
|
return;
|
|
250
254
|
}
|
|
251
|
-
currentConfig.series =
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
// ).length;
|
|
255
|
-
// currentConfig.yAxis[currentConfig.series[currentSeriesIndex].yAxisIndex].visible = seriesLinkCount !== 0;
|
|
255
|
+
currentConfig.series = currentConfig.series.map((seriesItem) => {
|
|
256
|
+
return { ...seriesItem };
|
|
257
|
+
});
|
|
256
258
|
try {
|
|
257
259
|
this.saveCookie(currentConfig);
|
|
258
260
|
}
|
|
@@ -260,6 +262,13 @@ class ChartService {
|
|
|
260
262
|
this.configUpdates$.next({ ...currentConfig });
|
|
261
263
|
}
|
|
262
264
|
}
|
|
265
|
+
async clearSeriesSettings() {
|
|
266
|
+
const config = await lastValueFrom(this.initialConfig.pipe(take(1)));
|
|
267
|
+
if (!config.name)
|
|
268
|
+
return;
|
|
269
|
+
localStorage.removeItem(`${config.name}_${ChartService._hiddenSeriesPostfix}`);
|
|
270
|
+
this.config$.next({ ...config });
|
|
271
|
+
}
|
|
263
272
|
emitMoveAnnotation(event) {
|
|
264
273
|
this.annotationMove$.next(event);
|
|
265
274
|
}
|
|
@@ -290,6 +299,7 @@ class ChartService {
|
|
|
290
299
|
visible: _.visible,
|
|
291
300
|
enabled: _.enabled,
|
|
292
301
|
color: _.color,
|
|
302
|
+
type: _.type,
|
|
293
303
|
strokeDasharray: _.style?.strokeDasharray,
|
|
294
304
|
strokeWidth: _.style?.strokeWidth,
|
|
295
305
|
};
|
|
@@ -308,22 +318,13 @@ class ChartService {
|
|
|
308
318
|
serie.visible = found.visible ?? serie.visible;
|
|
309
319
|
serie.enabled = found.enabled ?? serie.enabled;
|
|
310
320
|
serie.color = found.color ?? serie.color;
|
|
321
|
+
serie.type = parseInt(found.type, 10) ?? serie.type;
|
|
311
322
|
if (!serie.style) {
|
|
312
323
|
serie.style = {};
|
|
313
324
|
}
|
|
314
325
|
serie.style.strokeWidth = found.strokeWidth ?? serie.style.strokeWidth;
|
|
315
326
|
serie.style.strokeDasharray = found.strokeDasharray ?? serie.style.strokeDasharray;
|
|
316
327
|
}
|
|
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
|
-
// }
|
|
327
328
|
return serie;
|
|
328
329
|
});
|
|
329
330
|
return config;
|
|
@@ -1194,45 +1195,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1194
1195
|
}] } });
|
|
1195
1196
|
|
|
1196
1197
|
class XAxisComponent {
|
|
1197
|
-
constructor(
|
|
1198
|
-
this.scaleService =
|
|
1199
|
-
this.
|
|
1200
|
-
this.
|
|
1201
|
-
this.
|
|
1202
|
-
this.x =
|
|
1203
|
-
return
|
|
1204
|
-
})
|
|
1205
|
-
this.ticks =
|
|
1206
|
-
const
|
|
1207
|
-
const tickSize = x
|
|
1198
|
+
constructor() {
|
|
1199
|
+
this.scaleService = inject(ScaleService);
|
|
1200
|
+
this.xScales = toSignal(this.scaleService.scales.pipe(map((_) => _.x)));
|
|
1201
|
+
this.axis = input();
|
|
1202
|
+
this.size = input();
|
|
1203
|
+
this.x = computed(() => {
|
|
1204
|
+
return this.xScales().get(this.axis().index)?.scale;
|
|
1205
|
+
});
|
|
1206
|
+
this.ticks = computed(() => {
|
|
1207
|
+
const tickSize = this.x()
|
|
1208
1208
|
.ticks()
|
|
1209
|
-
.map((_) => getTextWidth(this.axis.options.tickFormat ? this.axis.options.tickFormat(_) : this.axis.defaultFormatter()(_), 0.45, 11));
|
|
1210
|
-
return x.ticks(size.width / parseInt(d3.max(tickSize), 10) / 5);
|
|
1211
|
-
})
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
}
|
|
1216
|
-
ngOnInit() { }
|
|
1217
|
-
ngOnDestroy() {
|
|
1218
|
-
this._alive = false;
|
|
1219
|
-
}
|
|
1220
|
-
ngOnChanges(changes) {
|
|
1221
|
-
if (changes.hasOwnProperty('axis')) {
|
|
1222
|
-
this.update$.next();
|
|
1223
|
-
}
|
|
1209
|
+
.map((_) => getTextWidth(this.axis().options.tickFormat ? this.axis().options.tickFormat(_) : this.axis().defaultFormatter()(_), 0.45, 11));
|
|
1210
|
+
return this.x().ticks(this.size().width / parseInt(d3.max(tickSize), 10) / 5);
|
|
1211
|
+
});
|
|
1212
|
+
this.getLabelTransform = computed(() => {
|
|
1213
|
+
return `translate(${this.size().width / 2}, ${this.axis().options.opposite ? -32 : 32})`;
|
|
1214
|
+
});
|
|
1224
1215
|
}
|
|
1225
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: XAxisComponent, deps: [
|
|
1226
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: XAxisComponent, isStandalone: true, selector: "[teta-x-axis]", inputs: { axis: "axis", size: "size"
|
|
1216
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: XAxisComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1217
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: XAxisComponent, isStandalone: true, selector: "[teta-x-axis]", inputs: { axis: { classPropertyName: "axis", publicName: "axis", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if ({\n x: x(),\n ticks: ticks(),\n axis: axis()\n}; as data) {\n @for (tick of data.ticks; track $index) {\n <svg:g text-anchor=\"middle\" [attr.transform]=\"'translate(' + data.x(tick) + ', 0)'\">\n <text\n fill=\"var(--color-text-70)\"\n [attr.dy]=\"data.axis.options.opposite ? '-0.71em' : '0.71em'\"\n [attr.y]=\"data.axis.options.opposite ? 0 : 9\"\n >\n {{ data.axis.options.tickFormat ? data.axis.options.tickFormat(tick) : data.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.y2]=\"data.axis.options.opposite ? -6 : 6\"></line>\n </svg:g>\n }\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text fill=\"var(--color-text-70)\" text-anchor=\"middle\" dominant-baseline=\"middle\">\n {{ data.axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1227
1218
|
}
|
|
1228
1219
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: XAxisComponent, decorators: [{
|
|
1229
1220
|
type: Component,
|
|
1230
|
-
args: [{ selector: '[teta-x-axis]', changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1231
|
-
}]
|
|
1232
|
-
type: Input
|
|
1233
|
-
}], size: [{
|
|
1234
|
-
type: Input
|
|
1235
|
-
}] } });
|
|
1221
|
+
args: [{ selector: '[teta-x-axis]', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if ({\n x: x(),\n ticks: ticks(),\n axis: axis()\n}; as data) {\n @for (tick of data.ticks; track $index) {\n <svg:g text-anchor=\"middle\" [attr.transform]=\"'translate(' + data.x(tick) + ', 0)'\">\n <text\n fill=\"var(--color-text-70)\"\n [attr.dy]=\"data.axis.options.opposite ? '-0.71em' : '0.71em'\"\n [attr.y]=\"data.axis.options.opposite ? 0 : 9\"\n >\n {{ data.axis.options.tickFormat ? data.axis.options.tickFormat(tick) : data.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.y2]=\"data.axis.options.opposite ? -6 : 6\"></line>\n </svg:g>\n }\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text fill=\"var(--color-text-70)\" text-anchor=\"middle\" dominant-baseline=\"middle\">\n {{ data.axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"] }]
|
|
1222
|
+
}] });
|
|
1236
1223
|
|
|
1237
1224
|
class ZoomableDirective {
|
|
1238
1225
|
mouseenter() {
|
|
@@ -1466,32 +1453,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1466
1453
|
}] } });
|
|
1467
1454
|
|
|
1468
1455
|
class YAxisComponent {
|
|
1469
|
-
constructor(
|
|
1470
|
-
this.scaleService =
|
|
1471
|
-
this.
|
|
1472
|
-
this.
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
ngAfterViewInit() { }
|
|
1481
|
-
getLabelTransform() {
|
|
1482
|
-
return `translate(${this.axis.options.opposite ? this.axis.selfSize : -this.axis.selfSize}, ${this.size.height / 2}) rotate(-90)`;
|
|
1456
|
+
constructor() {
|
|
1457
|
+
this.scaleService = inject(ScaleService);
|
|
1458
|
+
this.yScales = toSignal(this.scaleService.scales.pipe(map((_) => _.y)));
|
|
1459
|
+
this.axis = input();
|
|
1460
|
+
this.size = input();
|
|
1461
|
+
this.y = computed(() => {
|
|
1462
|
+
return this.yScales().get(this.axis().index)?.scale;
|
|
1463
|
+
});
|
|
1464
|
+
this.getLabelTransform = computed(() => {
|
|
1465
|
+
return `translate(${this.axis().options.opposite ? this.axis().selfSize : -this.axis().selfSize}, ${this.size().height / 2}) rotate(-90)`;
|
|
1466
|
+
});
|
|
1483
1467
|
}
|
|
1484
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: YAxisComponent, deps: [
|
|
1485
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: YAxisComponent, isStandalone: true, selector: "[teta-y-axis]", inputs: { axis: "axis", size: "size" }, ngImport: i0, template: "@if (y
|
|
1468
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: YAxisComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1469
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: YAxisComponent, isStandalone: true, selector: "[teta-y-axis]", inputs: { axis: { classPropertyName: "axis", publicName: "axis", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if ({\n y: y(),\n axis: axis()\n}; as data) {\n @for (tick of data.y.ticks(); track $index) {\n <svg:g\n [attr.text-anchor]=\"data.axis.options.opposite ? 'start' : 'end'\"\n [attr.transform]=\"'translate(0, ' + data.y(tick) + ')'\"\n >\n <text fill=\"var(--color-text-70)\" dy=\"0.32em\" [attr.x]=\"data.axis.options.opposite ? 10 : -9\">\n {{ data.axis.options.tickFormat ? data.axis.options.tickFormat(tick) : data.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.x2]=\"data.axis.options.opposite ? 6 : -6\"></line>\n </svg:g>\n }\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text\n [attr.dy]=\"data.axis.options.opposite ? '-4px' : '4px'\"\n text-anchor=\"middle\"\n [attr.dominant-baseline]=\"data.axis.options.opposite ? 'auto' : 'hanging'\"\n >\n {{ data.axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host{shape-rendering:crispEdges}:host .label-axis{fill:var(--color-text-70)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1486
1470
|
}
|
|
1487
1471
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: YAxisComponent, decorators: [{
|
|
1488
1472
|
type: Component,
|
|
1489
|
-
args: [{ selector: '[teta-y-axis]', changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1490
|
-
}]
|
|
1491
|
-
type: Input
|
|
1492
|
-
}], size: [{
|
|
1493
|
-
type: Input
|
|
1494
|
-
}] } });
|
|
1473
|
+
args: [{ selector: '[teta-y-axis]', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if ({\n y: y(),\n axis: axis()\n}; as data) {\n @for (tick of data.y.ticks(); track $index) {\n <svg:g\n [attr.text-anchor]=\"data.axis.options.opposite ? 'start' : 'end'\"\n [attr.transform]=\"'translate(0, ' + data.y(tick) + ')'\"\n >\n <text fill=\"var(--color-text-70)\" dy=\"0.32em\" [attr.x]=\"data.axis.options.opposite ? 10 : -9\">\n {{ data.axis.options.tickFormat ? data.axis.options.tickFormat(tick) : data.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.x2]=\"data.axis.options.opposite ? 6 : -6\"></line>\n </svg:g>\n }\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text\n [attr.dy]=\"data.axis.options.opposite ? '-4px' : '4px'\"\n text-anchor=\"middle\"\n [attr.dominant-baseline]=\"data.axis.options.opposite ? 'auto' : 'hanging'\"\n >\n {{ data.axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host{shape-rendering:crispEdges}:host .label-axis{fill:var(--color-text-70)}\n"] }]
|
|
1474
|
+
}] });
|
|
1495
1475
|
|
|
1496
1476
|
class PlotBand {
|
|
1497
1477
|
constructor(options) {
|
|
@@ -2232,22 +2212,25 @@ class SeriesHostComponent {
|
|
|
2232
2212
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
2233
2213
|
this.config = input();
|
|
2234
2214
|
this.series = input();
|
|
2235
|
-
this.
|
|
2236
|
-
effect(() => {
|
|
2237
|
-
this._componentRef.setInput('config', this.config());
|
|
2238
|
-
});
|
|
2215
|
+
this.count = 0;
|
|
2239
2216
|
effect(() => {
|
|
2240
|
-
|
|
2217
|
+
if (this.series()) {
|
|
2218
|
+
if (!Object.prototype.isPrototypeOf.call(SeriesBaseComponent, this.series().component)) {
|
|
2219
|
+
this.series().component = defaultSeriesTypeMapping.get(this.series().type) || LineSeriesComponent;
|
|
2220
|
+
}
|
|
2221
|
+
if (this.series().component !== this.seriesComponent) {
|
|
2222
|
+
this.viewContainerRef.clear();
|
|
2223
|
+
this._componentRef?.destroy();
|
|
2224
|
+
this._componentRef = this.viewContainerRef.createComponent(this.series().component);
|
|
2225
|
+
this.seriesComponent = this.series().component;
|
|
2226
|
+
}
|
|
2227
|
+
this._componentRef?.setInput('config', this.config());
|
|
2228
|
+
this._componentRef?.setInput('series', this.series());
|
|
2229
|
+
}
|
|
2241
2230
|
});
|
|
2242
2231
|
}
|
|
2243
|
-
ngOnInit() {
|
|
2244
|
-
if (!Object.prototype.isPrototypeOf.call(SeriesBaseComponent, this.series().component)) {
|
|
2245
|
-
this.series().component = defaultSeriesTypeMapping.get(this.series().type) || LineSeriesComponent;
|
|
2246
|
-
}
|
|
2247
|
-
this._componentRef = this.viewContainerRef.createComponent(this.series().component);
|
|
2248
|
-
}
|
|
2249
2232
|
ngOnDestroy() {
|
|
2250
|
-
this._componentRef
|
|
2233
|
+
this._componentRef?.destroy();
|
|
2251
2234
|
}
|
|
2252
2235
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2253
2236
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.5", type: SeriesHostComponent, isStandalone: true, selector: "[teta-series-host]", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
@@ -2593,6 +2576,12 @@ class SeriesControlsComponent {
|
|
|
2593
2576
|
this.chartService = inject(ChartService);
|
|
2594
2577
|
this.Align = Align$1;
|
|
2595
2578
|
this.series = input();
|
|
2579
|
+
this.enabledSeries = computed(() => {
|
|
2580
|
+
return this.series()?.filter((item) => item.enabled) ?? [];
|
|
2581
|
+
});
|
|
2582
|
+
this.disabledSeries = computed(() => {
|
|
2583
|
+
return this.series()?.filter((item) => !item.enabled) ?? [];
|
|
2584
|
+
});
|
|
2596
2585
|
this.strokeWidth = [
|
|
2597
2586
|
{ id: 1, value: 1 },
|
|
2598
2587
|
{ id: 2, value: 2 },
|
|
@@ -2605,6 +2594,16 @@ class SeriesControlsComponent {
|
|
|
2605
2594
|
{ id: '4, 8', value: 'dashed' },
|
|
2606
2595
|
{ id: '2, 2', value: 'dotted' },
|
|
2607
2596
|
];
|
|
2597
|
+
this.seriesType = [
|
|
2598
|
+
{ id: SeriesType.line, value: 'Line' },
|
|
2599
|
+
{ id: SeriesType.area, value: 'Area' },
|
|
2600
|
+
{ id: SeriesType.scatter, value: 'Scatter' },
|
|
2601
|
+
{ id: SeriesType.block, value: 'Block' },
|
|
2602
|
+
{ id: SeriesType.blockArea, value: 'BlockArea' },
|
|
2603
|
+
{ id: SeriesType.bar, value: 'Bar' },
|
|
2604
|
+
];
|
|
2605
|
+
this.TetaSize = TetaSize;
|
|
2606
|
+
this.SeriesType = SeriesType;
|
|
2608
2607
|
}
|
|
2609
2608
|
setSeriesEnabled(series, value) {
|
|
2610
2609
|
series.enabled = value;
|
|
@@ -2628,8 +2627,16 @@ class SeriesControlsComponent {
|
|
|
2628
2627
|
series.style.strokeDasharray = value;
|
|
2629
2628
|
this.chartService.updateSeries(series);
|
|
2630
2629
|
}
|
|
2630
|
+
setSeriesType(series, value) {
|
|
2631
|
+
series.type = value;
|
|
2632
|
+
series.component = defaultSeriesTypeMapping.get(series.type) || LineSeriesComponent;
|
|
2633
|
+
this.chartService.updateSeries(series);
|
|
2634
|
+
}
|
|
2635
|
+
clear() {
|
|
2636
|
+
this.chartService.clearSeriesSettings();
|
|
2637
|
+
}
|
|
2631
2638
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesControlsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
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
|
|
2639
|
+
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 @if (disabledSeries().length > 0) {\n <div class=\"row justify-content-end padding-h-3 padding-top-3\">\n <teta-dropdown [align]=\"Align.left\" [appendToBody]=\"true\">\n <button teta-button\n tetaDropdownHead\n [square]=\"true\"\n [size]=\"TetaSize.S\"\n [palette]=\"'primary'\">\n <teta-icon [name]=\"'add'\"></teta-icon>\n </button>\n <div tetaDropdownContent class=\"column list shadow-2\" style=\"min-width: 200px;\"\n (click)=\"$event.stopPropagation();\">\n @for (seriesItem of disabledSeries(); track seriesItem.id) {\n <div class=\"list-item list-item_interactive\"\n (click)=\"$event.stopPropagation();setSeriesEnabled(seriesItem, true)\">\n {{ seriesItem.name }}\n </div>\n }\n </div>\n </teta-dropdown>\n </div>\n }\n <teta-scrollable class=\"column column_auto\" [contentClass]=\"'column'\">\n <teta-accordion>\n @for (seriesItem of enabledSeries(); track seriesItem.id) {\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 <teta-select [options]=\"seriesType\"\n [ngModel]=\"seriesItem.type ?? SeriesType.line\"\n [valueRef]=\"'id'\"\n [textRef]=\"'value'\"\n (ngModelChange)=\"setSeriesType(seriesItem, $event)\"\n [allowNull]=\"false\">\n </teta-select>\n </div>\n </ng-template>\n </teta-accordion-item>\n }\n </teta-accordion>\n </teta-scrollable>\n <div class=\"row padding-3 justify-content-end\">\n <button teta-button\n [square]=\"true\"\n [size]=\"TetaSize.S\"\n [palette]=\"'red'\"\n (click)=\"clear()\">\n <teta-icon [name]=\"'delete'\"></teta-icon>\n </button>\n </div>\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 }); }
|
|
2633
2640
|
}
|
|
2634
2641
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SeriesControlsComponent, decorators: [{
|
|
2635
2642
|
type: Component,
|
|
@@ -2650,15 +2657,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
2650
2657
|
SelectOptionDirective,
|
|
2651
2658
|
SelectValueDirective,
|
|
2652
2659
|
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
|
|
2660
|
+
], 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 @if (disabledSeries().length > 0) {\n <div class=\"row justify-content-end padding-h-3 padding-top-3\">\n <teta-dropdown [align]=\"Align.left\" [appendToBody]=\"true\">\n <button teta-button\n tetaDropdownHead\n [square]=\"true\"\n [size]=\"TetaSize.S\"\n [palette]=\"'primary'\">\n <teta-icon [name]=\"'add'\"></teta-icon>\n </button>\n <div tetaDropdownContent class=\"column list shadow-2\" style=\"min-width: 200px;\"\n (click)=\"$event.stopPropagation();\">\n @for (seriesItem of disabledSeries(); track seriesItem.id) {\n <div class=\"list-item list-item_interactive\"\n (click)=\"$event.stopPropagation();setSeriesEnabled(seriesItem, true)\">\n {{ seriesItem.name }}\n </div>\n }\n </div>\n </teta-dropdown>\n </div>\n }\n <teta-scrollable class=\"column column_auto\" [contentClass]=\"'column'\">\n <teta-accordion>\n @for (seriesItem of enabledSeries(); track seriesItem.id) {\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 <teta-select [options]=\"seriesType\"\n [ngModel]=\"seriesItem.type ?? SeriesType.line\"\n [valueRef]=\"'id'\"\n [textRef]=\"'value'\"\n (ngModelChange)=\"setSeriesType(seriesItem, $event)\"\n [allowNull]=\"false\">\n </teta-select>\n </div>\n </ng-template>\n </teta-accordion-item>\n }\n </teta-accordion>\n </teta-scrollable>\n <div class=\"row padding-3 justify-content-end\">\n <button teta-button\n [square]=\"true\"\n [size]=\"TetaSize.S\"\n [palette]=\"'red'\"\n (click)=\"clear()\">\n <teta-icon [name]=\"'delete'\"></teta-icon>\n </button>\n </div>\n </div>\n</teta-dropdown>\n" }]
|
|
2654
2661
|
}] });
|
|
2655
2662
|
|
|
2656
2663
|
class ChartContainerComponent {
|
|
2657
|
-
constructor(_svc, _scaleService, _elementRef
|
|
2664
|
+
constructor(_svc, _scaleService, _elementRef) {
|
|
2658
2665
|
this._svc = _svc;
|
|
2659
2666
|
this._scaleService = _scaleService;
|
|
2660
2667
|
this._elementRef = _elementRef;
|
|
2661
|
-
this._zone = _zone;
|
|
2662
2668
|
this.zoomType = ZoomType;
|
|
2663
2669
|
this.filterPositionMap = new Map()
|
|
2664
2670
|
.set(true, (axis) => (_) => _.options.opposite && _.options.visible && axis.index <= _.index)
|
|
@@ -2796,8 +2802,8 @@ class ChartContainerComponent {
|
|
|
2796
2802
|
mouseLeave(event) {
|
|
2797
2803
|
this._svc.setPointerMove(event);
|
|
2798
2804
|
}
|
|
2799
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ChartContainerComponent, deps: [{ token: ChartService }, { token: ScaleService }, { token: i0.ElementRef }
|
|
2800
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ChartContainerComponent, isStandalone: true, selector: "teta-chart-container", ngImport: i0, template: "@if ({\n size: size | async,\n config: config | async,\n scales: scales | async,\n plotBands: plotBands | async,\n visibleRect: visibleRect | async,\n};\n as data) {\n @if (data.config?.tooltip?.enable) {\n <teta-tooltip [size]=\"data.size\" [config]=\"data.config\"></teta-tooltip>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n @for (item of data.scales.y | keyvalue; track item.value.index) {\n @if (item.value.selfSize > 0 && item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n }\n }\n </g>\n <g class=\"x-axis-container\">\n @for (item of data.scales.x | keyvalue; track item.value.index) {\n @if (item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n }\n }\n </g>\n </svg>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg\n tetaZoomable\n tetaBrushable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\n [config]=\"data.config\"\n [axis]=\"data.config?.zoom?.type === zoomType.x ? data.scales.x.get(0) : data.scales.y.get(0)\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.viewBox]=\"'0 0 ' + data.visibleRect.width + ' ' + data.visibleRect.height\"\n [style.transform]=\"'translate(' + data.visibleRect.x + 'px, ' + data.visibleRect.y + 'px)'\"\n (contextmenu)=\"contextMenu($event, data.scales.x, data.scales.y)\"\n (click)=\"click($event, data.scales.x, data.scales.y)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousemove)=\"mouseMove($event)\">\n @if (data.config.gridLines?.enable !== false) {\n <g class=\"gridlines\" teta-gridlines [size]=\"data.size\"></g>\n }\n <g class=\"x-axis-plotband-container\">\n @for (plotBand of data.plotBands; track $index) {\n <g teta-plot-band\n [plotBand]=\"plotBand.plotBand\"\n [scale]=\"plotBand.axis.scale\"\n [size]=\"data.visibleRect\"\n [axis]=\"plotBand.axis\"></g>\n }\n </g>\n <g class=\"series-container\">\n @for (series of data.config.series; track
|
|
2805
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ChartContainerComponent, deps: [{ token: ChartService }, { token: ScaleService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2806
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ChartContainerComponent, isStandalone: true, selector: "teta-chart-container", ngImport: i0, template: "@if ({\n size: size | async,\n config: config | async,\n scales: scales | async,\n plotBands: plotBands | async,\n visibleRect: visibleRect | async,\n};\n as data) {\n @if (data.config?.tooltip?.enable) {\n <teta-tooltip [size]=\"data.size\" [config]=\"data.config\"></teta-tooltip>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n @for (item of data.scales.y | keyvalue; track item.value.index) {\n @if (item.value.selfSize > 0 && item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n }\n }\n </g>\n <g class=\"x-axis-container\">\n @for (item of data.scales.x | keyvalue; track item.value.index) {\n @if (item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n }\n }\n </g>\n </svg>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg\n tetaZoomable\n tetaBrushable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\n [config]=\"data.config\"\n [axis]=\"data.config?.zoom?.type === zoomType.x ? data.scales.x.get(0) : data.scales.y.get(0)\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.viewBox]=\"'0 0 ' + data.visibleRect.width + ' ' + data.visibleRect.height\"\n [style.transform]=\"'translate(' + data.visibleRect.x + 'px, ' + data.visibleRect.y + 'px)'\"\n (contextmenu)=\"contextMenu($event, data.scales.x, data.scales.y)\"\n (click)=\"click($event, data.scales.x, data.scales.y)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousemove)=\"mouseMove($event)\">\n @if (data.config.gridLines?.enable !== false) {\n <g class=\"gridlines\" teta-gridlines [size]=\"data.size\"></g>\n }\n <g class=\"x-axis-plotband-container\">\n @for (plotBand of data.plotBands; track $index) {\n <g teta-plot-band\n [plotBand]=\"plotBand.plotBand\"\n [scale]=\"plotBand.axis.scale\"\n [size]=\"data.visibleRect\"\n [axis]=\"plotBand.axis\"></g>\n }\n </g>\n <g class=\"series-container\">\n @for (series of data.config.series; track $index) {\n @if (series.visible && series.enabled) {\n <g teta-series-host [config]=\"data.config\" [series]=\"series\"></g>\n }\n }\n </g>\n <g class=\"x-axis-plotline-container\">\n @for (axis of data.config.xAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n }\n }\n </g>\n <g class=\"y-axis-plotline-container\">\n @for (axis of data.config.yAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.get(i)\"></g>\n }\n }\n </g>\n <g class=\"annotations\">\n @for (annotation of data.config.annotations; track annotation) {\n <g teta-annotation [visibleRect]=\"data.visibleRect\" [annotation]=\"annotation\"></g>\n }\n </g>\n @if (data.config.tooltip?.showCrosshair) {\n <g class=\"crosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></g>\n </g>\n }\n </svg>\n @if (data.config.controls?.enable) {\n <teta-series-controls [series]=\"data.config.series\"\n class=\"position-absolute\"\n style=\"transform: translateX(-100%)\"\n [style.top.px]=\"data.visibleRect.y + 12\"\n [style.left.px]=\"data.visibleRect.width + data.visibleRect.x -12\">\n </teta-series-controls>\n }\n }\n}\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-width:0;min-height:0}:host .zoomable:hover{cursor:grab}:host .zoomable:active{cursor:grabbing}:host .crosshair{cursor:crosshair}\n"], dependencies: [{ kind: "component", type: TooltipComponent, selector: "teta-tooltip", inputs: ["size", "config"] }, { kind: "directive", type: ZoomableDirective, selector: "[tetaZoomable]", inputs: ["config", "axis", "size"] }, { kind: "component", type: XAxisComponent, selector: "[teta-x-axis]", inputs: ["axis", "size"] }, { kind: "component", type: YAxisComponent, selector: "[teta-y-axis]", inputs: ["axis", "size"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "component", type: PlotBandComponent, selector: "[teta-plot-band]", inputs: ["plotBand", "axis", "scale", "size"] }, { kind: "component", type: GridlinesComponent, selector: "[teta-gridlines]", inputs: ["size"] }, { kind: "component", type: SeriesHostComponent, selector: "[teta-series-host]", inputs: ["config", "series"] }, { kind: "component", type: PlotlineComponent, selector: "[teta-plot-line]", inputs: ["plotLine", "size", "axis", "scale"] }, { kind: "component", type: AnnotationComponent, selector: "[teta-annotation]", inputs: ["visibleRect", "annotation"] }, { kind: "component", type: CrosshairComponent, selector: "[teta-crosshair]", inputs: ["size"] }, { kind: "directive", type: BrushableDirective, selector: "[tetaBrushable]", inputs: ["config", "axis"] }, { kind: "component", type: SeriesControlsComponent, selector: "teta-series-controls", inputs: ["series"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2801
2807
|
}
|
|
2802
2808
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ChartContainerComponent, decorators: [{
|
|
2803
2809
|
type: Component,
|
|
@@ -2816,8 +2822,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
2816
2822
|
CrosshairComponent,
|
|
2817
2823
|
BrushableDirective,
|
|
2818
2824
|
SeriesControlsComponent,
|
|
2819
|
-
], template: "@if ({\n size: size | async,\n config: config | async,\n scales: scales | async,\n plotBands: plotBands | async,\n visibleRect: visibleRect | async,\n};\n as data) {\n @if (data.config?.tooltip?.enable) {\n <teta-tooltip [size]=\"data.size\" [config]=\"data.config\"></teta-tooltip>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n @for (item of data.scales.y | keyvalue; track item.value.index) {\n @if (item.value.selfSize > 0 && item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n }\n }\n </g>\n <g class=\"x-axis-container\">\n @for (item of data.scales.x | keyvalue; track item.value.index) {\n @if (item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n }\n }\n </g>\n </svg>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg\n tetaZoomable\n tetaBrushable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\n [config]=\"data.config\"\n [axis]=\"data.config?.zoom?.type === zoomType.x ? data.scales.x.get(0) : data.scales.y.get(0)\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.viewBox]=\"'0 0 ' + data.visibleRect.width + ' ' + data.visibleRect.height\"\n [style.transform]=\"'translate(' + data.visibleRect.x + 'px, ' + data.visibleRect.y + 'px)'\"\n (contextmenu)=\"contextMenu($event, data.scales.x, data.scales.y)\"\n (click)=\"click($event, data.scales.x, data.scales.y)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousemove)=\"mouseMove($event)\">\n @if (data.config.gridLines?.enable !== false) {\n <g class=\"gridlines\" teta-gridlines [size]=\"data.size\"></g>\n }\n <g class=\"x-axis-plotband-container\">\n @for (plotBand of data.plotBands; track $index) {\n <g teta-plot-band\n [plotBand]=\"plotBand.plotBand\"\n [scale]=\"plotBand.axis.scale\"\n [size]=\"data.visibleRect\"\n [axis]=\"plotBand.axis\"></g>\n }\n </g>\n <g class=\"series-container\">\n @for (series of data.config.series; track
|
|
2820
|
-
}], ctorParameters: () => [{ type: ChartService }, { type: ScaleService }, { type: i0.ElementRef }
|
|
2825
|
+
], template: "@if ({\n size: size | async,\n config: config | async,\n scales: scales | async,\n plotBands: plotBands | async,\n visibleRect: visibleRect | async,\n};\n as data) {\n @if (data.config?.tooltip?.enable) {\n <teta-tooltip [size]=\"data.size\" [config]=\"data.config\"></teta-tooltip>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n @for (item of data.scales.y | keyvalue; track item.value.index) {\n @if (item.value.selfSize > 0 && item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n }\n }\n </g>\n <g class=\"x-axis-container\">\n @for (item of data.scales.x | keyvalue; track item.value.index) {\n @if (item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n }\n }\n </g>\n </svg>\n }\n @if (data.size?.height > 0 &&\n data.size?.width > 0 &&\n data.visibleRect?.height > 0 &&\n data.visibleRect?.width > 0 &&\n data.scales?.x.size === data.config.xAxis.length &&\n data.scales?.y.size === data.config.yAxis.length) {\n <svg\n tetaZoomable\n tetaBrushable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\n [config]=\"data.config\"\n [axis]=\"data.config?.zoom?.type === zoomType.x ? data.scales.x.get(0) : data.scales.y.get(0)\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.viewBox]=\"'0 0 ' + data.visibleRect.width + ' ' + data.visibleRect.height\"\n [style.transform]=\"'translate(' + data.visibleRect.x + 'px, ' + data.visibleRect.y + 'px)'\"\n (contextmenu)=\"contextMenu($event, data.scales.x, data.scales.y)\"\n (click)=\"click($event, data.scales.x, data.scales.y)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousemove)=\"mouseMove($event)\">\n @if (data.config.gridLines?.enable !== false) {\n <g class=\"gridlines\" teta-gridlines [size]=\"data.size\"></g>\n }\n <g class=\"x-axis-plotband-container\">\n @for (plotBand of data.plotBands; track $index) {\n <g teta-plot-band\n [plotBand]=\"plotBand.plotBand\"\n [scale]=\"plotBand.axis.scale\"\n [size]=\"data.visibleRect\"\n [axis]=\"plotBand.axis\"></g>\n }\n </g>\n <g class=\"series-container\">\n @for (series of data.config.series; track $index) {\n @if (series.visible && series.enabled) {\n <g teta-series-host [config]=\"data.config\" [series]=\"series\"></g>\n }\n }\n </g>\n <g class=\"x-axis-plotline-container\">\n @for (axis of data.config.xAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n }\n }\n </g>\n <g class=\"y-axis-plotline-container\">\n @for (axis of data.config.yAxis; let i = $index; track axis) {\n @for (plotLine of axis.plotLines; track $index) {\n <g teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.get(i)\"></g>\n }\n }\n </g>\n <g class=\"annotations\">\n @for (annotation of data.config.annotations; track annotation) {\n <g teta-annotation [visibleRect]=\"data.visibleRect\" [annotation]=\"annotation\"></g>\n }\n </g>\n @if (data.config.tooltip?.showCrosshair) {\n <g class=\"crosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></g>\n </g>\n }\n </svg>\n @if (data.config.controls?.enable) {\n <teta-series-controls [series]=\"data.config.series\"\n class=\"position-absolute\"\n style=\"transform: translateX(-100%)\"\n [style.top.px]=\"data.visibleRect.y + 12\"\n [style.left.px]=\"data.visibleRect.width + data.visibleRect.x -12\">\n </teta-series-controls>\n }\n }\n}\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-width:0;min-height:0}:host .zoomable:hover{cursor:grab}:host .zoomable:active{cursor:grabbing}:host .crosshair{cursor:crosshair}\n"] }]
|
|
2826
|
+
}], ctorParameters: () => [{ type: ChartService }, { type: ScaleService }, { type: i0.ElementRef }] });
|
|
2821
2827
|
|
|
2822
2828
|
class LegendComponent {
|
|
2823
2829
|
constructor(chartService) {
|