@tetacom/svg-charts 1.6.2 → 1.6.4
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/crosshair/crosshair.component.d.ts +3 -3
- package/chart/chart-container/gridlines/gridlines.component.d.ts +4 -4
- package/chart/chart-container/y-axis/y-axis.component.d.ts +2 -2
- package/chart/legend/legend.component.d.ts +1 -1
- package/chart/model/series.d.ts +1 -1
- package/chart/model/tooltip-options.d.ts +1 -1
- package/esm2022/chart/base/series-base.component.mjs +3 -4
- package/esm2022/chart/chart/chart.component.mjs +15 -39
- package/esm2022/chart/chart-container/annotation/annotation.component.mjs +8 -11
- package/esm2022/chart/chart-container/chart-container.component.mjs +21 -46
- package/esm2022/chart/chart-container/crosshair/crosshair.component.mjs +7 -9
- package/esm2022/chart/chart-container/gridlines/gridlines.component.mjs +15 -14
- package/esm2022/chart/chart-container/plotband/plot-band.component.mjs +7 -15
- package/esm2022/chart/chart-container/plotline/plotline.component.mjs +7 -14
- package/esm2022/chart/chart-container/series/area-series/area-series.component.mjs +9 -12
- package/esm2022/chart/chart-container/series/bar/bar-series.component.mjs +5 -12
- package/esm2022/chart/chart-container/series/block-area-series/block-area-series.component.mjs +8 -16
- package/esm2022/chart/chart-container/series/block-horizontal-series/block-horizontal-series.component.mjs +9 -18
- package/esm2022/chart/chart-container/series/block-series/block-series.component.mjs +9 -17
- package/esm2022/chart/chart-container/series/line/line-series.component.mjs +6 -9
- package/esm2022/chart/chart-container/series/linear-series-base.mjs +11 -29
- package/esm2022/chart/chart-container/series/scatter-series/scatter-series.component.mjs +7 -10
- package/esm2022/chart/chart-container/series-host/series-host.component.mjs +2 -3
- package/esm2022/chart/chart-container/tooltip/tooltip.component.mjs +9 -18
- package/esm2022/chart/chart-container/x-axis/x-axis.component.mjs +7 -8
- package/esm2022/chart/chart-container/y-axis/y-axis.component.mjs +8 -13
- package/esm2022/chart/core/axis/axis.mjs +3 -5
- package/esm2022/chart/core/axis/builders/axis-size-builder.mjs +2 -2
- package/esm2022/chart/core/axis/builders/extremes-builder.mjs +4 -6
- package/esm2022/chart/core/utils/generate-ticks.mjs +2 -4
- package/esm2022/chart/core/utils/get-text-width.mjs +1 -1
- package/esm2022/chart/core/utils/position-util.mjs +6 -14
- package/esm2022/chart/default/default-chart-config.mjs +8 -8
- package/esm2022/chart/default/default-series-config.mjs +3 -3
- package/esm2022/chart/default/defaultSeriesTypeMapping.mjs +1 -1
- package/esm2022/chart/directives/brushable.directive.mjs +20 -46
- package/esm2022/chart/directives/draggable-point.directive.mjs +20 -18
- package/esm2022/chart/directives/zoomable.directive.mjs +15 -35
- package/esm2022/chart/legend/legend.component.mjs +5 -5
- package/esm2022/chart/model/annotation.mjs +1 -1
- package/esm2022/chart/model/chart-bounds.mjs +1 -1
- package/esm2022/chart/model/enum/align.enum.mjs +1 -1
- package/esm2022/chart/model/enum/axis-orientation.mjs +1 -1
- package/esm2022/chart/model/enum/clip-points-direction.mjs +1 -1
- package/esm2022/chart/model/enum/public-api.mjs +1 -1
- package/esm2022/chart/model/enum/scale-type.mjs +1 -1
- package/esm2022/chart/model/enum/series-type.mjs +1 -1
- package/esm2022/chart/model/enum/vertical-align.enum.mjs +1 -1
- package/esm2022/chart/model/enum/zoom-behavior-type.mjs +1 -1
- package/esm2022/chart/model/i-broadcast-message.mjs +1 -1
- package/esm2022/chart/model/i-chart-config.mjs +1 -1
- package/esm2022/chart/model/marker-options.mjs +1 -1
- package/esm2022/chart/model/plot-band.mjs +2 -3
- package/esm2022/chart/model/plot-line.mjs +1 -1
- package/esm2022/chart/model/public-api.mjs +1 -1
- package/esm2022/chart/model/series.mjs +1 -1
- package/esm2022/chart/model/tooltip-options.mjs +1 -1
- package/esm2022/chart/service/broadcast.service.mjs +1 -1
- package/esm2022/chart/service/brush.service.mjs +1 -1
- package/esm2022/chart/service/chart.service.mjs +24 -35
- package/esm2022/chart/service/scale.service.mjs +14 -26
- package/esm2022/chart/service/zoom.service.mjs +10 -8
- package/esm2022/index.mjs +1 -1
- package/esm2022/observable/zoneObservable.mjs +4 -4
- package/fesm2022/tetacom-svg-charts.mjs +250 -474
- package/fesm2022/tetacom-svg-charts.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -103,13 +103,13 @@ const defaultChartConfig = () => ({
|
|
|
103
103
|
enable: true,
|
|
104
104
|
type: ZoomType.x,
|
|
105
105
|
syncType: ZoomType.xy,
|
|
106
|
-
zoomBehavior: ZoomBehaviorType.move
|
|
106
|
+
zoomBehavior: ZoomBehaviorType.move,
|
|
107
107
|
},
|
|
108
108
|
bounds: new ChartBounds({
|
|
109
109
|
bottom: 12,
|
|
110
110
|
left: 12,
|
|
111
111
|
top: 12,
|
|
112
|
-
right: 12
|
|
112
|
+
right: 12,
|
|
113
113
|
}),
|
|
114
114
|
legend: {
|
|
115
115
|
enable: true,
|
|
@@ -121,15 +121,15 @@ const defaultChartConfig = () => ({
|
|
|
121
121
|
showCrosshair: false,
|
|
122
122
|
padding: {
|
|
123
123
|
x: 16,
|
|
124
|
-
y: 16
|
|
125
|
-
}
|
|
124
|
+
y: 16,
|
|
125
|
+
},
|
|
126
126
|
},
|
|
127
127
|
xAxis: [],
|
|
128
128
|
yAxis: [],
|
|
129
129
|
series: [],
|
|
130
130
|
gridLines: {
|
|
131
|
-
enable: true
|
|
132
|
-
}
|
|
131
|
+
enable: true,
|
|
132
|
+
},
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
var SeriesType;
|
|
@@ -168,7 +168,7 @@ const defaultSeriesConfig = () => ({
|
|
|
168
168
|
fillType: FillType.default,
|
|
169
169
|
color: 'coral',
|
|
170
170
|
visible: true,
|
|
171
|
-
clipPointsDirection: ClipPointsDirection.x
|
|
171
|
+
clipPointsDirection: ClipPointsDirection.x,
|
|
172
172
|
});
|
|
173
173
|
|
|
174
174
|
class ChartService {
|
|
@@ -190,7 +190,7 @@ class ChartService {
|
|
|
190
190
|
bufferSize: 1,
|
|
191
191
|
refCount: true,
|
|
192
192
|
}));
|
|
193
|
-
this.size = this.size$.asObservable().pipe(filter(size => size != null));
|
|
193
|
+
this.size = this.size$.asObservable().pipe(filter((size) => size != null));
|
|
194
194
|
this.pointerMove = this.pointerMove$.asObservable();
|
|
195
195
|
this.tooltips = this.tooltips$.asObservable();
|
|
196
196
|
this.plotBandEvent = this.plotBandEvent$.asObservable();
|
|
@@ -198,19 +198,13 @@ class ChartService {
|
|
|
198
198
|
this.pointMove = this.pointMove$.asObservable();
|
|
199
199
|
this.chartClick = this.chartClick$.asObservable();
|
|
200
200
|
this.chartContextMenu = this.chartContextMenu$.asObservable();
|
|
201
|
-
this.annotationClick = this.annotationEvent
|
|
202
|
-
.asObservable()
|
|
203
|
-
.pipe(filter(_ => _?.event?.type === 'click'));
|
|
201
|
+
this.annotationClick = this.annotationEvent$.asObservable().pipe(filter((_) => _?.event?.type === 'click'));
|
|
204
202
|
this.annotationContextMenu = this.annotationEvent$
|
|
205
203
|
.asObservable()
|
|
206
|
-
.pipe(filter(_ => _?.event?.type === 'contextmenu'));
|
|
204
|
+
.pipe(filter((_) => _?.event?.type === 'contextmenu'));
|
|
207
205
|
this.annotationMove = this.annotationMove$.asObservable();
|
|
208
|
-
this.plotBandClick = this.plotBandEvent
|
|
209
|
-
|
|
210
|
-
.pipe(filter(_ => _?.event?.type === 'click'));
|
|
211
|
-
this.plotBandContextMenu = this.plotBandEvent$
|
|
212
|
-
.asObservable()
|
|
213
|
-
.pipe(filter(_ => _?.event?.type === 'contextmenu'));
|
|
206
|
+
this.plotBandClick = this.plotBandEvent$.asObservable().pipe(filter((_) => _?.event?.type === 'click'));
|
|
207
|
+
this.plotBandContextMenu = this.plotBandEvent$.asObservable().pipe(filter((_) => _?.event?.type === 'contextmenu'));
|
|
214
208
|
// this.zoomInstance = this.zoomInstance$.asObservable();
|
|
215
209
|
// this.brushInstance = this.brushInstance$.asObservable();
|
|
216
210
|
}
|
|
@@ -242,17 +236,14 @@ class ChartService {
|
|
|
242
236
|
return;
|
|
243
237
|
}
|
|
244
238
|
const currentConfig = await lastValueFrom(this.config.pipe(take(1)));
|
|
245
|
-
seriesIndex.forEach(serieIndex => {
|
|
246
|
-
const currentSerieIndex = currentConfig.series.findIndex(_ => _.id === serieIndex);
|
|
239
|
+
seriesIndex.forEach((serieIndex) => {
|
|
240
|
+
const currentSerieIndex = currentConfig.series.findIndex((_) => _.id === serieIndex);
|
|
247
241
|
if (currentSerieIndex === -1) {
|
|
248
242
|
return;
|
|
249
243
|
}
|
|
250
244
|
currentConfig.series[currentSerieIndex].visible =
|
|
251
|
-
visible !== undefined
|
|
252
|
-
|
|
253
|
-
: !currentConfig.series[currentSerieIndex].visible;
|
|
254
|
-
const seriesLinkCount = currentConfig.series.filter(_ => _.yAxisIndex === currentConfig.series[currentSerieIndex].yAxisIndex &&
|
|
255
|
-
_.visible === true).length;
|
|
245
|
+
visible !== undefined ? visible : !currentConfig.series[currentSerieIndex].visible;
|
|
246
|
+
const seriesLinkCount = currentConfig.series.filter((_) => _.yAxisIndex === currentConfig.series[currentSerieIndex].yAxisIndex && _.visible === true).length;
|
|
256
247
|
currentConfig.yAxis[currentConfig.series[currentSerieIndex].yAxisIndex].visible = seriesLinkCount !== 0;
|
|
257
248
|
});
|
|
258
249
|
try {
|
|
@@ -293,7 +284,7 @@ class ChartService {
|
|
|
293
284
|
saveCookie(config) {
|
|
294
285
|
if (!config.name)
|
|
295
286
|
return;
|
|
296
|
-
const hiddenSeries = config.series?.filter(_ => !_.visible).map(_ => _.id);
|
|
287
|
+
const hiddenSeries = config.series?.filter((_) => !_.visible).map((_) => _.id);
|
|
297
288
|
localStorage.setItem(`${config.name}_${ChartService._hiddenSeriesPostfix}`, JSON.stringify(hiddenSeries));
|
|
298
289
|
}
|
|
299
290
|
restoreLocalStorage(config) {
|
|
@@ -304,12 +295,10 @@ class ChartService {
|
|
|
304
295
|
const json = JSON.parse(hiddenSeries);
|
|
305
296
|
config.series = config.series.map((serie, index) => {
|
|
306
297
|
serie.visible = !json.includes(serie.id);
|
|
307
|
-
const currentSerieIndex = config.series.findIndex(_ => _.id === serie.id);
|
|
298
|
+
const currentSerieIndex = config.series.findIndex((_) => _.id === serie.id);
|
|
308
299
|
if (currentSerieIndex !== -1) {
|
|
309
|
-
const seriesLinkCount = config.series.filter(_ => _.yAxisIndex === config.series[currentSerieIndex].yAxisIndex &&
|
|
310
|
-
|
|
311
|
-
config.yAxis[config.series[currentSerieIndex].yAxisIndex].visible =
|
|
312
|
-
seriesLinkCount !== 0;
|
|
300
|
+
const seriesLinkCount = config.series.filter((_) => _.yAxisIndex === config.series[currentSerieIndex].yAxisIndex && _.visible === true).length;
|
|
301
|
+
config.yAxis[config.series[currentSerieIndex].yAxisIndex].visible = seriesLinkCount !== 0;
|
|
313
302
|
}
|
|
314
303
|
return serie;
|
|
315
304
|
});
|
|
@@ -319,8 +308,8 @@ class ChartService {
|
|
|
319
308
|
}
|
|
320
309
|
setDefaults(data) {
|
|
321
310
|
let [config, id] = data;
|
|
322
|
-
const defaultConfig = defaultConfig => {
|
|
323
|
-
return source => {
|
|
311
|
+
const defaultConfig = (defaultConfig) => {
|
|
312
|
+
return (source) => {
|
|
324
313
|
return Object.assign({}, defaultConfig, source);
|
|
325
314
|
};
|
|
326
315
|
};
|
|
@@ -336,10 +325,10 @@ class ChartService {
|
|
|
336
325
|
id: _.id ?? index,
|
|
337
326
|
};
|
|
338
327
|
});
|
|
339
|
-
const oppositeYCount = config.yAxis?.filter(_ => _.opposite);
|
|
340
|
-
const oppositeXCount = config.xAxis?.filter(_ => _.opposite);
|
|
341
|
-
const nonOppositeYCount = config.yAxis?.filter(_ => !_.opposite);
|
|
342
|
-
const nonOppositeXCount = config.xAxis?.filter(_ => !_.opposite);
|
|
328
|
+
const oppositeYCount = config.yAxis?.filter((_) => _.opposite);
|
|
329
|
+
const oppositeXCount = config.xAxis?.filter((_) => _.opposite);
|
|
330
|
+
const nonOppositeYCount = config.yAxis?.filter((_) => !_.opposite);
|
|
331
|
+
const nonOppositeXCount = config.xAxis?.filter((_) => !_.opposite);
|
|
343
332
|
if (nonOppositeXCount?.length > 1) {
|
|
344
333
|
config.bounds.bottom = 0;
|
|
345
334
|
}
|
|
@@ -363,7 +352,7 @@ class ChartService {
|
|
|
363
352
|
const yAxes = [...config.yAxis];
|
|
364
353
|
config.xAxis = yAxes;
|
|
365
354
|
config.yAxis = xAxes;
|
|
366
|
-
config.series = config.series?.map(serie => {
|
|
355
|
+
config.series = config.series?.map((serie) => {
|
|
367
356
|
const x = serie.xAxisIndex;
|
|
368
357
|
const y = serie.yAxisIndex;
|
|
369
358
|
serie.xAxisIndex = y;
|
|
@@ -371,7 +360,7 @@ class ChartService {
|
|
|
371
360
|
return {
|
|
372
361
|
...serie,
|
|
373
362
|
clipPointsDirection: ClipPointsDirection.y,
|
|
374
|
-
data: serie?.data?.map(point => {
|
|
363
|
+
data: serie?.data?.map((point) => {
|
|
375
364
|
return {
|
|
376
365
|
...point,
|
|
377
366
|
x: point?.y,
|
|
@@ -384,8 +373,8 @@ class ChartService {
|
|
|
384
373
|
});
|
|
385
374
|
}
|
|
386
375
|
if (config?.brush?.enable) {
|
|
387
|
-
config.yAxis = config.yAxis.map(_ => ({ ..._, zoom: false }));
|
|
388
|
-
config.xAxis = config.xAxis.map(_ => ({ ..._, zoom: false }));
|
|
376
|
+
config.yAxis = config.yAxis.map((_) => ({ ..._, zoom: false }));
|
|
377
|
+
config.xAxis = config.xAxis.map((_) => ({ ..._, zoom: false }));
|
|
389
378
|
}
|
|
390
379
|
return config;
|
|
391
380
|
}
|
|
@@ -414,9 +403,7 @@ const getTextWidth = (inputText, backupRatio = 0.5, fontSize = 10) => {
|
|
|
414
403
|
function generateTicks(extremes, count = 10) {
|
|
415
404
|
const [min, max] = extremes;
|
|
416
405
|
const tickStep = (max - min) / count;
|
|
417
|
-
const ticks = d3
|
|
418
|
-
.range(min, max + tickStep, tickStep)
|
|
419
|
-
.filter((step) => step <= max);
|
|
406
|
+
const ticks = d3.range(min, max + tickStep, tickStep).filter((step) => step <= max);
|
|
420
407
|
return ticks;
|
|
421
408
|
}
|
|
422
409
|
|
|
@@ -452,8 +439,8 @@ class AxisSizeBuilder {
|
|
|
452
439
|
class ExtremesBuilder {
|
|
453
440
|
constructor() {
|
|
454
441
|
this.extentAccessorMap = new Map()
|
|
455
|
-
.set(AxisOrientation.x, _ => _.x)
|
|
456
|
-
.set(AxisOrientation.y, _ => _.y);
|
|
442
|
+
.set(AxisOrientation.x, (_) => _.x)
|
|
443
|
+
.set(AxisOrientation.y, (_) => _.y);
|
|
457
444
|
this.extremes = [0, 1];
|
|
458
445
|
}
|
|
459
446
|
build(settings) {
|
|
@@ -480,9 +467,7 @@ class ExtremesBuilder {
|
|
|
480
467
|
if (hasMax) {
|
|
481
468
|
extremes[1] = options?.max;
|
|
482
469
|
}
|
|
483
|
-
if (typeof extremes[0] === 'number' &&
|
|
484
|
-
typeof extremes[1] === 'number' &&
|
|
485
|
-
extremes[0] === extremes[1]) {
|
|
470
|
+
if (typeof extremes[0] === 'number' && typeof extremes[1] === 'number' && extremes[0] === extremes[1]) {
|
|
486
471
|
extremes[0] = extremes[0] - 1;
|
|
487
472
|
extremes[1] = extremes[1] + 1;
|
|
488
473
|
}
|
|
@@ -502,7 +487,7 @@ class Axis {
|
|
|
502
487
|
.set(ScaleType.symlog, d3.format('~s'))
|
|
503
488
|
.set(ScaleType.pow, d3.format('~s'))
|
|
504
489
|
.set(ScaleType.sqrt, d3.format('~s'))
|
|
505
|
-
.set(ScaleType.band, _ => {
|
|
490
|
+
.set(ScaleType.band, (_) => {
|
|
506
491
|
return _;
|
|
507
492
|
});
|
|
508
493
|
this.defaultScales = new Map()
|
|
@@ -580,9 +565,7 @@ class Axis {
|
|
|
580
565
|
//this._ticksValues = generateTicks(this._extremes);
|
|
581
566
|
}
|
|
582
567
|
setOptions() {
|
|
583
|
-
const options = this.orientation === AxisOrientation.x
|
|
584
|
-
? this.chartConfig.xAxis[this.index]
|
|
585
|
-
: this.chartConfig.yAxis[this.index];
|
|
568
|
+
const options = this.orientation === AxisOrientation.x ? this.chartConfig.xAxis[this.index] : this.chartConfig.yAxis[this.index];
|
|
586
569
|
this._options = options;
|
|
587
570
|
}
|
|
588
571
|
get scale() {
|
|
@@ -642,7 +625,7 @@ class ZoomService {
|
|
|
642
625
|
this.zoomed$ = new BehaviorSubject(null);
|
|
643
626
|
this.zoomed = this.zoomed$.asObservable().pipe(shareReplay({
|
|
644
627
|
bufferSize: 1,
|
|
645
|
-
refCount: true
|
|
628
|
+
refCount: true,
|
|
646
629
|
}));
|
|
647
630
|
}
|
|
648
631
|
fireZoom(zoom) {
|
|
@@ -652,7 +635,7 @@ class ZoomService {
|
|
|
652
635
|
if (this.broadcastChannel?.length) {
|
|
653
636
|
this._broadcast.broadcastZoom({
|
|
654
637
|
channel: this.broadcastChannel,
|
|
655
|
-
message: zoom
|
|
638
|
+
message: zoom,
|
|
656
639
|
});
|
|
657
640
|
}
|
|
658
641
|
}
|
|
@@ -664,9 +647,10 @@ class ZoomService {
|
|
|
664
647
|
if (this.broadcastChannel?.length) {
|
|
665
648
|
this.broadcastSub = combineLatest([this._broadcast.subscribeToZoom(this.broadcastChannel), this._chart.config])
|
|
666
649
|
.pipe(filter(([zoom, config]) => {
|
|
667
|
-
return zoom.message?.chartId !== config.id &&
|
|
668
|
-
(
|
|
669
|
-
|
|
650
|
+
return (zoom.message?.chartId !== config.id &&
|
|
651
|
+
(config.zoom.syncType === ZoomType.xy ||
|
|
652
|
+
(zoom.message.axis.orientation === AxisOrientation.y && config.zoom.syncType === ZoomType.y) ||
|
|
653
|
+
(zoom.message.axis.orientation === AxisOrientation.x && config.zoom.syncType === ZoomType.x)));
|
|
670
654
|
}))
|
|
671
655
|
.subscribe(([zoom, config]) => {
|
|
672
656
|
this.fireZoom(zoom.message);
|
|
@@ -674,7 +658,8 @@ class ZoomService {
|
|
|
674
658
|
}
|
|
675
659
|
}
|
|
676
660
|
getD3Transform(targetDomain, originalDomain, scale, orientation, inverted) {
|
|
677
|
-
const zoomScale = Math.abs(scale(originalDomain[1]) - scale(originalDomain[0])) /
|
|
661
|
+
const zoomScale = Math.abs(scale(originalDomain[1]) - scale(originalDomain[0])) /
|
|
662
|
+
Math.abs(scale(targetDomain[1]) - scale(targetDomain[0]));
|
|
678
663
|
let transform = zoomIdentity.scale(zoomScale);
|
|
679
664
|
if (orientation === AxisOrientation.x) {
|
|
680
665
|
if (!!inverted) {
|
|
@@ -721,11 +706,7 @@ class ScaleService {
|
|
|
721
706
|
.set(ScaleType.pow, d3.scalePow)
|
|
722
707
|
.set(ScaleType.sqrt, d3.scaleSqrt)
|
|
723
708
|
.set(ScaleType.band, d3.scaleBand);
|
|
724
|
-
this.scales = combineLatest([
|
|
725
|
-
this.chartService.size,
|
|
726
|
-
this.chartService.config,
|
|
727
|
-
this.zoomService.zoomed,
|
|
728
|
-
]).pipe(map((data) => {
|
|
709
|
+
this.scales = combineLatest([this.chartService.size, this.chartService.config, this.zoomService.zoomed]).pipe(map((data) => {
|
|
729
710
|
const [size, config, zoom] = data;
|
|
730
711
|
const xAxisMap = new Map();
|
|
731
712
|
const yAxisMap = new Map();
|
|
@@ -737,13 +718,13 @@ class ScaleService {
|
|
|
737
718
|
});
|
|
738
719
|
// Generate x scales
|
|
739
720
|
const left = Array.from(yAxisMap.values())
|
|
740
|
-
.filter(_ => _.options?.visible && _.options?.opposite)
|
|
721
|
+
.filter((_) => _.options?.visible && _.options?.opposite)
|
|
741
722
|
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
742
723
|
const right = Array.from(yAxisMap.values())
|
|
743
|
-
.filter(_ => _.options?.visible && _.options?.opposite !== true)
|
|
724
|
+
.filter((_) => _.options?.visible && _.options?.opposite !== true)
|
|
744
725
|
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
745
726
|
const finalWidth = (size.width || 0) - left - right;
|
|
746
|
-
xAxisMap.forEach(axis => {
|
|
727
|
+
xAxisMap.forEach((axis) => {
|
|
747
728
|
let domain = axis.extremes;
|
|
748
729
|
if (axis?.options.inverted) {
|
|
749
730
|
domain = [...axis.extremes].reverse();
|
|
@@ -766,8 +747,7 @@ class ScaleService {
|
|
|
766
747
|
axis.setScale(scale);
|
|
767
748
|
axis.setOriginDomain(scale.domain());
|
|
768
749
|
const hasCache = this.transformCacheX.has(axis.index);
|
|
769
|
-
const shouldRestore = zoom?.axis?.orientation !== AxisOrientation.x ||
|
|
770
|
-
zoom.axis?.index !== axis.index;
|
|
750
|
+
const shouldRestore = zoom?.axis?.orientation !== AxisOrientation.x || zoom.axis?.index !== axis.index;
|
|
771
751
|
if (hasCache && shouldRestore) {
|
|
772
752
|
const restoredTransform = this.transformCacheX.get(axis.index);
|
|
773
753
|
axis.setScale(restoredTransform.rescaleX(scale));
|
|
@@ -786,17 +766,13 @@ class ScaleService {
|
|
|
786
766
|
}
|
|
787
767
|
// Generate y axis
|
|
788
768
|
const top = Array.from(xAxisMap.values())
|
|
789
|
-
.filter(_ => _.options?.visible && _.options?.opposite)
|
|
769
|
+
.filter((_) => _.options?.visible && _.options?.opposite)
|
|
790
770
|
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
791
771
|
const bottom = Array.from(xAxisMap.values())
|
|
792
|
-
.filter(_ => _.options?.visible && _.options?.opposite !== true)
|
|
772
|
+
.filter((_) => _.options?.visible && _.options?.opposite !== true)
|
|
793
773
|
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
794
|
-
const finalHeight = (size.height || 0) -
|
|
795
|
-
|
|
796
|
-
bottom -
|
|
797
|
-
config?.bounds?.top -
|
|
798
|
-
config.bounds?.bottom;
|
|
799
|
-
yAxisMap.forEach(axis => {
|
|
774
|
+
const finalHeight = (size.height || 0) - top - bottom - config?.bounds?.top - config.bounds?.bottom;
|
|
775
|
+
yAxisMap.forEach((axis) => {
|
|
800
776
|
let domain = axis.extremes;
|
|
801
777
|
if (axis.orientation === AxisOrientation.y) {
|
|
802
778
|
domain = [...axis.extremes].reverse();
|
|
@@ -822,8 +798,7 @@ class ScaleService {
|
|
|
822
798
|
axis.setScale(scale);
|
|
823
799
|
axis.setOriginDomain(scale.domain());
|
|
824
800
|
const hasCache = this.transformCacheY.has(axis.index);
|
|
825
|
-
const shouldRestore = zoom?.axis?.orientation !== AxisOrientation.y ||
|
|
826
|
-
zoom.axis?.index !== axis.index;
|
|
801
|
+
const shouldRestore = zoom?.axis?.orientation !== AxisOrientation.y || zoom.axis?.index !== axis.index;
|
|
827
802
|
if (hasCache && shouldRestore) {
|
|
828
803
|
const restoredTransform = this.transformCacheY.get(axis.index);
|
|
829
804
|
axis.setScale(restoredTransform.rescaleY(scale));
|
|
@@ -866,8 +841,7 @@ class ScaleService {
|
|
|
866
841
|
chartId: config.id,
|
|
867
842
|
});
|
|
868
843
|
this.zoomService.fireZoom(msg);
|
|
869
|
-
if (config.zoom.syncChannel &&
|
|
870
|
-
config.zoom.syncType === ZoomType.x) {
|
|
844
|
+
if (config.zoom.syncChannel && config.zoom.syncType === ZoomType.x) {
|
|
871
845
|
this.zoomService.broadcastZoom(msg);
|
|
872
846
|
}
|
|
873
847
|
}
|
|
@@ -885,8 +859,7 @@ class ScaleService {
|
|
|
885
859
|
chartId: config.id,
|
|
886
860
|
});
|
|
887
861
|
this.zoomService.fireZoom(msg);
|
|
888
|
-
if (config.zoom.syncChannel &&
|
|
889
|
-
config.zoom.syncType === ZoomType.y) {
|
|
862
|
+
if (config.zoom.syncChannel && config.zoom.syncType === ZoomType.y) {
|
|
890
863
|
this.zoomService.broadcastZoom(msg);
|
|
891
864
|
}
|
|
892
865
|
}
|
|
@@ -924,8 +897,7 @@ class SeriesBaseComponent {
|
|
|
924
897
|
this.element = element;
|
|
925
898
|
this.zone = zone;
|
|
926
899
|
}
|
|
927
|
-
ngOnInit() {
|
|
928
|
-
}
|
|
900
|
+
ngOnInit() { }
|
|
929
901
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SeriesBaseComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
930
902
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.1", type: SeriesBaseComponent, isStandalone: true, selector: "ng-component", inputs: { config: "config", series: "series" }, ngImport: i0, template: '', isInline: true }); }
|
|
931
903
|
}
|
|
@@ -997,9 +969,7 @@ class PositionUtil {
|
|
|
997
969
|
rect.left = containerPosition.right - elementWidth - margin;
|
|
998
970
|
}
|
|
999
971
|
if (align === Align.center) {
|
|
1000
|
-
rect.left =
|
|
1001
|
-
(containerPosition.left + containerPosition.right) / 2 -
|
|
1002
|
-
elementWidth / 2;
|
|
972
|
+
rect.left = (containerPosition.left + containerPosition.right) / 2 - elementWidth / 2;
|
|
1003
973
|
}
|
|
1004
974
|
if (align === Align.outerAuto) {
|
|
1005
975
|
align = Align.outerRight;
|
|
@@ -1052,9 +1022,7 @@ class PositionUtil {
|
|
|
1052
1022
|
rect.top = containerPosition.top + verticalMargin;
|
|
1053
1023
|
}
|
|
1054
1024
|
if (verticalAlign === VerticalAlign.center) {
|
|
1055
|
-
rect.top =
|
|
1056
|
-
(containerPosition.top + containerPosition.bottom) / 2 -
|
|
1057
|
-
elementHeight / 2;
|
|
1025
|
+
rect.top = (containerPosition.top + containerPosition.bottom) / 2 - elementHeight / 2;
|
|
1058
1026
|
}
|
|
1059
1027
|
if (rect.left + elementWidth > window.innerWidth) {
|
|
1060
1028
|
rect.left = window.innerWidth - elementWidth;
|
|
@@ -1073,8 +1041,7 @@ class PositionUtil {
|
|
|
1073
1041
|
verticalAlign === VerticalAlign.innerBottom) {
|
|
1074
1042
|
rect.maxHeight = window.innerHeight - rect.top;
|
|
1075
1043
|
}
|
|
1076
|
-
if (verticalAlign === VerticalAlign.top ||
|
|
1077
|
-
verticalAlign === VerticalAlign.innerTop) {
|
|
1044
|
+
if (verticalAlign === VerticalAlign.top || verticalAlign === VerticalAlign.innerTop) {
|
|
1078
1045
|
rect.maxHeight = containerPosition.top;
|
|
1079
1046
|
}
|
|
1080
1047
|
if (!isNaN(rect.left)) {
|
|
@@ -1087,9 +1054,7 @@ class PositionUtil {
|
|
|
1087
1054
|
rect.top = rect.top - transformedParentRect.top;
|
|
1088
1055
|
}
|
|
1089
1056
|
if (!isNaN(rect.bottom)) {
|
|
1090
|
-
rect.bottom = rect.bottom
|
|
1091
|
-
? rect.bottom - transformedParentRect.bottom
|
|
1092
|
-
: rect.bottom;
|
|
1057
|
+
rect.bottom = rect.bottom ? rect.bottom - transformedParentRect.bottom : rect.bottom;
|
|
1093
1058
|
}
|
|
1094
1059
|
return rect;
|
|
1095
1060
|
}
|
|
@@ -1098,8 +1063,7 @@ class PositionUtil {
|
|
|
1098
1063
|
element.style.right = rect.right != null ? `${rect.right}px` : '';
|
|
1099
1064
|
element.style.top = rect.top != null ? `${rect.top}px` : '';
|
|
1100
1065
|
element.style.bottom = rect.bottom != null ? `${rect.bottom}px` : '';
|
|
1101
|
-
element.style.maxHeight =
|
|
1102
|
-
rect.maxHeight != null ? `${rect.maxHeight}px` : '';
|
|
1066
|
+
element.style.maxHeight = rect.maxHeight != null ? `${rect.maxHeight}px` : '';
|
|
1103
1067
|
element.style.minWidth = rect.minWidth != null ? `${rect.minWidth}px` : '';
|
|
1104
1068
|
}
|
|
1105
1069
|
static getMaxHeight(position) {
|
|
@@ -1122,7 +1086,7 @@ class TooltipComponent {
|
|
|
1122
1086
|
this.sanitizer = sanitizer;
|
|
1123
1087
|
this._zone = _zone;
|
|
1124
1088
|
this._elementRef = _elementRef;
|
|
1125
|
-
this.tooltips = this.svc.tooltips.pipe(map(_ => [..._.values()]));
|
|
1089
|
+
this.tooltips = this.svc.tooltips.pipe(map((_) => [..._.values()]));
|
|
1126
1090
|
}
|
|
1127
1091
|
getImplicit(t) {
|
|
1128
1092
|
return { $implicit: t };
|
|
@@ -1135,7 +1099,7 @@ class TooltipComponent {
|
|
|
1135
1099
|
this.cdr.detectChanges();
|
|
1136
1100
|
});
|
|
1137
1101
|
}));
|
|
1138
|
-
this.position = this.svc.pointerMove.pipe(filter(event => !!event), map(_ => {
|
|
1102
|
+
this.position = this.svc.pointerMove.pipe(filter((event) => !!event), map((_) => {
|
|
1139
1103
|
return this.getPosition(_);
|
|
1140
1104
|
}), tap(() => this.cdr.detectChanges()));
|
|
1141
1105
|
const transformHtml = (html) => {
|
|
@@ -1144,17 +1108,13 @@ class TooltipComponent {
|
|
|
1144
1108
|
const defaultFormatter = (tooltips) => {
|
|
1145
1109
|
let html = '';
|
|
1146
1110
|
const format = d3.timeFormat('%d.%m.%Y');
|
|
1147
|
-
tooltips.forEach(_ => {
|
|
1111
|
+
tooltips.forEach((_) => {
|
|
1148
1112
|
const indicatorStyle = `display:block; width: 10px; height: 2px; background-color: ${_?.series?.color}`;
|
|
1149
1113
|
html += `<div class='display-flex align-center'><span class='margin-right-1' style='${indicatorStyle}'></span>
|
|
1150
1114
|
<span class='font-title-3'>${_.series.name}
|
|
1151
1115
|
<span class='font-body-3'>
|
|
1152
|
-
x: ${_.point.x instanceof Date
|
|
1153
|
-
|
|
1154
|
-
: _.point.x?.toFixed(2)}
|
|
1155
|
-
y: ${_.point.y instanceof Date
|
|
1156
|
-
? format(_.point.y)
|
|
1157
|
-
: _.point.y?.toFixed(2)}
|
|
1116
|
+
x: ${_.point.x instanceof Date ? format(_.point.x) : _.point.x?.toFixed(2)}
|
|
1117
|
+
y: ${_.point.y instanceof Date ? format(_.point.y) : _.point.y?.toFixed(2)}
|
|
1158
1118
|
</span>
|
|
1159
1119
|
</span></div>`;
|
|
1160
1120
|
});
|
|
@@ -1166,9 +1126,7 @@ class TooltipComponent {
|
|
|
1166
1126
|
if (tooltipList?.length < 1) {
|
|
1167
1127
|
return '';
|
|
1168
1128
|
}
|
|
1169
|
-
const formatted = formatter
|
|
1170
|
-
? transformHtml(formatter(tooltipList))
|
|
1171
|
-
: defaultFormatter(tooltipList);
|
|
1129
|
+
const formatted = formatter ? transformHtml(formatter(tooltipList)) : defaultFormatter(tooltipList);
|
|
1172
1130
|
return formatted;
|
|
1173
1131
|
}));
|
|
1174
1132
|
}
|
|
@@ -1192,14 +1150,11 @@ class TooltipComponent {
|
|
|
1192
1150
|
return format(input);
|
|
1193
1151
|
}
|
|
1194
1152
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: TooltipComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ZoomService }, { token: i3.DomSanitizer }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1195
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: TooltipComponent, isStandalone: true, selector: "teta-tooltip", inputs: { size: "size", config: "config" }, viewQueries: [{ propertyName: "tooltip", first: true, predicate: ["tooltip"], descendants: true, read: ElementRef }], ngImport: i0, template: "@if ({p: position | async}; as data) {
|
|
1153
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: TooltipComponent, isStandalone: true, selector: "teta-tooltip", inputs: { size: "size", config: "config" }, viewQueries: [{ propertyName: "tooltip", first: true, predicate: ["tooltip"], descendants: true, read: ElementRef }], ngImport: i0, template: "@if ({p: position | async}; as data) { @if ((tooltips | async); as t) { @if (t.length > 0) {\n<div\n class=\"chart-tooltip color-text-90 bg-global-bgcard shadow-2\"\n #tooltip\n [style.position]=\"'fixed'\"\n [style.opacity]=\"display | async\"\n [hidden]=\"!data.p\"\n style=\"pointer-events: none; min-width: 200px\"\n [style.left.px]=\"data.p?.left\"\n [style.top.px]=\"data.p?.top\"\n [style.bottom.px]=\"data.p?.bottom\"\n [style.right.px]=\"data.p?.right\"\n>\n @if (config.tooltip?.template) {\n <ng-container *ngTemplateOutlet=\"config.tooltip.template; context: getImplicit(t)\"></ng-container>\n } @if (config.tooltip?.format) {\n <div [innerHTML]=\"displayTooltips | async\"></div>\n } @else { @if (!config.tooltip?.template) {\n <div class=\"padding-2 border-radius-1\">\n @for (tooltip of t; track $index) {\n <div class=\"display-flex align-center\">\n <span\n class=\"display-block margin-right-1\"\n [style.width.px]=\"10\"\n [style.height.px]=\"2\"\n [style.background-color]=\"tooltip.series?.color\"\n >\n </span>\n <span class=\"font-title-3\">\n {{ tooltip.series?.name }}\n <span class=\"font-body-3\"> x: {{ format(tooltip.point?.x) }} y: {{ format(tooltip.point?.y) }} </span>\n </span>\n </div>\n }\n </div>\n } }\n</div>\n} } }\n", styles: [":host{position:absolute;z-index:2}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1196
1154
|
}
|
|
1197
1155
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
1198
1156
|
type: Component,
|
|
1199
|
-
args: [{ selector: 'teta-tooltip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1200
|
-
AsyncPipe,
|
|
1201
|
-
NgTemplateOutlet
|
|
1202
|
-
], template: "@if ({p: position | async}; as data) {\n @if ((tooltips | async); as t) {\n @if (t.length > 0) {\n <div class=\"chart-tooltip color-text-90 bg-global-bgcard shadow-2\"\n #tooltip\n [style.position]=\"'fixed'\"\n [style.opacity]=\"display | async\"\n [hidden]=\"!data.p\"\n style=\"pointer-events: none; min-width: 200px;\"\n [style.left.px]=\"data.p?.left\"\n [style.top.px]=\"data.p?.top\"\n [style.bottom.px]=\"data.p?.bottom\"\n [style.right.px]=\"data.p?.right\">\n @if (config.tooltip?.template) {\n <ng-container *ngTemplateOutlet=\"config.tooltip.template; context: getImplicit(t)\"></ng-container>\n }\n @if (config.tooltip?.format) {\n <div [innerHTML]=\"displayTooltips | async\"></div>\n } @else {\n @if (!config.tooltip?.template) {\n <div class=\"padding-2 border-radius-1\">\n @for (tooltip of t; track tooltip) {\n <div class=\"display-flex align-center\">\n <span class=\"display-block margin-right-1\" [style.width.px]=\"10\" [style.height.px]=\"2\"\n [style.background-color]=\"tooltip.series?.color\">\n </span>\n <span class=\"font-title-3\">\n {{ tooltip.series?.name }}\n <span class=\"font-body-3\">\n x: {{ format(tooltip.point?.x) }}\n y: {{ format(tooltip.point?.y) }}\n </span>\n </span>\n </div>\n }\n </div>\n }\n }\n </div>\n }\n }\n}\n", styles: [":host{position:absolute;z-index:2}\n"] }]
|
|
1157
|
+
args: [{ selector: 'teta-tooltip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe, NgTemplateOutlet], template: "@if ({p: position | async}; as data) { @if ((tooltips | async); as t) { @if (t.length > 0) {\n<div\n class=\"chart-tooltip color-text-90 bg-global-bgcard shadow-2\"\n #tooltip\n [style.position]=\"'fixed'\"\n [style.opacity]=\"display | async\"\n [hidden]=\"!data.p\"\n style=\"pointer-events: none; min-width: 200px\"\n [style.left.px]=\"data.p?.left\"\n [style.top.px]=\"data.p?.top\"\n [style.bottom.px]=\"data.p?.bottom\"\n [style.right.px]=\"data.p?.right\"\n>\n @if (config.tooltip?.template) {\n <ng-container *ngTemplateOutlet=\"config.tooltip.template; context: getImplicit(t)\"></ng-container>\n } @if (config.tooltip?.format) {\n <div [innerHTML]=\"displayTooltips | async\"></div>\n } @else { @if (!config.tooltip?.template) {\n <div class=\"padding-2 border-radius-1\">\n @for (tooltip of t; track $index) {\n <div class=\"display-flex align-center\">\n <span\n class=\"display-block margin-right-1\"\n [style.width.px]=\"10\"\n [style.height.px]=\"2\"\n [style.background-color]=\"tooltip.series?.color\"\n >\n </span>\n <span class=\"font-title-3\">\n {{ tooltip.series?.name }}\n <span class=\"font-body-3\"> x: {{ format(tooltip.point?.x) }} y: {{ format(tooltip.point?.y) }} </span>\n </span>\n </div>\n }\n </div>\n } }\n</div>\n} } }\n", styles: [":host{position:absolute;z-index:2}\n"] }]
|
|
1203
1158
|
}], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ZoomService }, { type: i3.DomSanitizer }, { type: i0.NgZone }, { type: i0.ElementRef }], propDecorators: { size: [{
|
|
1204
1159
|
type: Input
|
|
1205
1160
|
}], config: [{
|
|
@@ -1220,15 +1175,16 @@ class XAxisComponent {
|
|
|
1220
1175
|
}));
|
|
1221
1176
|
this.ticks = combineLatest([this.x, this.update$]).pipe(withLatestFrom(this._svc.size), map((_) => {
|
|
1222
1177
|
const [[x], size] = _;
|
|
1223
|
-
const tickSize = x
|
|
1178
|
+
const tickSize = x
|
|
1179
|
+
.ticks()
|
|
1180
|
+
.map((_) => getTextWidth(this.axis.options.tickFormat ? this.axis.options.tickFormat(_) : this.axis.defaultFormatter()(_), 0.45, 11));
|
|
1224
1181
|
return x.ticks(size.width / parseInt(d3.max(tickSize), 10) / 5);
|
|
1225
1182
|
}));
|
|
1226
1183
|
}
|
|
1227
1184
|
getLabelTransform() {
|
|
1228
1185
|
return `translate(${this.size.width / 2}, ${this.axis.options.opposite ? -32 : 32})`;
|
|
1229
1186
|
}
|
|
1230
|
-
ngOnInit() {
|
|
1231
|
-
}
|
|
1187
|
+
ngOnInit() { }
|
|
1232
1188
|
ngOnDestroy() {
|
|
1233
1189
|
this._alive = false;
|
|
1234
1190
|
}
|
|
@@ -1238,13 +1194,11 @@ class XAxisComponent {
|
|
|
1238
1194
|
}
|
|
1239
1195
|
}
|
|
1240
1196
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: XAxisComponent, deps: [{ token: ScaleService }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1241
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: XAxisComponent, isStandalone: true, selector: "[teta-x-axis]", inputs: { axis: "axis", size: "size" }, usesOnChanges: true, ngImport: i0, template: "@if ({x: x | async, ticks: ticks | async}; as data) {
|
|
1197
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: XAxisComponent, isStandalone: true, selector: "[teta-x-axis]", inputs: { axis: "axis", size: "size" }, usesOnChanges: true, ngImport: i0, template: "@if ({x: x | async, ticks: ticks | async}; as data) { @for (tick of data.ticks; track tick) {\n<svg:g text-anchor=\"middle\" [attr.transform]=\"'translate(' + data.x(tick) + ', 0)'\">\n <text\n fill=\"var(--color-text-70)\"\n [attr.dy]=\"axis.options.opposite ? '-0.71em' : '0.71em'\"\n [attr.y]=\"axis.options.opposite ? 0 : 9\"\n >\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.y2]=\"axis.options.opposite ? -6 : 6\"></line>\n</svg:g>\n}\n<svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text fill=\"var(--color-text-70)\" text-anchor=\"middle\" dominant-baseline=\"middle\">\n {{ axis.options.title }}\n </text>\n</svg:g>\n}\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1242
1198
|
}
|
|
1243
1199
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: XAxisComponent, decorators: [{
|
|
1244
1200
|
type: Component,
|
|
1245
|
-
args: [{ selector: '[teta-x-axis]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1246
|
-
AsyncPipe,
|
|
1247
|
-
], template: "@if ({x: x | async, ticks: ticks | async}; as data) {\n @for (tick of data.ticks; track tick) {\n <svg:g text-anchor=\"middle\" [attr.transform]=\"'translate('+ data.x(tick) +', 0)'\">\n <text fill=\"var(--color-text-70)\" [attr.dy]=\"axis.options.opposite ? '-0.71em' : '0.71em'\"\n [attr.y]=\"axis.options.opposite ? 0 : 9\">\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.y2]=\"axis.options.opposite ? -6 : 6\"></line>\n </svg:g>\n }\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text fill=\"var(--color-text-70)\" text-anchor=\"middle\" dominant-baseline=\"middle\">\n {{ axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"] }]
|
|
1201
|
+
args: [{ selector: '[teta-x-axis]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({x: x | async, ticks: ticks | async}; as data) { @for (tick of data.ticks; track tick) {\n<svg:g text-anchor=\"middle\" [attr.transform]=\"'translate(' + data.x(tick) + ', 0)'\">\n <text\n fill=\"var(--color-text-70)\"\n [attr.dy]=\"axis.options.opposite ? '-0.71em' : '0.71em'\"\n [attr.y]=\"axis.options.opposite ? 0 : 9\"\n >\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.y2]=\"axis.options.opposite ? -6 : 6\"></line>\n</svg:g>\n}\n<svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text fill=\"var(--color-text-70)\" text-anchor=\"middle\" dominant-baseline=\"middle\">\n {{ axis.options.title }}\n </text>\n</svg:g>\n}\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"] }]
|
|
1248
1202
|
}], ctorParameters: () => [{ type: ScaleService }, { type: ChartService }], propDecorators: { axis: [{
|
|
1249
1203
|
type: Input
|
|
1250
1204
|
}], size: [{
|
|
@@ -1311,9 +1265,7 @@ class ZoomableDirective {
|
|
|
1311
1265
|
}
|
|
1312
1266
|
ngOnInit() {
|
|
1313
1267
|
if (this.axis?.options?.zoom || this.config?.zoom?.enable) {
|
|
1314
|
-
this.zoomable =
|
|
1315
|
-
this.config?.zoom?.zoomBehavior === ZoomBehaviorType.move &&
|
|
1316
|
-
!this.config?.tooltip?.showCrosshair;
|
|
1268
|
+
this.zoomable = this.config?.zoom?.zoomBehavior === ZoomBehaviorType.move && !this.config?.tooltip?.showCrosshair;
|
|
1317
1269
|
this.crosshair = this.config?.tooltip?.showCrosshair;
|
|
1318
1270
|
}
|
|
1319
1271
|
}
|
|
@@ -1327,9 +1279,7 @@ class ZoomableDirective {
|
|
|
1327
1279
|
this.alive = false;
|
|
1328
1280
|
}
|
|
1329
1281
|
initZoomSync() {
|
|
1330
|
-
this.zoomService.zoomed
|
|
1331
|
-
.pipe(takeWhile(() => this.alive))
|
|
1332
|
-
.subscribe((zoomed) => {
|
|
1282
|
+
this.zoomService.zoomed.pipe(takeWhile(() => this.alive)).subscribe((zoomed) => {
|
|
1333
1283
|
if (this._element &&
|
|
1334
1284
|
this.elementRef !== zoomed?.element &&
|
|
1335
1285
|
zoomed?.axis?.index === this.axis.index &&
|
|
@@ -1348,8 +1298,7 @@ class ZoomableDirective {
|
|
|
1348
1298
|
});
|
|
1349
1299
|
}
|
|
1350
1300
|
initZoomListeners() {
|
|
1351
|
-
const enable = (this.axis?.options?.zoom && this.axis?.options.visible !== false) ||
|
|
1352
|
-
this.config?.zoom?.enable;
|
|
1301
|
+
const enable = (this.axis?.options?.zoom && this.axis?.options.visible !== false) || this.config?.zoom?.enable;
|
|
1353
1302
|
if (!enable) {
|
|
1354
1303
|
return;
|
|
1355
1304
|
}
|
|
@@ -1358,21 +1307,15 @@ class ZoomableDirective {
|
|
|
1358
1307
|
[0, 0],
|
|
1359
1308
|
[this.size.width, this.size.height],
|
|
1360
1309
|
]);
|
|
1361
|
-
const min = this.config?.zoom?.minTranslate != null
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
const max = this.config?.zoom?.maxTranslate != null
|
|
1365
|
-
? this.axis.scale(this.config?.zoom?.maxTranslate)
|
|
1366
|
-
: Infinity;
|
|
1367
|
-
if (this.axis.orientation === AxisOrientation.x &&
|
|
1368
|
-
this.config.zoom.type === ZoomType.x) {
|
|
1310
|
+
const min = this.config?.zoom?.minTranslate != null ? this.axis.scale(this.config?.zoom?.minTranslate) : -Infinity;
|
|
1311
|
+
const max = this.config?.zoom?.maxTranslate != null ? this.axis.scale(this.config?.zoom?.maxTranslate) : Infinity;
|
|
1312
|
+
if (this.axis.orientation === AxisOrientation.x && this.config.zoom.type === ZoomType.x) {
|
|
1369
1313
|
this.zoom.translateExtent([
|
|
1370
1314
|
[Math.min(min, max), -Infinity],
|
|
1371
1315
|
[Math.max(min, max), Infinity],
|
|
1372
1316
|
]);
|
|
1373
1317
|
}
|
|
1374
|
-
if (this.axis.orientation === AxisOrientation.y &&
|
|
1375
|
-
this.config.zoom.type === ZoomType.y) {
|
|
1318
|
+
if (this.axis.orientation === AxisOrientation.y && this.config.zoom.type === ZoomType.y) {
|
|
1376
1319
|
this.zoom.translateExtent([
|
|
1377
1320
|
[-Infinity, Math.min(min, max)],
|
|
1378
1321
|
[Infinity, Math.max(min, max)],
|
|
@@ -1391,9 +1334,7 @@ class ZoomableDirective {
|
|
|
1391
1334
|
: this.config.zoom?.limitZoomByData
|
|
1392
1335
|
? 1
|
|
1393
1336
|
: 0;
|
|
1394
|
-
const minZoom = this.config.zoom?.min
|
|
1395
|
-
? (extremes[1] - extremes[0]) / this.config.zoom?.min
|
|
1396
|
-
: Infinity;
|
|
1337
|
+
const minZoom = this.config.zoom?.min ? (extremes[1] - extremes[0]) / this.config.zoom?.min : Infinity;
|
|
1397
1338
|
this.zoom.scaleExtent([maxZoom, minZoom]);
|
|
1398
1339
|
}
|
|
1399
1340
|
if (this.config?.zoom?.zoomBehavior === ZoomBehaviorType.wheel) {
|
|
@@ -1407,22 +1348,17 @@ class ZoomableDirective {
|
|
|
1407
1348
|
this.zoom.on('start zoom end', this.zoomed);
|
|
1408
1349
|
this._element?.call(this.zoom);
|
|
1409
1350
|
this.zoom
|
|
1410
|
-
.filter(event => {
|
|
1411
|
-
return (
|
|
1412
|
-
Boolean(window.TouchEvent && event.type !== 'wheel'));
|
|
1351
|
+
.filter((event) => {
|
|
1352
|
+
return (event.ctrlKey && event.type === 'wheel') || Boolean(window.TouchEvent && event.type !== 'wheel');
|
|
1413
1353
|
})
|
|
1414
|
-
.wheelDelta(event => {
|
|
1354
|
+
.wheelDelta((event) => {
|
|
1415
1355
|
const delta = this.config?.zoom.type === ZoomType.x ? -event.deltaX : -event.deltaY;
|
|
1416
1356
|
return delta * 0.002;
|
|
1417
1357
|
});
|
|
1418
1358
|
const emit = (type, event) => {
|
|
1419
1359
|
const origin = this.axis.scale.copy().domain(this.axis.originDomain);
|
|
1420
1360
|
let transform = zoomIdentity;
|
|
1421
|
-
const delta = type === 'end'
|
|
1422
|
-
? 0
|
|
1423
|
-
: this.axis.orientation === AxisOrientation.y
|
|
1424
|
-
? event.deltaY
|
|
1425
|
-
: event.deltaX;
|
|
1361
|
+
const delta = type === 'end' ? 0 : this.axis.orientation === AxisOrientation.y ? event.deltaY : event.deltaX;
|
|
1426
1362
|
if (this.axis.orientation === AxisOrientation.y) {
|
|
1427
1363
|
transform = transform.translate(0, this.currentTransform.y - delta / 2);
|
|
1428
1364
|
}
|
|
@@ -1433,9 +1369,7 @@ class ZoomableDirective {
|
|
|
1433
1369
|
let domain = this.axis.orientation === AxisOrientation.y
|
|
1434
1370
|
? transform.rescaleY(origin).domain()
|
|
1435
1371
|
: transform.rescaleX(origin).domain();
|
|
1436
|
-
const extent = this.axis.options?.inverted
|
|
1437
|
-
? domain
|
|
1438
|
-
: [...domain].reverse();
|
|
1372
|
+
const extent = this.axis.options?.inverted ? domain : [...domain].reverse();
|
|
1439
1373
|
if (extent[0] <= this.config.zoom?.minTranslate) {
|
|
1440
1374
|
return;
|
|
1441
1375
|
}
|
|
@@ -1480,7 +1414,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImpor
|
|
|
1480
1414
|
type: Directive,
|
|
1481
1415
|
args: [{
|
|
1482
1416
|
selector: '[tetaZoomable]',
|
|
1483
|
-
standalone: true
|
|
1417
|
+
standalone: true,
|
|
1484
1418
|
}]
|
|
1485
1419
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: ZoomService }, { type: ChartService }, { type: i0.NgZone }], propDecorators: { config: [{
|
|
1486
1420
|
type: Input
|
|
@@ -1514,21 +1448,16 @@ class YAxisComponent {
|
|
|
1514
1448
|
ngOnDestroy() {
|
|
1515
1449
|
this._alive = false;
|
|
1516
1450
|
}
|
|
1517
|
-
ngAfterViewInit() {
|
|
1518
|
-
}
|
|
1451
|
+
ngAfterViewInit() { }
|
|
1519
1452
|
getLabelTransform() {
|
|
1520
|
-
return `translate(${this.axis.options.opposite
|
|
1521
|
-
? this.axis.selfSize
|
|
1522
|
-
: -this.axis.selfSize}, ${this.size.height / 2}) rotate(-90)`;
|
|
1453
|
+
return `translate(${this.axis.options.opposite ? this.axis.selfSize : -this.axis.selfSize}, ${this.size.height / 2}) rotate(-90)`;
|
|
1523
1454
|
}
|
|
1524
1455
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: YAxisComponent, deps: [{ token: ScaleService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1525
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: YAxisComponent, isStandalone: true, selector: "[teta-y-axis]", inputs: { axis: "axis", size: "size" }, ngImport: i0, template: "@if (y | async; as scale) {
|
|
1456
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: YAxisComponent, isStandalone: true, selector: "[teta-y-axis]", inputs: { axis: "axis", size: "size" }, ngImport: i0, template: "@if (y | async; as scale) { @for (tick of scale.ticks(); track tick) {\n<svg:g\n [attr.text-anchor]=\"axis.options.opposite ? 'start' : 'end'\"\n [attr.transform]=\"'translate(0, ' + scale(tick) + ')'\"\n>\n <text fill=\"var(--color-text-70)\" dy=\"0.32em\" [attr.x]=\"axis.options.opposite ? 10 : -9\">\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.x2]=\"axis.options.opposite ? 6 : -6\"></line>\n</svg:g>\n}\n<svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text\n [attr.dy]=\"axis.options.opposite ? '-4px' : '4px'\"\n text-anchor=\"middle\"\n [attr.dominant-baseline]=\"axis.options.opposite ? 'auto' : 'hanging'\"\n >\n {{ axis.options.title }}\n </text>\n</svg:g>\n}\n", styles: [":host{shape-rendering:crispEdges}:host .label-axis{fill:var(--color-text-70)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1526
1457
|
}
|
|
1527
1458
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: YAxisComponent, decorators: [{
|
|
1528
1459
|
type: Component,
|
|
1529
|
-
args: [{ selector: '[teta-y-axis]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1530
|
-
AsyncPipe,
|
|
1531
|
-
], template: "@if (y | async; as scale) {\n @for (tick of scale.ticks(); track tick) {\n <svg:g [attr.text-anchor]=\"axis.options.opposite ? 'start' : 'end'\"\n [attr.transform]=\"'translate(0, '+ scale(tick) +')'\">\n <text fill=\"var(--color-text-70)\" dy=\"0.32em\"\n [attr.x]=\"axis.options.opposite ? 10 : -9\">\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.x2]=\"axis.options.opposite ? 6 : -6\"></line>\n </svg:g>\n }\n <svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text [attr.dy]=\"axis.options.opposite ? '-4px' : '4px'\" text-anchor=\"middle\"\n [attr.dominant-baseline]=\"axis.options.opposite ? 'auto' : 'hanging'\">\n {{ axis.options.title }}\n </text>\n </svg:g>\n}\n", styles: [":host{shape-rendering:crispEdges}:host .label-axis{fill:var(--color-text-70)}\n"] }]
|
|
1460
|
+
args: [{ selector: '[teta-y-axis]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if (y | async; as scale) { @for (tick of scale.ticks(); track tick) {\n<svg:g\n [attr.text-anchor]=\"axis.options.opposite ? 'start' : 'end'\"\n [attr.transform]=\"'translate(0, ' + scale(tick) + ')'\"\n>\n <text fill=\"var(--color-text-70)\" dy=\"0.32em\" [attr.x]=\"axis.options.opposite ? 10 : -9\">\n {{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}\n </text>\n <line stroke=\"var(--color-text-30)\" [attr.x2]=\"axis.options.opposite ? 6 : -6\"></line>\n</svg:g>\n}\n<svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text\n [attr.dy]=\"axis.options.opposite ? '-4px' : '4px'\"\n text-anchor=\"middle\"\n [attr.dominant-baseline]=\"axis.options.opposite ? 'auto' : 'hanging'\"\n >\n {{ axis.options.title }}\n </text>\n</svg:g>\n}\n", styles: [":host{shape-rendering:crispEdges}:host .label-axis{fill:var(--color-text-70)}\n"] }]
|
|
1532
1461
|
}], ctorParameters: () => [{ type: ScaleService }], propDecorators: { axis: [{
|
|
1533
1462
|
type: Input
|
|
1534
1463
|
}], size: [{
|
|
@@ -1543,8 +1472,7 @@ class PlotBand {
|
|
|
1543
1472
|
this.from = options?.from;
|
|
1544
1473
|
this.to = options?.to;
|
|
1545
1474
|
this.label = options?.label;
|
|
1546
|
-
this.showGrabbers =
|
|
1547
|
-
options?.showGrabbers != null ? options.showGrabbers : true;
|
|
1475
|
+
this.showGrabbers = options?.showGrabbers != null ? options.showGrabbers : true;
|
|
1548
1476
|
this.draggable = options?.draggable != null ? options?.draggable : false;
|
|
1549
1477
|
this.resizable = options?.resizable != null ? options?.resizable : true;
|
|
1550
1478
|
this.min = options?.min;
|
|
@@ -1591,12 +1519,8 @@ class PlotBandComponent {
|
|
|
1591
1519
|
let [min, max] = this.scale.domain();
|
|
1592
1520
|
min = min instanceof Date ? min.getTime() : min;
|
|
1593
1521
|
max = max instanceof Date ? max.getTime() : max;
|
|
1594
|
-
const from = this.plotBand.from instanceof Date
|
|
1595
|
-
|
|
1596
|
-
: this.plotBand.from;
|
|
1597
|
-
const to = this.plotBand.to instanceof Date
|
|
1598
|
-
? this.plotBand.to.getTime()
|
|
1599
|
-
: this.plotBand.to;
|
|
1522
|
+
const from = this.plotBand.from instanceof Date ? this.plotBand.from.getTime() : this.plotBand.from;
|
|
1523
|
+
const to = this.plotBand.to instanceof Date ? this.plotBand.to.getTime() : this.plotBand.to;
|
|
1600
1524
|
const position = ((from <= min ? min : from) + (to >= max ? max : to)) / 2;
|
|
1601
1525
|
return this.scale(position);
|
|
1602
1526
|
};
|
|
@@ -1605,12 +1529,8 @@ class PlotBandComponent {
|
|
|
1605
1529
|
this.chartService.emitPlotband(event);
|
|
1606
1530
|
}
|
|
1607
1531
|
ngAfterViewInit() {
|
|
1608
|
-
const plotbandElement = d3
|
|
1609
|
-
|
|
1610
|
-
.select('.plotband');
|
|
1611
|
-
const grabElements = d3
|
|
1612
|
-
.select(this.element.nativeElement)
|
|
1613
|
-
.selectAll('.grabber');
|
|
1532
|
+
const plotbandElement = d3.select(this.element.nativeElement).select('.plotband');
|
|
1533
|
+
const grabElements = d3.select(this.element.nativeElement).selectAll('.grabber');
|
|
1614
1534
|
this.dragElements = d3.drag().subject(() => {
|
|
1615
1535
|
if (this.axis.orientation === AxisOrientation.x) {
|
|
1616
1536
|
return { x: plotbandElement.attr('x') };
|
|
@@ -1686,11 +1606,11 @@ class PlotBandComponent {
|
|
|
1686
1606
|
return d.style.plotBand?.fill;
|
|
1687
1607
|
}
|
|
1688
1608
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: PlotBandComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1689
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: PlotBandComponent, isStandalone: true, selector: "[teta-plot-band]", inputs: { plotBand: "plotBand", axis: "axis", scale: "scale", size: "size" }, host: { listeners: { "click": "click($event)", "contextmenu": "contextMenu($event)" } }, ngImport: i0, template: "<svg:rect\n class
|
|
1609
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: PlotBandComponent, isStandalone: true, selector: "[teta-plot-band]", inputs: { plotBand: "plotBand", axis: "axis", scale: "scale", size: "size" }, host: { listeners: { "click": "click($event)", "contextmenu": "contextMenu($event)" } }, ngImport: i0, template: "<svg:rect\n class=\"plotband\"\n xmlns:svg=\"http://www.w3.org/1999/html\"\n [class.draggable]=\"plotBand?.draggable === true\"\n [attr.fill]=\"getFill(plotBand)\"\n [attr.opacity]=\"plotBand.style?.plotBand?.opacity\"\n [attr.height]=\"axis.orientation === orientation.x ? height : bandSize\"\n [attr.width]=\"axis.orientation === orientation.x ? bandSize : width\"\n [attr.y]=\"axis.orientation === orientation.y ? (axis.options.inverted === true ? from : to) : null\"\n [attr.x]=\"axis.orientation === orientation.x ? (axis.options.inverted === true ? to : from) : null\"\n></svg:rect>\n@if (axis.orientation === orientation.x) {\n<svg:text\n text-anchor=\"middle\"\n dominant-baseline=\"middle\"\n class=\"label font-caption fill-text-90\"\n [attr.x]=\"getTextPosition()\"\n [attr.transform]=\"'rotate(-90, ' + getTextPosition() + ',' + height / 2 + ')'\"\n [attr.y]=\"height / 2\"\n>\n {{ plotBand.label }}\n</svg:text>\n} @if (axis.orientation === orientation.y) {\n<svg:text\n text-anchor=\"middle\"\n class=\"label font-caption fill-text-90\"\n dominant-baseline=\"central\"\n [attr.x]=\"getTextPosition()\"\n [attr.y]=\"width / 2\"\n>\n {{ plotBand.label }}\n</svg:text>\n} @if (plotBand.resizable) { @if (plotBand.showGrabbers) {\n<svg:line\n class=\"display-grabber\"\n [attr.stroke]=\"plotBand.style?.grabbers?.stroke || 'var(--color-text-50)'\"\n [attr.stroke-width]=\"plotBand.style?.grabbers?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotBand.style?.grabbers?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? from : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? from : width\"\n [attr.data-grabber]=\"'from'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : from\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : from\"\n></svg:line>\n<svg:line\n class=\"display-grabber\"\n [attr.stroke]=\"plotBand.style?.grabbers?.stroke || 'var(--color-text-50)'\"\n [attr.stroke-width]=\"plotBand.style?.grabbers?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotBand.style?.grabbers?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? to : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? to : width\"\n [attr.data-grabber]=\"'to'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : to\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : to\"\n></svg:line>\n}\n<svg:line\n class=\"grabber\"\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [class.resizeable]=\"plotBand?.resizable\"\n [attr.stroke]=\"plotBand.style?.grabbers?.stroke || 'var(--color-text-50)'\"\n [attr.stroke-width]=\"8\"\n [style.transform]=\"axis.orientation === orientation.x ? 'translateX(2px)' : 'translateY(2px)'\"\n [attr.x1]=\"axis.orientation === orientation.x ? from : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? from : width\"\n [attr.data-grabber]=\"'from'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : from\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : from\"\n></svg:line>\n<svg:line\n class=\"grabber\"\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [class.resizeable]=\"plotBand?.resizable\"\n [attr.stroke]=\"plotBand.style?.grabbers?.stroke || 'var(--color-text-50)'\"\n [attr.stroke-width]=\"8\"\n [style.transform]=\"axis.orientation === orientation.x ? 'translateX(-2px)' : 'translateY(-2px)'\"\n [attr.x1]=\"axis.orientation === orientation.x ? to : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? to : width\"\n [attr.data-grabber]=\"'to'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : to\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : to\"\n></svg:line>\n}\n", styles: [":host .draggable rect:hover{cursor:grab}:host .draggable rect:active{cursor:grabbing}:host .x-grabber.resizeable{cursor:col-resize}:host .y-grabber.resizeable{cursor:row-resize}:host:hover .grabber{opacity:.1}.grabber{opacity:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1690
1610
|
}
|
|
1691
1611
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: PlotBandComponent, decorators: [{
|
|
1692
1612
|
type: Component,
|
|
1693
|
-
args: [{ selector: '[teta-plot-band]', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:rect\n class
|
|
1613
|
+
args: [{ selector: '[teta-plot-band]', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:rect\n class=\"plotband\"\n xmlns:svg=\"http://www.w3.org/1999/html\"\n [class.draggable]=\"plotBand?.draggable === true\"\n [attr.fill]=\"getFill(plotBand)\"\n [attr.opacity]=\"plotBand.style?.plotBand?.opacity\"\n [attr.height]=\"axis.orientation === orientation.x ? height : bandSize\"\n [attr.width]=\"axis.orientation === orientation.x ? bandSize : width\"\n [attr.y]=\"axis.orientation === orientation.y ? (axis.options.inverted === true ? from : to) : null\"\n [attr.x]=\"axis.orientation === orientation.x ? (axis.options.inverted === true ? to : from) : null\"\n></svg:rect>\n@if (axis.orientation === orientation.x) {\n<svg:text\n text-anchor=\"middle\"\n dominant-baseline=\"middle\"\n class=\"label font-caption fill-text-90\"\n [attr.x]=\"getTextPosition()\"\n [attr.transform]=\"'rotate(-90, ' + getTextPosition() + ',' + height / 2 + ')'\"\n [attr.y]=\"height / 2\"\n>\n {{ plotBand.label }}\n</svg:text>\n} @if (axis.orientation === orientation.y) {\n<svg:text\n text-anchor=\"middle\"\n class=\"label font-caption fill-text-90\"\n dominant-baseline=\"central\"\n [attr.x]=\"getTextPosition()\"\n [attr.y]=\"width / 2\"\n>\n {{ plotBand.label }}\n</svg:text>\n} @if (plotBand.resizable) { @if (plotBand.showGrabbers) {\n<svg:line\n class=\"display-grabber\"\n [attr.stroke]=\"plotBand.style?.grabbers?.stroke || 'var(--color-text-50)'\"\n [attr.stroke-width]=\"plotBand.style?.grabbers?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotBand.style?.grabbers?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? from : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? from : width\"\n [attr.data-grabber]=\"'from'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : from\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : from\"\n></svg:line>\n<svg:line\n class=\"display-grabber\"\n [attr.stroke]=\"plotBand.style?.grabbers?.stroke || 'var(--color-text-50)'\"\n [attr.stroke-width]=\"plotBand.style?.grabbers?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotBand.style?.grabbers?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? to : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? to : width\"\n [attr.data-grabber]=\"'to'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : to\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : to\"\n></svg:line>\n}\n<svg:line\n class=\"grabber\"\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [class.resizeable]=\"plotBand?.resizable\"\n [attr.stroke]=\"plotBand.style?.grabbers?.stroke || 'var(--color-text-50)'\"\n [attr.stroke-width]=\"8\"\n [style.transform]=\"axis.orientation === orientation.x ? 'translateX(2px)' : 'translateY(2px)'\"\n [attr.x1]=\"axis.orientation === orientation.x ? from : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? from : width\"\n [attr.data-grabber]=\"'from'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : from\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : from\"\n></svg:line>\n<svg:line\n class=\"grabber\"\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [class.resizeable]=\"plotBand?.resizable\"\n [attr.stroke]=\"plotBand.style?.grabbers?.stroke || 'var(--color-text-50)'\"\n [attr.stroke-width]=\"8\"\n [style.transform]=\"axis.orientation === orientation.x ? 'translateX(-2px)' : 'translateY(-2px)'\"\n [attr.x1]=\"axis.orientation === orientation.x ? to : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? to : width\"\n [attr.data-grabber]=\"'to'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : to\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : to\"\n></svg:line>\n}\n", styles: [":host .draggable rect:hover{cursor:grab}:host .draggable rect:active{cursor:grabbing}:host .x-grabber.resizeable{cursor:col-resize}:host .y-grabber.resizeable{cursor:row-resize}:host:hover .grabber{opacity:.1}.grabber{opacity:0}\n"] }]
|
|
1694
1614
|
}], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }], propDecorators: { plotBand: [{
|
|
1695
1615
|
type: Input
|
|
1696
1616
|
}], axis: [{
|
|
@@ -1715,26 +1635,27 @@ class GridlinesComponent {
|
|
|
1715
1635
|
this.tickYValues = this.svc.scales.pipe(withLatestFrom(this.config), map((_) => {
|
|
1716
1636
|
const [scales, config] = _;
|
|
1717
1637
|
const ratio = this.size.height / 40;
|
|
1718
|
-
return config.gridLines?.y?.ticksCount != null
|
|
1638
|
+
return config.gridLines?.y?.ticksCount != null
|
|
1639
|
+
? generateTicks(scales.y.get(0).scale.domain(), config.gridLines?.y?.ticksCount)
|
|
1640
|
+
: scales.y.get(0)?.scale.ticks(ratio);
|
|
1719
1641
|
}));
|
|
1720
1642
|
this.tickXValues = this.svc.scales.pipe(withLatestFrom(this.config), map((_) => {
|
|
1721
1643
|
const [scales, config] = _;
|
|
1722
1644
|
const ratio = this.size.width / 40;
|
|
1723
|
-
return config.gridLines?.x?.ticksCount != null
|
|
1645
|
+
return config.gridLines?.x?.ticksCount != null
|
|
1646
|
+
? generateTicks(scales.x.get(0).originDomain, config.gridLines?.x?.ticksCount)
|
|
1647
|
+
: scales.x.get(0)?.scale.ticks(ratio);
|
|
1724
1648
|
}));
|
|
1725
1649
|
this.y = this.svc.scales.pipe(map((_) => _.y.get(0)?.scale));
|
|
1726
1650
|
this.x = this.svc.scales.pipe(map((_) => _.x.get(0)?.scale));
|
|
1727
1651
|
}
|
|
1728
|
-
ngAfterViewInit() {
|
|
1729
|
-
}
|
|
1652
|
+
ngAfterViewInit() { }
|
|
1730
1653
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: GridlinesComponent, deps: [{ token: ScaleService }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1731
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: GridlinesComponent, isStandalone: true, selector: "[teta-gridlines]", inputs: { size: "size" }, ngImport: i0, template: "@if ({
|
|
1654
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: GridlinesComponent, isStandalone: true, selector: "[teta-gridlines]", inputs: { size: "size" }, ngImport: i0, template: "@if ({ xValues: tickXValues | async, yValues: tickYValues | async, x: x | async, y: y | async, config: config | async };\nas data) { @if (data.y && data.config.gridLines?.showY !== false) { @for (tick of data.yValues; track tick) {\n<svg:line [attr.x1]=\"0\" [attr.y1]=\"data.y(tick) || 1\" [attr.x2]=\"size?.width\" [attr.y2]=\"data.y(tick) || 1\"></svg:line>\n} } @if (data.x && data.config.gridLines?.showX !== false) { @for (tick of data.xValues; track tick) {\n<svg:line [attr.x1]=\"data.x(tick) || 1\" [attr.y1]=\"0\" [attr.x2]=\"data.x(tick) || 1\" [attr.y2]=\"size?.height\"></svg:line>\n} } }\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke:var(--color-text-5)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1732
1655
|
}
|
|
1733
1656
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: GridlinesComponent, decorators: [{
|
|
1734
1657
|
type: Component,
|
|
1735
|
-
args: [{ selector: '[teta-gridlines]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1736
|
-
AsyncPipe,
|
|
1737
|
-
], template: "@if ({\n xValues: tickXValues | async,\n yValues: tickYValues | async,\n x: x | async,\n y: y | async,\n config: config | async\n}; as data) {\n @if (data.y && data.config.gridLines?.showY !== false) {\n @for (tick of data.yValues; track tick) {\n <svg:line [attr.x1]=\"0\"\n [attr.y1]=\"data.y(tick) || 1\"\n [attr.x2]=\"size?.width\"\n [attr.y2]=\"data.y(tick) || 1\"></svg:line>\n }\n }\n @if (data.x && data.config.gridLines?.showX !== false) {\n @for (tick of data.xValues; track tick) {\n <svg:line [attr.x1]=\"data.x(tick) || 1\"\n [attr.y1]=\"0\"\n [attr.x2]=\"data.x(tick) || 1\"\n [attr.y2]=\"size?.height\"></svg:line>\n }\n }\n}\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke:var(--color-text-5)}\n"] }]
|
|
1658
|
+
args: [{ selector: '[teta-gridlines]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ xValues: tickXValues | async, yValues: tickYValues | async, x: x | async, y: y | async, config: config | async };\nas data) { @if (data.y && data.config.gridLines?.showY !== false) { @for (tick of data.yValues; track tick) {\n<svg:line [attr.x1]=\"0\" [attr.y1]=\"data.y(tick) || 1\" [attr.x2]=\"size?.width\" [attr.y2]=\"data.y(tick) || 1\"></svg:line>\n} } @if (data.x && data.config.gridLines?.showX !== false) { @for (tick of data.xValues; track tick) {\n<svg:line [attr.x1]=\"data.x(tick) || 1\" [attr.y1]=\"0\" [attr.x2]=\"data.x(tick) || 1\" [attr.y2]=\"size?.height\"></svg:line>\n} } }\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke:var(--color-text-5)}\n"] }]
|
|
1738
1659
|
}], ctorParameters: () => [{ type: ScaleService }, { type: ChartService }], propDecorators: { size: [{
|
|
1739
1660
|
type: Input
|
|
1740
1661
|
}] } });
|
|
@@ -1742,11 +1663,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImpor
|
|
|
1742
1663
|
class LinearSeriesBase extends SeriesBaseComponent {
|
|
1743
1664
|
set series(series) {
|
|
1744
1665
|
this.__series = series;
|
|
1745
|
-
this.markers = this.__series.data?.filter(_ => _?.marker &&
|
|
1746
|
-
_?.x !== undefined &&
|
|
1747
|
-
_?.y !== undefined &&
|
|
1748
|
-
_?.x !== null &&
|
|
1749
|
-
_?.y !== null);
|
|
1666
|
+
this.markers = this.__series.data?.filter((_) => _?.marker && _?.x !== undefined && _?.y !== undefined && _?.x !== null && _?.y !== null);
|
|
1750
1667
|
}
|
|
1751
1668
|
get series() {
|
|
1752
1669
|
return this.__series;
|
|
@@ -1802,14 +1719,14 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1802
1719
|
const filter = this.defaultClipPointsMapping.get(this.series.clipPointsDirection);
|
|
1803
1720
|
const line = d3
|
|
1804
1721
|
.line()
|
|
1805
|
-
.defined(point => point.x !== null &&
|
|
1722
|
+
.defined((point) => point.x !== null &&
|
|
1806
1723
|
point.y !== null &&
|
|
1807
1724
|
point.x !== undefined &&
|
|
1808
1725
|
point.y !== undefined &&
|
|
1809
1726
|
!isNaN(point.x) &&
|
|
1810
1727
|
!isNaN(point.y))
|
|
1811
|
-
.x(point => this.x(point.x))
|
|
1812
|
-
.y(point => this.y(point.y));
|
|
1728
|
+
.x((point) => this.x(point.x))
|
|
1729
|
+
.y((point) => this.y(point.y));
|
|
1813
1730
|
let filteredData = this.series.data;
|
|
1814
1731
|
if (this.series.clipPointsDirection === ClipPointsDirection.x) {
|
|
1815
1732
|
let [min, max] = this.x.domain();
|
|
@@ -1847,12 +1764,8 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1847
1764
|
s2_x = p3_x - p2_x;
|
|
1848
1765
|
s2_y = p3_y - p2_y;
|
|
1849
1766
|
let s, t;
|
|
1850
|
-
s =
|
|
1851
|
-
|
|
1852
|
-
(-s2_x * s1_y + s1_x * s2_y);
|
|
1853
|
-
t =
|
|
1854
|
-
(s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) /
|
|
1855
|
-
(-s2_x * s1_y + s1_x * s2_y);
|
|
1767
|
+
s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / (-s2_x * s1_y + s1_x * s2_y);
|
|
1768
|
+
t = (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / (-s2_x * s1_y + s1_x * s2_y);
|
|
1856
1769
|
if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
|
|
1857
1770
|
// Collision detected
|
|
1858
1771
|
rV.x = p0_x + t * s1_x;
|
|
@@ -1872,12 +1785,7 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1872
1785
|
const intersect = lineIntersection(pointer, range[0], pointer, Number.MAX_SAFE_INTEGER, scaleX(this.series.data[rightId - 1]?.x), scaleY(this.series.data[rightId - 1]?.y), scaleX(this.series.data[rightId]?.x), scaleY(this.series.data[rightId]?.y));
|
|
1873
1786
|
const x = scaleX.invert(intersect.x);
|
|
1874
1787
|
const y = scaleY.invert(intersect.y);
|
|
1875
|
-
if (x !== null &&
|
|
1876
|
-
x !== undefined &&
|
|
1877
|
-
!isNaN(x) &&
|
|
1878
|
-
y !== null &&
|
|
1879
|
-
y !== undefined &&
|
|
1880
|
-
!isNaN(y)) {
|
|
1788
|
+
if (x !== null && x !== undefined && !isNaN(x) && y !== null && y !== undefined && !isNaN(y)) {
|
|
1881
1789
|
this.svc.setTooltip({
|
|
1882
1790
|
point: {
|
|
1883
1791
|
x: scaleX.invert(intersect.x),
|
|
@@ -1908,12 +1816,7 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1908
1816
|
const intersect = lineIntersection(range[0], mouse[1], Number.MAX_SAFE_INTEGER, mouse[1], scaleX(this.series.data[rightId - 1]?.x), scaleY(this.series.data[rightId - 1]?.y), scaleX(this.series.data[rightId]?.x), scaleY(this.series.data[rightId]?.y));
|
|
1909
1817
|
const x = scaleX.invert(intersect.x);
|
|
1910
1818
|
const y = scaleY.invert(intersect.y);
|
|
1911
|
-
if (x !== null &&
|
|
1912
|
-
x !== undefined &&
|
|
1913
|
-
!isNaN(x) &&
|
|
1914
|
-
y !== null &&
|
|
1915
|
-
y !== undefined &&
|
|
1916
|
-
!isNaN(y)) {
|
|
1819
|
+
if (x !== null && x !== undefined && !isNaN(x) && y !== null && y !== undefined && !isNaN(y)) {
|
|
1917
1820
|
this.svc.setTooltip({
|
|
1918
1821
|
point: {
|
|
1919
1822
|
x: scaleX.invert(intersect.x),
|
|
@@ -1970,7 +1873,7 @@ class DraggablePointDirective {
|
|
|
1970
1873
|
event.preventDefault();
|
|
1971
1874
|
this.startPosition = {
|
|
1972
1875
|
x: event.x,
|
|
1973
|
-
y: event.y
|
|
1876
|
+
y: event.y,
|
|
1974
1877
|
};
|
|
1975
1878
|
this.moveStart.emit(this.startPosition);
|
|
1976
1879
|
}
|
|
@@ -1984,12 +1887,13 @@ class DraggablePointDirective {
|
|
|
1984
1887
|
if (this.dragDirection === DragPointType.y) {
|
|
1985
1888
|
deltaX = 0;
|
|
1986
1889
|
}
|
|
1987
|
-
if (this.allowDrag &&
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1890
|
+
if (this.allowDrag &&
|
|
1891
|
+
!this.allowDrag({
|
|
1892
|
+
x: event.x,
|
|
1893
|
+
y: event.y,
|
|
1894
|
+
deltaX,
|
|
1895
|
+
deltaY,
|
|
1896
|
+
})) {
|
|
1993
1897
|
this.startPosition = null;
|
|
1994
1898
|
return;
|
|
1995
1899
|
}
|
|
@@ -2000,14 +1904,14 @@ class DraggablePointDirective {
|
|
|
2000
1904
|
else {
|
|
2001
1905
|
this.transformCache = {
|
|
2002
1906
|
x: deltaX,
|
|
2003
|
-
y: deltaY
|
|
1907
|
+
y: deltaY,
|
|
2004
1908
|
};
|
|
2005
1909
|
}
|
|
2006
1910
|
this.moveEnd.emit({
|
|
2007
1911
|
x: event.x,
|
|
2008
1912
|
y: event.y,
|
|
2009
1913
|
deltaX,
|
|
2010
|
-
deltaY
|
|
1914
|
+
deltaY,
|
|
2011
1915
|
});
|
|
2012
1916
|
}
|
|
2013
1917
|
this.startPosition = null;
|
|
@@ -2020,12 +1924,13 @@ class DraggablePointDirective {
|
|
|
2020
1924
|
deltaX = this.transformCache.x + deltaX;
|
|
2021
1925
|
deltaY = this.transformCache.y + deltaY;
|
|
2022
1926
|
}
|
|
2023
|
-
if (this.allowDrag &&
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
1927
|
+
if (this.allowDrag &&
|
|
1928
|
+
!this.allowDrag({
|
|
1929
|
+
x: event.x,
|
|
1930
|
+
y: event.y,
|
|
1931
|
+
deltaX,
|
|
1932
|
+
deltaY,
|
|
1933
|
+
})) {
|
|
2029
1934
|
return;
|
|
2030
1935
|
}
|
|
2031
1936
|
if (this.dragDirection === DragPointType.x) {
|
|
@@ -2041,7 +1946,7 @@ class DraggablePointDirective {
|
|
|
2041
1946
|
x: event.x,
|
|
2042
1947
|
y: event.y,
|
|
2043
1948
|
deltaX,
|
|
2044
|
-
deltaY
|
|
1949
|
+
deltaY,
|
|
2045
1950
|
});
|
|
2046
1951
|
}
|
|
2047
1952
|
}
|
|
@@ -2060,7 +1965,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImpor
|
|
|
2060
1965
|
args: [{
|
|
2061
1966
|
selector: '[tetaDraggablePoint]',
|
|
2062
1967
|
exportAs: 'tetaDraggablePoint',
|
|
2063
|
-
standalone: true
|
|
1968
|
+
standalone: true,
|
|
2064
1969
|
}]
|
|
2065
1970
|
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { tetaDraggablePoint: [{
|
|
2066
1971
|
type: Input
|
|
@@ -2137,7 +2042,7 @@ class LineSeriesComponent extends LinearSeriesBase {
|
|
|
2137
2042
|
this._update.next();
|
|
2138
2043
|
const emitEvent = {
|
|
2139
2044
|
type: 'end',
|
|
2140
|
-
sourceEvent: event
|
|
2045
|
+
sourceEvent: event,
|
|
2141
2046
|
};
|
|
2142
2047
|
this.svc.emitPoint({
|
|
2143
2048
|
target: {
|
|
@@ -2153,7 +2058,7 @@ class LineSeriesComponent extends LinearSeriesBase {
|
|
|
2153
2058
|
this._update.next();
|
|
2154
2059
|
const emitEvent = {
|
|
2155
2060
|
type: 'drag',
|
|
2156
|
-
sourceEvent: event
|
|
2061
|
+
sourceEvent: event,
|
|
2157
2062
|
};
|
|
2158
2063
|
this.svc.emitPoint({
|
|
2159
2064
|
target: {
|
|
@@ -2171,14 +2076,11 @@ class LineSeriesComponent extends LinearSeriesBase {
|
|
|
2171
2076
|
label.dy = this.labelStart.dy + event.deltaY;
|
|
2172
2077
|
}
|
|
2173
2078
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: LineSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2174
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: LineSeriesComponent, isStandalone: true, selector: "svg:svg[teta-line-series]", usesInheritance: true, ngImport: i0, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\"
|
|
2079
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: LineSeriesComponent, isStandalone: true, selector: "svg:svg[teta-line-series]", usesInheritance: true, ngImport: i0, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\"\n></svg:path>\n@if (transform | async; as t) { @if (t?.x != null && t?.y != null) {\n<svg:circle r=\"3\" [attr.fill]=\"series.color\" [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n} } @if (markers; as draggablePoints) { @if (x && y) { @for (point of draggablePoints; track point) {\n<svg:g [attr.transform]=\"'translate(' + x(point.x) + ',' + y(point.y) + ')'\">\n <svg:g\n [tetaDraggablePoint]=\"point.marker.draggable\"\n [dragDirection]=\"point.marker.dragType\"\n [allowDrag]=\"allowDrag(point)\"\n #dragPoint=\"tetaDraggablePoint\"\n (moveStart)=\"moveStart($event, point)\"\n (moveEnd)=\"moveEnd($event, point); dragPoint.resetTransform()\"\n (moveProcess)=\"moveProcess($event, point); dragPoint.resetTransform()\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n >\n <svg:circle\n class=\"marker\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"0\"\n [attr.cy]=\"0\"\n ></svg:circle>\n @if (point.marker.label?.text) {\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"0\"\n [attr.x2]=\"point.marker.label?.dx\"\n [attr.y2]=\"point.marker.label?.dy\"\n [attr.stroke]=\"point.marker.label?.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"point.marker.label?.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"point.marker.label?.style?.strokeDasharray ?? null\"\n ></svg:line>\n <svg:foreignObject\n [tetaDraggablePoint]=\"point.marker.label?.draggable\"\n [dragDirection]=\"point.marker.label.dragType\"\n #labelPoint=\"tetaDraggablePoint\"\n (moveStart)=\"startLabel($event, point.marker.label)\"\n (moveProcess)=\"moveLabel($event, point.marker.label); labelPoint.resetTransform()\"\n (moveEnd)=\"labelPoint.resetTransform()\"\n [attr.width]=\"annotationNode?.offsetWidth ?? 0\"\n [attr.height]=\"annotationNode?.offsetHeight ?? 0\"\n [attr.x]=\"point.marker.label?.dx\"\n [attr.y]=\"point.marker.label?.dy\"\n class=\"position-absolute\"\n >\n <div\n #annotationNode\n class=\"shadow-2 padding-2\"\n [style.color]=\"'var(--color-text-90)'\"\n [style.background-color]=\"'var(--color-global-bgcard)'\"\n [style.cursor]=\"'move'\"\n style=\"border-radius: 2px; display: inline-block\"\n >\n {{ point.marker.label?.text }}\n </div>\n </svg:foreignObject>\n }\n </svg:g>\n</svg:g>\n} } }\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: DraggablePointDirective, selector: "[tetaDraggablePoint]", inputs: ["tetaDraggablePoint", "dragDirection", "allowDrag"], outputs: ["moveStart", "moveProcess", "moveEnd"], exportAs: ["tetaDraggablePoint"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2175
2080
|
}
|
|
2176
2081
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: LineSeriesComponent, decorators: [{
|
|
2177
2082
|
type: Component,
|
|
2178
|
-
args: [{ selector: 'svg:svg[teta-line-series]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2179
|
-
AsyncPipe,
|
|
2180
|
-
DraggablePointDirective,
|
|
2181
|
-
], template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n@if (transform | async; as t) {\n @if (t?.x != null && t?.y != null) {\n <svg:circle r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\">\n </svg:circle>\n }\n}\n@if (markers; as draggablePoints) {\n @if (x && y) {\n @for (point of draggablePoints; track point) {\n <svg:g\n [attr.transform]=\"'translate(' + x(point.x) + ',' + y(point.y) + ')'\">\n <svg:g [tetaDraggablePoint]=\"point.marker.draggable\"\n [dragDirection]=\"point.marker.dragType\"\n [allowDrag]=\"allowDrag(point)\"\n #dragPoint=\"tetaDraggablePoint\"\n (moveStart)=\"moveStart($event, point)\"\n (moveEnd)=\"moveEnd($event, point);dragPoint.resetTransform();\"\n (moveProcess)=\"moveProcess($event, point);dragPoint.resetTransform();\"\n [class.draggable-marker]=\"point?.marker?.draggable\">\n <svg:circle\n class=\"marker\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"0\"\n [attr.cy]=\"0\">\n </svg:circle>\n @if (point.marker.label?.text) {\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"0\"\n [attr.x2]=\"point.marker.label?.dx\"\n [attr.y2]=\"point.marker.label?.dy\"\n [attr.stroke]=\"point.marker.label?.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"point.marker.label?.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"point.marker.label?.style?.strokeDasharray ?? null\">\n </svg:line>\n <svg:foreignObject\n [tetaDraggablePoint]=\"point.marker.label?.draggable\"\n [dragDirection]=\"point.marker.label.dragType\"\n #labelPoint=\"tetaDraggablePoint\"\n (moveStart)=\"startLabel($event, point.marker.label)\"\n (moveProcess)=\"moveLabel($event, point.marker.label); labelPoint.resetTransform();\"\n (moveEnd)=\"labelPoint.resetTransform();\"\n [attr.width]=\"annotationNode?.offsetWidth ?? 0\"\n [attr.height]=\"annotationNode?.offsetHeight ?? 0\"\n [attr.x]=\"point.marker.label?.dx\"\n [attr.y]=\"point.marker.label?.dy\"\n class=\"position-absolute\">\n <div\n #annotationNode\n class=\"shadow-2 padding-2\"\n [style.color]=\"'var(--color-text-90)'\"\n [style.background-color]=\"'var(--color-global-bgcard)'\"\n [style.cursor]=\"'move'\"\n style=\"border-radius: 2px; display: inline-block;\">\n {{ point.marker.label?.text }}\n </div>\n </svg:foreignObject>\n }\n </svg:g>\n </svg:g>\n }\n }\n}\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
|
|
2083
|
+
args: [{ selector: 'svg:svg[teta-line-series]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe, DraggablePointDirective], template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\"\n></svg:path>\n@if (transform | async; as t) { @if (t?.x != null && t?.y != null) {\n<svg:circle r=\"3\" [attr.fill]=\"series.color\" [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n} } @if (markers; as draggablePoints) { @if (x && y) { @for (point of draggablePoints; track point) {\n<svg:g [attr.transform]=\"'translate(' + x(point.x) + ',' + y(point.y) + ')'\">\n <svg:g\n [tetaDraggablePoint]=\"point.marker.draggable\"\n [dragDirection]=\"point.marker.dragType\"\n [allowDrag]=\"allowDrag(point)\"\n #dragPoint=\"tetaDraggablePoint\"\n (moveStart)=\"moveStart($event, point)\"\n (moveEnd)=\"moveEnd($event, point); dragPoint.resetTransform()\"\n (moveProcess)=\"moveProcess($event, point); dragPoint.resetTransform()\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n >\n <svg:circle\n class=\"marker\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"0\"\n [attr.cy]=\"0\"\n ></svg:circle>\n @if (point.marker.label?.text) {\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"0\"\n [attr.x2]=\"point.marker.label?.dx\"\n [attr.y2]=\"point.marker.label?.dy\"\n [attr.stroke]=\"point.marker.label?.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"point.marker.label?.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"point.marker.label?.style?.strokeDasharray ?? null\"\n ></svg:line>\n <svg:foreignObject\n [tetaDraggablePoint]=\"point.marker.label?.draggable\"\n [dragDirection]=\"point.marker.label.dragType\"\n #labelPoint=\"tetaDraggablePoint\"\n (moveStart)=\"startLabel($event, point.marker.label)\"\n (moveProcess)=\"moveLabel($event, point.marker.label); labelPoint.resetTransform()\"\n (moveEnd)=\"labelPoint.resetTransform()\"\n [attr.width]=\"annotationNode?.offsetWidth ?? 0\"\n [attr.height]=\"annotationNode?.offsetHeight ?? 0\"\n [attr.x]=\"point.marker.label?.dx\"\n [attr.y]=\"point.marker.label?.dy\"\n class=\"position-absolute\"\n >\n <div\n #annotationNode\n class=\"shadow-2 padding-2\"\n [style.color]=\"'var(--color-text-90)'\"\n [style.background-color]=\"'var(--color-global-bgcard)'\"\n [style.cursor]=\"'move'\"\n style=\"border-radius: 2px; display: inline-block\"\n >\n {{ point.marker.label?.text }}\n </div>\n </svg:foreignObject>\n }\n </svg:g>\n</svg:g>\n} } }\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
|
|
2182
2084
|
}], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
|
|
2183
2085
|
|
|
2184
2086
|
class BarSeriesComponent extends SeriesBaseComponent {
|
|
@@ -2200,11 +2102,7 @@ class BarSeriesComponent extends SeriesBaseComponent {
|
|
|
2200
2102
|
const x = _.x.get(this.series.xAxisIndex)?.scale;
|
|
2201
2103
|
const range = x.range();
|
|
2202
2104
|
const domain = this.series.data.map((_) => _.x);
|
|
2203
|
-
return d3
|
|
2204
|
-
.scaleBand()
|
|
2205
|
-
.range([0, range[1]])
|
|
2206
|
-
.domain(domain)
|
|
2207
|
-
.padding(0.1);
|
|
2105
|
+
return d3.scaleBand().range([0, range[1]]).domain(domain).padding(0.1);
|
|
2208
2106
|
}));
|
|
2209
2107
|
this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex)?.scale));
|
|
2210
2108
|
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex)?.scale));
|
|
@@ -2221,19 +2119,16 @@ class BarSeriesComponent extends SeriesBaseComponent {
|
|
|
2221
2119
|
series: this.series,
|
|
2222
2120
|
});
|
|
2223
2121
|
}
|
|
2224
|
-
ngOnChanges(changes) {
|
|
2225
|
-
}
|
|
2122
|
+
ngOnChanges(changes) { }
|
|
2226
2123
|
isNumber(value) {
|
|
2227
2124
|
return typeof value === 'number';
|
|
2228
2125
|
}
|
|
2229
2126
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: BarSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2230
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: BarSeriesComponent, isStandalone: true, selector: "svg:svg[teta-bar-series]", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "@if ({
|
|
2127
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: BarSeriesComponent, isStandalone: true, selector: "svg:svg[teta-bar-series]", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "@if ({ x: x | async, x1: x1 | async, y: y | async, barSeriesCount: barSeriesCount | async }; as data) { @if (data.x &&\ndata.y) { @if (data.barSeriesCount > 1) { @for (point of series.data; track point; ) {\n<svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"data.x(point.x) + ((isNumber(series.id) ? series.id : 0) * data.x1.bandwidth()) / data.barSeriesCount\"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth() / data.barSeriesCount\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"series.color\"\n></svg:rect>\n} } @if (data.barSeriesCount === 1) { @for (point of series.data; track point; ) {\n<svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth()\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"point.color ?? series.color\"\n></svg:rect>\n} } } }\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2231
2128
|
}
|
|
2232
2129
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: BarSeriesComponent, decorators: [{
|
|
2233
2130
|
type: Component,
|
|
2234
|
-
args: [{ selector: 'svg:svg[teta-bar-series]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2235
|
-
AsyncPipe,
|
|
2236
|
-
], template: "@if ({\n x: x | async,\n x1: x1 | async,\n y: y | async,\n barSeriesCount: barSeriesCount | async\n}; as data) {\n @if (data.x && data.y) {\n @if (data.barSeriesCount > 1) {\n @for (point of series.data; track point; ) {\n <svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"data.x(point.x) + ((isNumber(series.id) ? series.id : 0) * data.x1.bandwidth() / data.barSeriesCount)\"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth() / data.barSeriesCount\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"series.color\"\n ></svg:rect>\n }\n }\n @if (data.barSeriesCount === 1) {\n @for (point of series.data; track point; ) {\n <svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth()\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"point.color ?? series.color\"\n ></svg:rect>\n }\n }\n }\n}\n" }]
|
|
2131
|
+
args: [{ selector: 'svg:svg[teta-bar-series]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ x: x | async, x1: x1 | async, y: y | async, barSeriesCount: barSeriesCount | async }; as data) { @if (data.x &&\ndata.y) { @if (data.barSeriesCount > 1) { @for (point of series.data; track point; ) {\n<svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"data.x(point.x) + ((isNumber(series.id) ? series.id : 0) * data.x1.bandwidth()) / data.barSeriesCount\"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth() / data.barSeriesCount\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"series.color\"\n></svg:rect>\n} } @if (data.barSeriesCount === 1) { @for (point of series.data; track point; ) {\n<svg:rect\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"point.y > 0 ? data.y(point.y) : data.y(0)\"\n [attr.width]=\"data.x1.bandwidth()\"\n [attr.height]=\"Math.abs(data.y(point.y) - data.y(0))\"\n [attr.fill]=\"point.color ?? series.color\"\n></svg:rect>\n} } } }\n" }]
|
|
2237
2132
|
}], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
|
|
2238
2133
|
|
|
2239
2134
|
class ScatterSeriesComponent extends SeriesBaseComponent {
|
|
@@ -2246,11 +2141,10 @@ class ScatterSeriesComponent extends SeriesBaseComponent {
|
|
|
2246
2141
|
this.element = element;
|
|
2247
2142
|
}
|
|
2248
2143
|
ngOnInit() {
|
|
2249
|
-
this.x = this.scaleService.scales.pipe(map(_ => _.x.get(this.series.xAxisIndex)?.scale));
|
|
2250
|
-
this.y = this.scaleService.scales.pipe(map(_ => _.y.get(this.series.yAxisIndex)?.scale));
|
|
2251
|
-
}
|
|
2252
|
-
ngAfterViewInit() {
|
|
2144
|
+
this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex)?.scale));
|
|
2145
|
+
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex)?.scale));
|
|
2253
2146
|
}
|
|
2147
|
+
ngAfterViewInit() { }
|
|
2254
2148
|
mouseenter(point) {
|
|
2255
2149
|
this.svc.setTooltip({
|
|
2256
2150
|
point: point,
|
|
@@ -2264,13 +2158,11 @@ class ScatterSeriesComponent extends SeriesBaseComponent {
|
|
|
2264
2158
|
});
|
|
2265
2159
|
}
|
|
2266
2160
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: ScatterSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2267
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: ScatterSeriesComponent, isStandalone: true, selector: "svg:svg[teta-scatter-series]", usesInheritance: true, ngImport: i0, template: "@if ({
|
|
2161
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: ScatterSeriesComponent, isStandalone: true, selector: "svg:svg[teta-scatter-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y | async, x: x | async }; as scales) { @if (scales.x && scales.y) { @for (point of series.data; track point)\n{\n<svg:circle\n class=\"line\"\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.cx]=\"scales.x(point.x)\"\n [attr.cy]=\"scales.y(point.y)\"\n [attr.r]=\"series.style?.radius ?? 1\"\n [attr.stroke]=\"point.color ?? series.color\"\n [attr.fill]=\"point.color ?? series.color\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n></svg:circle>\n} } }\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2268
2162
|
}
|
|
2269
2163
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: ScatterSeriesComponent, decorators: [{
|
|
2270
2164
|
type: Component,
|
|
2271
|
-
args: [{ selector: 'svg:svg[teta-scatter-series]', standalone: true, imports: [
|
|
2272
|
-
AsyncPipe
|
|
2273
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if ({\n y: y | async,\n x: x | async\n}; as scales) {\n @if (scales.x && scales.y) {\n @for (point of series.data; track point) {\n <svg:circle\n class=\"line\"\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.cx]=\"scales.x(point.x)\"\n [attr.cy]=\"scales.y(point.y)\"\n [attr.r]=\"series.style?.radius ?? 1\"\n [attr.stroke]=\"point.color ?? series.color\"\n [attr.fill]=\"point.color ?? series.color\"\n [attr.stroke-width]=\"series.style?.strokeWidth\">\n </svg:circle>\n }\n }\n}\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
|
|
2165
|
+
args: [{ selector: 'svg:svg[teta-scatter-series]', standalone: true, imports: [AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if ({ y: y | async, x: x | async }; as scales) { @if (scales.x && scales.y) { @for (point of series.data; track point)\n{\n<svg:circle\n class=\"line\"\n (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\"\n [attr.cx]=\"scales.x(point.x)\"\n [attr.cy]=\"scales.y(point.y)\"\n [attr.r]=\"series.style?.radius ?? 1\"\n [attr.stroke]=\"point.color ?? series.color\"\n [attr.fill]=\"point.color ?? series.color\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n></svg:circle>\n} } }\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
|
|
2274
2166
|
}], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
|
|
2275
2167
|
|
|
2276
2168
|
class BlockSeriesComponent extends SeriesBaseComponent {
|
|
@@ -2286,19 +2178,13 @@ class BlockSeriesComponent extends SeriesBaseComponent {
|
|
|
2286
2178
|
this.id = (Date.now() + Math.random()).toString(36);
|
|
2287
2179
|
}
|
|
2288
2180
|
ngOnInit() {
|
|
2289
|
-
this.x = this.scaleService.scales.pipe(map(_ => _.x.get(this.series.xAxisIndex)?.scale));
|
|
2290
|
-
this.y = this.scaleService.scales.pipe(map(_ => _.y.get(this.series.yAxisIndex)?.scale));
|
|
2291
|
-
this.displayPoints = this.y.pipe(filter(y => y), map(y => {
|
|
2181
|
+
this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex)?.scale));
|
|
2182
|
+
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex)?.scale));
|
|
2183
|
+
this.displayPoints = this.y.pipe(filter((y) => y), map((y) => {
|
|
2292
2184
|
return this.series.data.filter((point, index, arr) => {
|
|
2293
2185
|
const [min, max] = y.domain();
|
|
2294
|
-
return ((point.y >= min ||
|
|
2295
|
-
point.y1
|
|
2296
|
-
arr[index + 1]?.y >= min ||
|
|
2297
|
-
arr[index + 1]?.y1 >= min) &&
|
|
2298
|
-
(point.y <= max ||
|
|
2299
|
-
point.y1 <= max ||
|
|
2300
|
-
arr[index - 1]?.y <= max ||
|
|
2301
|
-
arr[index - 1]?.y1 <= max));
|
|
2186
|
+
return ((point.y >= min || point.y1 >= min || arr[index + 1]?.y >= min || arr[index + 1]?.y1 >= min) &&
|
|
2187
|
+
(point.y <= max || point.y1 <= max || arr[index - 1]?.y <= max || arr[index - 1]?.y1 <= max));
|
|
2302
2188
|
});
|
|
2303
2189
|
}));
|
|
2304
2190
|
}
|
|
@@ -2315,13 +2201,11 @@ class BlockSeriesComponent extends SeriesBaseComponent {
|
|
|
2315
2201
|
});
|
|
2316
2202
|
}
|
|
2317
2203
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: BlockSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2318
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: BlockSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-series]", usesInheritance: true, ngImport: i0, template: "@if ({
|
|
2204
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: BlockSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) { @if (series?.fillType ===\nfillType.gradient) {\n<svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n} @if (data.x && data.y) { @for (point of data.points; track point) {\n<svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : point.color ?? series.style?.fill ?? series.color\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n width=\"100%\"\n ></svg:rect>\n @if (point.text && data.y(point.y1) - data.y(point.y) > 8) {\n <svg:text\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y)\"\n [attr.y2]=\"data.y(point.y)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? series.color\"\n ></svg:line>\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y1)\"\n [attr.y2]=\"data.y(point.y1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? series.color\"\n ></svg:line>\n</svg:g>\n} } }\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2319
2205
|
}
|
|
2320
2206
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: BlockSeriesComponent, decorators: [{
|
|
2321
2207
|
type: Component,
|
|
2322
|
-
args: [{ selector: 'svg:svg[teta-block-series]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2323
|
-
AsyncPipe,
|
|
2324
|
-
], template: "@if ({\n y: y | async,\n x: x | async,\n points: displayPoints | async\n}; as data) {\n @if (series?.fillType === fillType.gradient) {\n <svg:defs>\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.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\"\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.style?.fill ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n width=\"100%\">\n </svg:rect>\n @if (point.text && data.y(point.y1) - data.y(point.y) > 8) {\n <svg:text 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)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? 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.style?.stroke ?? series.color\"></svg:line>\n </svg:g>\n }\n }\n}\n" }]
|
|
2208
|
+
args: [{ selector: 'svg:svg[teta-block-series]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) { @if (series?.fillType ===\nfillType.gradient) {\n<svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n} @if (data.x && data.y) { @for (point of data.points; track point) {\n<svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : point.color ?? series.style?.fill ?? series.color\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n width=\"100%\"\n ></svg:rect>\n @if (point.text && data.y(point.y1) - data.y(point.y) > 8) {\n <svg:text\n x=\"50%\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y)\"\n [attr.y2]=\"data.y(point.y)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? series.color\"\n ></svg:line>\n <svg:line\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"data.y(point.y1)\"\n [attr.y2]=\"data.y(point.y1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? series.color\"\n ></svg:line>\n</svg:g>\n} } }\n" }]
|
|
2325
2209
|
}], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
|
|
2326
2210
|
|
|
2327
2211
|
class BlockAreaSeriesComponent extends SeriesBaseComponent {
|
|
@@ -2337,19 +2221,13 @@ class BlockAreaSeriesComponent extends SeriesBaseComponent {
|
|
|
2337
2221
|
this.id = (Date.now() + Math.random()).toString(36);
|
|
2338
2222
|
}
|
|
2339
2223
|
ngOnInit() {
|
|
2340
|
-
this.x = this.scaleService.scales.pipe(map(_ => _.x.get(this.series.xAxisIndex)?.scale));
|
|
2341
|
-
this.y = this.scaleService.scales.pipe(map(_ => _.y.get(this.series.yAxisIndex)?.scale));
|
|
2342
|
-
this.displayPoints = this.y.pipe(filter(y => y), map(y => {
|
|
2224
|
+
this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex)?.scale));
|
|
2225
|
+
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex)?.scale));
|
|
2226
|
+
this.displayPoints = this.y.pipe(filter((y) => y), map((y) => {
|
|
2343
2227
|
return this.series.data.filter((point, index, arr) => {
|
|
2344
2228
|
const [min, max] = y.domain();
|
|
2345
|
-
return ((point.y >= min ||
|
|
2346
|
-
point.y1
|
|
2347
|
-
arr[index + 1]?.y >= min ||
|
|
2348
|
-
arr[index + 1]?.y1 >= min) &&
|
|
2349
|
-
(point.y <= max ||
|
|
2350
|
-
point.y1 <= max ||
|
|
2351
|
-
arr[index - 1]?.y <= max ||
|
|
2352
|
-
arr[index - 1]?.y1 <= max));
|
|
2229
|
+
return ((point.y >= min || point.y1 >= min || arr[index + 1]?.y >= min || arr[index + 1]?.y1 >= min) &&
|
|
2230
|
+
(point.y <= max || point.y1 <= max || arr[index - 1]?.y <= max || arr[index - 1]?.y1 <= max));
|
|
2353
2231
|
});
|
|
2354
2232
|
}));
|
|
2355
2233
|
}
|
|
@@ -2367,13 +2245,11 @@ class BlockAreaSeriesComponent extends SeriesBaseComponent {
|
|
|
2367
2245
|
});
|
|
2368
2246
|
}
|
|
2369
2247
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: BlockAreaSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2370
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: BlockAreaSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-area-series]", usesInheritance: true, ngImport: i0, template: "@if ({
|
|
2248
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: BlockAreaSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-area-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) { @if (series?.fillType ===\nfillType.gradient) {\n<svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n} @if (data.x && data.y) { @for (point of data.points; track point) {\n<svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n @if (!!config.inverted) {\n <svg:rect\n [attr.x]=\"data.x(0) < data.x(point.x) ? data.x(0) : data.x(point.x)\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.width]=\"data.x(0) < data.x(point.x) ? data.x(point.x) - data.x(0) : data.x(0) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : point.color ?? series.style?.stroke ?? series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : point.color ?? series.style?.fill ?? series.color\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n ></svg:rect>\n } @else {\n <svg:rect\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"data.y(0)\"\n [attr.height]=\"Math.abs(data.y(0) - data.y(point.y))\"\n [attr.width]=\"data.x(point.x1) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : point.color ?? series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : point.color ?? series.color\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n ></svg:rect>\n } @if (point.text) {\n <svg:text\n x=\"50%\"\n fill=\"var(--color-text-50)\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n</svg:g>\n} } }\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2371
2249
|
}
|
|
2372
2250
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: BlockAreaSeriesComponent, decorators: [{
|
|
2373
2251
|
type: Component,
|
|
2374
|
-
args: [{ selector: 'svg:svg[teta-block-area-series]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2375
|
-
AsyncPipe,
|
|
2376
|
-
], template: "@if ({\n y: y | async,\n x: x | async,\n points: displayPoints | async\n}; as data) {\n @if (series?.fillType === fillType.gradient) {\n <svg:defs>\n <svg:linearGradient [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\">\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\">\n @if (!!config.inverted) {\n <svg:rect\n [attr.x]=\"data.x(0) < data.x(point.x) ? data.x(0) : data.x(point.x)\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.width]=\"data.x(0) < data.x(point.x) ? data.x(point.x) - data.x(0) : data.x(0) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : point.color ?? series.style?.stroke ?? series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.style?.fill ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\">\n </svg:rect>\n } @else {\n <svg:rect\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"data.y(0)\"\n [attr.height]=\"Math.abs(data.y(0) - data.y(point.y))\"\n [attr.width]=\"data.x(point.x1) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : point.color ?? series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"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 }\n @if (point.text) {\n <svg:text x=\"50%\"\n fill=\"var(--color-text-50)\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\">{{ point.text }}\n </svg:text>\n }\n </svg:g>\n }\n }\n}\n" }]
|
|
2252
|
+
args: [{ selector: 'svg:svg[teta-block-area-series]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe], template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) { @if (series?.fillType ===\nfillType.gradient) {\n<svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n} @if (data.x && data.y) { @for (point of data.points; track point) {\n<svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n @if (!!config.inverted) {\n <svg:rect\n [attr.x]=\"data.x(0) < data.x(point.x) ? data.x(0) : data.x(point.x)\"\n [attr.y]=\"data.y(point.y)\"\n [attr.height]=\"Math.abs(data.y(point.y1) - data.y(point.y))\"\n [attr.width]=\"data.x(0) < data.x(point.x) ? data.x(point.x) - data.x(0) : data.x(0) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : point.color ?? series.style?.stroke ?? series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : point.color ?? series.style?.fill ?? series.color\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n ></svg:rect>\n } @else {\n <svg:rect\n [attr.x]=\"data.x(point.x)\"\n [attr.y]=\"data.y(0)\"\n [attr.height]=\"Math.abs(data.y(0) - data.y(point.y))\"\n [attr.width]=\"data.x(point.x1) - data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? '' : point.color ?? series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : point.color ?? series.color\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n ></svg:rect>\n } @if (point.text) {\n <svg:text\n x=\"50%\"\n fill=\"var(--color-text-50)\"\n [attr.y]=\"(data.y(point.y1) + data.y(point.y)) / 2\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n</svg:g>\n} } }\n" }]
|
|
2377
2253
|
}], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
|
|
2378
2254
|
|
|
2379
2255
|
class AreaSeriesComponent extends LinearSeriesBase {
|
|
@@ -2390,7 +2266,7 @@ class AreaSeriesComponent extends LinearSeriesBase {
|
|
|
2390
2266
|
}
|
|
2391
2267
|
ngOnInit() {
|
|
2392
2268
|
super.ngOnInit();
|
|
2393
|
-
this.areaPath = this.scaleService.scales.pipe(map(data => {
|
|
2269
|
+
this.areaPath = this.scaleService.scales.pipe(map((data) => {
|
|
2394
2270
|
const { x, y } = data;
|
|
2395
2271
|
this.x = x.get(this.series.xAxisIndex)?.scale;
|
|
2396
2272
|
this.y = y.get(this.series.yAxisIndex)?.scale;
|
|
@@ -2399,14 +2275,11 @@ class AreaSeriesComponent extends LinearSeriesBase {
|
|
|
2399
2275
|
}
|
|
2400
2276
|
const area = d3
|
|
2401
2277
|
.area()
|
|
2402
|
-
.defined(point => point.x !== null &&
|
|
2403
|
-
point.y !== null &&
|
|
2404
|
-
!isNaN(point.x) &&
|
|
2405
|
-
!isNaN(point.y));
|
|
2278
|
+
.defined((point) => point.x !== null && point.y !== null && !isNaN(point.x) && !isNaN(point.y));
|
|
2406
2279
|
area
|
|
2407
|
-
.x1(_ => _.x1 !== null && _.x1 !== undefined ? this.x(_.x1) : this.x(0))
|
|
2408
|
-
.x0(_ => this.x(_.x))
|
|
2409
|
-
.y(_ => this.y(_.y));
|
|
2280
|
+
.x1((_) => (_.x1 !== null && _.x1 !== undefined ? this.x(_.x1) : this.x(0)))
|
|
2281
|
+
.x0((_) => this.x(_.x))
|
|
2282
|
+
.y((_) => this.y(_.y));
|
|
2410
2283
|
const filter = this.defaultClipPointsMapping.get(this.series.clipPointsDirection);
|
|
2411
2284
|
let filteredData = this.series.data;
|
|
2412
2285
|
if (this.series.clipPointsDirection === ClipPointsDirection.x) {
|
|
@@ -2425,11 +2298,11 @@ class AreaSeriesComponent extends LinearSeriesBase {
|
|
|
2425
2298
|
}));
|
|
2426
2299
|
}
|
|
2427
2300
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AreaSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2428
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: AreaSeriesComponent, isStandalone: true, selector: "svg:svg[teta-area-series]", usesInheritance: true, ngImport: i0, template: "@if (series?.fillType === fillType.gradient) {\n
|
|
2301
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: AreaSeriesComponent, isStandalone: true, selector: "svg:svg[teta-area-series]", usesInheritance: true, ngImport: i0, template: "@if (series?.fillType === fillType.gradient) {\n<svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.8\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n}\n<svg:path\n class=\"area\"\n [attr.d]=\"areaPath | async\"\n [attr.stroke-width]=\"0\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n [attr.fill]=\"\n series.fillType === fillType.gradient ? 'url(#gradient-fill-' + id + ')' : series.style?.fill ?? series.color\n \"\n></svg:path>\n<svg:path\n class=\"area\"\n fill=\"none\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n></svg:path>\n@if (transform | async; as t) { @if (t?.x != null && t?.y != null) {\n<svg:circle r=\"3\" [attr.fill]=\"series.color\" [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n} } @if (markers; as draggablePoints) { @for (point of draggablePoints; track point; ) {\n<svg:circle\n class=\"marker\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n></svg:circle>\n} }\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2429
2302
|
}
|
|
2430
2303
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AreaSeriesComponent, decorators: [{
|
|
2431
2304
|
type: Component,
|
|
2432
|
-
args: [{ selector: 'svg:svg[teta-area-series]', standalone: true, imports: [AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (series?.fillType === fillType.gradient) {\n
|
|
2305
|
+
args: [{ selector: 'svg:svg[teta-area-series]', standalone: true, imports: [AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (series?.fillType === fillType.gradient) {\n<svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted || series?.fillDirection === fillDirection.y ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.color\" stop-opacity=\"0.8\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n}\n<svg:path\n class=\"area\"\n [attr.d]=\"areaPath | async\"\n [attr.stroke-width]=\"0\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n [attr.fill]=\"\n series.fillType === fillType.gradient ? 'url(#gradient-fill-' + id + ')' : series.style?.fill ?? series.color\n \"\n></svg:path>\n<svg:path\n class=\"area\"\n fill=\"none\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n></svg:path>\n@if (transform | async; as t) { @if (t?.x != null && t?.y != null) {\n<svg:circle r=\"3\" [attr.fill]=\"series.color\" [attr.transform]=\"'translate(' + t.x + ', ' + t.y + ')'\"></svg:circle>\n} } @if (markers; as draggablePoints) { @for (point of draggablePoints; track point; ) {\n<svg:circle\n class=\"marker\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n></svg:circle>\n} }\n" }]
|
|
2433
2306
|
}], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
|
|
2434
2307
|
|
|
2435
2308
|
const defaultSeriesTypeMapping = new Map()
|
|
@@ -2447,8 +2320,7 @@ class SeriesHostComponent {
|
|
|
2447
2320
|
}
|
|
2448
2321
|
ngOnInit() {
|
|
2449
2322
|
if (!SeriesBaseComponent.isPrototypeOf(this.series.component)) {
|
|
2450
|
-
this.series.component =
|
|
2451
|
-
defaultSeriesTypeMapping.get(this.series.type) || LineSeriesComponent;
|
|
2323
|
+
this.series.component = defaultSeriesTypeMapping.get(this.series.type) || LineSeriesComponent;
|
|
2452
2324
|
}
|
|
2453
2325
|
this._componentRef = this.viewContainerRef.createComponent(this.series.component);
|
|
2454
2326
|
this._componentRef.instance.config = this.config;
|
|
@@ -2506,15 +2378,9 @@ class PlotlineComponent {
|
|
|
2506
2378
|
}
|
|
2507
2379
|
ngOnInit() {
|
|
2508
2380
|
this._domain = this.scale.domain();
|
|
2509
|
-
const plotlineElement = d3
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
const grabElement = d3
|
|
2513
|
-
.select(this.element.nativeElement)
|
|
2514
|
-
.selectAll('.grabber');
|
|
2515
|
-
this.dragElements = d3
|
|
2516
|
-
.drag()
|
|
2517
|
-
.subject(() => {
|
|
2381
|
+
const plotlineElement = d3.select(this.element.nativeElement).select('.plotline');
|
|
2382
|
+
const grabElement = d3.select(this.element.nativeElement).selectAll('.grabber');
|
|
2383
|
+
this.dragElements = d3.drag().subject(() => {
|
|
2518
2384
|
if (this.axis.orientation === AxisOrientation.y) {
|
|
2519
2385
|
return { y: plotlineElement.attr('y1') };
|
|
2520
2386
|
}
|
|
@@ -2523,8 +2389,7 @@ class PlotlineComponent {
|
|
|
2523
2389
|
}
|
|
2524
2390
|
return null;
|
|
2525
2391
|
});
|
|
2526
|
-
const drag = this.dragElements
|
|
2527
|
-
.on('start drag end', (event, d) => {
|
|
2392
|
+
const drag = this.dragElements.on('start drag end', (event, d) => {
|
|
2528
2393
|
d.value = this.scale.invert(event[AxisOrientation[this.axis.orientation]]);
|
|
2529
2394
|
if (d.max !== null && d.max !== undefined && d.value >= d.max) {
|
|
2530
2395
|
d.value = d.max;
|
|
@@ -2560,11 +2425,11 @@ class PlotlineComponent {
|
|
|
2560
2425
|
return this.size.width;
|
|
2561
2426
|
}
|
|
2562
2427
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: PlotlineComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: ZoomService }, { token: ScaleService }, { token: ChartService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2563
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: PlotlineComponent, isStandalone: true, selector: "[teta-plot-line]", inputs: { plotLine: "plotLine", size: "size", axis: "axis", scale: "scale" }, ngImport: i0, template: "<svg:line
|
|
2428
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: PlotlineComponent, isStandalone: true, selector: "[teta-plot-line]", inputs: { plotLine: "plotLine", size: "size", axis: "axis", scale: "scale" }, ngImport: i0, template: "<svg:line\n class=\"plotline\"\n [attr.stroke]=\"plotLine.style?.stroke || 'red'\"\n [attr.stroke-width]=\"plotLine.style?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotLine.style?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? value : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? value : width\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : value\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : value\"\n></svg:line>\n\n@if (axis.orientation === orientation.x) {\n<svg:text\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n class=\"label font-title-2 fill-text-70\"\n [attr.x]=\"value\"\n dy=\"-2em\"\n [attr.transform]=\"'rotate(-90, ' + value + ',' + height / 2 + ')'\"\n [attr.y]=\"height / 2\"\n>\n {{ plotLine.label }}\n</svg:text>\n} @if (axis.orientation === orientation.y) {\n<svg:text\n text-anchor=\"middle\"\n class=\"label font-title-2 fill-text-70\"\n dominant-baseline=\"central\"\n [attr.x]=\"value\"\n [attr.y]=\"width / 2\"\n>\n {{ plotLine.label }}\n</svg:text>\n}\n<svg:line\n class=\"grabber\"\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [attr.stroke]=\"'red'\"\n [attr.stroke-width]=\"8\"\n opacity=\"0\"\n [attr.x1]=\"axis.orientation === orientation.x ? value : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? value : width\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : value\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : value\"\n></svg:line>\n", styles: [":host .x-grabber{cursor:col-resize}:host .y-grabber{cursor:row-resize}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2564
2429
|
}
|
|
2565
2430
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: PlotlineComponent, decorators: [{
|
|
2566
2431
|
type: Component,
|
|
2567
|
-
args: [{ selector: '[teta-plot-line]', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:line
|
|
2432
|
+
args: [{ selector: '[teta-plot-line]', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:line\n class=\"plotline\"\n [attr.stroke]=\"plotLine.style?.stroke || 'red'\"\n [attr.stroke-width]=\"plotLine.style?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotLine.style?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? value : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? value : width\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : value\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : value\"\n></svg:line>\n\n@if (axis.orientation === orientation.x) {\n<svg:text\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n class=\"label font-title-2 fill-text-70\"\n [attr.x]=\"value\"\n dy=\"-2em\"\n [attr.transform]=\"'rotate(-90, ' + value + ',' + height / 2 + ')'\"\n [attr.y]=\"height / 2\"\n>\n {{ plotLine.label }}\n</svg:text>\n} @if (axis.orientation === orientation.y) {\n<svg:text\n text-anchor=\"middle\"\n class=\"label font-title-2 fill-text-70\"\n dominant-baseline=\"central\"\n [attr.x]=\"value\"\n [attr.y]=\"width / 2\"\n>\n {{ plotLine.label }}\n</svg:text>\n}\n<svg:line\n class=\"grabber\"\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [attr.stroke]=\"'red'\"\n [attr.stroke-width]=\"8\"\n opacity=\"0\"\n [attr.x1]=\"axis.orientation === orientation.x ? value : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? value : width\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : value\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : value\"\n></svg:line>\n", styles: [":host .x-grabber{cursor:col-resize}:host .y-grabber{cursor:row-resize}\n"] }]
|
|
2568
2433
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: ZoomService }, { type: ScaleService }, { type: ChartService }, { type: i0.ElementRef }], propDecorators: { plotLine: [{
|
|
2569
2434
|
type: Input
|
|
2570
2435
|
}], size: [{
|
|
@@ -2601,13 +2466,13 @@ class AnnotationComponent {
|
|
|
2601
2466
|
click(event) {
|
|
2602
2467
|
this.chartService.emitAnnotation({
|
|
2603
2468
|
event,
|
|
2604
|
-
target: this.annotation
|
|
2469
|
+
target: this.annotation,
|
|
2605
2470
|
});
|
|
2606
2471
|
}
|
|
2607
2472
|
contextMenu(event) {
|
|
2608
2473
|
this.chartService.emitAnnotation({
|
|
2609
2474
|
event,
|
|
2610
|
-
target: this.annotation
|
|
2475
|
+
target: this.annotation,
|
|
2611
2476
|
});
|
|
2612
2477
|
}
|
|
2613
2478
|
ngOnDestroy() {
|
|
@@ -2624,14 +2489,14 @@ class AnnotationComponent {
|
|
|
2624
2489
|
d.dx += event.dx;
|
|
2625
2490
|
d.dy += event.dy;
|
|
2626
2491
|
// x constraint
|
|
2627
|
-
if (
|
|
2492
|
+
if (d.dx + x(d.point.x) - offsetPx <= 0) {
|
|
2628
2493
|
d.dx = -x(d.point.x) + offsetPx;
|
|
2629
2494
|
}
|
|
2630
2495
|
if (d.dx + x(d.point.x) + nodeRect.width - offsetPx >= this.visibleRect.width) {
|
|
2631
2496
|
d.dx = this.visibleRect.width - x(d.point.x) - nodeRect.width + offsetPx;
|
|
2632
2497
|
}
|
|
2633
2498
|
// y constraint
|
|
2634
|
-
if (
|
|
2499
|
+
if (d.dy + y(d.point.y) - offsetPx <= 0) {
|
|
2635
2500
|
d.dy = -y(d.point.y) + offsetPx;
|
|
2636
2501
|
}
|
|
2637
2502
|
if (d.dy + y(d.point.y) + nodeRect.height - offsetPx >= this.visibleRect.height) {
|
|
@@ -2640,21 +2505,18 @@ class AnnotationComponent {
|
|
|
2640
2505
|
this.cdr.detectChanges();
|
|
2641
2506
|
this.chartService.emitMoveAnnotation({
|
|
2642
2507
|
event,
|
|
2643
|
-
target: d
|
|
2508
|
+
target: d,
|
|
2644
2509
|
});
|
|
2645
2510
|
});
|
|
2646
2511
|
d3.select(this.node.nativeElement).call(this.drag);
|
|
2647
2512
|
}
|
|
2648
2513
|
}
|
|
2649
2514
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AnnotationComponent, deps: [{ token: ScaleService }, { token: i0.ChangeDetectorRef }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2650
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: AnnotationComponent, isStandalone: true, selector: "[teta-annotation]", inputs: { visibleRect: "visibleRect", annotation: "annotation" }, host: { listeners: { "click": "click($event)", "contextmenu": "contextMenu($event)" } }, viewQueries: [{ propertyName: "node", first: true, predicate: ["annotationNode"], descendants: true }], ngImport: i0, template: "@if ({
|
|
2515
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: AnnotationComponent, isStandalone: true, selector: "[teta-annotation]", inputs: { visibleRect: "visibleRect", annotation: "annotation" }, host: { listeners: { "click": "click($event)", "contextmenu": "contextMenu($event)" } }, viewQueries: [{ propertyName: "node", first: true, predicate: ["annotationNode"], descendants: true }], ngImport: i0, template: "@if ({ x: x | async, y: y | async }; as data) { @if (data.x && data.y) {\n<svg:circle\n [attr.r]=\"annotation.style?.radius ?? 5\"\n [attr.cx]=\"data.x(annotation.point.x)\"\n [attr.fill]=\"annotation?.style?.fill ?? 'var(--color-text-90)'\"\n [attr.cy]=\"data.y(annotation.point.y)\"\n></svg:circle>\n<svg:line\n [attr.x1]=\"data.x(annotation.point.x)\"\n [attr.y1]=\"data.y(annotation.point.y)\"\n [attr.x2]=\"data.x(annotation.point.x) + (annotation.dx ?? 0)\"\n [attr.y2]=\"data.y(annotation.point.y) + (annotation.dy ?? 0)\"\n [attr.stroke]=\"annotation.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"annotation.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"annotation.style?.strokeDasharray ?? null\"\n></svg:line>\n<svg:foreignObject\n class=\"position-absolute\"\n [attr.width]=\"node?.nativeElement.offsetWidth ?? 0\"\n [attr.height]=\"node?.nativeElement.offsetHeight ?? 0\"\n [attr.x]=\"data.x(annotation.point.x) + (annotation.dx ?? 0) - 10\"\n [attr.y]=\"data.y(annotation.point.y) + (annotation.dy ?? 0) - 10\"\n>\n <div\n #annotationNode\n [style.background-color]=\"annotation.style?.fill ?? 'var(--color-global-bgmain)'\"\n [style.cursor]=\"annotation?.draggable ? 'move' : 'default'\"\n [className]=\"'padding-h-2 ' + annotation.className ?? ''\"\n style=\"border-radius: 2px; display: inline-block\"\n >\n @if (annotation.template) {\n <ng-container *ngTemplateOutlet=\"annotation.template; context: { $implicit: annotation }\"></ng-container>\n } @else {\n {{ annotation.note?.label }}\n }\n </div>\n</svg:foreignObject>\n} }\n", styles: [""], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2651
2516
|
}
|
|
2652
2517
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AnnotationComponent, decorators: [{
|
|
2653
2518
|
type: Component,
|
|
2654
|
-
args: [{ selector: '[teta-annotation]', standalone: true, imports: [
|
|
2655
|
-
NgTemplateOutlet,
|
|
2656
|
-
AsyncPipe
|
|
2657
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if ({\n x: x | async,\n y: y | async\n}; as data) {\n @if (data.x && data.y) {\n <svg:circle\n [attr.r]=\"annotation.style?.radius ?? 5\"\n [attr.cx]=\"data.x(annotation.point.x)\"\n [attr.fill]=\"annotation?.style?.fill ?? 'var(--color-text-90)'\"\n [attr.cy]=\"data.y(annotation.point.y)\">\n </svg:circle>\n <svg:line\n [attr.x1]=\"data.x(annotation.point.x)\"\n [attr.y1]=\"data.y(annotation.point.y)\"\n [attr.x2]=\"data.x(annotation.point.x) + (annotation.dx ?? 0)\"\n [attr.y2]=\"data.y(annotation.point.y) + (annotation.dy ?? 0)\"\n [attr.stroke]=\"annotation.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"annotation.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"annotation.style?.strokeDasharray ?? null\"\n >\n </svg:line>\n <svg:foreignObject\n class=\"position-absolute\"\n [attr.width]=\"node?.nativeElement.offsetWidth ?? 0\"\n [attr.height]=\"node?.nativeElement.offsetHeight ?? 0\"\n [attr.x]=\"data.x(annotation.point.x) + (annotation.dx ?? 0) - 10\"\n [attr.y]=\"data.y(annotation.point.y) + (annotation.dy ?? 0) - 10\">\n <div\n #annotationNode\n [style.background-color]=\"annotation.style?.fill ?? 'var(--color-global-bgmain)'\"\n [style.cursor]=\"annotation?.draggable ? 'move' : 'default'\"\n [className]=\"'padding-h-2 ' + annotation.className ?? ''\"\n style=\"border-radius: 2px; display: inline-block;\">\n @if (annotation.template) {\n <ng-container *ngTemplateOutlet=\"annotation.template;context: {$implicit: annotation}\"></ng-container>\n } @else {\n {{ annotation.note?.label }}\n }\n </div>\n </svg:foreignObject>\n }\n}\n" }]
|
|
2519
|
+
args: [{ selector: '[teta-annotation]', standalone: true, imports: [NgTemplateOutlet, AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if ({ x: x | async, y: y | async }; as data) { @if (data.x && data.y) {\n<svg:circle\n [attr.r]=\"annotation.style?.radius ?? 5\"\n [attr.cx]=\"data.x(annotation.point.x)\"\n [attr.fill]=\"annotation?.style?.fill ?? 'var(--color-text-90)'\"\n [attr.cy]=\"data.y(annotation.point.y)\"\n></svg:circle>\n<svg:line\n [attr.x1]=\"data.x(annotation.point.x)\"\n [attr.y1]=\"data.y(annotation.point.y)\"\n [attr.x2]=\"data.x(annotation.point.x) + (annotation.dx ?? 0)\"\n [attr.y2]=\"data.y(annotation.point.y) + (annotation.dy ?? 0)\"\n [attr.stroke]=\"annotation.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"annotation.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"annotation.style?.strokeDasharray ?? null\"\n></svg:line>\n<svg:foreignObject\n class=\"position-absolute\"\n [attr.width]=\"node?.nativeElement.offsetWidth ?? 0\"\n [attr.height]=\"node?.nativeElement.offsetHeight ?? 0\"\n [attr.x]=\"data.x(annotation.point.x) + (annotation.dx ?? 0) - 10\"\n [attr.y]=\"data.y(annotation.point.y) + (annotation.dy ?? 0) - 10\"\n>\n <div\n #annotationNode\n [style.background-color]=\"annotation.style?.fill ?? 'var(--color-global-bgmain)'\"\n [style.cursor]=\"annotation?.draggable ? 'move' : 'default'\"\n [className]=\"'padding-h-2 ' + annotation.className ?? ''\"\n style=\"border-radius: 2px; display: inline-block\"\n >\n @if (annotation.template) {\n <ng-container *ngTemplateOutlet=\"annotation.template; context: { $implicit: annotation }\"></ng-container>\n } @else {\n {{ annotation.note?.label }}\n }\n </div>\n</svg:foreignObject>\n} }\n" }]
|
|
2658
2520
|
}], ctorParameters: () => [{ type: ScaleService }, { type: i0.ChangeDetectorRef }, { type: ChartService }], propDecorators: { visibleRect: [{
|
|
2659
2521
|
type: Input
|
|
2660
2522
|
}], annotation: [{
|
|
@@ -2680,7 +2542,7 @@ class CrosshairComponent {
|
|
|
2680
2542
|
this.transform = this.chartService.pointerMove.pipe(map((event) => {
|
|
2681
2543
|
return {
|
|
2682
2544
|
x: event.type === 'mouseleave' ? -9999 : event.offsetX,
|
|
2683
|
-
y: event.type === 'mouseleave' ? -9999 : event.offsetY
|
|
2545
|
+
y: event.type === 'mouseleave' ? -9999 : event.offsetY,
|
|
2684
2546
|
};
|
|
2685
2547
|
}), tap(() => {
|
|
2686
2548
|
setTimeout(() => {
|
|
@@ -2689,13 +2551,11 @@ class CrosshairComponent {
|
|
|
2689
2551
|
}));
|
|
2690
2552
|
}
|
|
2691
2553
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: CrosshairComponent, deps: [{ token: ScaleService }, { token: ChartService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2692
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: CrosshairComponent, isStandalone: true, selector: "[teta-crosshair]", inputs: { size: "size" }, ngImport: i0, template: "@if (transform | async; as t) {\n
|
|
2554
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: CrosshairComponent, isStandalone: true, selector: "[teta-crosshair]", inputs: { size: "size" }, ngImport: i0, template: "@if (transform | async; as t) {\n<svg:line\n [attr.x1]=\"t.x\"\n y1=\"0\"\n [attr.x2]=\"t.x\"\n [attr.y2]=\"size.height\"\n stroke=\"var(--color-text-90)\"\n stroke-width=\"0.5\"\n></svg:line>\n<svg:line\n x1=\"0\"\n [attr.y1]=\"t.y\"\n [attr.x2]=\"size.width\"\n [attr.y2]=\"t.y\"\n stroke=\"var(--color-text-90)\"\n stroke-width=\"0.5\"\n></svg:line>\n}\n", styles: [":host{shape-rendering:crispEdges;pointer-events:none}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }] }); }
|
|
2693
2555
|
}
|
|
2694
2556
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: CrosshairComponent, decorators: [{
|
|
2695
2557
|
type: Component,
|
|
2696
|
-
args: [{ selector: '[teta-crosshair]', standalone: true, imports: [
|
|
2697
|
-
AsyncPipe,
|
|
2698
|
-
], template: "@if (transform | async; as t) {\n <svg:line [attr.x1]=\"t.x\" y1=\"0\" [attr.x2]=\"t.x\" [attr.y2]=\"size.height\" stroke=\"var(--color-text-90)\"\n stroke-width=\"0.5\"></svg:line>\n <svg:line x1=\"0\" [attr.y1]=\"t.y\" [attr.x2]=\"size.width\" [attr.y2]=\"t.y\" stroke=\"var(--color-text-90)\"\n stroke-width=\"0.5\"></svg:line>\n}\n", styles: [":host{shape-rendering:crispEdges;pointer-events:none}\n"] }]
|
|
2558
|
+
args: [{ selector: '[teta-crosshair]', standalone: true, imports: [AsyncPipe], template: "@if (transform | async; as t) {\n<svg:line\n [attr.x1]=\"t.x\"\n y1=\"0\"\n [attr.x2]=\"t.x\"\n [attr.y2]=\"size.height\"\n stroke=\"var(--color-text-90)\"\n stroke-width=\"0.5\"\n></svg:line>\n<svg:line\n x1=\"0\"\n [attr.y1]=\"t.y\"\n [attr.x2]=\"size.width\"\n [attr.y2]=\"t.y\"\n stroke=\"var(--color-text-90)\"\n stroke-width=\"0.5\"\n></svg:line>\n}\n", styles: [":host{shape-rendering:crispEdges;pointer-events:none}\n"] }]
|
|
2699
2559
|
}], ctorParameters: () => [{ type: ScaleService }, { type: ChartService }, { type: i0.ChangeDetectorRef }], propDecorators: { size: [{
|
|
2700
2560
|
type: Input
|
|
2701
2561
|
}] } });
|
|
@@ -2713,11 +2573,10 @@ class BrushableDirective {
|
|
|
2713
2573
|
this._container = d3.select(this.element.nativeElement);
|
|
2714
2574
|
}
|
|
2715
2575
|
ngOnInit() {
|
|
2716
|
-
this.brushService.brushDomain
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
].map(this.axis.scale));
|
|
2576
|
+
this.brushService.brushDomain
|
|
2577
|
+
.pipe(takeWhile(() => this._alive), filter((brush) => brush.chartId !== this.config.id))
|
|
2578
|
+
.subscribe((brush) => {
|
|
2579
|
+
this._container.call(this.brush.move, [Math.floor(brush.selection[0]), Math.floor(brush.selection[1])].map(this.axis.scale));
|
|
2721
2580
|
});
|
|
2722
2581
|
}
|
|
2723
2582
|
ngOnDestroy() {
|
|
@@ -2728,7 +2587,7 @@ class BrushableDirective {
|
|
|
2728
2587
|
const brushMessage = new BrushMessage({
|
|
2729
2588
|
chartId: this.config.id,
|
|
2730
2589
|
selection: [this.config?.brush?.from, this.config?.brush?.to],
|
|
2731
|
-
mode: 'init'
|
|
2590
|
+
mode: 'init',
|
|
2732
2591
|
});
|
|
2733
2592
|
this.brushService.setBrush(brushMessage);
|
|
2734
2593
|
}
|
|
@@ -2751,52 +2610,29 @@ class BrushableDirective {
|
|
|
2751
2610
|
return;
|
|
2752
2611
|
const [from, to] = _.selection;
|
|
2753
2612
|
if (to - from === 0) {
|
|
2754
|
-
const selection = this.selection?.map(brushScale) ??
|
|
2755
|
-
[config.brush?.from, config.brush?.to].map(brushScale);
|
|
2613
|
+
const selection = this.selection?.map(brushScale) ?? [config.brush?.from, config.brush?.to].map(brushScale);
|
|
2756
2614
|
const halfBrushHeight = (selection[1] - selection[0]) / 2;
|
|
2757
|
-
const invertedSelection = [
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
].map(brushScale.invert);
|
|
2761
|
-
if (invertedSelection[1] - invertedSelection[0] >
|
|
2762
|
-
config.brush?.max) {
|
|
2763
|
-
this._container.call(this.brush.move, [
|
|
2764
|
-
Math.floor(invertedSelection[0]),
|
|
2765
|
-
Math.floor(invertedSelection[0] + config.brush?.max),
|
|
2766
|
-
].map(brushScale));
|
|
2615
|
+
const invertedSelection = [from - halfBrushHeight, to + halfBrushHeight].map(brushScale.invert);
|
|
2616
|
+
if (invertedSelection[1] - invertedSelection[0] > config.brush?.max) {
|
|
2617
|
+
this._container.call(this.brush.move, [Math.floor(invertedSelection[0]), Math.floor(invertedSelection[0] + config.brush?.max)].map(brushScale));
|
|
2767
2618
|
return;
|
|
2768
2619
|
}
|
|
2769
|
-
if (invertedSelection[1] - invertedSelection[0] <
|
|
2770
|
-
config.brush?.min)
|
|
2771
|
-
this._container.call(this.brush.move, [
|
|
2772
|
-
Math.floor(invertedSelection[0]),
|
|
2773
|
-
Math.ceil(invertedSelection[0] + config.brush?.min),
|
|
2774
|
-
].map(brushScale));
|
|
2620
|
+
if (invertedSelection[1] - invertedSelection[0] < config.brush?.min) {
|
|
2621
|
+
this._container.call(this.brush.move, [Math.floor(invertedSelection[0]), Math.ceil(invertedSelection[0] + config.brush?.min)].map(brushScale));
|
|
2775
2622
|
return;
|
|
2776
2623
|
}
|
|
2777
|
-
this._container.call(this.brush.move, [
|
|
2778
|
-
from - halfBrushHeight,
|
|
2779
|
-
to + halfBrushHeight,
|
|
2780
|
-
]);
|
|
2624
|
+
this._container.call(this.brush.move, [from - halfBrushHeight, to + halfBrushHeight]);
|
|
2781
2625
|
return;
|
|
2782
2626
|
}
|
|
2783
|
-
if (brushScale.invert(to) - brushScale.invert(from) >
|
|
2784
|
-
config.brush?.max) {
|
|
2627
|
+
if (brushScale.invert(to) - brushScale.invert(from) > config.brush?.max) {
|
|
2785
2628
|
this._container.call(this.brush.move, this.selection
|
|
2786
|
-
? [
|
|
2787
|
-
this.selection[0],
|
|
2788
|
-
this.selection[0] + config.brush?.max,
|
|
2789
|
-
].map(brushScale)
|
|
2629
|
+
? [this.selection[0], this.selection[0] + config.brush?.max].map(brushScale)
|
|
2790
2630
|
: [config.brush?.from, config.brush?.to].map(brushScale));
|
|
2791
2631
|
return;
|
|
2792
2632
|
}
|
|
2793
|
-
if (brushScale.invert(to) - brushScale.invert(from) <
|
|
2794
|
-
config.brush?.min) {
|
|
2633
|
+
if (brushScale.invert(to) - brushScale.invert(from) < config.brush?.min) {
|
|
2795
2634
|
this._container.call(this.brush.move, this.selection
|
|
2796
|
-
? [
|
|
2797
|
-
this.selection[0],
|
|
2798
|
-
this.selection[0] + config.brush?.min,
|
|
2799
|
-
].map(brushScale)
|
|
2635
|
+
? [this.selection[0], this.selection[0] + config.brush?.min].map(brushScale)
|
|
2800
2636
|
: [config.brush?.from, config.brush?.to].map(brushScale));
|
|
2801
2637
|
return;
|
|
2802
2638
|
}
|
|
@@ -2806,7 +2642,7 @@ class BrushableDirective {
|
|
|
2806
2642
|
const brushMessage = new BrushMessage({
|
|
2807
2643
|
chartId: this.config.id,
|
|
2808
2644
|
selection: [brushScale.invert(from), brushScale.invert(to)],
|
|
2809
|
-
mode: _.mode
|
|
2645
|
+
mode: _.mode,
|
|
2810
2646
|
});
|
|
2811
2647
|
this.brushService.setBrush(brushMessage);
|
|
2812
2648
|
}
|
|
@@ -2821,9 +2657,7 @@ class BrushableDirective {
|
|
|
2821
2657
|
if (config?.brush?.to) {
|
|
2822
2658
|
domain[1] = config.brush.to;
|
|
2823
2659
|
}
|
|
2824
|
-
this._container.call(this.brush.move, this.selection
|
|
2825
|
-
? this.selection.map(brushScale)
|
|
2826
|
-
: domain.map(brushScale), {});
|
|
2660
|
+
this._container.call(this.brush.move, this.selection ? this.selection.map(brushScale) : domain.map(brushScale), {});
|
|
2827
2661
|
}, 0);
|
|
2828
2662
|
});
|
|
2829
2663
|
}
|
|
@@ -2838,7 +2672,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImpor
|
|
|
2838
2672
|
type: Directive,
|
|
2839
2673
|
args: [{
|
|
2840
2674
|
selector: '[tetaBrushable]',
|
|
2841
|
-
standalone: true
|
|
2675
|
+
standalone: true,
|
|
2842
2676
|
}]
|
|
2843
2677
|
}], ctorParameters: () => [{ type: BrushService }, { type: ChartService }, { type: i0.ElementRef }, { type: i0.NgZone }], propDecorators: { config: [{
|
|
2844
2678
|
type: Input
|
|
@@ -2847,14 +2681,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImpor
|
|
|
2847
2681
|
}] } });
|
|
2848
2682
|
|
|
2849
2683
|
function tetaZoneFull(ngZone) {
|
|
2850
|
-
return source => new Observable(subscriber => source.subscribe({
|
|
2851
|
-
next: value => ngZone.run(() => subscriber.next(value)),
|
|
2684
|
+
return (source) => new Observable((subscriber) => source.subscribe({
|
|
2685
|
+
next: (value) => ngZone.run(() => subscriber.next(value)),
|
|
2852
2686
|
error: (error) => ngZone.run(() => subscriber.error(error)),
|
|
2853
2687
|
complete: () => ngZone.run(() => subscriber.complete()),
|
|
2854
2688
|
}));
|
|
2855
2689
|
}
|
|
2856
2690
|
function tetaZoneFree(ngZone) {
|
|
2857
|
-
return source => new Observable(subscriber => ngZone.runOutsideAngular(() => source.subscribe(subscriber)));
|
|
2691
|
+
return (source) => new Observable((subscriber) => ngZone.runOutsideAngular(() => source.subscribe(subscriber)));
|
|
2858
2692
|
}
|
|
2859
2693
|
function tetaZoneOptimized(ngZone) {
|
|
2860
2694
|
return pipe(tetaZoneFree(ngZone), tetaZoneFull(ngZone));
|
|
@@ -2868,10 +2702,8 @@ class ChartContainerComponent {
|
|
|
2868
2702
|
this._zone = _zone;
|
|
2869
2703
|
this.zoomType = ZoomType;
|
|
2870
2704
|
this.filterPositionMap = new Map()
|
|
2871
|
-
.set(true, axis => (_) => _.options.opposite && _.options.visible && axis.index <= _.index)
|
|
2872
|
-
.set(false, axis => (_) => _.options.opposite !== true &&
|
|
2873
|
-
_.options.visible &&
|
|
2874
|
-
_.index <= axis.index);
|
|
2705
|
+
.set(true, (axis) => (_) => _.options.opposite && _.options.visible && axis.index <= _.index)
|
|
2706
|
+
.set(false, (axis) => (_) => _.options.opposite !== true && _.options.visible && _.index <= axis.index);
|
|
2875
2707
|
this.sumSize = (acc, curr) => acc + curr.selfSize;
|
|
2876
2708
|
this.config = this._svc.config;
|
|
2877
2709
|
this.size = this._svc.size;
|
|
@@ -2882,7 +2714,7 @@ class ChartContainerComponent {
|
|
|
2882
2714
|
this.plotBands = combineLatest([this.config, this.scales]).pipe(map(([config, scales]) => {
|
|
2883
2715
|
const bands = [];
|
|
2884
2716
|
config.xAxis?.forEach((axis, index) => {
|
|
2885
|
-
axis.plotBands?.forEach(band => {
|
|
2717
|
+
axis.plotBands?.forEach((band) => {
|
|
2886
2718
|
bands.push({
|
|
2887
2719
|
plotBand: band,
|
|
2888
2720
|
axis: scales.x.get(index),
|
|
@@ -2890,7 +2722,7 @@ class ChartContainerComponent {
|
|
|
2890
2722
|
});
|
|
2891
2723
|
});
|
|
2892
2724
|
config.yAxis?.forEach((axis, index) => {
|
|
2893
|
-
axis.plotBands?.forEach(band => {
|
|
2725
|
+
axis.plotBands?.forEach((band) => {
|
|
2894
2726
|
bands.push({
|
|
2895
2727
|
plotBand: band,
|
|
2896
2728
|
axis: scales.y.get(index),
|
|
@@ -2901,47 +2733,28 @@ class ChartContainerComponent {
|
|
|
2901
2733
|
}));
|
|
2902
2734
|
this.brushScale = this._scaleService.scales.pipe(withLatestFrom(this.config), map((data) => {
|
|
2903
2735
|
const [{ x, y }, config] = data;
|
|
2904
|
-
return config.brush?.type === BrushType.x ||
|
|
2905
|
-
config?.zoom?.type === ZoomType.x
|
|
2736
|
+
return config.brush?.type === BrushType.x || config?.zoom?.type === ZoomType.x
|
|
2906
2737
|
? x.get(0)?.scale
|
|
2907
2738
|
: y.get(0)?.scale;
|
|
2908
2739
|
}), shareReplay({
|
|
2909
2740
|
bufferSize: 1,
|
|
2910
2741
|
refCount: true,
|
|
2911
2742
|
}));
|
|
2912
|
-
this.visibleRect = combineLatest([
|
|
2913
|
-
this.size,
|
|
2914
|
-
this.scales,
|
|
2915
|
-
this.config,
|
|
2916
|
-
]).pipe(map((data) => {
|
|
2743
|
+
this.visibleRect = combineLatest([this.size, this.scales, this.config]).pipe(map((data) => {
|
|
2917
2744
|
const [size, { x, y }, config] = data;
|
|
2918
2745
|
const yAxesArray = Array.from(y.values());
|
|
2919
2746
|
const xAxesArray = Array.from(x.values());
|
|
2920
|
-
const left = yAxesArray
|
|
2921
|
-
|
|
2922
|
-
.reduce(this.sumSize, 0);
|
|
2923
|
-
const right = yAxesArray
|
|
2924
|
-
.filter(_ => _.options.opposite && _.options.visible)
|
|
2925
|
-
.reduce(this.sumSize, 0);
|
|
2747
|
+
const left = yAxesArray.filter((_) => _.options.opposite !== true && _.options.visible).reduce(this.sumSize, 0);
|
|
2748
|
+
const right = yAxesArray.filter((_) => _.options.opposite && _.options.visible).reduce(this.sumSize, 0);
|
|
2926
2749
|
const bottom = xAxesArray
|
|
2927
|
-
.filter(_ => _.options.opposite !== true && _.options.visible)
|
|
2928
|
-
.reduce(this.sumSize, 0);
|
|
2929
|
-
const top = xAxesArray
|
|
2930
|
-
.filter(_ => _.options.opposite && _.options.visible)
|
|
2750
|
+
.filter((_) => _.options.opposite !== true && _.options.visible)
|
|
2931
2751
|
.reduce(this.sumSize, 0);
|
|
2752
|
+
const top = xAxesArray.filter((_) => _.options.opposite && _.options.visible).reduce(this.sumSize, 0);
|
|
2932
2753
|
return {
|
|
2933
2754
|
x: left + config.bounds?.left,
|
|
2934
2755
|
y: top + config.bounds?.top,
|
|
2935
|
-
width: size.width -
|
|
2936
|
-
|
|
2937
|
-
right -
|
|
2938
|
-
config.bounds?.left -
|
|
2939
|
-
config.bounds?.right,
|
|
2940
|
-
height: size.height -
|
|
2941
|
-
top -
|
|
2942
|
-
bottom -
|
|
2943
|
-
config.bounds?.top -
|
|
2944
|
-
config.bounds?.bottom,
|
|
2756
|
+
width: size.width - left - right - config.bounds?.left - config.bounds?.right,
|
|
2757
|
+
height: size.height - top - bottom - config.bounds?.top - config.bounds?.bottom,
|
|
2945
2758
|
};
|
|
2946
2759
|
}), tetaZoneFull(this._zone), shareReplay({
|
|
2947
2760
|
bufferSize: 1,
|
|
@@ -2982,20 +2795,16 @@ class ChartContainerComponent {
|
|
|
2982
2795
|
const oppositeTranslateX = oppositeOffsetX.reduce((acc, curr) => acc + curr.selfSize, config.bounds?.top);
|
|
2983
2796
|
const nonOppisteTranslateX = nonOppositeOffsetX.reduce((acc, curr) => acc + curr.selfSize, config.bounds?.bottom);
|
|
2984
2797
|
const left = yAxesArray
|
|
2985
|
-
.filter(_ => _.options.visible && _.options.opposite !== true)
|
|
2798
|
+
.filter((_) => _.options.visible && _.options.opposite !== true)
|
|
2986
2799
|
.reduce((acc, curr) => acc + curr.selfSize, config.bounds?.left);
|
|
2987
2800
|
const top = xAxesArray
|
|
2988
|
-
.filter(_ => _.options.visible && _.options.opposite === true)
|
|
2801
|
+
.filter((_) => _.options.visible && _.options.opposite === true)
|
|
2989
2802
|
.reduce((acc, curr) => acc + curr.selfSize, config.bounds?.top);
|
|
2990
2803
|
if (axis.orientation === AxisOrientation.x) {
|
|
2991
|
-
return `translate(${left}, ${axis.options.opposite
|
|
2992
|
-
? oppositeTranslateX
|
|
2993
|
-
: size.height - nonOppisteTranslateX})`;
|
|
2804
|
+
return `translate(${left}, ${axis.options.opposite ? oppositeTranslateX : size.height - nonOppisteTranslateX})`;
|
|
2994
2805
|
}
|
|
2995
2806
|
if (axis.orientation === AxisOrientation.y) {
|
|
2996
|
-
return `translate(${axis.options.opposite
|
|
2997
|
-
? size.width - oppositeTranslateY
|
|
2998
|
-
: nonOppisteTranslateY}, ${top})`;
|
|
2807
|
+
return `translate(${axis.options.opposite ? size.width - oppositeTranslateY : nonOppisteTranslateY}, ${top})`;
|
|
2999
2808
|
}
|
|
3000
2809
|
return 'translate(0, 0)';
|
|
3001
2810
|
}));
|
|
@@ -3032,7 +2841,7 @@ class ChartContainerComponent {
|
|
|
3032
2841
|
return item.name?.length ? item.name : index;
|
|
3033
2842
|
}
|
|
3034
2843
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: ChartContainerComponent, deps: [{ token: ChartService }, { token: ScaleService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3035
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: ChartContainerComponent, isStandalone: true, selector: "teta-chart-container", ngImport: i0, template: "@if ({
|
|
2844
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: ChartContainerComponent, isStandalone: true, selector: "teta-chart-container", ngImport: i0, template: "@if ({ size: size | async, config: config | async, scales: scales | async, plotBands: plotBands | async, visibleRect:\nvisibleRect | async }; as data) { @if (data.config?.tooltip?.enable) {\n<teta-tooltip [size]=\"data.size\" [config]=\"data.config\"></teta-tooltip>\n} @if (data.size?.height > 0 && data.size?.width > 0 && data.visibleRect?.height > 0 && data.visibleRect?.width > 0 &&\ndata.scales?.x.size === data.config.xAxis.length && 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) { @if (item.value.selfSize > 0 &&\n item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></rect>\n } }\n </g>\n <g class=\"x-axis-container\">\n @for (item of data.scales.x | keyvalue; track item.value.index) { @if (item.value.options.visible &&\n data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></rect>\n } }\n </g>\n</svg>\n} @if (data.size?.height > 0 && data.size?.width > 0 && data.visibleRect?.height > 0 && data.visibleRect?.width > 0 &&\ndata.scales?.x.size === data.config.xAxis.length && 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>\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 plotBand) {\n <g\n teta-plot-band\n [plotBand]=\"plotBand.plotBand\"\n [scale]=\"plotBand.axis.scale\"\n [size]=\"data.visibleRect\"\n [axis]=\"plotBand.axis\"\n ></g>\n }\n </g>\n <g class=\"series-container\">\n @for (series of data.config.series; track series; ) { @if (series.visible) {\n <g teta-series-host [config]=\"data.config\" [series]=\"series\"></g>\n } }\n </g>\n <g class=\"x-axis-plotline-container\">\n @for (axis of data.config.xAxis; let i = $index; track axis) { @for (plotLine of axis.plotLines; track plotLine) {\n <g\n teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"\n ></g>\n } }\n </g>\n <g class=\"y-axis-plotline-container\">\n @for (axis of data.config.yAxis; let i = $index; track axis; ) { @for (plotLine of axis.plotLines; track plotLine) {\n <g\n teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.get(i)\"\n ></g>\n } }\n </g>\n <g class=\"annotations\">\n @for (annotation of data.config.annotations; track annotation) {\n <g teta-annotation [visibleRect]=\"data.visibleRect\" [annotation]=\"annotation\"></g>\n }\n </g>\n @if (data.config.tooltip?.showCrosshair) {\n <g class=\"crosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></g>\n </g>\n }\n</svg>\n} }\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-width:0;min-height:0}:host .zoomable:hover{cursor:grab}:host .zoomable:active{cursor:grabbing}:host .crosshair{cursor:crosshair}\n"], dependencies: [{ kind: "component", type: TooltipComponent, selector: "teta-tooltip", inputs: ["size", "config"] }, { kind: "directive", type: ZoomableDirective, selector: "[tetaZoomable]", inputs: ["config", "axis", "size"] }, { kind: "component", type: XAxisComponent, selector: "[teta-x-axis]", inputs: ["axis", "size"] }, { kind: "component", type: YAxisComponent, selector: "[teta-y-axis]", inputs: ["axis", "size"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "component", type: PlotBandComponent, selector: "[teta-plot-band]", inputs: ["plotBand", "axis", "scale", "size"] }, { kind: "component", type: GridlinesComponent, selector: "[teta-gridlines]", inputs: ["size"] }, { kind: "component", type: SeriesHostComponent, selector: "[teta-series-host]", inputs: ["config", "series"] }, { kind: "component", type: PlotlineComponent, selector: "[teta-plot-line]", inputs: ["plotLine", "size", "axis", "scale"] }, { kind: "component", type: AnnotationComponent, selector: "[teta-annotation]", inputs: ["visibleRect", "annotation"] }, { kind: "component", type: CrosshairComponent, selector: "[teta-crosshair]", inputs: ["size"] }, { kind: "directive", type: BrushableDirective, selector: "[tetaBrushable]", inputs: ["config", "axis"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3036
2845
|
}
|
|
3037
2846
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: ChartContainerComponent, decorators: [{
|
|
3038
2847
|
type: Component,
|
|
@@ -3050,7 +2859,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImpor
|
|
|
3050
2859
|
AnnotationComponent,
|
|
3051
2860
|
CrosshairComponent,
|
|
3052
2861
|
BrushableDirective,
|
|
3053
|
-
], template: "@if ({
|
|
2862
|
+
], template: "@if ({ size: size | async, config: config | async, scales: scales | async, plotBands: plotBands | async, visibleRect:\nvisibleRect | async }; as data) { @if (data.config?.tooltip?.enable) {\n<teta-tooltip [size]=\"data.size\" [config]=\"data.config\"></teta-tooltip>\n} @if (data.size?.height > 0 && data.size?.width > 0 && data.visibleRect?.height > 0 && data.visibleRect?.width > 0 &&\ndata.scales?.x.size === data.config.xAxis.length && 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) { @if (item.value.selfSize > 0 &&\n item.value.options.visible && data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></rect>\n } }\n </g>\n <g class=\"x-axis-container\">\n @for (item of data.scales.x | keyvalue; track item.value.index) { @if (item.value.options.visible &&\n data.scales.x.size > 0 && data.scales.y.size > 0) {\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"\n ></rect>\n } }\n </g>\n</svg>\n} @if (data.size?.height > 0 && data.size?.width > 0 && data.visibleRect?.height > 0 && data.visibleRect?.width > 0 &&\ndata.scales?.x.size === data.config.xAxis.length && 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>\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 plotBand) {\n <g\n teta-plot-band\n [plotBand]=\"plotBand.plotBand\"\n [scale]=\"plotBand.axis.scale\"\n [size]=\"data.visibleRect\"\n [axis]=\"plotBand.axis\"\n ></g>\n }\n </g>\n <g class=\"series-container\">\n @for (series of data.config.series; track series; ) { @if (series.visible) {\n <g teta-series-host [config]=\"data.config\" [series]=\"series\"></g>\n } }\n </g>\n <g class=\"x-axis-plotline-container\">\n @for (axis of data.config.xAxis; let i = $index; track axis) { @for (plotLine of axis.plotLines; track plotLine) {\n <g\n teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"\n ></g>\n } }\n </g>\n <g class=\"y-axis-plotline-container\">\n @for (axis of data.config.yAxis; let i = $index; track axis; ) { @for (plotLine of axis.plotLines; track plotLine) {\n <g\n teta-plot-line\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.get(i)\"\n ></g>\n } }\n </g>\n <g class=\"annotations\">\n @for (annotation of data.config.annotations; track annotation) {\n <g teta-annotation [visibleRect]=\"data.visibleRect\" [annotation]=\"annotation\"></g>\n }\n </g>\n @if (data.config.tooltip?.showCrosshair) {\n <g class=\"crosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></g>\n </g>\n }\n</svg>\n} }\n", 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"] }]
|
|
3054
2863
|
}], ctorParameters: () => [{ type: ChartService }, { type: ScaleService }, { type: i0.ElementRef }, { type: i0.NgZone }] });
|
|
3055
2864
|
|
|
3056
2865
|
class LegendComponent {
|
|
@@ -3072,11 +2881,11 @@ class LegendComponent {
|
|
|
3072
2881
|
this.chartService.toggleVisibilitySeries([serie.id]);
|
|
3073
2882
|
}
|
|
3074
2883
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: LegendComponent, deps: [{ token: ChartService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3075
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: LegendComponent, isStandalone: true, selector: "teta-legend", inputs: { series: "series" }, host: { properties: { "class.padding-bottom-4": "this.classLegend" } }, ngImport: i0, template: "@for (serie of series; track serie.id) {
|
|
2884
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: LegendComponent, isStandalone: true, selector: "teta-legend", inputs: { series: "series" }, host: { properties: { "class.padding-bottom-4": "this.classLegend" } }, ngImport: i0, template: "@for (serie of series; track serie.id) { @if (serie?.showInLegend !== false) {\n<div>\n <div class=\"legend-item cursor-pointer\" (click)=\"click(serie)\">\n <div\n class=\"legend-icon-form\"\n [style.height.px]=\"getHeight(serie)\"\n [style.border-top-color]=\"serie.visible ? serie.color : 'var(--color-text-30)'\"\n [style.border-top-style]=\"serie.style?.strokeDasharray ? 'dashed' : 'solid'\"\n [style.border-width.px]=\"serie.style?.strokeDasharray ? 1 : 2\"\n ></div>\n <div\n class=\"legend-label\"\n style=\"user-select: none\"\n [style.text-decoration]=\"serie.visible ? 'none' : 'line-through'\"\n >\n {{ serie.name }}\n </div>\n </div>\n</div>\n} }\n", styles: [":host{display:flex;grid-gap:8px;flex-wrap:wrap;align-items:center;justify-content:space-evenly}:host .legend-item{display:flex;align-items:center}:host .legend-icon-form{width:12px}:host .legend-label{margin-left:5px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3076
2885
|
}
|
|
3077
2886
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: LegendComponent, decorators: [{
|
|
3078
2887
|
type: Component,
|
|
3079
|
-
args: [{ selector: 'teta-legend', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (serie of series; track serie.id) {
|
|
2888
|
+
args: [{ selector: 'teta-legend', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (serie of series; track serie.id) { @if (serie?.showInLegend !== false) {\n<div>\n <div class=\"legend-item cursor-pointer\" (click)=\"click(serie)\">\n <div\n class=\"legend-icon-form\"\n [style.height.px]=\"getHeight(serie)\"\n [style.border-top-color]=\"serie.visible ? serie.color : 'var(--color-text-30)'\"\n [style.border-top-style]=\"serie.style?.strokeDasharray ? 'dashed' : 'solid'\"\n [style.border-width.px]=\"serie.style?.strokeDasharray ? 1 : 2\"\n ></div>\n <div\n class=\"legend-label\"\n style=\"user-select: none\"\n [style.text-decoration]=\"serie.visible ? 'none' : 'line-through'\"\n >\n {{ serie.name }}\n </div>\n </div>\n</div>\n} }\n", styles: [":host{display:flex;grid-gap:8px;flex-wrap:wrap;align-items:center;justify-content:space-evenly}:host .legend-item{display:flex;align-items:center}:host .legend-icon-form{width:12px}:host .legend-label{margin-left:5px}\n"] }]
|
|
3080
2889
|
}], ctorParameters: () => [{ type: ChartService }], propDecorators: { series: [{
|
|
3081
2890
|
type: Input
|
|
3082
2891
|
}], classLegend: [{
|
|
@@ -3109,7 +2918,7 @@ class ChartComponent {
|
|
|
3109
2918
|
this.brushServiceInstance = new EventEmitter();
|
|
3110
2919
|
this._alive = true;
|
|
3111
2920
|
this.svcConfig = this.chartService.config;
|
|
3112
|
-
this.hasSeriesData = this.svcConfig.pipe(map(_ => _.series?.length > 0 && _.series?.some(_ => _.data?.length > 0)));
|
|
2921
|
+
this.hasSeriesData = this.svcConfig.pipe(map((_) => _.series?.length > 0 && _.series?.some((_) => _.data?.length > 0)));
|
|
3113
2922
|
}
|
|
3114
2923
|
resetZoom() {
|
|
3115
2924
|
this.scaleService.resetZoom();
|
|
@@ -3149,54 +2958,34 @@ class ChartComponent {
|
|
|
3149
2958
|
});
|
|
3150
2959
|
}
|
|
3151
2960
|
});
|
|
3152
|
-
this.chartService.plotBandEvent
|
|
3153
|
-
.pipe(takeWhile(() => this._alive))
|
|
3154
|
-
.subscribe(_ => {
|
|
2961
|
+
this.chartService.plotBandEvent.pipe(takeWhile(() => this._alive)).subscribe((_) => {
|
|
3155
2962
|
this.plotBandsMove.emit(_);
|
|
3156
2963
|
});
|
|
3157
|
-
this.chartService.plotLineMove
|
|
3158
|
-
.pipe(takeWhile(() => this._alive))
|
|
3159
|
-
.subscribe(_ => {
|
|
2964
|
+
this.chartService.plotLineMove.pipe(takeWhile(() => this._alive)).subscribe((_) => {
|
|
3160
2965
|
this.plotLinesMove.emit(_);
|
|
3161
2966
|
});
|
|
3162
|
-
this.chartService.pointMove
|
|
3163
|
-
.pipe(takeWhile(() => this._alive))
|
|
3164
|
-
.subscribe(_ => {
|
|
2967
|
+
this.chartService.pointMove.pipe(takeWhile(() => this._alive)).subscribe((_) => {
|
|
3165
2968
|
this.pointMove.emit(_);
|
|
3166
2969
|
});
|
|
3167
|
-
this.chartService.chartClick
|
|
3168
|
-
.pipe(takeWhile(() => this._alive))
|
|
3169
|
-
.subscribe(_ => {
|
|
2970
|
+
this.chartService.chartClick.pipe(takeWhile(() => this._alive)).subscribe((_) => {
|
|
3170
2971
|
this.chartClick.emit(_);
|
|
3171
2972
|
});
|
|
3172
|
-
this.chartService.chartContextMenu
|
|
3173
|
-
.pipe(takeWhile(() => this._alive))
|
|
3174
|
-
.subscribe(_ => {
|
|
2973
|
+
this.chartService.chartContextMenu.pipe(takeWhile(() => this._alive)).subscribe((_) => {
|
|
3175
2974
|
this.chartContextMenu.emit(_);
|
|
3176
2975
|
});
|
|
3177
|
-
this.chartService.plotBandClick
|
|
3178
|
-
.pipe(takeWhile(() => this._alive))
|
|
3179
|
-
.subscribe(_ => {
|
|
2976
|
+
this.chartService.plotBandClick.pipe(takeWhile(() => this._alive)).subscribe((_) => {
|
|
3180
2977
|
this.plotBandClick.emit(_);
|
|
3181
2978
|
});
|
|
3182
|
-
this.chartService.plotBandContextMenu
|
|
3183
|
-
.pipe(takeWhile(() => this._alive))
|
|
3184
|
-
.subscribe(_ => {
|
|
2979
|
+
this.chartService.plotBandContextMenu.pipe(takeWhile(() => this._alive)).subscribe((_) => {
|
|
3185
2980
|
this.plotBandContextMenu.emit(_);
|
|
3186
2981
|
});
|
|
3187
|
-
this.chartService.annotationContextMenu
|
|
3188
|
-
.pipe(takeWhile(() => this._alive))
|
|
3189
|
-
.subscribe(_ => {
|
|
2982
|
+
this.chartService.annotationContextMenu.pipe(takeWhile(() => this._alive)).subscribe((_) => {
|
|
3190
2983
|
this.annotationContextMenu.emit(_);
|
|
3191
2984
|
});
|
|
3192
|
-
this.chartService.annotationClick
|
|
3193
|
-
.pipe(takeWhile(() => this._alive))
|
|
3194
|
-
.subscribe(_ => {
|
|
2985
|
+
this.chartService.annotationClick.pipe(takeWhile(() => this._alive)).subscribe((_) => {
|
|
3195
2986
|
this.annotationClick.emit(_);
|
|
3196
2987
|
});
|
|
3197
|
-
this.chartService.annotationMove
|
|
3198
|
-
.pipe(takeWhile(() => this._alive))
|
|
3199
|
-
.subscribe(_ => {
|
|
2988
|
+
this.chartService.annotationMove.pipe(takeWhile(() => this._alive)).subscribe((_) => {
|
|
3200
2989
|
this.annotationMove.emit(_);
|
|
3201
2990
|
});
|
|
3202
2991
|
}
|
|
@@ -3204,15 +2993,11 @@ class ChartComponent {
|
|
|
3204
2993
|
this._alive = false;
|
|
3205
2994
|
}
|
|
3206
2995
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: ChartComponent, deps: [{ token: ChartService }, { token: ZoomService }, { token: BrushService }, { token: ScaleService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3207
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: ChartComponent, isStandalone: true, selector: "teta-svg-chart", inputs: { config: "config" }, outputs: { pointerMove: "pointerMove", plotBandsMove: "plotBandsMove", plotBandClick: "plotBandClick", plotBandContextMenu: "plotBandContextMenu", plotLinesMove: "plotLinesMove", pointMove: "pointMove", chartClick: "chartClick", chartContextMenu: "chartContextMenu", annotationContextMenu: "annotationContextMenu", annotationClick: "annotationClick", annotationMove: "annotationMove", zoomServiceInstance: "zoomServiceInstance", brushServiceInstance: "brushServiceInstance" }, providers: [ChartService, ZoomService, ScaleService, BrushService], ngImport: i0, template: "@if ({
|
|
2996
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: ChartComponent, isStandalone: true, selector: "teta-svg-chart", inputs: { config: "config" }, outputs: { pointerMove: "pointerMove", plotBandsMove: "plotBandsMove", plotBandClick: "plotBandClick", plotBandContextMenu: "plotBandContextMenu", plotLinesMove: "plotLinesMove", pointMove: "pointMove", chartClick: "chartClick", chartContextMenu: "chartContextMenu", annotationContextMenu: "annotationContextMenu", annotationClick: "annotationClick", annotationMove: "annotationMove", zoomServiceInstance: "zoomServiceInstance", brushServiceInstance: "brushServiceInstance" }, providers: [ChartService, ZoomService, ScaleService, BrushService], ngImport: i0, template: "@if ({ hasSeriesData: hasSeriesData | async, svcConfig: svcConfig | async }; as data) { @if (data.hasSeriesData ===\ntrue) {\n<div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container position-relative\"></teta-chart-container>\n</div>\n@if (data.svcConfig.legend?.enable === true) {\n<teta-legend [series]=\"data.svcConfig.series\"></teta-legend>\n} } @else {\n<div class=\"column column_auto justify-content-center\">\n <span class=\"font-body-3 color-text-40 overflow-hidden text-overflow-ellipsis nowrap text-align-center\">\n <div #ref><ng-content></ng-content></div>\n @if (!ref.hasChildNodes()) {\n <span> No data </span>\n }\n </span>\n</div>\n} }\n", styles: [":host{position:relative;display:flex;flex-direction:column;height:100%;width:100%}\n"], dependencies: [{ kind: "component", type: ChartContainerComponent, selector: "teta-chart-container" }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: LegendComponent, selector: "teta-legend", inputs: ["series"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3208
2997
|
}
|
|
3209
2998
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: ChartComponent, decorators: [{
|
|
3210
2999
|
type: Component,
|
|
3211
|
-
args: [{ selector: 'teta-svg-chart', standalone: true, providers: [ChartService, ZoomService, ScaleService, BrushService], changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
3212
|
-
ChartContainerComponent,
|
|
3213
|
-
AsyncPipe,
|
|
3214
|
-
LegendComponent,
|
|
3215
|
-
], template: "@if ({\n hasSeriesData: hasSeriesData | async,\n svcConfig: svcConfig | async\n}; as data) {\n @if (data.hasSeriesData === true) {\n <div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container position-relative\"></teta-chart-container>\n </div>\n @if (data.svcConfig.legend?.enable === true) {\n <teta-legend [series]=\"data.svcConfig.series\"></teta-legend>\n }\n } @else {\n <div class=\"column column_auto justify-content-center\">\n <span class=\"font-body-3 color-text-40 overflow-hidden text-overflow-ellipsis nowrap text-align-center\">\n <div #ref><ng-content></ng-content></div>\n @if (!ref.hasChildNodes()) {\n <span>\n No data\n </span>\n }\n </span>\n </div>\n }\n}\n", styles: [":host{position:relative;display:flex;flex-direction:column;height:100%;width:100%}\n"] }]
|
|
3000
|
+
args: [{ selector: 'teta-svg-chart', standalone: true, providers: [ChartService, ZoomService, ScaleService, BrushService], changeDetection: ChangeDetectionStrategy.OnPush, imports: [ChartContainerComponent, AsyncPipe, LegendComponent], template: "@if ({ hasSeriesData: hasSeriesData | async, svcConfig: svcConfig | async }; as data) { @if (data.hasSeriesData ===\ntrue) {\n<div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container position-relative\"></teta-chart-container>\n</div>\n@if (data.svcConfig.legend?.enable === true) {\n<teta-legend [series]=\"data.svcConfig.series\"></teta-legend>\n} } @else {\n<div class=\"column column_auto justify-content-center\">\n <span class=\"font-body-3 color-text-40 overflow-hidden text-overflow-ellipsis nowrap text-align-center\">\n <div #ref><ng-content></ng-content></div>\n @if (!ref.hasChildNodes()) {\n <span> No data </span>\n }\n </span>\n</div>\n} }\n", styles: [":host{position:relative;display:flex;flex-direction:column;height:100%;width:100%}\n"] }]
|
|
3216
3001
|
}], ctorParameters: () => [{ type: ChartService }, { type: ZoomService }, { type: BrushService }, { type: ScaleService }], propDecorators: { pointerMove: [{
|
|
3217
3002
|
type: Output
|
|
3218
3003
|
}], plotBandsMove: [{
|
|
@@ -3256,19 +3041,13 @@ class BlockHorizontalSeriesComponent extends SeriesBaseComponent {
|
|
|
3256
3041
|
this.id = (Date.now() + Math.random()).toString(36);
|
|
3257
3042
|
}
|
|
3258
3043
|
ngOnInit() {
|
|
3259
|
-
this.x = this.scaleService.scales.pipe(map(_ => _.x.get(this.series.xAxisIndex)?.scale));
|
|
3260
|
-
this.y = this.scaleService.scales.pipe(map(_ => _.y.get(this.series.yAxisIndex)?.scale));
|
|
3261
|
-
this.displayPoints = this.x.pipe(filter(y => y), map(y => {
|
|
3044
|
+
this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex)?.scale));
|
|
3045
|
+
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex)?.scale));
|
|
3046
|
+
this.displayPoints = this.x.pipe(filter((y) => y), map((y) => {
|
|
3262
3047
|
return this.series.data.filter((point, index, arr) => {
|
|
3263
3048
|
const [min, max] = y.domain();
|
|
3264
|
-
return ((point.x >= min ||
|
|
3265
|
-
point.x1
|
|
3266
|
-
arr[index + 1]?.x >= min ||
|
|
3267
|
-
arr[index + 1]?.x1 >= min) &&
|
|
3268
|
-
(point.x <= max ||
|
|
3269
|
-
point.x1 <= max ||
|
|
3270
|
-
arr[index - 1]?.x <= max ||
|
|
3271
|
-
arr[index - 1]?.x1 <= max));
|
|
3049
|
+
return ((point.x >= min || point.x1 >= min || arr[index + 1]?.x >= min || arr[index + 1]?.x1 >= min) &&
|
|
3050
|
+
(point.x <= max || point.x1 <= max || arr[index - 1]?.x <= max || arr[index - 1]?.x1 <= max));
|
|
3272
3051
|
});
|
|
3273
3052
|
}));
|
|
3274
3053
|
}
|
|
@@ -3285,14 +3064,11 @@ class BlockHorizontalSeriesComponent extends SeriesBaseComponent {
|
|
|
3285
3064
|
});
|
|
3286
3065
|
}
|
|
3287
3066
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: BlockHorizontalSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3288
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: BlockHorizontalSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-horizontal-series]", usesInheritance: true, ngImport: i0, template: "@if ({
|
|
3067
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.1", type: BlockHorizontalSeriesComponent, isStandalone: true, selector: "svg:svg[teta-block-horizontal-series]", usesInheritance: true, ngImport: i0, template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) { @if (series?.fillType ===\nfillType.gradient) {\n<svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n} @if (data.x && data.y) { @for (point of data.points; track point) {\n<svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.x]=\"data.x(point.x)\"\n [attr.width]=\"Math.abs(data.x(point.x1) - data.x(point.x))\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : point.color ?? series.style?.fill ?? series.color\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n height=\"100%\"\n ></svg:rect>\n @if (point.text && data.x(point.x1) - data.x(point.x) > 8) {\n <svg:text\n [attr.transform]=\"'rotate(270)'\"\n [ngStyle]=\"{ 'transform-origin': (data.x(point.x1) + data.x(point.x)) / 2 + 'px 50%' }\"\n y=\"50%\"\n [attr.x]=\"(data.x(point.x1) + data.x(point.x)) / 2\"\n text-anchor=\"middle\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n <svg:line\n y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x)\"\n [attr.x2]=\"data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? series.color\"\n ></svg:line>\n <svg:line\n y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x1)\"\n [attr.x2]=\"data.x(point.x1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? series.color\"\n ></svg:line>\n</svg:g>\n} } }\n", styles: [""], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3289
3068
|
}
|
|
3290
3069
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: BlockHorizontalSeriesComponent, decorators: [{
|
|
3291
3070
|
type: Component,
|
|
3292
|
-
args: [{ selector: 'svg:svg[teta-block-horizontal-series]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
3293
|
-
AsyncPipe,
|
|
3294
|
-
NgStyle,
|
|
3295
|
-
], template: "@if ({\n y: y | async,\n x: x | async,\n points: displayPoints | async\n}; as data) {\n @if (series?.fillType === fillType.gradient) {\n <svg:defs>\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.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n </svg:defs>\n }\n @if (data.x && data.y) {\n @for (point of data.points; track point) {\n <svg:g (mouseenter)=\"mouseenter(point)\"\n (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.x]=\"data.x(point.x)\"\n [attr.width]=\"Math.abs(data.x(point.x1) - data.x(point.x))\"\n [attr.fill]=\"series.fillType === fillType.gradient ? 'url(#gradient-fill-'+id+')' : point.iconId ? 'url(#pattern'+point.iconId+')' : point.color ?? series.style?.fill ?? series.color\"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n height=\"100%\">\n </svg:rect>\n @if (point.text && data.x(point.x1) - data.x(point.x) > 8) {\n <svg:text [attr.transform]=\"'rotate(270)'\"\n [ngStyle]='{\"transform-origin\": (data.x(point.x1) + data.x(point.x)) / 2+\"px 50%\"}'\n y=\"50%\"\n [attr.x]=\"(data.x(point.x1) + data.x(point.x)) / 2\"\n text-anchor=\"middle\" alignment-baseline=\"middle\"\n text-anchor=\"middle\">{{ point.text }}\n </svg:text>\n }\n <svg:line y1=\"0\" y2=\"100%\" [attr.x1]=\"data.x(point.x)\" [attr.x2]=\"data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? series.color\"></svg:line>\n <svg:line y1=\"0\" y2=\"100%\" [attr.x1]=\"data.x(point.x1)\" [attr.x2]=\"data.x(point.x1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? series.color\"></svg:line>\n </svg:g>\n }\n }\n}\n" }]
|
|
3071
|
+
args: [{ selector: 'svg:svg[teta-block-horizontal-series]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe, NgStyle], template: "@if ({ y: y | async, x: x | async, points: displayPoints | async }; as data) { @if (series?.fillType ===\nfillType.gradient) {\n<svg:defs>\n <svg:linearGradient\n [id]=\"'gradient-fill-' + id\"\n gradientUnits=\"userSpaceOnUse\"\n x1=\"0%\"\n [attr.y1]=\"config?.inverted ? '0%' : '100%'\"\n [attr.x2]=\"config?.inverted ? '100%' : '0%'\"\n y2=\"0%\"\n >\n <svg:stop offset=\"0%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0\"></svg:stop>\n <svg:stop offset=\"5%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.1\"></svg:stop>\n <svg:stop offset=\"20%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.2\"></svg:stop>\n <svg:stop offset=\"60%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.5\"></svg:stop>\n <svg:stop offset=\"100%\" [attr.stop-color]=\"series.style?.fill ?? series.color\" stop-opacity=\"0.9\"></svg:stop>\n </svg:linearGradient>\n</svg:defs>\n} @if (data.x && data.y) { @for (point of data.points; track point) {\n<svg:g (mouseenter)=\"mouseenter(point)\" (mouseleave)=\"mouseleave(point)\">\n <svg:rect\n x=\"0\"\n [attr.x]=\"data.x(point.x)\"\n [attr.width]=\"Math.abs(data.x(point.x1) - data.x(point.x))\"\n [attr.fill]=\"\n series.fillType === fillType.gradient\n ? 'url(#gradient-fill-' + id + ')'\n : point.iconId\n ? 'url(#pattern' + point.iconId + ')'\n : point.color ?? series.style?.fill ?? series.color\n \"\n [attr.fill-opacity]=\"series.style?.fillOpacity\"\n height=\"100%\"\n ></svg:rect>\n @if (point.text && data.x(point.x1) - data.x(point.x) > 8) {\n <svg:text\n [attr.transform]=\"'rotate(270)'\"\n [ngStyle]=\"{ 'transform-origin': (data.x(point.x1) + data.x(point.x)) / 2 + 'px 50%' }\"\n y=\"50%\"\n [attr.x]=\"(data.x(point.x1) + data.x(point.x)) / 2\"\n text-anchor=\"middle\"\n alignment-baseline=\"middle\"\n text-anchor=\"middle\"\n >\n {{ point.text }}\n </svg:text>\n }\n <svg:line\n y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x)\"\n [attr.x2]=\"data.x(point.x)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? series.color\"\n ></svg:line>\n <svg:line\n y1=\"0\"\n y2=\"100%\"\n [attr.x1]=\"data.x(point.x1)\"\n [attr.x2]=\"data.x(point.x1)\"\n [attr.stroke]=\"point.iconId ? 'var(--color-text-10)' : point.color ?? series.style?.stroke ?? series.color\"\n ></svg:line>\n</svg:g>\n} } }\n" }]
|
|
3296
3072
|
}], ctorParameters: () => [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }] });
|
|
3297
3073
|
|
|
3298
3074
|
/*
|