@tetacom/svg-charts 1.2.2 → 1.2.3
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/model/i-broadcast-message.d.ts +2 -2
- package/esm2020/chart/chart-container/gridlines/gridlines.component.mjs +9 -3
- package/esm2020/chart/directives/zoomable.directive.mjs +24 -5
- package/esm2020/chart/model/i-broadcast-message.mjs +2 -2
- package/esm2020/chart/service/brush.service.mjs +6 -6
- package/fesm2015/tetacom-svg-charts.mjs +37 -12
- package/fesm2015/tetacom-svg-charts.mjs.map +1 -1
- package/fesm2020/tetacom-svg-charts.mjs +36 -11
- package/fesm2020/tetacom-svg-charts.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -791,7 +791,7 @@ class ZoomMessage {
|
|
|
791
791
|
constructor(options) {
|
|
792
792
|
this.event = options?.event;
|
|
793
793
|
this.axis = options?.axis;
|
|
794
|
-
this.
|
|
794
|
+
this.domain = options.domain;
|
|
795
795
|
this.chartId = options?.chartId;
|
|
796
796
|
this.style = options?.style;
|
|
797
797
|
}
|
|
@@ -946,20 +946,20 @@ class BrushService {
|
|
|
946
946
|
(window.TouchEvent &&
|
|
947
947
|
m.message.event.sourceEvent instanceof TouchEvent));
|
|
948
948
|
}), tap((m) => {
|
|
949
|
-
const { message: {
|
|
949
|
+
const { message: { domain }, } = m;
|
|
950
950
|
if ((m.message?.axis.index === 0 &&
|
|
951
951
|
m.message?.axis.orientation === AxisOrientation.y &&
|
|
952
952
|
config.brush?.type === BrushType.y) ||
|
|
953
953
|
(m.message?.axis.orientation === AxisOrientation.x &&
|
|
954
954
|
config.brush?.type === BrushType.x)) {
|
|
955
955
|
container.call(this.brush.move, [
|
|
956
|
-
brushScale(
|
|
957
|
-
brushScale(
|
|
956
|
+
brushScale(domain[0]),
|
|
957
|
+
brushScale(domain[1]),
|
|
958
958
|
]);
|
|
959
959
|
if (m.message.event.type === 'end') {
|
|
960
960
|
const brushMessage = new BrushMessage({
|
|
961
961
|
event: null,
|
|
962
|
-
selection:
|
|
962
|
+
selection: domain,
|
|
963
963
|
brushType: config?.brush?.type ?? BrushType.x,
|
|
964
964
|
brushScale,
|
|
965
965
|
});
|
|
@@ -968,7 +968,7 @@ class BrushService {
|
|
|
968
968
|
message: brushMessage,
|
|
969
969
|
});
|
|
970
970
|
}
|
|
971
|
-
this.selection =
|
|
971
|
+
this.selection = domain;
|
|
972
972
|
}
|
|
973
973
|
}))
|
|
974
974
|
.subscribe();
|
|
@@ -1567,8 +1567,14 @@ class GridlinesComponent {
|
|
|
1567
1567
|
this.svc = svc;
|
|
1568
1568
|
this.chartService = chartService;
|
|
1569
1569
|
this.config = this.chartService.config;
|
|
1570
|
-
this.tickYValues = this.svc.yScaleMap.pipe(map((_) =>
|
|
1571
|
-
|
|
1570
|
+
this.tickYValues = this.svc.yScaleMap.pipe(map((_) => {
|
|
1571
|
+
const ratio = this.size.height / 40;
|
|
1572
|
+
return _.get(0).ticks(ratio);
|
|
1573
|
+
}));
|
|
1574
|
+
this.tickXValues = this.svc.xScaleMap.pipe(map((_) => {
|
|
1575
|
+
const ratio = this.size.width / 40;
|
|
1576
|
+
return _.get(0).ticks(ratio);
|
|
1577
|
+
}));
|
|
1572
1578
|
this.y = this.svc.yScaleMap.pipe(map((_) => _.get(0)));
|
|
1573
1579
|
this.x = this.svc.xScaleMap.pipe(map((_) => _.get(0)));
|
|
1574
1580
|
}
|
|
@@ -1996,7 +2002,7 @@ class ZoomableDirective {
|
|
|
1996
2002
|
const message = new ZoomMessage({
|
|
1997
2003
|
event,
|
|
1998
2004
|
axis: this.axis,
|
|
1999
|
-
|
|
2005
|
+
domain,
|
|
2000
2006
|
chartId: this.config.id,
|
|
2001
2007
|
});
|
|
2002
2008
|
this.broadcastService.broadcastZoom({
|
|
@@ -2083,7 +2089,26 @@ class ZoomableDirective {
|
|
|
2083
2089
|
this.axis.orientation === m.message?.axis?.orientation);
|
|
2084
2090
|
}), tap$1((m) => {
|
|
2085
2091
|
if (this.config.id !== m.message?.chartId) {
|
|
2086
|
-
this.
|
|
2092
|
+
this.brushScale.domain(this.axis.originDomain);
|
|
2093
|
+
const scale = Math.abs(this.axis.originDomain[1] - this.axis.originDomain[0]) / Math.abs(m.message.domain[1] - m.message.domain[0]);
|
|
2094
|
+
let transform = zoomIdentity.scale(scale);
|
|
2095
|
+
if (this.config?.zoom?.type === ZoomType.x) {
|
|
2096
|
+
if (this.config.xAxis[0]?.inverted) {
|
|
2097
|
+
transform = transform.translate(-this.brushScale(m.message.domain[0]), 0);
|
|
2098
|
+
}
|
|
2099
|
+
else {
|
|
2100
|
+
transform = transform.translate(this.brushScale(-m.message.domain[1]), 0);
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
if (this.config?.zoom?.type === ZoomType.y) {
|
|
2104
|
+
if (this.config.yAxis[0]?.inverted) {
|
|
2105
|
+
transform = transform.translate(0, -this.brushScale(m.message.domain[0]));
|
|
2106
|
+
}
|
|
2107
|
+
else {
|
|
2108
|
+
transform = transform.translate(0, -this.brushScale(m.message.domain[1]));
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
this._element.call(this.zoom.transform, transform, null, {});
|
|
2087
2112
|
}
|
|
2088
2113
|
}))
|
|
2089
2114
|
.subscribe();
|
|
@@ -2180,7 +2205,7 @@ class ZoomableDirective {
|
|
|
2180
2205
|
type,
|
|
2181
2206
|
},
|
|
2182
2207
|
axis: this.axis,
|
|
2183
|
-
|
|
2208
|
+
domain,
|
|
2184
2209
|
chartId: this.config.id,
|
|
2185
2210
|
});
|
|
2186
2211
|
this.zoomService.fireZoom({
|