@tetacom/svg-charts 1.2.3 → 1.2.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/chart.component.d.ts +2 -1
- package/chart/chart-container/chart-container.component.d.ts +3 -5
- package/chart/chart-container/series/linear-series-base.d.ts +1 -1
- package/chart/chart-container/series/scatter-series/scatter-series.component.d.ts +0 -1
- package/chart/chart-container/x-axis/x-axis.component.d.ts +2 -4
- package/chart/core/axis/axis.d.ts +3 -0
- package/chart/service/chart.service.d.ts +4 -0
- package/chart/service/scale.service.d.ts +2 -0
- package/esm2020/chart/chart/chart.component.mjs +10 -2
- package/esm2020/chart/chart-container/annotation/annotation.component.mjs +3 -3
- package/esm2020/chart/chart-container/chart-container.component.mjs +10 -12
- package/esm2020/chart/chart-container/gridlines/gridlines.component.mjs +7 -7
- package/esm2020/chart/chart-container/series/area-series/area-series.component.mjs +5 -5
- 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 +19 -21
- 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 -27
- package/esm2020/chart/chart-container/y-axis/y-axis.component.mjs +3 -3
- package/esm2020/chart/core/axis/axis.mjs +7 -1
- package/esm2020/chart/default/default-axis-config.mjs +2 -2
- package/esm2020/chart/directives/zoomable.directive.mjs +4 -3
- package/esm2020/chart/service/brush.service.mjs +16 -13
- package/esm2020/chart/service/chart.service.mjs +6 -1
- package/esm2020/chart/service/scale.service.mjs +134 -1
- package/esm2020/chart/service/zoom.service.mjs +2 -2
- package/fesm2015/tetacom-svg-charts.mjs +233 -99
- package/fesm2015/tetacom-svg-charts.mjs.map +1 -1
- package/fesm2020/tetacom-svg-charts.mjs +225 -98
- package/fesm2020/tetacom-svg-charts.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -8,9 +8,9 @@ import * as d3 from 'd3';
|
|
|
8
8
|
import { zoomIdentity } from 'd3';
|
|
9
9
|
import objectHash from 'object-hash';
|
|
10
10
|
import { maxIndex } from 'd3-array';
|
|
11
|
+
import { debounceTime, tap as tap$1 } from 'rxjs/operators';
|
|
11
12
|
import { tetaZoneFull } from '@tetacom/ng-components';
|
|
12
13
|
import * as i3 from '@angular/platform-browser';
|
|
13
|
-
import { tap as tap$1, debounceTime } from 'rxjs/operators';
|
|
14
14
|
|
|
15
15
|
var ZoomType;
|
|
16
16
|
(function (ZoomType) {
|
|
@@ -95,7 +95,7 @@ const defaultAxisConfig = {
|
|
|
95
95
|
scaleType: {
|
|
96
96
|
type: ScaleType.linear,
|
|
97
97
|
},
|
|
98
|
-
niceTicks:
|
|
98
|
+
niceTicks: false,
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
var SeriesType;
|
|
@@ -149,6 +149,7 @@ class ChartService {
|
|
|
149
149
|
this.chartContextMenu$ = new Subject();
|
|
150
150
|
this.annotationEvent$ = new Subject();
|
|
151
151
|
this.annotationMove$ = new Subject();
|
|
152
|
+
this.zoomInstance$ = new Subject();
|
|
152
153
|
this.id = of((Date.now() + Math.random()).toString(36));
|
|
153
154
|
this.config = this.config$.asObservable().pipe(withLatestFrom(this.id), map(this.setDefaults), map(this.setPreparationData), map(this.restoreLocalStorage), shareReplay({
|
|
154
155
|
bufferSize: 1,
|
|
@@ -175,6 +176,7 @@ class ChartService {
|
|
|
175
176
|
this.plotBandContextMenu = this.plotBandEvent$
|
|
176
177
|
.asObservable()
|
|
177
178
|
.pipe(filter((_) => { var _a; return ((_a = _ === null || _ === void 0 ? void 0 : _.event) === null || _a === void 0 ? void 0 : _a.type) === 'contextmenu'; }));
|
|
179
|
+
this.zoomInstance = this.zoomInstance$.asObservable();
|
|
178
180
|
}
|
|
179
181
|
setConfig(config) {
|
|
180
182
|
this.clearTooltips();
|
|
@@ -243,6 +245,9 @@ class ChartService {
|
|
|
243
245
|
emitChartContextMenu(event) {
|
|
244
246
|
this.chartContextMenu$.next(event);
|
|
245
247
|
}
|
|
248
|
+
emitZoomInstance(event) {
|
|
249
|
+
this.zoomInstance$.next(event);
|
|
250
|
+
}
|
|
246
251
|
saveCookie(config) {
|
|
247
252
|
var _a;
|
|
248
253
|
if (!config.name)
|
|
@@ -355,7 +360,7 @@ class ZoomService {
|
|
|
355
360
|
this.scaleHashMap = new Map();
|
|
356
361
|
this.elementHashMap = new Map();
|
|
357
362
|
this.zoomHashMap = new Map();
|
|
358
|
-
this.zoomed$ = new BehaviorSubject(
|
|
363
|
+
this.zoomed$ = new BehaviorSubject({});
|
|
359
364
|
this.zoomed = this.zoomed$.asObservable().pipe(shareReplay({
|
|
360
365
|
bufferSize: 1,
|
|
361
366
|
refCount: true
|
|
@@ -562,6 +567,9 @@ class Axis {
|
|
|
562
567
|
setOriginDomain(domain) {
|
|
563
568
|
this._originDomain = domain;
|
|
564
569
|
}
|
|
570
|
+
setScale(scale) {
|
|
571
|
+
this._scale = scale;
|
|
572
|
+
}
|
|
565
573
|
setSelfSize() {
|
|
566
574
|
this._selfSize = new AxisSizeBuilder().build(this);
|
|
567
575
|
}
|
|
@@ -574,6 +582,9 @@ class Axis {
|
|
|
574
582
|
: this.chartConfig.yAxis[this.index];
|
|
575
583
|
this._options = options;
|
|
576
584
|
}
|
|
585
|
+
get scale() {
|
|
586
|
+
return this._scale;
|
|
587
|
+
}
|
|
577
588
|
get extremes() {
|
|
578
589
|
return this._extremes;
|
|
579
590
|
}
|
|
@@ -703,6 +714,143 @@ class ScaleService {
|
|
|
703
714
|
bufferSize: 1,
|
|
704
715
|
refCount: true,
|
|
705
716
|
}));
|
|
717
|
+
this.xMap = combineLatest([
|
|
718
|
+
this.chartService.size,
|
|
719
|
+
this.chartService.config,
|
|
720
|
+
this.zoomService.zoomed,
|
|
721
|
+
]).pipe(map((data) => {
|
|
722
|
+
var _a;
|
|
723
|
+
const [size, config, zoom] = data;
|
|
724
|
+
const xAxisMap = new Map();
|
|
725
|
+
const yAxisMap = new Map();
|
|
726
|
+
config.yAxis.map((_, index) => {
|
|
727
|
+
yAxisMap.set(index, Axis.createAxis(AxisOrientation.y, config, index));
|
|
728
|
+
});
|
|
729
|
+
config.xAxis.map((_, index) => {
|
|
730
|
+
xAxisMap.set(index, Axis.createAxis(AxisOrientation.x, config, index));
|
|
731
|
+
});
|
|
732
|
+
const left = Array.from(yAxisMap.values())
|
|
733
|
+
.filter((_) => { var _a, _b; return ((_a = _.options) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = _.options) === null || _b === void 0 ? void 0 : _b.opposite); })
|
|
734
|
+
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
735
|
+
const right = Array.from(yAxisMap.values())
|
|
736
|
+
.filter((_) => { var _a, _b; return ((_a = _.options) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = _.options) === null || _b === void 0 ? void 0 : _b.opposite) !== true; })
|
|
737
|
+
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
738
|
+
const finalWidth = (size.width || 0) - left - right;
|
|
739
|
+
xAxisMap.forEach((axis) => {
|
|
740
|
+
var _a, _b;
|
|
741
|
+
let domain = axis.extremes;
|
|
742
|
+
if (axis === null || axis === void 0 ? void 0 : axis.options.inverted) {
|
|
743
|
+
domain = [...axis.extremes].reverse();
|
|
744
|
+
}
|
|
745
|
+
let scale = this.scaleMapping
|
|
746
|
+
.get(axis.options.scaleType.type)()
|
|
747
|
+
.domain(domain)
|
|
748
|
+
.range([0, finalWidth - config.bounds.right]);
|
|
749
|
+
if (axis.options.niceTicks) {
|
|
750
|
+
scale.nice();
|
|
751
|
+
}
|
|
752
|
+
if (axis.options.scaleType.type === ScaleType.log) {
|
|
753
|
+
scale.base(axis.options.scaleType.base);
|
|
754
|
+
}
|
|
755
|
+
axis.setScale(scale);
|
|
756
|
+
axis.setOriginDomain(scale.domain());
|
|
757
|
+
const hasCache = this.transformCacheX.has(axis.index);
|
|
758
|
+
const shouldRestore = ((_a = zoom === null || zoom === void 0 ? void 0 : zoom.target) === null || _a === void 0 ? void 0 : _a.orientation) !== AxisOrientation.x ||
|
|
759
|
+
((_b = zoom.target) === null || _b === void 0 ? void 0 : _b.index) !== axis.index;
|
|
760
|
+
if (hasCache && shouldRestore) {
|
|
761
|
+
const restoredTransform = this.transformCacheX.get(axis.index);
|
|
762
|
+
axis.setScale(restoredTransform.rescaleX(scale));
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
if (zoom) {
|
|
766
|
+
const event = zoom.event;
|
|
767
|
+
if (((_a = zoom.target) === null || _a === void 0 ? void 0 : _a.orientation) === AxisOrientation.x) {
|
|
768
|
+
if (xAxisMap.has(zoom.target.index)) {
|
|
769
|
+
const x = xAxisMap.get(zoom.target.index);
|
|
770
|
+
const rescaled = event.transform.rescaleX(x.scale);
|
|
771
|
+
x.setScale(rescaled);
|
|
772
|
+
const axis = xAxisMap.get(zoom.target.index);
|
|
773
|
+
this.transformCacheX.set(axis.index, event.transform);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return xAxisMap;
|
|
778
|
+
}), shareReplay({
|
|
779
|
+
bufferSize: 1,
|
|
780
|
+
refCount: true,
|
|
781
|
+
}));
|
|
782
|
+
this.yMap = combineLatest([
|
|
783
|
+
this.chartService.size,
|
|
784
|
+
this.chartService.config,
|
|
785
|
+
this.zoomService.zoomed,
|
|
786
|
+
]).pipe(map((data) => {
|
|
787
|
+
var _a, _b, _c;
|
|
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
|
+
});
|
|
797
|
+
const top = Array.from(xAxisMap.values())
|
|
798
|
+
.filter((_) => { var _a, _b; return ((_a = _.options) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = _.options) === null || _b === void 0 ? void 0 : _b.opposite); })
|
|
799
|
+
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
800
|
+
const bottom = Array.from(xAxisMap.values())
|
|
801
|
+
.filter((_) => { var _a, _b; return ((_a = _.options) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = _.options) === null || _b === void 0 ? void 0 : _b.opposite) !== true; })
|
|
802
|
+
.reduce((acc, cur) => acc + cur.selfSize, 0);
|
|
803
|
+
const finalHeight = (size.height || 0) -
|
|
804
|
+
top -
|
|
805
|
+
bottom -
|
|
806
|
+
((_a = config === null || config === void 0 ? void 0 : config.bounds) === null || _a === void 0 ? void 0 : _a.top) -
|
|
807
|
+
((_b = config.bounds) === null || _b === void 0 ? void 0 : _b.bottom);
|
|
808
|
+
yAxisMap.forEach((axis) => {
|
|
809
|
+
var _a, _b;
|
|
810
|
+
let domain = axis.extremes;
|
|
811
|
+
if (axis.orientation === AxisOrientation.y) {
|
|
812
|
+
domain = [...axis.extremes].reverse();
|
|
813
|
+
}
|
|
814
|
+
if (axis === null || axis === void 0 ? void 0 : axis.options.inverted) {
|
|
815
|
+
domain = domain.reverse();
|
|
816
|
+
}
|
|
817
|
+
const scale = this.scaleMapping
|
|
818
|
+
.get(axis.options.scaleType.type)()
|
|
819
|
+
.domain(domain)
|
|
820
|
+
.range([config.bounds.top, finalHeight]);
|
|
821
|
+
if (axis.options.niceTicks) {
|
|
822
|
+
scale.nice();
|
|
823
|
+
}
|
|
824
|
+
if (axis.options.scaleType.type === ScaleType.log) {
|
|
825
|
+
scale.base(axis.options.scaleType.base);
|
|
826
|
+
}
|
|
827
|
+
axis.setScale(scale);
|
|
828
|
+
axis.setOriginDomain(scale.domain());
|
|
829
|
+
const hasCache = this.transformCacheY.has(axis.index);
|
|
830
|
+
const shouldRestore = ((_a = zoom === null || zoom === void 0 ? void 0 : zoom.target) === null || _a === void 0 ? void 0 : _a.orientation) !== AxisOrientation.y ||
|
|
831
|
+
((_b = zoom.target) === null || _b === void 0 ? void 0 : _b.index) !== axis.index;
|
|
832
|
+
if (hasCache && shouldRestore) {
|
|
833
|
+
const restoredTransform = this.transformCacheY.get(axis.index);
|
|
834
|
+
axis.setScale(restoredTransform.rescaleY(scale));
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
if (zoom) {
|
|
838
|
+
const event = zoom.event;
|
|
839
|
+
if (((_c = zoom.target) === null || _c === void 0 ? void 0 : _c.orientation) === AxisOrientation.y) {
|
|
840
|
+
if (yAxisMap.has(zoom.target.index)) {
|
|
841
|
+
const y = yAxisMap.get(zoom.target.index);
|
|
842
|
+
const rescaled = event.transform.rescaleY(y.scale);
|
|
843
|
+
y.setScale(rescaled);
|
|
844
|
+
const axis = yAxisMap.get(zoom.target.index);
|
|
845
|
+
this.transformCacheY.set(axis.index, event.transform);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return yAxisMap;
|
|
850
|
+
}), shareReplay({
|
|
851
|
+
bufferSize: 1,
|
|
852
|
+
refCount: true,
|
|
853
|
+
}));
|
|
706
854
|
this.yScaleMap = combineLatest([
|
|
707
855
|
this.chartService.size,
|
|
708
856
|
this.chartService.config,
|
|
@@ -947,7 +1095,7 @@ class BrushService {
|
|
|
947
1095
|
(window.TouchEvent &&
|
|
948
1096
|
m.message.event.sourceEvent instanceof TouchEvent));
|
|
949
1097
|
}), tap((m) => {
|
|
950
|
-
var _a, _b, _c, _d, _e
|
|
1098
|
+
var _a, _b, _c, _d, _e;
|
|
951
1099
|
const { message: { domain }, } = m;
|
|
952
1100
|
if ((((_a = m.message) === null || _a === void 0 ? void 0 : _a.axis.index) === 0 &&
|
|
953
1101
|
((_b = m.message) === null || _b === void 0 ? void 0 : _b.axis.orientation) === AxisOrientation.y &&
|
|
@@ -958,20 +1106,23 @@ class BrushService {
|
|
|
958
1106
|
brushScale(domain[0]),
|
|
959
1107
|
brushScale(domain[1]),
|
|
960
1108
|
]);
|
|
961
|
-
if (m.message.event.type === 'end') {
|
|
962
|
-
const brushMessage = new BrushMessage({
|
|
963
|
-
event: null,
|
|
964
|
-
selection: domain,
|
|
965
|
-
brushType: (_g = (_f = config === null || config === void 0 ? void 0 : config.brush) === null || _f === void 0 ? void 0 : _f.type) !== null && _g !== void 0 ? _g : BrushType.x,
|
|
966
|
-
brushScale,
|
|
967
|
-
});
|
|
968
|
-
this.broadcastService.broadcastBrush({
|
|
969
|
-
channel: (_h = config === null || config === void 0 ? void 0 : config.zoom) === null || _h === void 0 ? void 0 : _h.syncChannel,
|
|
970
|
-
message: brushMessage,
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
1109
|
this.selection = domain;
|
|
974
1110
|
}
|
|
1111
|
+
}), debounceTime(30), tap((m) => {
|
|
1112
|
+
var _a, _b, _c;
|
|
1113
|
+
const { message: { domain }, } = m;
|
|
1114
|
+
if (m.message.event.type === 'zoom') {
|
|
1115
|
+
const brushMessage = new BrushMessage({
|
|
1116
|
+
event: null,
|
|
1117
|
+
selection: domain,
|
|
1118
|
+
brushType: (_b = (_a = config === null || config === void 0 ? void 0 : config.brush) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : BrushType.x,
|
|
1119
|
+
brushScale,
|
|
1120
|
+
});
|
|
1121
|
+
this.broadcastService.broadcastBrush({
|
|
1122
|
+
channel: (_c = config === null || config === void 0 ? void 0 : config.zoom) === null || _c === void 0 ? void 0 : _c.syncChannel,
|
|
1123
|
+
message: brushMessage,
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
975
1126
|
}))
|
|
976
1127
|
.subscribe();
|
|
977
1128
|
}
|
|
@@ -1069,17 +1220,17 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1069
1220
|
};
|
|
1070
1221
|
this.defaultClipPointsMapping.set(ClipPointsDirection.x, filterX);
|
|
1071
1222
|
this.defaultClipPointsMapping.set(ClipPointsDirection.y, filterY);
|
|
1072
|
-
this.transform = this.svc.pointerMove.pipe(withLatestFrom(this.scaleService.
|
|
1223
|
+
this.transform = this.svc.pointerMove.pipe(withLatestFrom(this.scaleService.xMap, this.scaleService.yMap), map((data) => {
|
|
1073
1224
|
const [event, x, y] = data;
|
|
1074
|
-
return this.getTransform(event, x, y);
|
|
1225
|
+
return this.getTransform(event, x.get(this.series.xAxisIndex).scale, y.get(this.series.yAxisIndex).scale);
|
|
1075
1226
|
}), tap(() => setTimeout(() => this.cdr.detectChanges())));
|
|
1076
1227
|
this.path = combineLatest([
|
|
1077
|
-
this.scaleService.
|
|
1078
|
-
this.scaleService.
|
|
1228
|
+
this.scaleService.xMap,
|
|
1229
|
+
this.scaleService.yMap,
|
|
1079
1230
|
]).pipe(map((data) => {
|
|
1080
1231
|
const [x, y] = data;
|
|
1081
|
-
this.x = x.get(this.series.xAxisIndex);
|
|
1082
|
-
this.y = y.get(this.series.yAxisIndex);
|
|
1232
|
+
this.x = x.get(this.series.xAxisIndex).scale;
|
|
1233
|
+
this.y = y.get(this.series.yAxisIndex).scale;
|
|
1083
1234
|
const filter = this.defaultClipPointsMapping.get(this.series.clipPointsDirection);
|
|
1084
1235
|
const line = d3
|
|
1085
1236
|
.line()
|
|
@@ -1167,8 +1318,6 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1167
1318
|
return null;
|
|
1168
1319
|
}
|
|
1169
1320
|
const mouse = [event === null || event === void 0 ? void 0 : event.offsetX, event === null || event === void 0 ? void 0 : event.offsetY];
|
|
1170
|
-
const foundX = scaleX.get(this.series.xAxisIndex);
|
|
1171
|
-
const foundY = scaleY.get(this.series.yAxisIndex);
|
|
1172
1321
|
const tooltipTracking = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.tooltip) === null || _b === void 0 ? void 0 : _b.tracking;
|
|
1173
1322
|
const lineIntersection = (p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y) => {
|
|
1174
1323
|
const rV = {};
|
|
@@ -1194,18 +1343,18 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1194
1343
|
if (tooltipTracking === TooltipTracking.x) {
|
|
1195
1344
|
const bisect = d3.bisector((_) => _.x).right;
|
|
1196
1345
|
const pointer = mouse[0];
|
|
1197
|
-
let x0 =
|
|
1346
|
+
let x0 = scaleX.invert(pointer);
|
|
1198
1347
|
if (x0 instanceof Date) {
|
|
1199
1348
|
x0 = x0.getTime();
|
|
1200
1349
|
}
|
|
1201
1350
|
const rightId = bisect(this.series.data, x0);
|
|
1202
|
-
const range =
|
|
1203
|
-
const intersect = lineIntersection(pointer, range[0], pointer, range[1],
|
|
1204
|
-
const x =
|
|
1205
|
-
const y =
|
|
1351
|
+
const range = scaleY.range();
|
|
1352
|
+
const intersect = lineIntersection(pointer, range[0], pointer, range[1], scaleX((_c = this.series.data[rightId - 1]) === null || _c === void 0 ? void 0 : _c.x), scaleY((_d = this.series.data[rightId - 1]) === null || _d === void 0 ? void 0 : _d.y), scaleX((_e = this.series.data[rightId]) === null || _e === void 0 ? void 0 : _e.x), scaleY((_f = this.series.data[rightId]) === null || _f === void 0 ? void 0 : _f.y));
|
|
1353
|
+
const x = scaleX.invert(intersect.x);
|
|
1354
|
+
const y = scaleY.invert(intersect.y);
|
|
1206
1355
|
if (x !== null && x !== undefined && !isNaN(x) && y !== null && y !== undefined && !isNaN(y)) {
|
|
1207
1356
|
this.svc.setTooltip({
|
|
1208
|
-
point: { x:
|
|
1357
|
+
point: { x: scaleX.invert(intersect.x), y: scaleY.invert(intersect.y) },
|
|
1209
1358
|
series: this.series,
|
|
1210
1359
|
});
|
|
1211
1360
|
}
|
|
@@ -1222,18 +1371,18 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1222
1371
|
}
|
|
1223
1372
|
if (tooltipTracking === TooltipTracking.y) {
|
|
1224
1373
|
const bisect = d3.bisector((_) => _.y).right;
|
|
1225
|
-
let y0 =
|
|
1374
|
+
let y0 = scaleY.invert(mouse[1]);
|
|
1226
1375
|
if (y0 instanceof Date) {
|
|
1227
1376
|
y0 = y0.getTime();
|
|
1228
1377
|
}
|
|
1229
1378
|
const rightId = bisect(this.series.data, y0);
|
|
1230
|
-
const range =
|
|
1231
|
-
const intersect = lineIntersection(range[0], mouse[1], range[1], mouse[1],
|
|
1232
|
-
const x =
|
|
1233
|
-
const y =
|
|
1379
|
+
const range = scaleX.range();
|
|
1380
|
+
const intersect = lineIntersection(range[0], mouse[1], range[1], mouse[1], scaleX((_g = this.series.data[rightId - 1]) === null || _g === void 0 ? void 0 : _g.x), scaleY((_h = this.series.data[rightId - 1]) === null || _h === void 0 ? void 0 : _h.y), scaleX((_j = this.series.data[rightId]) === null || _j === void 0 ? void 0 : _j.x), scaleY((_k = this.series.data[rightId]) === null || _k === void 0 ? void 0 : _k.y));
|
|
1381
|
+
const x = scaleX.invert(intersect.x);
|
|
1382
|
+
const y = scaleY.invert(intersect.y);
|
|
1234
1383
|
if (x !== null && x !== undefined && !isNaN(x) && y !== null && y !== undefined && !isNaN(y)) {
|
|
1235
1384
|
this.svc.setTooltip({
|
|
1236
|
-
point: { x:
|
|
1385
|
+
point: { x: scaleX.invert(intersect.x), y: scaleY.invert(intersect.y) },
|
|
1237
1386
|
series: this.series,
|
|
1238
1387
|
});
|
|
1239
1388
|
}
|
|
@@ -1291,8 +1440,8 @@ class BarSeriesComponent extends SeriesBaseComponent {
|
|
|
1291
1440
|
const count = _.series.filter((_) => _.type === SeriesType.bar && _.xAxisIndex === this.series.xAxisIndex);
|
|
1292
1441
|
return count.length;
|
|
1293
1442
|
}));
|
|
1294
|
-
this.x1 = this.scaleService.
|
|
1295
|
-
const x = _.get(this.series.xAxisIndex);
|
|
1443
|
+
this.x1 = this.scaleService.xMap.pipe(map((_) => {
|
|
1444
|
+
const x = _.get(this.series.xAxisIndex).scale;
|
|
1296
1445
|
const range = x.range();
|
|
1297
1446
|
const domain = this.series.data.map((_) => _.x);
|
|
1298
1447
|
return d3
|
|
@@ -1301,8 +1450,8 @@ class BarSeriesComponent extends SeriesBaseComponent {
|
|
|
1301
1450
|
.domain(domain)
|
|
1302
1451
|
.padding(0.1);
|
|
1303
1452
|
}));
|
|
1304
|
-
this.x = this.scaleService.
|
|
1305
|
-
this.y = this.scaleService.
|
|
1453
|
+
this.x = this.scaleService.xMap.pipe(map((_) => _.get(this.series.xAxisIndex).scale));
|
|
1454
|
+
this.y = this.scaleService.yMap.pipe(map((_) => _.get(this.series.yAxisIndex).scale));
|
|
1306
1455
|
}
|
|
1307
1456
|
mouseenter(point) {
|
|
1308
1457
|
this.svc.setTooltip({
|
|
@@ -1335,8 +1484,8 @@ class ScatterSeriesComponent extends SeriesBaseComponent {
|
|
|
1335
1484
|
this.element = element;
|
|
1336
1485
|
}
|
|
1337
1486
|
ngOnInit() {
|
|
1338
|
-
this.x = this.scaleService.
|
|
1339
|
-
this.y = this.scaleService.
|
|
1487
|
+
this.x = this.scaleService.xMap.pipe(map(_ => _.get(this.series.xAxisIndex).scale));
|
|
1488
|
+
this.y = this.scaleService.yMap.pipe(map(_ => _.get(this.series.yAxisIndex).scale));
|
|
1340
1489
|
}
|
|
1341
1490
|
ngAfterViewInit() {
|
|
1342
1491
|
}
|
|
@@ -1374,8 +1523,8 @@ class BlockSeriesComponent extends SeriesBaseComponent {
|
|
|
1374
1523
|
}
|
|
1375
1524
|
ngOnInit() {
|
|
1376
1525
|
const defaultVisiblePixels = 0;
|
|
1377
|
-
this.x = this.scaleService.
|
|
1378
|
-
this.y = this.scaleService.
|
|
1526
|
+
this.x = this.scaleService.xMap.pipe(map((_) => _.get(this.series.xAxisIndex).scale));
|
|
1527
|
+
this.y = this.scaleService.yMap.pipe(map((_) => _.get(this.series.yAxisIndex).scale));
|
|
1379
1528
|
this.displayPoints = this.y.pipe(map((y) => {
|
|
1380
1529
|
return this.series.data.filter((point, index, arr) => {
|
|
1381
1530
|
var _a, _b, _c, _d;
|
|
@@ -1427,8 +1576,8 @@ class BlockAreaSeriesComponent extends SeriesBaseComponent {
|
|
|
1427
1576
|
}
|
|
1428
1577
|
ngOnInit() {
|
|
1429
1578
|
const defaultVisiblePixels = 0;
|
|
1430
|
-
this.x = this.scaleService.
|
|
1431
|
-
this.y = this.scaleService.
|
|
1579
|
+
this.x = this.scaleService.xMap.pipe(map((_) => _.get(this.series.xAxisIndex).scale));
|
|
1580
|
+
this.y = this.scaleService.yMap.pipe(map((_) => _.get(this.series.yAxisIndex).scale));
|
|
1432
1581
|
this.displayPoints = this.y.pipe(map((y) => {
|
|
1433
1582
|
return this.series.data.filter((point, index, arr) => {
|
|
1434
1583
|
var _a, _b, _c, _d;
|
|
@@ -1481,12 +1630,12 @@ class AreaSeriesComponent extends LinearSeriesBase {
|
|
|
1481
1630
|
ngOnInit() {
|
|
1482
1631
|
super.ngOnInit();
|
|
1483
1632
|
this.areaPath = combineLatest([
|
|
1484
|
-
this.scaleService.
|
|
1485
|
-
this.scaleService.
|
|
1633
|
+
this.scaleService.xMap,
|
|
1634
|
+
this.scaleService.yMap,
|
|
1486
1635
|
]).pipe(map((data) => {
|
|
1487
1636
|
const [x, y] = data;
|
|
1488
|
-
this.x = x.get(this.series.xAxisIndex);
|
|
1489
|
-
this.y = y.get(this.series.yAxisIndex);
|
|
1637
|
+
this.x = x.get(this.series.xAxisIndex).scale;
|
|
1638
|
+
this.y = y.get(this.series.yAxisIndex).scale;
|
|
1490
1639
|
const area = d3
|
|
1491
1640
|
.area()
|
|
1492
1641
|
.defined((point) => point.x !== null &&
|
|
@@ -1576,16 +1725,16 @@ class GridlinesComponent {
|
|
|
1576
1725
|
this.svc = svc;
|
|
1577
1726
|
this.chartService = chartService;
|
|
1578
1727
|
this.config = this.chartService.config;
|
|
1579
|
-
this.tickYValues = this.svc.
|
|
1728
|
+
this.tickYValues = this.svc.yMap.pipe(map((_) => {
|
|
1580
1729
|
const ratio = this.size.height / 40;
|
|
1581
|
-
return _.get(0).ticks(ratio);
|
|
1730
|
+
return _.get(0).scale.ticks(ratio);
|
|
1582
1731
|
}));
|
|
1583
|
-
this.tickXValues = this.svc.
|
|
1732
|
+
this.tickXValues = this.svc.xMap.pipe(map((_) => {
|
|
1584
1733
|
const ratio = this.size.width / 40;
|
|
1585
|
-
return _.get(0).ticks(ratio);
|
|
1734
|
+
return _.get(0).scale.ticks(ratio);
|
|
1586
1735
|
}));
|
|
1587
|
-
this.y = this.svc.
|
|
1588
|
-
this.x = this.svc.
|
|
1736
|
+
this.y = this.svc.yMap.pipe(map((_) => _.get(0).scale));
|
|
1737
|
+
this.x = this.svc.xMap.pipe(map((_) => _.get(0).scale));
|
|
1589
1738
|
}
|
|
1590
1739
|
ngAfterViewInit() {
|
|
1591
1740
|
}
|
|
@@ -1603,8 +1752,9 @@ class XAxisComponent {
|
|
|
1603
1752
|
constructor(scaleService) {
|
|
1604
1753
|
this.scaleService = scaleService;
|
|
1605
1754
|
this._alive = true;
|
|
1606
|
-
this.x = this.scaleService.
|
|
1607
|
-
|
|
1755
|
+
this.x = this.scaleService.xMap.pipe(map((_) => {
|
|
1756
|
+
var _a;
|
|
1757
|
+
return (_a = _.get(this.axis.index)) === null || _a === void 0 ? void 0 : _a.scale;
|
|
1608
1758
|
}));
|
|
1609
1759
|
}
|
|
1610
1760
|
getLabelTransform() {
|
|
@@ -1614,30 +1764,6 @@ class XAxisComponent {
|
|
|
1614
1764
|
ngOnDestroy() {
|
|
1615
1765
|
this._alive = false;
|
|
1616
1766
|
}
|
|
1617
|
-
ngAfterViewInit() {
|
|
1618
|
-
// this.draw();
|
|
1619
|
-
}
|
|
1620
|
-
draw() {
|
|
1621
|
-
// if (!this.node || !this.axis) {
|
|
1622
|
-
// return;
|
|
1623
|
-
// }
|
|
1624
|
-
//
|
|
1625
|
-
// const axis = this.axis.options.opposite
|
|
1626
|
-
// ? d3
|
|
1627
|
-
// .axisTop(this.scale)
|
|
1628
|
-
// .tickFormat(
|
|
1629
|
-
// this.axis.options.tickFormat ?? this.axis.defaultFormatter()
|
|
1630
|
-
// )
|
|
1631
|
-
// : d3
|
|
1632
|
-
// .axisBottom(this.scale)
|
|
1633
|
-
// .tickFormat(
|
|
1634
|
-
// this.axis.options.tickFormat ?? this.axis.defaultFormatter()
|
|
1635
|
-
// );
|
|
1636
|
-
//
|
|
1637
|
-
// d3.select(this.node.nativeElement)
|
|
1638
|
-
// .call(axis)
|
|
1639
|
-
// .call((_) => _.select('.domain').remove());
|
|
1640
|
-
}
|
|
1641
1767
|
}
|
|
1642
1768
|
XAxisComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: XAxisComponent, deps: [{ token: ScaleService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1643
1769
|
XAxisComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: XAxisComponent, selector: "[teta-x-axis]", inputs: { axis: "axis", size: "size" }, ngImport: i0, template: "<ng-container *ngIf=\"x | async as scale\">\n <svg:g text-anchor=\"middle\" *ngFor=\"let tick of scale.ticks()\" [attr.transform]=\"'translate('+ scale(tick) +', 0)'\">\n <text fill=\"var(--color-text-70)\" [attr.dy]=\"axis.options.opposite ? '-0.71em' : '0.71em'\" [attr.y]=\"axis.options.opposite ? 0 : 9\">{{ this.axis.options.tickFormat ? this.axis.options.tickFormat(tick) : this.axis.defaultFormatter()(tick) }}</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\">{{ axis.options.title }}</text>\n </svg:g>\n</ng-container>\n\n", styles: [":host .tick{stroke:var(--color-text-20)}\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: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
@@ -1654,8 +1780,9 @@ class YAxisComponent {
|
|
|
1654
1780
|
constructor(scaleService) {
|
|
1655
1781
|
this.scaleService = scaleService;
|
|
1656
1782
|
this._alive = true;
|
|
1657
|
-
this.y = this.scaleService.
|
|
1658
|
-
|
|
1783
|
+
this.y = this.scaleService.yMap.pipe(map((_) => {
|
|
1784
|
+
var _a;
|
|
1785
|
+
return (_a = _.get(this.axis.index)) === null || _a === void 0 ? void 0 : _a.scale;
|
|
1659
1786
|
}));
|
|
1660
1787
|
}
|
|
1661
1788
|
ngOnInit() { }
|
|
@@ -2086,6 +2213,7 @@ class ZoomableDirective {
|
|
|
2086
2213
|
this.zoom.scaleExtent([maxZoom, minZoom]);
|
|
2087
2214
|
this.zoom.on('zoom end', this.zoomed);
|
|
2088
2215
|
this._element.call(this.zoom).on('dblclick.zoom', null); // Disable dbclick zoom
|
|
2216
|
+
this.chartService.emitZoomInstance(this.zoomService);
|
|
2089
2217
|
if (((_p = (_o = this.config) === null || _o === void 0 ? void 0 : _o.zoom) === null || _p === void 0 ? void 0 : _p.zoomBehavior) === ZoomBehaviorType.wheel) {
|
|
2090
2218
|
this.runWheelZoom();
|
|
2091
2219
|
}
|
|
@@ -2141,7 +2269,7 @@ class ZoomableDirective {
|
|
|
2141
2269
|
.pipe(combineLatestWith(this.chartService.size), takeWhile((_) => this.alive), filter((data) => {
|
|
2142
2270
|
const [m] = data;
|
|
2143
2271
|
return Boolean(m.message.selection);
|
|
2144
|
-
}),
|
|
2272
|
+
}), tap$1((data) => {
|
|
2145
2273
|
var _a, _b, _c, _d, _e, _f;
|
|
2146
2274
|
const [m] = data;
|
|
2147
2275
|
const currentTransform = d3.zoomTransform(this._element.node());
|
|
@@ -2325,8 +2453,8 @@ class AnnotationComponent {
|
|
|
2325
2453
|
this.scaleService = scaleService;
|
|
2326
2454
|
this.cdr = cdr;
|
|
2327
2455
|
this.chartService = chartService;
|
|
2328
|
-
this.x = this.scaleService.
|
|
2329
|
-
this.y = this.scaleService.
|
|
2456
|
+
this.x = this.scaleService.xMap.pipe(map((_) => { var _a; return _.get((_a = this.annotation.xAxisIndex) !== null && _a !== void 0 ? _a : 0).scale; }));
|
|
2457
|
+
this.y = this.scaleService.yMap.pipe(map((_) => { var _a; return _.get((_a = this.annotation.yAxisIndex) !== null && _a !== void 0 ? _a : 0).scale; }));
|
|
2330
2458
|
this.drag = d3.drag();
|
|
2331
2459
|
}
|
|
2332
2460
|
set annotation(annotation) {
|
|
@@ -2440,28 +2568,26 @@ class ChartContainerComponent {
|
|
|
2440
2568
|
this.sumSize = (acc, curr) => acc + curr.selfSize;
|
|
2441
2569
|
this.config = this._svc.config;
|
|
2442
2570
|
this.size = this._svc.size;
|
|
2443
|
-
this.
|
|
2444
|
-
this.xAxisMap = this._scaleService.xAxisMap;
|
|
2445
|
-
this.yScaleMap = this._scaleService.yScaleMap.pipe(observeOn(animationFrameScheduler, 10), tetaZoneFull(this._zone), shareReplay({
|
|
2571
|
+
this.yMap = this._scaleService.yMap.pipe(observeOn(animationFrameScheduler), tetaZoneFull(this._zone), shareReplay({
|
|
2446
2572
|
bufferSize: 1,
|
|
2447
2573
|
refCount: true,
|
|
2448
2574
|
}));
|
|
2449
|
-
this.
|
|
2575
|
+
this.xMap = this._scaleService.xMap.pipe(observeOn(animationFrameScheduler), tetaZoneFull(this._zone), shareReplay({
|
|
2450
2576
|
bufferSize: 1,
|
|
2451
2577
|
refCount: true,
|
|
2452
2578
|
}));
|
|
2453
2579
|
this.brushScale = combineLatest([
|
|
2454
|
-
this._scaleService.
|
|
2455
|
-
this._scaleService.
|
|
2580
|
+
this._scaleService.xMap,
|
|
2581
|
+
this._scaleService.yMap,
|
|
2456
2582
|
]).pipe(withLatestFrom(this.config), map((data) => {
|
|
2457
2583
|
var _a, _b;
|
|
2458
2584
|
const [[x, y], config] = data;
|
|
2459
|
-
return ((_a = config.brush) === null || _a === void 0 ? void 0 : _a.type) === BrushType.x || ((_b = config === null || config === void 0 ? void 0 : config.zoom) === null || _b === void 0 ? void 0 : _b.type) === ZoomType.x ? x.get(0) : y.get(0);
|
|
2585
|
+
return ((_a = config.brush) === null || _a === void 0 ? void 0 : _a.type) === BrushType.x || ((_b = config === null || config === void 0 ? void 0 : config.zoom) === null || _b === void 0 ? void 0 : _b.type) === ZoomType.x ? x.get(0).scale : y.get(0).scale;
|
|
2460
2586
|
}), shareReplay({
|
|
2461
2587
|
bufferSize: 1,
|
|
2462
2588
|
refCount: true,
|
|
2463
2589
|
}));
|
|
2464
|
-
this.visibleRect = this.size.pipe(combineLatestWith(this.
|
|
2590
|
+
this.visibleRect = this.size.pipe(combineLatestWith(this.xMap, this.yMap)).pipe(withLatestFrom(this.config), map((data) => {
|
|
2465
2591
|
var _a, _b, _c, _d, _e, _f;
|
|
2466
2592
|
const [[size, x, y], config] = data;
|
|
2467
2593
|
const yAxesArray = [...y.values()];
|
|
@@ -2517,7 +2643,7 @@ class ChartContainerComponent {
|
|
|
2517
2643
|
this._observer.disconnect();
|
|
2518
2644
|
}
|
|
2519
2645
|
getTranslate(axis, size) {
|
|
2520
|
-
return combineLatest([this.
|
|
2646
|
+
return combineLatest([this.xMap, this.yMap]).pipe(withLatestFrom(this.config), map((data) => {
|
|
2521
2647
|
var _a, _b;
|
|
2522
2648
|
const [[x, y], config] = data;
|
|
2523
2649
|
const xAxesArray = [...x.values()];
|
|
@@ -2584,10 +2710,10 @@ class ChartContainerComponent {
|
|
|
2584
2710
|
}
|
|
2585
2711
|
}
|
|
2586
2712
|
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 });
|
|
2587
|
-
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
|
|
2713
|
+
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 yMap: yMap | async,\n xMap: xMap | 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.xMap.size === data.config?.xAxis?.length && data.yMap.size === data.config?.yAxis?.length\">\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n <ng-container *ngFor=\"let item of data.yMap | 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.yMap.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.xMap | keyvalue; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible && data.xMap.size === data.config?.xAxis?.length && data.yMap.size === data.config?.yAxis?.length\">\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.xMap.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.xMap.size === data.config?.xAxis?.length && data.yMap.size === data.config?.yAxis?.length\">\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.xMap.get(0) : data.yMap.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.xMap, data.yMap)\"\n (click)=\"click($event, data.xMap, data.yMap)\"\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.xMap.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.xMap.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.yMap.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.yMap.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.xMap.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.xMap.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.yMap.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.yMap.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 });
|
|
2588
2714
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ChartContainerComponent, decorators: [{
|
|
2589
2715
|
type: Component,
|
|
2590
|
-
args: [{ selector: 'teta-chart-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n
|
|
2716
|
+
args: [{ selector: 'teta-chart-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n size: size | async,\n config: config | async,\n yMap: yMap | async,\n xMap: xMap | 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.xMap.size === data.config?.xAxis?.length && data.yMap.size === data.config?.yAxis?.length\">\n <svg height=\"100%\" width=\"100%\" class=\"position-absolute\">\n <g class=\"y-axis-container\">\n <ng-container *ngFor=\"let item of data.yMap | 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.yMap.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.xMap | keyvalue; trackBy: identify\">\n <ng-container *ngIf=\"item.value.options.visible && data.xMap.size === data.config?.xAxis?.length && data.yMap.size === data.config?.yAxis?.length\">\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.xMap.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.xMap.size === data.config?.xAxis?.length && data.yMap.size === data.config?.yAxis?.length\">\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.xMap.get(0) : data.yMap.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.xMap, data.yMap)\"\n (click)=\"click($event, data.xMap, data.yMap)\"\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.xMap.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.xMap.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.yMap.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.yMap.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.xMap.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.xMap.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.yMap.get(i).scale\"\n [size]=\"data.size\"\n [axis]=\"data.yMap.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"] }]
|
|
2591
2717
|
}], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }, { type: i0.NgZone }]; } });
|
|
2592
2718
|
|
|
2593
2719
|
class LegendComponent {
|
|
@@ -2638,6 +2764,7 @@ class ChartComponent {
|
|
|
2638
2764
|
this.annotationContextMenu = new EventEmitter();
|
|
2639
2765
|
this.annotationClick = new EventEmitter();
|
|
2640
2766
|
this.annotationMove = new EventEmitter();
|
|
2767
|
+
this.zoomServiceInstance = new EventEmitter();
|
|
2641
2768
|
this._alive = true;
|
|
2642
2769
|
this.svcConfig = this.chartService.config;
|
|
2643
2770
|
this.hasSeriesData = this.svcConfig.pipe(map((_) => { var _a, _b; return ((_a = _.series) === null || _a === void 0 ? void 0 : _a.length) > 0 && ((_b = _.series) === null || _b === void 0 ? void 0 : _b.some((_) => { var _a; return ((_a = _.data) === null || _a === void 0 ? void 0 : _a.length) > 0; })); }));
|
|
@@ -2719,6 +2846,11 @@ class ChartComponent {
|
|
|
2719
2846
|
.subscribe((_) => {
|
|
2720
2847
|
this.annotationMove.emit(_);
|
|
2721
2848
|
});
|
|
2849
|
+
this.chartService.zoomInstance
|
|
2850
|
+
.pipe(takeWhile(() => this._alive))
|
|
2851
|
+
.subscribe((_) => {
|
|
2852
|
+
this.zoomServiceInstance.emit(_);
|
|
2853
|
+
});
|
|
2722
2854
|
}
|
|
2723
2855
|
ngAfterViewInit() {
|
|
2724
2856
|
}
|
|
@@ -2731,7 +2863,7 @@ class ChartComponent {
|
|
|
2731
2863
|
}
|
|
2732
2864
|
}
|
|
2733
2865
|
ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ChartComponent, deps: [{ token: ChartService }, { token: ZoomService }, { token: ScaleService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2734
|
-
ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: ChartComponent, 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" }, providers: [ChartService, ZoomService, ScaleService, BrushService], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"{\n hasSeriesData: hasSeriesData | async,\n svcConfig: svcConfig | async\n} as data\">\n <ng-container *ngIf=\"data.hasSeriesData === true else noData\">\n <div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container position-relative\"></teta-chart-container>\n </div>\n <teta-legend *ngIf=\"data.svcConfig.legend?.enable === true\" [series]=\"data.svcConfig.series\"></teta-legend>\n </ng-container>\n</ng-container>\n<ng-template #noData>\n <div class=\"column column_auto align-center justify-content-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n </div>\n</ng-template>\n", styles: [":host{position:relative;display:flex;flex-direction:column;height:100%;width:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ChartContainerComponent, selector: "teta-chart-container" }, { kind: "component", type: LegendComponent, selector: "teta-legend", inputs: ["series"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2866
|
+
ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: ChartComponent, 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" }, providers: [ChartService, ZoomService, ScaleService, BrushService], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"{\n hasSeriesData: hasSeriesData | async,\n svcConfig: svcConfig | async\n} as data\">\n <ng-container *ngIf=\"data.hasSeriesData === true else noData\">\n <div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container position-relative\"></teta-chart-container>\n </div>\n <teta-legend *ngIf=\"data.svcConfig.legend?.enable === true\" [series]=\"data.svcConfig.series\"></teta-legend>\n </ng-container>\n</ng-container>\n<ng-template #noData>\n <div class=\"column column_auto align-center justify-content-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n </div>\n</ng-template>\n", styles: [":host{position:relative;display:flex;flex-direction:column;height:100%;width:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ChartContainerComponent, selector: "teta-chart-container" }, { kind: "component", type: LegendComponent, selector: "teta-legend", inputs: ["series"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2735
2867
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: ChartComponent, decorators: [{
|
|
2736
2868
|
type: Component,
|
|
2737
2869
|
args: [{ selector: 'teta-svg-chart', providers: [ChartService, ZoomService, ScaleService, BrushService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{\n hasSeriesData: hasSeriesData | async,\n svcConfig: svcConfig | async\n} as data\">\n <ng-container *ngIf=\"data.hasSeriesData === true else noData\">\n <div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container position-relative\"></teta-chart-container>\n </div>\n <teta-legend *ngIf=\"data.svcConfig.legend?.enable === true\" [series]=\"data.svcConfig.series\"></teta-legend>\n </ng-container>\n</ng-container>\n<ng-template #noData>\n <div class=\"column column_auto align-center justify-content-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n </div>\n</ng-template>\n", styles: [":host{position:relative;display:flex;flex-direction:column;height:100%;width:100%}\n"] }]
|
|
@@ -2757,6 +2889,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
|
|
|
2757
2889
|
type: Output
|
|
2758
2890
|
}], annotationMove: [{
|
|
2759
2891
|
type: Output
|
|
2892
|
+
}], zoomServiceInstance: [{
|
|
2893
|
+
type: Output
|
|
2760
2894
|
}], config: [{
|
|
2761
2895
|
type: Input
|
|
2762
2896
|
}] } });
|