@tetacom/svg-charts 1.2.4 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chart/chart-container/chart-container.component.d.ts +4 -4
- package/chart/model/i-scales-map.d.ts +5 -0
- package/chart/model/public-api.d.ts +1 -0
- package/chart/service/scale.service.d.ts +2 -7
- package/esm2020/chart/chart/chart.component.mjs +5 -5
- package/esm2020/chart/chart-container/annotation/annotation.component.mjs +3 -3
- package/esm2020/chart/chart-container/chart-container.component.mjs +19 -26
- package/esm2020/chart/chart-container/gridlines/gridlines.component.mjs +7 -7
- package/esm2020/chart/chart-container/plotband/plot-band.component.mjs +3 -3
- package/esm2020/chart/chart-container/series/area-series/area-series.component.mjs +4 -7
- package/esm2020/chart/chart-container/series/bar/bar-series.component.mjs +5 -5
- package/esm2020/chart/chart-container/series/block-area-series/block-area-series.component.mjs +3 -3
- package/esm2020/chart/chart-container/series/block-series/block-series.component.mjs +3 -3
- package/esm2020/chart/chart-container/series/linear-series-base.mjs +6 -9
- package/esm2020/chart/chart-container/series/scatter-series/scatter-series.component.mjs +3 -3
- package/esm2020/chart/chart-container/x-axis/x-axis.component.mjs +3 -3
- package/esm2020/chart/chart-container/y-axis/y-axis.component.mjs +3 -3
- package/esm2020/chart/directives/brushable.directive.mjs +1 -1
- package/esm2020/chart/model/i-scales-map.mjs +2 -0
- package/esm2020/chart/model/public-api.mjs +2 -1
- package/esm2020/chart/service/scale.service.mjs +9 -170
- package/fesm2015/tetacom-svg-charts.mjs +62 -241
- package/fesm2015/tetacom-svg-charts.mjs.map +1 -1
- package/fesm2020/tetacom-svg-charts.mjs +58 -232
- package/fesm2020/tetacom-svg-charts.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -633,91 +633,7 @@ class ScaleService {
|
|
|
633
633
|
.set(ScaleType.symlog, d3.scaleSymlog)
|
|
634
634
|
.set(ScaleType.pow, d3.scalePow)
|
|
635
635
|
.set(ScaleType.sqrt, d3.scaleSqrt);
|
|
636
|
-
this.
|
|
637
|
-
this.chartService.size,
|
|
638
|
-
this.chartService.config,
|
|
639
|
-
]).pipe(map((data) => {
|
|
640
|
-
const [, config] = data;
|
|
641
|
-
const map = new Map();
|
|
642
|
-
config.xAxis.map((_, index) => {
|
|
643
|
-
map.set(index, Axis.createAxis(AxisOrientation.x, config, index));
|
|
644
|
-
});
|
|
645
|
-
return map;
|
|
646
|
-
}), shareReplay({
|
|
647
|
-
bufferSize: 1,
|
|
648
|
-
refCount: true,
|
|
649
|
-
}));
|
|
650
|
-
this.yAxisMap = combineLatest([
|
|
651
|
-
this.chartService.size,
|
|
652
|
-
this.chartService.config,
|
|
653
|
-
]).pipe(map((data) => {
|
|
654
|
-
const [, config] = data;
|
|
655
|
-
const map = new Map();
|
|
656
|
-
config.yAxis.map((_, index) => {
|
|
657
|
-
map.set(index, Axis.createAxis(AxisOrientation.y, config, index));
|
|
658
|
-
});
|
|
659
|
-
return map;
|
|
660
|
-
}), shareReplay({
|
|
661
|
-
bufferSize: 1,
|
|
662
|
-
refCount: true,
|
|
663
|
-
}));
|
|
664
|
-
this.xScaleMap = combineLatest([
|
|
665
|
-
this.chartService.size,
|
|
666
|
-
this.chartService.config,
|
|
667
|
-
this.zoomService.zoomed,
|
|
668
|
-
]).pipe(withLatestFrom(this.yAxisMap, this.xAxisMap), map((data) => {
|
|
669
|
-
const [[size, config, zoom], yAxes, xAxes] = data;
|
|
670
|
-
const map = new Map();
|
|
671
|
-
const left = [...yAxes.values()]
|
|
672
|
-
.filter((_) => _.options?.visible && _.options?.opposite)
|
|
673
|
-
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
674
|
-
const right = [...yAxes.values()]
|
|
675
|
-
.filter((_) => _.options?.visible && _.options?.opposite !== true)
|
|
676
|
-
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
677
|
-
const finalWidth = (size.width || 0) - left - right;
|
|
678
|
-
xAxes.forEach((axis) => {
|
|
679
|
-
let domain = axis.extremes;
|
|
680
|
-
if (axis?.options.inverted) {
|
|
681
|
-
domain = [...axis.extremes].reverse();
|
|
682
|
-
}
|
|
683
|
-
let scale = this.scaleMapping
|
|
684
|
-
.get(axis.options.scaleType.type)()
|
|
685
|
-
.domain(domain)
|
|
686
|
-
.range([0, finalWidth - config.bounds.right]);
|
|
687
|
-
if (axis.options.niceTicks) {
|
|
688
|
-
scale.nice();
|
|
689
|
-
}
|
|
690
|
-
if (axis.options.scaleType.type === ScaleType.log) {
|
|
691
|
-
scale.base(axis.options.scaleType.base);
|
|
692
|
-
}
|
|
693
|
-
map.set(axis.index, scale);
|
|
694
|
-
axis.setOriginDomain(scale.domain());
|
|
695
|
-
const hasCache = this.transformCacheX.has(axis.index);
|
|
696
|
-
const shouldRestore = zoom?.target?.orientation !== AxisOrientation.x ||
|
|
697
|
-
zoom.target?.index !== axis.index;
|
|
698
|
-
if (hasCache && shouldRestore) {
|
|
699
|
-
const restoredTransform = this.transformCacheX.get(axis.index);
|
|
700
|
-
map.set(axis.index, restoredTransform.rescaleX(scale));
|
|
701
|
-
}
|
|
702
|
-
});
|
|
703
|
-
if (zoom) {
|
|
704
|
-
const event = zoom.event;
|
|
705
|
-
if (zoom.target?.orientation === AxisOrientation.x) {
|
|
706
|
-
if (map.has(zoom.target.index)) {
|
|
707
|
-
const currentScale = map.get(zoom.target.index);
|
|
708
|
-
const rescaled = event.transform.rescaleX(currentScale);
|
|
709
|
-
map.set(zoom.target.index, rescaled);
|
|
710
|
-
const axis = xAxes.get(zoom.target.index);
|
|
711
|
-
this.transformCacheX.set(axis.index, event.transform);
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
return map;
|
|
716
|
-
}), shareReplay({
|
|
717
|
-
bufferSize: 1,
|
|
718
|
-
refCount: true,
|
|
719
|
-
}));
|
|
720
|
-
this.xMap = combineLatest([
|
|
636
|
+
this.scales = combineLatest([
|
|
721
637
|
this.chartService.size,
|
|
722
638
|
this.chartService.config,
|
|
723
639
|
this.zoomService.zoomed,
|
|
@@ -731,6 +647,7 @@ class ScaleService {
|
|
|
731
647
|
config.xAxis.map((_, index) => {
|
|
732
648
|
xAxisMap.set(index, Axis.createAxis(AxisOrientation.x, config, index));
|
|
733
649
|
});
|
|
650
|
+
// Generate x scales
|
|
734
651
|
const left = Array.from(yAxisMap.values())
|
|
735
652
|
.filter((_) => _.options?.visible && _.options?.opposite)
|
|
736
653
|
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
@@ -775,25 +692,7 @@ class ScaleService {
|
|
|
775
692
|
}
|
|
776
693
|
}
|
|
777
694
|
}
|
|
778
|
-
|
|
779
|
-
}), shareReplay({
|
|
780
|
-
bufferSize: 1,
|
|
781
|
-
refCount: true,
|
|
782
|
-
}));
|
|
783
|
-
this.yMap = combineLatest([
|
|
784
|
-
this.chartService.size,
|
|
785
|
-
this.chartService.config,
|
|
786
|
-
this.zoomService.zoomed,
|
|
787
|
-
]).pipe(map((data) => {
|
|
788
|
-
const [size, config, zoom] = data;
|
|
789
|
-
const xAxisMap = new Map();
|
|
790
|
-
const yAxisMap = new Map();
|
|
791
|
-
config.yAxis.map((_, index) => {
|
|
792
|
-
yAxisMap.set(index, Axis.createAxis(AxisOrientation.y, config, index));
|
|
793
|
-
});
|
|
794
|
-
config.xAxis.map((_, index) => {
|
|
795
|
-
xAxisMap.set(index, Axis.createAxis(AxisOrientation.x, config, index));
|
|
796
|
-
});
|
|
695
|
+
// Generate y axis
|
|
797
696
|
const top = Array.from(xAxisMap.values())
|
|
798
697
|
.filter((_) => _.options?.visible && _.options?.opposite)
|
|
799
698
|
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
@@ -845,70 +744,10 @@ class ScaleService {
|
|
|
845
744
|
}
|
|
846
745
|
}
|
|
847
746
|
}
|
|
848
|
-
return
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
}));
|
|
853
|
-
this.yScaleMap = combineLatest([
|
|
854
|
-
this.chartService.size,
|
|
855
|
-
this.chartService.config,
|
|
856
|
-
this.zoomService.zoomed,
|
|
857
|
-
]).pipe(withLatestFrom(this.yAxisMap, this.xAxisMap), map((data) => {
|
|
858
|
-
const [[size, config, zoom], yAxes, xAxes] = data;
|
|
859
|
-
const map = new Map();
|
|
860
|
-
const top = [...xAxes.values()]
|
|
861
|
-
.filter((_) => _.options?.visible && _.options?.opposite)
|
|
862
|
-
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
863
|
-
const bottom = [...xAxes.values()]
|
|
864
|
-
.filter((_) => _.options?.visible && _.options?.opposite !== true)
|
|
865
|
-
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
866
|
-
const finalHeight = (size.height || 0) -
|
|
867
|
-
top -
|
|
868
|
-
bottom -
|
|
869
|
-
config?.bounds?.top -
|
|
870
|
-
config.bounds?.bottom;
|
|
871
|
-
yAxes.forEach((axis) => {
|
|
872
|
-
let domain = axis.extremes;
|
|
873
|
-
if (axis.orientation === AxisOrientation.y) {
|
|
874
|
-
domain = [...axis.extremes].reverse();
|
|
875
|
-
}
|
|
876
|
-
if (axis?.options.inverted) {
|
|
877
|
-
domain = domain.reverse();
|
|
878
|
-
}
|
|
879
|
-
const scale = this.scaleMapping
|
|
880
|
-
.get(axis.options.scaleType.type)()
|
|
881
|
-
.domain(domain)
|
|
882
|
-
.range([config.bounds.top, finalHeight]);
|
|
883
|
-
if (axis.options.niceTicks) {
|
|
884
|
-
scale.nice();
|
|
885
|
-
}
|
|
886
|
-
if (axis.options.scaleType.type === ScaleType.log) {
|
|
887
|
-
scale.base(axis.options.scaleType.base);
|
|
888
|
-
}
|
|
889
|
-
map.set(axis.index, scale);
|
|
890
|
-
axis.setOriginDomain(scale.domain());
|
|
891
|
-
const hasCache = this.transformCacheY.has(axis.index);
|
|
892
|
-
const shouldRestore = zoom?.target?.orientation !== AxisOrientation.y ||
|
|
893
|
-
zoom.target?.index !== axis.index;
|
|
894
|
-
if (hasCache && shouldRestore) {
|
|
895
|
-
const restoredTransform = this.transformCacheY.get(axis.index);
|
|
896
|
-
map.set(axis.index, restoredTransform.rescaleY(scale));
|
|
897
|
-
}
|
|
898
|
-
});
|
|
899
|
-
if (zoom) {
|
|
900
|
-
const event = zoom.event;
|
|
901
|
-
if (zoom.target?.orientation === AxisOrientation.y) {
|
|
902
|
-
if (map.has(zoom.target.index)) {
|
|
903
|
-
const currentScale = map.get(zoom.target.index);
|
|
904
|
-
const rescaled = event.transform.rescaleY(currentScale);
|
|
905
|
-
map.set(zoom.target.index, rescaled);
|
|
906
|
-
const axis = yAxes.get(zoom.target.index);
|
|
907
|
-
this.transformCacheY.set(axis.index, event.transform);
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
return map;
|
|
747
|
+
return {
|
|
748
|
+
x: xAxisMap,
|
|
749
|
+
y: yAxisMap
|
|
750
|
+
};
|
|
912
751
|
}), shareReplay({
|
|
913
752
|
bufferSize: 1,
|
|
914
753
|
refCount: true,
|
|
@@ -1213,15 +1052,12 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1213
1052
|
};
|
|
1214
1053
|
this.defaultClipPointsMapping.set(ClipPointsDirection.x, filterX);
|
|
1215
1054
|
this.defaultClipPointsMapping.set(ClipPointsDirection.y, filterY);
|
|
1216
|
-
this.transform = this.svc.pointerMove.pipe(withLatestFrom(this.scaleService.
|
|
1217
|
-
const [event, x, y] = data;
|
|
1055
|
+
this.transform = this.svc.pointerMove.pipe(withLatestFrom(this.scaleService.scales), map((data) => {
|
|
1056
|
+
const [event, { x, y }] = data;
|
|
1218
1057
|
return this.getTransform(event, x.get(this.series.xAxisIndex).scale, y.get(this.series.yAxisIndex).scale);
|
|
1219
1058
|
}), tap(() => setTimeout(() => this.cdr.detectChanges())));
|
|
1220
|
-
this.path =
|
|
1221
|
-
|
|
1222
|
-
this.scaleService.yMap,
|
|
1223
|
-
]).pipe(map((data) => {
|
|
1224
|
-
const [x, y] = data;
|
|
1059
|
+
this.path = this.scaleService.scales.pipe(map((data) => {
|
|
1060
|
+
const { x, y } = data;
|
|
1225
1061
|
this.x = x.get(this.series.xAxisIndex).scale;
|
|
1226
1062
|
this.y = y.get(this.series.yAxisIndex).scale;
|
|
1227
1063
|
const filter = this.defaultClipPointsMapping.get(this.series.clipPointsDirection);
|
|
@@ -1428,8 +1264,8 @@ class BarSeriesComponent extends SeriesBaseComponent {
|
|
|
1428
1264
|
const count = _.series.filter((_) => _.type === SeriesType.bar && _.xAxisIndex === this.series.xAxisIndex);
|
|
1429
1265
|
return count.length;
|
|
1430
1266
|
}));
|
|
1431
|
-
this.x1 = this.scaleService.
|
|
1432
|
-
const x = _.get(this.series.xAxisIndex).scale;
|
|
1267
|
+
this.x1 = this.scaleService.scales.pipe(map((_) => {
|
|
1268
|
+
const x = _.x.get(this.series.xAxisIndex).scale;
|
|
1433
1269
|
const range = x.range();
|
|
1434
1270
|
const domain = this.series.data.map((_) => _.x);
|
|
1435
1271
|
return d3
|
|
@@ -1438,8 +1274,8 @@ class BarSeriesComponent extends SeriesBaseComponent {
|
|
|
1438
1274
|
.domain(domain)
|
|
1439
1275
|
.padding(0.1);
|
|
1440
1276
|
}));
|
|
1441
|
-
this.x = this.scaleService.
|
|
1442
|
-
this.y = this.scaleService.
|
|
1277
|
+
this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex).scale));
|
|
1278
|
+
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex).scale));
|
|
1443
1279
|
}
|
|
1444
1280
|
mouseenter(point) {
|
|
1445
1281
|
this.svc.setTooltip({
|
|
@@ -1472,8 +1308,8 @@ class ScatterSeriesComponent extends SeriesBaseComponent {
|
|
|
1472
1308
|
this.element = element;
|
|
1473
1309
|
}
|
|
1474
1310
|
ngOnInit() {
|
|
1475
|
-
this.x = this.scaleService.
|
|
1476
|
-
this.y = this.scaleService.
|
|
1311
|
+
this.x = this.scaleService.scales.pipe(map(_ => _.x.get(this.series.xAxisIndex).scale));
|
|
1312
|
+
this.y = this.scaleService.scales.pipe(map(_ => _.y.get(this.series.yAxisIndex).scale));
|
|
1477
1313
|
}
|
|
1478
1314
|
ngAfterViewInit() {
|
|
1479
1315
|
}
|
|
@@ -1511,8 +1347,8 @@ class BlockSeriesComponent extends SeriesBaseComponent {
|
|
|
1511
1347
|
}
|
|
1512
1348
|
ngOnInit() {
|
|
1513
1349
|
const defaultVisiblePixels = 0;
|
|
1514
|
-
this.x = this.scaleService.
|
|
1515
|
-
this.y = this.scaleService.
|
|
1350
|
+
this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex).scale));
|
|
1351
|
+
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex).scale));
|
|
1516
1352
|
this.displayPoints = this.y.pipe(map((y) => {
|
|
1517
1353
|
return this.series.data.filter((point, index, arr) => {
|
|
1518
1354
|
const [min, max] = y.domain();
|
|
@@ -1563,8 +1399,8 @@ class BlockAreaSeriesComponent extends SeriesBaseComponent {
|
|
|
1563
1399
|
}
|
|
1564
1400
|
ngOnInit() {
|
|
1565
1401
|
const defaultVisiblePixels = 0;
|
|
1566
|
-
this.x = this.scaleService.
|
|
1567
|
-
this.y = this.scaleService.
|
|
1402
|
+
this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.series.xAxisIndex).scale));
|
|
1403
|
+
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.series.yAxisIndex).scale));
|
|
1568
1404
|
this.displayPoints = this.y.pipe(map((y) => {
|
|
1569
1405
|
return this.series.data.filter((point, index, arr) => {
|
|
1570
1406
|
const [min, max] = y.domain();
|
|
@@ -1615,11 +1451,8 @@ class AreaSeriesComponent extends LinearSeriesBase {
|
|
|
1615
1451
|
}
|
|
1616
1452
|
ngOnInit() {
|
|
1617
1453
|
super.ngOnInit();
|
|
1618
|
-
this.areaPath =
|
|
1619
|
-
|
|
1620
|
-
this.scaleService.yMap,
|
|
1621
|
-
]).pipe(map((data) => {
|
|
1622
|
-
const [x, y] = data;
|
|
1454
|
+
this.areaPath = this.scaleService.scales.pipe(map((data) => {
|
|
1455
|
+
const { x, y } = data;
|
|
1623
1456
|
this.x = x.get(this.series.xAxisIndex).scale;
|
|
1624
1457
|
this.y = y.get(this.series.yAxisIndex).scale;
|
|
1625
1458
|
const area = d3
|
|
@@ -1711,16 +1544,16 @@ class GridlinesComponent {
|
|
|
1711
1544
|
this.svc = svc;
|
|
1712
1545
|
this.chartService = chartService;
|
|
1713
1546
|
this.config = this.chartService.config;
|
|
1714
|
-
this.tickYValues = this.svc.
|
|
1547
|
+
this.tickYValues = this.svc.scales.pipe(map((_) => {
|
|
1715
1548
|
const ratio = this.size.height / 40;
|
|
1716
|
-
return _.get(0).scale.ticks(ratio);
|
|
1549
|
+
return _.y.get(0).scale.ticks(ratio);
|
|
1717
1550
|
}));
|
|
1718
|
-
this.tickXValues = this.svc.
|
|
1551
|
+
this.tickXValues = this.svc.scales.pipe(map((_) => {
|
|
1719
1552
|
const ratio = this.size.width / 40;
|
|
1720
|
-
return _.get(0).scale.ticks(ratio);
|
|
1553
|
+
return _.x.get(0).scale.ticks(ratio);
|
|
1721
1554
|
}));
|
|
1722
|
-
this.y = this.svc.
|
|
1723
|
-
this.x = this.svc.
|
|
1555
|
+
this.y = this.svc.scales.pipe(map((_) => _.y.get(0).scale));
|
|
1556
|
+
this.x = this.svc.scales.pipe(map((_) => _.x.get(0).scale));
|
|
1724
1557
|
}
|
|
1725
1558
|
ngAfterViewInit() {
|
|
1726
1559
|
}
|
|
@@ -1738,8 +1571,8 @@ class XAxisComponent {
|
|
|
1738
1571
|
constructor(scaleService) {
|
|
1739
1572
|
this.scaleService = scaleService;
|
|
1740
1573
|
this._alive = true;
|
|
1741
|
-
this.x = this.scaleService.
|
|
1742
|
-
return _.get(this.axis.index)?.scale;
|
|
1574
|
+
this.x = this.scaleService.scales.pipe(map((_) => {
|
|
1575
|
+
return _.x.get(this.axis.index)?.scale;
|
|
1743
1576
|
}));
|
|
1744
1577
|
}
|
|
1745
1578
|
getLabelTransform() {
|
|
@@ -1765,8 +1598,8 @@ class YAxisComponent {
|
|
|
1765
1598
|
constructor(scaleService) {
|
|
1766
1599
|
this.scaleService = scaleService;
|
|
1767
1600
|
this._alive = true;
|
|
1768
|
-
this.y = this.scaleService.
|
|
1769
|
-
return _.get(this.axis.index)?.scale;
|
|
1601
|
+
this.y = this.scaleService.scales.pipe(map((_) => {
|
|
1602
|
+
return _.y.get(this.axis.index)?.scale;
|
|
1770
1603
|
}));
|
|
1771
1604
|
}
|
|
1772
1605
|
ngOnInit() { }
|
|
@@ -1992,10 +1825,10 @@ class PlotBandComponent {
|
|
|
1992
1825
|
}
|
|
1993
1826
|
}
|
|
1994
1827
|
PlotBandComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PlotBandComponent, deps: [{ token: ScaleService }, { token: ZoomService }, { token: ChartService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1995
|
-
PlotBandComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: PlotBandComponent, 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\" 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 ? from : null\"\n [attr.x]=\"axis.orientation === orientation.x ? from : null\">\n</svg:rect>\n\n<svg:text\n *ngIf=\"axis.orientation === orientation.x\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n class=\"label font-
|
|
1828
|
+
PlotBandComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: PlotBandComponent, 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\" 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 ? from : null\"\n [attr.x]=\"axis.orientation === orientation.x ? from : null\">\n</svg:rect>\n\n<svg:text\n *ngIf=\"axis.orientation === orientation.x\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n class=\"label font-body-3 fill-text-70\"\n [attr.x]=\"getTextCenter()\"\n [attr.transform]=\"'rotate(-90, '+ getTextCenter() +',' + height / 2 + ')'\"\n [attr.y]=\"height / 2\">{{plotBand.label}}\n</svg:text>\n\n<svg:text\n *ngIf=\"axis.orientation === orientation.y\"\n text-anchor=\"middle\"\n class=\"label font-body-3 fill-text-70\"\n dominant-baseline=\"central\"\n [attr.x]=\"getTextCenter()\"\n [attr.y]=\"width / 2\">{{plotBand.label}}\n</svg:text>\n\n<svg:line class=\"display-grabber\"\n *ngIf=\"plotBand.showGrabbers && plotBand.resizable\"\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\n<svg:line class=\"display-grabber\"\n *ngIf=\"plotBand.showGrabbers && plotBand.resizable\"\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 class=\"grabber\"\n *ngIf=\"plotBand.resizable\"\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 class=\"grabber\"\n *ngIf=\"plotBand.resizable\"\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\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"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1996
1829
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PlotBandComponent, decorators: [{
|
|
1997
1830
|
type: Component,
|
|
1998
|
-
args: [{ selector: '[teta-plot-band]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:rect\n class=\"plotband\" 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 ? from : null\"\n [attr.x]=\"axis.orientation === orientation.x ? from : null\">\n</svg:rect>\n\n<svg:text\n *ngIf=\"axis.orientation === orientation.x\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n class=\"label font-
|
|
1831
|
+
args: [{ selector: '[teta-plot-band]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:rect\n class=\"plotband\" 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 ? from : null\"\n [attr.x]=\"axis.orientation === orientation.x ? from : null\">\n</svg:rect>\n\n<svg:text\n *ngIf=\"axis.orientation === orientation.x\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n class=\"label font-body-3 fill-text-70\"\n [attr.x]=\"getTextCenter()\"\n [attr.transform]=\"'rotate(-90, '+ getTextCenter() +',' + height / 2 + ')'\"\n [attr.y]=\"height / 2\">{{plotBand.label}}\n</svg:text>\n\n<svg:text\n *ngIf=\"axis.orientation === orientation.y\"\n text-anchor=\"middle\"\n class=\"label font-body-3 fill-text-70\"\n dominant-baseline=\"central\"\n [attr.x]=\"getTextCenter()\"\n [attr.y]=\"width / 2\">{{plotBand.label}}\n</svg:text>\n\n<svg:line class=\"display-grabber\"\n *ngIf=\"plotBand.showGrabbers && plotBand.resizable\"\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\n<svg:line class=\"display-grabber\"\n *ngIf=\"plotBand.showGrabbers && plotBand.resizable\"\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 class=\"grabber\"\n *ngIf=\"plotBand.resizable\"\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 class=\"grabber\"\n *ngIf=\"plotBand.resizable\"\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\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"] }]
|
|
1999
1832
|
}], ctorParameters: function () { return [{ type: ScaleService }, { type: ZoomService }, { type: ChartService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { plotBand: [{
|
|
2000
1833
|
type: Input
|
|
2001
1834
|
}], axis: [{
|
|
@@ -2421,8 +2254,8 @@ class AnnotationComponent {
|
|
|
2421
2254
|
this.scaleService = scaleService;
|
|
2422
2255
|
this.cdr = cdr;
|
|
2423
2256
|
this.chartService = chartService;
|
|
2424
|
-
this.x = this.scaleService.
|
|
2425
|
-
this.y = this.scaleService.
|
|
2257
|
+
this.x = this.scaleService.scales.pipe(map((_) => _.x.get(this.annotation.xAxisIndex ?? 0).scale));
|
|
2258
|
+
this.y = this.scaleService.scales.pipe(map((_) => _.y.get(this.annotation.yAxisIndex ?? 0).scale));
|
|
2426
2259
|
this.drag = d3.drag();
|
|
2427
2260
|
}
|
|
2428
2261
|
set annotation(annotation) {
|
|
@@ -2536,28 +2369,21 @@ class ChartContainerComponent {
|
|
|
2536
2369
|
this.sumSize = (acc, curr) => acc + curr.selfSize;
|
|
2537
2370
|
this.config = this._svc.config;
|
|
2538
2371
|
this.size = this._svc.size;
|
|
2539
|
-
this.
|
|
2540
|
-
bufferSize: 1,
|
|
2541
|
-
refCount: true,
|
|
2542
|
-
}));
|
|
2543
|
-
this.xMap = this._scaleService.xMap.pipe(observeOn(animationFrameScheduler), tetaZoneFull(this._zone), shareReplay({
|
|
2372
|
+
this.scales = this._scaleService.scales.pipe(observeOn(animationFrameScheduler), tetaZoneFull(this._zone), shareReplay({
|
|
2544
2373
|
bufferSize: 1,
|
|
2545
2374
|
refCount: true,
|
|
2546
2375
|
}));
|
|
2547
|
-
this.brushScale =
|
|
2548
|
-
|
|
2549
|
-
this._scaleService.yMap,
|
|
2550
|
-
]).pipe(withLatestFrom(this.config), map((data) => {
|
|
2551
|
-
const [[x, y], config] = data;
|
|
2376
|
+
this.brushScale = this._scaleService.scales.pipe(withLatestFrom(this.config), map((data) => {
|
|
2377
|
+
const [{ x, y }, config] = data;
|
|
2552
2378
|
return config.brush?.type === BrushType.x || config?.zoom?.type === ZoomType.x ? x.get(0).scale : y.get(0).scale;
|
|
2553
2379
|
}), shareReplay({
|
|
2554
2380
|
bufferSize: 1,
|
|
2555
2381
|
refCount: true,
|
|
2556
2382
|
}));
|
|
2557
|
-
this.visibleRect = this.size.pipe(combineLatestWith(this.
|
|
2558
|
-
const [[size, x, y], config] = data;
|
|
2559
|
-
const yAxesArray =
|
|
2560
|
-
const xAxesArray =
|
|
2383
|
+
this.visibleRect = this.size.pipe(combineLatestWith(this.scales)).pipe(withLatestFrom(this.config), map((data) => {
|
|
2384
|
+
const [[size, { x, y }], config] = data;
|
|
2385
|
+
const yAxesArray = Array.from(y.values());
|
|
2386
|
+
const xAxesArray = Array.from(x.values());
|
|
2561
2387
|
const left = yAxesArray
|
|
2562
2388
|
.filter((_) => _.options.opposite !== true && _.options.visible)
|
|
2563
2389
|
.reduce(this.sumSize, 0);
|
|
@@ -2609,10 +2435,10 @@ class ChartContainerComponent {
|
|
|
2609
2435
|
this._observer.disconnect();
|
|
2610
2436
|
}
|
|
2611
2437
|
getTranslate(axis, size) {
|
|
2612
|
-
return
|
|
2613
|
-
const [
|
|
2614
|
-
const xAxesArray =
|
|
2615
|
-
const yAxesArray =
|
|
2438
|
+
return this.scales.pipe(withLatestFrom(this.config), map((data) => {
|
|
2439
|
+
const [{ x, y }, config] = data;
|
|
2440
|
+
const xAxesArray = Array.from(x.values());
|
|
2441
|
+
const yAxesArray = Array.from(y.values());
|
|
2616
2442
|
const oppositeFilter = this.filterPositionMap.get(true);
|
|
2617
2443
|
const nonOppositeFilter = this.filterPositionMap.get(false);
|
|
2618
2444
|
const oppositeOffsetY = yAxesArray.filter(oppositeFilter(axis));
|
|
@@ -2646,8 +2472,8 @@ class ChartContainerComponent {
|
|
|
2646
2472
|
return item.value.index;
|
|
2647
2473
|
}
|
|
2648
2474
|
click(event, xScales, yScales) {
|
|
2649
|
-
const x = xScales.get(0);
|
|
2650
|
-
const y = yScales.get(0);
|
|
2475
|
+
const x = xScales.get(0).scale;
|
|
2476
|
+
const y = yScales.get(0).scale;
|
|
2651
2477
|
this._svc.emitChartClick({
|
|
2652
2478
|
event: event,
|
|
2653
2479
|
target: {
|
|
@@ -2657,8 +2483,8 @@ class ChartContainerComponent {
|
|
|
2657
2483
|
});
|
|
2658
2484
|
}
|
|
2659
2485
|
contextMenu(event, xScales, yScales) {
|
|
2660
|
-
const x = xScales.get(0);
|
|
2661
|
-
const y = yScales.get(0);
|
|
2486
|
+
const x = xScales.get(0).scale;
|
|
2487
|
+
const y = yScales.get(0).scale;
|
|
2662
2488
|
this._svc.emitChartContextMenu({
|
|
2663
2489
|
event: event,
|
|
2664
2490
|
target: {
|
|
@@ -2675,10 +2501,10 @@ class ChartContainerComponent {
|
|
|
2675
2501
|
}
|
|
2676
2502
|
}
|
|
2677
2503
|
ChartContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ChartContainerComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
2678
|
-
ChartContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: ChartContainerComponent, selector: "teta-chart-container", ngImport: i0, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n
|
|
2504
|
+
ChartContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: ChartContainerComponent, selector: "teta-chart-container", ngImport: i0, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n scales: scales | async,\n visibleRect: visibleRect | async,\n brushScale: brushScale | async\n} as data\" xmlns:svg=\"http://www.w3.org/1999/html\">\n <teta-tooltip *ngIf=\"data.config?.tooltip?.enable\"\n [size]=\"data.size\"\n [config]=\"data.config\"></teta-tooltip>\n <ng-container *ngIf=\"data.visibleRect?.width > 0 && data.visibleRect?.height > 0 && data.scales.x && data.scales.y\">\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n <ng-container *ngFor=\"let item of data.scales.y | keyvalue; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.scales.y.get(item.key).scale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n\n </ng-container>\n </g>\n <g class=\"x-axis-container\">\n <ng-container *ngFor=\"let item of data.scales.x | keyvalue; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible && data.scales.x && data.scales.y\">\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.scales.x.get(item.key).scale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n </ng-container>\n </g>\n </svg>\n </ng-container>\n <ng-container *ngIf=\"data.visibleRect?.width > 0 && data.visibleRect?.height > 0 && data.scales.x && data.scales.y\">\n <svg\n tetaBrushable\n tetaZoomable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.brushScale\"\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 <g class=\"gridlines\"\n teta-gridlines\n *ngIf=\"data.config.gridLines?.enable !== false\"\n [size]=\"data.size\"></g>\n\n <g class=\"x-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"x-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"series-container\">\n <ng-container *ngFor=\"let series of data.config.series\">\n <g teta-series-host\n *ngIf=\"series.visible\"\n [config]=\"data.config\"\n [series]=\"series\"></g>\n </ng-container>\n </g>\n <g class=\"annotations\">\n <g teta-annotation\n *ngFor=\"let annotation of data.config.annotations\"\n [annotation]=\"annotation\"></g>\n </g>\n <g class=\"crosshair\" *ngIf=\"data.config.tooltip?.showCrosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></g>\n </g>\n </svg>\n\n </ng-container>\n</ng-container>\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: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SeriesHostComponent, selector: "[teta-series-host]", inputs: ["config", "series"] }, { kind: "component", type: GridlinesComponent, selector: "[teta-gridlines]", inputs: ["size"] }, { kind: "component", type: XAxisComponent, selector: "[teta-x-axis]", inputs: ["axis", "size"] }, { kind: "component", type: YAxisComponent, selector: "[teta-y-axis]", inputs: ["axis", "size"] }, { kind: "component", type: PlotlineComponent, selector: "[teta-plot-line]", inputs: ["plotLine", "size", "axis", "scale"] }, { kind: "component", type: PlotBandComponent, selector: "[teta-plot-band]", inputs: ["plotBand", "axis", "scale", "size"] }, { kind: "component", type: TooltipComponent, selector: "teta-tooltip", inputs: ["size", "config"] }, { kind: "directive", type: ZoomableDirective, selector: "[tetaZoomable]", inputs: ["config", "axis", "size", "brushScale", "scale"] }, { kind: "directive", type: BrushableDirective, selector: "[tetaBrushable]", inputs: ["config", "brushScale"] }, { kind: "component", type: AnnotationComponent, selector: "[teta-annotation]", inputs: ["annotation"] }, { kind: "component", type: CrosshairComponent, selector: "[teta-crosshair]", inputs: ["size"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2679
2505
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ChartContainerComponent, decorators: [{
|
|
2680
2506
|
type: Component,
|
|
2681
|
-
args: [{ selector: 'teta-chart-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n
|
|
2507
|
+
args: [{ selector: 'teta-chart-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n scales: scales | async,\n visibleRect: visibleRect | async,\n brushScale: brushScale | async\n} as data\" xmlns:svg=\"http://www.w3.org/1999/html\">\n <teta-tooltip *ngIf=\"data.config?.tooltip?.enable\"\n [size]=\"data.size\"\n [config]=\"data.config\"></teta-tooltip>\n <ng-container *ngIf=\"data.visibleRect?.width > 0 && data.visibleRect?.height > 0 && data.scales.x && data.scales.y\">\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n <ng-container *ngFor=\"let item of data.scales.y | keyvalue; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible\">\n <g\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.scales.y.get(item.key).scale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"item.value.options.opposite ? 0 : -item.value.selfSize\"\n [attr.y]=\"0\"\n [attr.height]=\"data.visibleRect.height\"\n [attr.width]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n\n </ng-container>\n </g>\n <g class=\"x-axis-container\">\n <ng-container *ngFor=\"let item of data.scales.x | keyvalue; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible && data.scales.x && data.scales.y\">\n <g\n teta-x-axis\n [axis]=\"item.value\"\n [size]=\"data.visibleRect\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></g>\n <rect\n tetaZoomable\n fill-opacity=\"0\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.scales.x.get(item.key).scale\"\n [axis]=\"item.value\"\n [config]=\"data.config\"\n [size]=\"data.visibleRect\"\n [attr.x]=\"0\"\n [attr.y]=\"item.value.options.opposite ? -item.value.selfSize : 0\"\n [attr.width]=\"data.visibleRect.width\"\n [attr.height]=\"item.value.selfSize\"\n [attr.transform]=\"getTranslate(item.value, data.size) | async\"></rect>\n </ng-container>\n </ng-container>\n </g>\n </svg>\n </ng-container>\n <ng-container *ngIf=\"data.visibleRect?.width > 0 && data.visibleRect?.height > 0 && data.scales.x && data.scales.y\">\n <svg\n tetaBrushable\n tetaZoomable\n class=\"position-absolute\"\n [size]=\"data.visibleRect\"\n [brushScale]=\"data.brushScale\"\n [scale]=\"data.brushScale\"\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 <g class=\"gridlines\"\n teta-gridlines\n *ngIf=\"data.config.gridLines?.enable !== false\"\n [size]=\"data.size\"></g>\n\n <g class=\"x-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotBand of axis.plotBands\"\n [plotBand]=\"plotBand\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.y.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"x-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.xAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.x.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of data.config.yAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotLine of axis.plotLines\"\n [plotLine]=\"plotLine\"\n [scale]=\"data.scales.y.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.scales.x.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"series-container\">\n <ng-container *ngFor=\"let series of data.config.series\">\n <g teta-series-host\n *ngIf=\"series.visible\"\n [config]=\"data.config\"\n [series]=\"series\"></g>\n </ng-container>\n </g>\n <g class=\"annotations\">\n <g teta-annotation\n *ngFor=\"let annotation of data.config.annotations\"\n [annotation]=\"annotation\"></g>\n </g>\n <g class=\"crosshair\" *ngIf=\"data.config.tooltip?.showCrosshair\">\n <g teta-crosshair [size]=\"data.visibleRect\"></g>\n </g>\n </svg>\n\n </ng-container>\n</ng-container>\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"] }]
|
|
2682
2508
|
}], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }, { type: i0.NgZone }]; } });
|
|
2683
2509
|
|
|
2684
2510
|
class LegendComponent {
|
|
@@ -2740,14 +2566,14 @@ class ChartComponent {
|
|
|
2740
2566
|
}
|
|
2741
2567
|
ngOnInit() {
|
|
2742
2568
|
this.chartService.pointerMove
|
|
2743
|
-
.pipe(takeWhile(() => this._alive), withLatestFrom(this.scaleService.
|
|
2569
|
+
.pipe(takeWhile(() => this._alive), withLatestFrom(this.scaleService.scales, this.chartService.config))
|
|
2744
2570
|
.subscribe((data) => {
|
|
2745
|
-
const [event, x, y, config] = data;
|
|
2571
|
+
const [event, { x, y }, config] = data;
|
|
2746
2572
|
const tooltipTracking = config?.tooltip?.tracking;
|
|
2747
2573
|
if (tooltipTracking === TooltipTracking.y) {
|
|
2748
2574
|
const result = new Map();
|
|
2749
2575
|
y.forEach((value, key) => {
|
|
2750
|
-
result.set(key, value.invert(event.offsetY));
|
|
2576
|
+
result.set(key, value.scale.invert(event.offsetY));
|
|
2751
2577
|
});
|
|
2752
2578
|
this.pointerMove.emit({
|
|
2753
2579
|
event: event,
|
|
@@ -2757,7 +2583,7 @@ class ChartComponent {
|
|
|
2757
2583
|
else {
|
|
2758
2584
|
const result = new Map();
|
|
2759
2585
|
x.forEach((value, key) => {
|
|
2760
|
-
result.set(key, value.invert(event.offsetX));
|
|
2586
|
+
result.set(key, value.scale.invert(event.offsetX));
|
|
2761
2587
|
});
|
|
2762
2588
|
this.pointerMove.emit({
|
|
2763
2589
|
event: event,
|