@tetacom/svg-charts 1.2.26 → 1.2.29
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/series/line/line-series.component.d.ts +8 -0
- package/chart/chart-container/series/linear-series-base.d.ts +3 -2
- package/chart/chart.module.d.ts +4 -3
- package/chart/directives/draggable-point.directive.d.ts +40 -0
- package/chart/model/marker-options.d.ts +14 -1
- package/esm2020/chart/chart-container/series/line/line-series.component.mjs +71 -3
- package/esm2020/chart/chart-container/series/linear-series-base.mjs +67 -47
- package/esm2020/chart/chart-container/x-axis/x-axis.component.mjs +2 -2
- package/esm2020/chart/chart.module.mjs +5 -2
- package/esm2020/chart/directives/draggable-point.directive.mjs +141 -0
- package/esm2020/chart/model/marker-options.mjs +1 -1
- package/fesm2015/tetacom-svg-charts.mjs +283 -58
- package/fesm2015/tetacom-svg-charts.mjs.map +1 -1
- package/fesm2020/tetacom-svg-charts.mjs +283 -55
- package/fesm2020/tetacom-svg-charts.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Component, Input,
|
|
2
|
+
import { Injectable, Component, Input, EventEmitter, Directive, Output, HostListener, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef, ViewChild, HostBinding, NgModule } from '@angular/core';
|
|
3
3
|
import * as i4 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { BehaviorSubject, Subject, of, withLatestFrom, map, shareReplay, filter, lastValueFrom, take, combineLatest, ReplaySubject, tap, takeWhile, combineLatestWith, observeOn, animationFrameScheduler } from 'rxjs';
|
|
@@ -1010,13 +1010,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
|
|
|
1010
1010
|
type: Input
|
|
1011
1011
|
}] } });
|
|
1012
1012
|
|
|
1013
|
-
var DragPointType;
|
|
1014
|
-
(function (DragPointType) {
|
|
1015
|
-
DragPointType[DragPointType["x"] = 0] = "x";
|
|
1016
|
-
DragPointType[DragPointType["y"] = 1] = "y";
|
|
1017
|
-
DragPointType[DragPointType["xy"] = 2] = "xy";
|
|
1018
|
-
})(DragPointType || (DragPointType = {}));
|
|
1019
|
-
|
|
1020
1013
|
class LinearSeriesBase extends SeriesBaseComponent {
|
|
1021
1014
|
constructor(svc, cdr, scaleService, zoomService, element) {
|
|
1022
1015
|
super(svc, cdr, scaleService, zoomService, element);
|
|
@@ -1026,6 +1019,7 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1026
1019
|
this.zoomService = zoomService;
|
|
1027
1020
|
this.element = element;
|
|
1028
1021
|
this.defaultClipPointsMapping = new Map();
|
|
1022
|
+
this._update = new BehaviorSubject(null);
|
|
1029
1023
|
}
|
|
1030
1024
|
set series(series) {
|
|
1031
1025
|
this.__series = series;
|
|
@@ -1065,7 +1059,8 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1065
1059
|
const [event, { x, y }] = data;
|
|
1066
1060
|
return this.getTransform(event, x.get(this.series.xAxisIndex).scale, y.get(this.series.yAxisIndex).scale);
|
|
1067
1061
|
}), tap(() => setTimeout(() => this.cdr.detectChanges())));
|
|
1068
|
-
this.path = this.scaleService.scales.pipe(map((data) => {
|
|
1062
|
+
this.path = combineLatest([this.scaleService.scales, this._update]).pipe(map(([data]) => {
|
|
1063
|
+
// console.log(data);
|
|
1069
1064
|
const { x, y } = data;
|
|
1070
1065
|
this.x = x.get(this.series.xAxisIndex)?.scale;
|
|
1071
1066
|
this.y = y.get(this.series.yAxisIndex)?.scale;
|
|
@@ -1097,16 +1092,17 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1097
1092
|
filteredData = filteredData?.filter(filter(min, max));
|
|
1098
1093
|
}
|
|
1099
1094
|
return line(filteredData);
|
|
1100
|
-
}), tap(() => {
|
|
1095
|
+
}), tap((_) => {
|
|
1096
|
+
// console.log(_)
|
|
1101
1097
|
setTimeout(() => {
|
|
1102
1098
|
if (this.markers?.length > 0) {
|
|
1103
|
-
this.addDragEvents();
|
|
1099
|
+
// this.addDragEvents();
|
|
1104
1100
|
}
|
|
1105
1101
|
});
|
|
1106
1102
|
}));
|
|
1107
1103
|
}
|
|
1108
1104
|
ngOnDestroy() {
|
|
1109
|
-
this.markerListeners?.on('start drag end', null);
|
|
1105
|
+
// this.markerListeners?.on('start drag end', null);
|
|
1110
1106
|
this.svc.setTooltip({
|
|
1111
1107
|
point: null,
|
|
1112
1108
|
series: this.series,
|
|
@@ -1115,45 +1111,63 @@ class LinearSeriesBase extends SeriesBaseComponent {
|
|
|
1115
1111
|
ngAfterViewInit() {
|
|
1116
1112
|
}
|
|
1117
1113
|
addDragEvents() {
|
|
1118
|
-
this.markerListeners?.on('start drag end', null);
|
|
1119
|
-
const drag = (node, event, d) => {
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1114
|
+
// this.markerListeners?.on('start drag end', null);
|
|
1115
|
+
// const drag = (node, event: d3.D3DragEvent<any, any, any>, d: BasePoint) => {
|
|
1116
|
+
// if (
|
|
1117
|
+
// d.marker?.dragType === DragPointType.x ||
|
|
1118
|
+
// d.marker?.dragType === DragPointType.xy
|
|
1119
|
+
// ) {
|
|
1120
|
+
// d.x = this.x.invert(event.x);
|
|
1121
|
+
// }
|
|
1122
|
+
//
|
|
1123
|
+
// if (
|
|
1124
|
+
// d.marker?.dragType === DragPointType.y ||
|
|
1125
|
+
// d.marker?.dragType === DragPointType.xy
|
|
1126
|
+
// ) {
|
|
1127
|
+
// d.y = this.y.invert(event.y);
|
|
1128
|
+
// }
|
|
1129
|
+
//
|
|
1130
|
+
// this.svc.emitPoint({
|
|
1131
|
+
// target: {
|
|
1132
|
+
// series: this.series,
|
|
1133
|
+
// point: d,
|
|
1134
|
+
// },
|
|
1135
|
+
// event,
|
|
1136
|
+
// });
|
|
1137
|
+
//
|
|
1138
|
+
// this.cdr.detectChanges();
|
|
1139
|
+
// };
|
|
1140
|
+
// this.markerListeners = d3
|
|
1141
|
+
// .drag()
|
|
1142
|
+
// .subject(function (event, d: BasePoint) {
|
|
1143
|
+
// const node = d3.select(this);
|
|
1144
|
+
// return {x: node.attr('cx'), y: node.attr('cy')};
|
|
1145
|
+
// });
|
|
1146
|
+
// const dragMarkers =
|
|
1147
|
+
// this.markerListeners.on(
|
|
1148
|
+
// 'start drag end',
|
|
1149
|
+
// function (event: d3.D3DragEvent<any, any, any>, d: BasePoint) {
|
|
1150
|
+
// const node = d3.select(this);
|
|
1151
|
+
//
|
|
1152
|
+
// drag(node, event, d);
|
|
1153
|
+
// }
|
|
1154
|
+
// );
|
|
1155
|
+
//
|
|
1156
|
+
// const draggableMarkers = this.series.data?.filter(
|
|
1157
|
+
// (_) => _?.marker && _?.marker?.draggable
|
|
1158
|
+
// );
|
|
1159
|
+
//
|
|
1160
|
+
// const element = d3
|
|
1161
|
+
// .select(this.element.nativeElement)
|
|
1162
|
+
// .selectAll('.draggable-marker')
|
|
1163
|
+
// .data(draggableMarkers);
|
|
1164
|
+
//
|
|
1165
|
+
// element.call(dragMarkers as any);
|
|
1166
|
+
//
|
|
1167
|
+
// this.svgElement = d3
|
|
1168
|
+
// .select(this.element.nativeElement)
|
|
1169
|
+
// .select('.line')
|
|
1170
|
+
// .node() as SVGGeometryElement;
|
|
1157
1171
|
}
|
|
1158
1172
|
getTransform(event, scaleX, scaleY) {
|
|
1159
1173
|
if (event.type === 'mouseleave') {
|
|
@@ -1252,6 +1266,151 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
|
|
|
1252
1266
|
type: Input
|
|
1253
1267
|
}] } });
|
|
1254
1268
|
|
|
1269
|
+
var DragPointType;
|
|
1270
|
+
(function (DragPointType) {
|
|
1271
|
+
DragPointType[DragPointType["x"] = 0] = "x";
|
|
1272
|
+
DragPointType[DragPointType["y"] = 1] = "y";
|
|
1273
|
+
DragPointType[DragPointType["xy"] = 2] = "xy";
|
|
1274
|
+
})(DragPointType || (DragPointType = {}));
|
|
1275
|
+
|
|
1276
|
+
class DraggablePointDirective {
|
|
1277
|
+
constructor(_elementRef) {
|
|
1278
|
+
this._elementRef = _elementRef;
|
|
1279
|
+
this.moveStart = new EventEmitter();
|
|
1280
|
+
this.moveProcess = new EventEmitter();
|
|
1281
|
+
this.moveEnd = new EventEmitter();
|
|
1282
|
+
}
|
|
1283
|
+
mouseDown(event) {
|
|
1284
|
+
if (!this.tetaDraggablePoint) {
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
event.stopPropagation();
|
|
1288
|
+
event.preventDefault();
|
|
1289
|
+
this.startPosition = {
|
|
1290
|
+
x: event.x,
|
|
1291
|
+
y: event.y
|
|
1292
|
+
};
|
|
1293
|
+
this.moveStart.emit(this.startPosition);
|
|
1294
|
+
}
|
|
1295
|
+
mouseUp(event) {
|
|
1296
|
+
if (this.startPosition !== null && this.startPosition !== undefined) {
|
|
1297
|
+
let deltaX = event.x - this.startPosition.x;
|
|
1298
|
+
let deltaY = event.y - this.startPosition.y;
|
|
1299
|
+
if (this.dragDirection === DragPointType.x) {
|
|
1300
|
+
deltaY = 0;
|
|
1301
|
+
}
|
|
1302
|
+
if (this.dragDirection === DragPointType.y) {
|
|
1303
|
+
deltaX = 0;
|
|
1304
|
+
}
|
|
1305
|
+
if (this.allowDrag && !this.allowDrag({
|
|
1306
|
+
x: event.x,
|
|
1307
|
+
y: event.y,
|
|
1308
|
+
deltaX,
|
|
1309
|
+
deltaY
|
|
1310
|
+
})) {
|
|
1311
|
+
this.startPosition = null;
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
if (this.transformCache) {
|
|
1315
|
+
this.transformCache.x = this.transformCache.x + deltaX;
|
|
1316
|
+
this.transformCache.y = this.transformCache.y + deltaY;
|
|
1317
|
+
}
|
|
1318
|
+
else {
|
|
1319
|
+
this.transformCache = {
|
|
1320
|
+
x: deltaX,
|
|
1321
|
+
y: deltaY
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
this.moveEnd.emit({
|
|
1325
|
+
x: event.x,
|
|
1326
|
+
y: event.y,
|
|
1327
|
+
deltaX,
|
|
1328
|
+
deltaY
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
this.startPosition = null;
|
|
1332
|
+
}
|
|
1333
|
+
mouseMove(event) {
|
|
1334
|
+
if (this.startPosition) {
|
|
1335
|
+
let deltaX = event.x - this.startPosition.x;
|
|
1336
|
+
let deltaY = event.y - this.startPosition.y;
|
|
1337
|
+
if (this.transformCache) {
|
|
1338
|
+
deltaX = this.transformCache.x + deltaX;
|
|
1339
|
+
deltaY = this.transformCache.y + deltaY;
|
|
1340
|
+
}
|
|
1341
|
+
if (this.allowDrag && !this.allowDrag({
|
|
1342
|
+
x: event.x,
|
|
1343
|
+
y: event.y,
|
|
1344
|
+
deltaX,
|
|
1345
|
+
deltaY
|
|
1346
|
+
})) {
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
if (this.dragDirection === DragPointType.x) {
|
|
1350
|
+
deltaY = 0;
|
|
1351
|
+
}
|
|
1352
|
+
if (this.dragDirection === DragPointType.y) {
|
|
1353
|
+
deltaX = 0;
|
|
1354
|
+
}
|
|
1355
|
+
this.setTransform(deltaX, deltaY);
|
|
1356
|
+
event.stopPropagation();
|
|
1357
|
+
event.preventDefault();
|
|
1358
|
+
this.moveProcess.emit({
|
|
1359
|
+
x: event.x,
|
|
1360
|
+
y: event.y,
|
|
1361
|
+
deltaX,
|
|
1362
|
+
deltaY
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
setTransform(x, y) {
|
|
1367
|
+
this._elementRef.nativeElement.style.transform = `translate(${x}px, ${y}px)`;
|
|
1368
|
+
}
|
|
1369
|
+
resetTransform() {
|
|
1370
|
+
this.setTransform(0, 0);
|
|
1371
|
+
this.transformCache = null;
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
DraggablePointDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DraggablePointDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1375
|
+
DraggablePointDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.2", type: DraggablePointDirective, selector: "[tetaDraggablePoint]", inputs: { tetaDraggablePoint: "tetaDraggablePoint", dragDirection: "dragDirection", allowDrag: "allowDrag" }, outputs: { moveStart: "moveStart", moveProcess: "moveProcess", moveEnd: "moveEnd" }, host: { listeners: { "mousedown": "mouseDown($event)", "touchstart": "mouseDown($event)", "window:mouseup": "mouseUp($event)", "window:touchend": "mouseUp($event)", "window:mousemove": "mouseMove($event)", "window:touchmove": "mouseMove($event)" } }, exportAs: ["tetaDraggablePoint"], ngImport: i0 });
|
|
1376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DraggablePointDirective, decorators: [{
|
|
1377
|
+
type: Directive,
|
|
1378
|
+
args: [{
|
|
1379
|
+
selector: '[tetaDraggablePoint]',
|
|
1380
|
+
exportAs: 'tetaDraggablePoint'
|
|
1381
|
+
}]
|
|
1382
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { tetaDraggablePoint: [{
|
|
1383
|
+
type: Input
|
|
1384
|
+
}], dragDirection: [{
|
|
1385
|
+
type: Input
|
|
1386
|
+
}], allowDrag: [{
|
|
1387
|
+
type: Input
|
|
1388
|
+
}], moveStart: [{
|
|
1389
|
+
type: Output
|
|
1390
|
+
}], moveProcess: [{
|
|
1391
|
+
type: Output
|
|
1392
|
+
}], moveEnd: [{
|
|
1393
|
+
type: Output
|
|
1394
|
+
}], mouseDown: [{
|
|
1395
|
+
type: HostListener,
|
|
1396
|
+
args: ['mousedown', ['$event']]
|
|
1397
|
+
}, {
|
|
1398
|
+
type: HostListener,
|
|
1399
|
+
args: ['touchstart', ['$event']]
|
|
1400
|
+
}], mouseUp: [{
|
|
1401
|
+
type: HostListener,
|
|
1402
|
+
args: ['window:mouseup', ['$event']]
|
|
1403
|
+
}, {
|
|
1404
|
+
type: HostListener,
|
|
1405
|
+
args: ['window:touchend', ['$event']]
|
|
1406
|
+
}], mouseMove: [{
|
|
1407
|
+
type: HostListener,
|
|
1408
|
+
args: ['window:mousemove', ['$event']]
|
|
1409
|
+
}, {
|
|
1410
|
+
type: HostListener,
|
|
1411
|
+
args: ['window:touchmove', ['$event']]
|
|
1412
|
+
}] } });
|
|
1413
|
+
|
|
1255
1414
|
class LineSeriesComponent extends LinearSeriesBase {
|
|
1256
1415
|
constructor(svc, cdr, scaleService, zoomService, element) {
|
|
1257
1416
|
super(svc, cdr, scaleService, zoomService, element);
|
|
@@ -1260,13 +1419,80 @@ class LineSeriesComponent extends LinearSeriesBase {
|
|
|
1260
1419
|
this.scaleService = scaleService;
|
|
1261
1420
|
this.zoomService = zoomService;
|
|
1262
1421
|
this.element = element;
|
|
1422
|
+
this.allowDrag = (point) => {
|
|
1423
|
+
return (newPoint) => {
|
|
1424
|
+
if (point.marker.minX !== null && point.marker.minX !== undefined) {
|
|
1425
|
+
if (this.x.invert(this.x(this.start.x) + newPoint.deltaX) < point.marker.minX) {
|
|
1426
|
+
return false;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
if (point.marker.maxX !== null && point.marker.maxX !== undefined) {
|
|
1430
|
+
if (this.x.invert(this.x(this.start.x) + newPoint.deltaX) > point.marker.maxX) {
|
|
1431
|
+
return false;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
if (point.marker.minY !== null && point.marker.minY !== undefined) {
|
|
1435
|
+
if (this.y.invert(this.y(this.start.y) + newPoint.deltaY) < point.marker.minY) {
|
|
1436
|
+
return false;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
if (point.marker.maxY !== null && point.marker.maxY !== undefined) {
|
|
1440
|
+
if (this.y.invert(this.y(this.start.y) + newPoint.deltaY) > point.marker.maxY) {
|
|
1441
|
+
return false;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
return true;
|
|
1445
|
+
};
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
moveStart(event, point) {
|
|
1449
|
+
this.start = { x: point.x, y: point.y };
|
|
1450
|
+
}
|
|
1451
|
+
moveEnd(event, point) {
|
|
1452
|
+
point.x = this.x.invert(this.x(this.start.x) + event.deltaX);
|
|
1453
|
+
point.y = this.y.invert(this.y(this.start.y) + event.deltaY);
|
|
1454
|
+
this._update.next();
|
|
1455
|
+
const emitEvent = {
|
|
1456
|
+
type: 'end',
|
|
1457
|
+
sourceEvent: event
|
|
1458
|
+
};
|
|
1459
|
+
this.svc.emitPoint({
|
|
1460
|
+
target: {
|
|
1461
|
+
series: this.series,
|
|
1462
|
+
point: point,
|
|
1463
|
+
},
|
|
1464
|
+
event: emitEvent,
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
moveProcess(event, point) {
|
|
1468
|
+
point.x = this.x.invert(this.x(this.start.x) + event.deltaX);
|
|
1469
|
+
point.y = this.y.invert(this.y(this.start.y) + event.deltaY);
|
|
1470
|
+
this._update.next();
|
|
1471
|
+
const emitEvent = {
|
|
1472
|
+
type: 'drag',
|
|
1473
|
+
sourceEvent: event
|
|
1474
|
+
};
|
|
1475
|
+
this.svc.emitPoint({
|
|
1476
|
+
target: {
|
|
1477
|
+
series: this.series,
|
|
1478
|
+
point: point,
|
|
1479
|
+
},
|
|
1480
|
+
event: emitEvent,
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
startLabel(event, label) {
|
|
1484
|
+
this.labelStart = { dx: label.dx, dy: label.dy };
|
|
1485
|
+
}
|
|
1486
|
+
moveLabel(event, label) {
|
|
1487
|
+
label.dx = this.labelStart.dx + event.deltaX;
|
|
1488
|
+
label.dy = this.labelStart.dy + event.deltaY;
|
|
1263
1489
|
}
|
|
1264
1490
|
}
|
|
1265
1491
|
LineSeriesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: LineSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1266
|
-
LineSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: LineSeriesComponent, selector: "svg:svg[teta-line-series]", usesInheritance: true, ngImport: i0, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n<ng-container *ngIf=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t?.x !=null && t?.y!=null\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n<ng-container *ngIf=\"markers as draggablePoints\">\n <svg:
|
|
1492
|
+
LineSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: LineSeriesComponent, selector: "svg:svg[teta-line-series]", usesInheritance: true, ngImport: i0, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n<ng-container *ngIf=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t?.x !=null && t?.y!=null\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n<ng-container *ngIf=\"markers as draggablePoints\">\n <svg:g\n *ngFor=\"let point of draggablePoints\"\n [attr.transform]=\"'translate(' + x(point.x)+ ',' +y(point.y) + ')'\">\n <svg:g [tetaDraggablePoint]=\"point.marker.draggable\"\n [dragDirection]=\"point.marker.dragType\"\n [allowDrag]=\"allowDrag(point)\"\n #dragPoint=\"tetaDraggablePoint\"\n (moveStart)=\"moveStart($event, point)\"\n (moveEnd)=\"moveEnd($event, point);dragPoint.resetTransform();\"\n (moveProcess)=\"moveProcess($event, point);dragPoint.resetTransform();\"\n [class.draggable-marker]=\"point?.marker?.draggable\">\n <svg:circle\n class=\"marker\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"0\"\n [attr.cy]=\"0\">\n </svg:circle>\n <ng-container *ngIf=\"point.marker.label?.text\">\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"0\"\n [attr.x2]=\"point.marker.label?.dx\"\n [attr.y2]=\"point.marker.label?.dy\"\n [attr.stroke]=\"point.marker.label?.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"point.marker.label?.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"point.marker.label?.style?.strokeDasharray ?? null\">\n </svg:line>\n <svg:foreignObject\n [tetaDraggablePoint]=\"point.marker.label?.draggable\"\n [dragDirection]=\"point.marker.label.dragType\"\n #labelPoint=\"tetaDraggablePoint\"\n (moveStart)=\"startLabel($event, point.marker.label)\"\n (moveProcess)=\"moveLabel($event, point.marker.label); labelPoint.resetTransform();\"\n (moveEnd)=\"labelPoint.resetTransform();\"\n [attr.width]=\"annotationNode?.offsetWidth ?? 0\"\n [attr.height]=\"annotationNode?.offsetHeight ?? 0\"\n [attr.x]=\"point.marker.label?.dx\"\n [attr.y]=\"point.marker.label?.dy\"\n class=\"position-absolute\">\n <div\n #annotationNode\n class=\"shadow-2 padding-2\"\n [style.color]=\"'var(--color-text-90)'\"\n [style.background-color]=\"'var(--color-background-50)'\"\n [style.cursor]=\"'move'\"\n style=\"border-radius: 2px; display: inline-block;\">\n {{point.marker.label?.text}}\n </div>\n </svg:foreignObject>\n </ng-container>\n </svg:g>\n </svg:g>\n</ng-container>\n\n\n\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\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: "directive", type: DraggablePointDirective, selector: "[tetaDraggablePoint]", inputs: ["tetaDraggablePoint", "dragDirection", "allowDrag"], outputs: ["moveStart", "moveProcess", "moveEnd"], exportAs: ["tetaDraggablePoint"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1267
1493
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: LineSeriesComponent, decorators: [{
|
|
1268
1494
|
type: Component,
|
|
1269
|
-
args: [{ selector: 'svg:svg[teta-line-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n<ng-container *ngIf=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t?.x !=null && t?.y!=null\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n<ng-container *ngIf=\"markers as draggablePoints\">\n <svg:
|
|
1495
|
+
args: [{ selector: 'svg:svg[teta-line-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:path\n class=\"line\"\n [attr.d]=\"path | async\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-dasharray]=\"series.style?.strokeDasharray\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n<ng-container *ngIf=\"transform | async as t\">\n <svg:circle\n *ngIf=\"t?.x !=null && t?.y!=null\"\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n >\n </svg:circle>\n</ng-container>\n<ng-container *ngIf=\"markers as draggablePoints\">\n <svg:g\n *ngFor=\"let point of draggablePoints\"\n [attr.transform]=\"'translate(' + x(point.x)+ ',' +y(point.y) + ')'\">\n <svg:g [tetaDraggablePoint]=\"point.marker.draggable\"\n [dragDirection]=\"point.marker.dragType\"\n [allowDrag]=\"allowDrag(point)\"\n #dragPoint=\"tetaDraggablePoint\"\n (moveStart)=\"moveStart($event, point)\"\n (moveEnd)=\"moveEnd($event, point);dragPoint.resetTransform();\"\n (moveProcess)=\"moveProcess($event, point);dragPoint.resetTransform();\"\n [class.draggable-marker]=\"point?.marker?.draggable\">\n <svg:circle\n class=\"marker\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"0\"\n [attr.cy]=\"0\">\n </svg:circle>\n <ng-container *ngIf=\"point.marker.label?.text\">\n <svg:line\n [attr.x1]=\"0\"\n [attr.y1]=\"0\"\n [attr.x2]=\"point.marker.label?.dx\"\n [attr.y2]=\"point.marker.label?.dy\"\n [attr.stroke]=\"point.marker.label?.style?.stroke ?? 'var(--color-text-90)'\"\n [attr.stroke-width]=\"point.marker.label?.style?.strokeWidth ?? 1\"\n [attr.stroke-dasharray]=\"point.marker.label?.style?.strokeDasharray ?? null\">\n </svg:line>\n <svg:foreignObject\n [tetaDraggablePoint]=\"point.marker.label?.draggable\"\n [dragDirection]=\"point.marker.label.dragType\"\n #labelPoint=\"tetaDraggablePoint\"\n (moveStart)=\"startLabel($event, point.marker.label)\"\n (moveProcess)=\"moveLabel($event, point.marker.label); labelPoint.resetTransform();\"\n (moveEnd)=\"labelPoint.resetTransform();\"\n [attr.width]=\"annotationNode?.offsetWidth ?? 0\"\n [attr.height]=\"annotationNode?.offsetHeight ?? 0\"\n [attr.x]=\"point.marker.label?.dx\"\n [attr.y]=\"point.marker.label?.dy\"\n class=\"position-absolute\">\n <div\n #annotationNode\n class=\"shadow-2 padding-2\"\n [style.color]=\"'var(--color-text-90)'\"\n [style.background-color]=\"'var(--color-background-50)'\"\n [style.cursor]=\"'move'\"\n style=\"border-radius: 2px; display: inline-block;\">\n {{point.marker.label?.text}}\n </div>\n </svg:foreignObject>\n </ng-container>\n </svg:g>\n </svg:g>\n</ng-container>\n\n\n\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
|
|
1270
1496
|
}], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; } });
|
|
1271
1497
|
|
|
1272
1498
|
class BarSeriesComponent extends SeriesBaseComponent {
|
|
@@ -1599,7 +1825,7 @@ class XAxisComponent {
|
|
|
1599
1825
|
this.ticks = this.x.pipe(withLatestFrom(this._svc.size), map((_) => {
|
|
1600
1826
|
const [x, size] = _;
|
|
1601
1827
|
const tickSize = x.ticks().map((_) => getTextWidth(this.axis.options.tickFormat ? this.axis.options.tickFormat(_) : this.axis.defaultFormatter()(_), 0.45, 11));
|
|
1602
|
-
return x.ticks(size.width / parseInt(d3.max(tickSize), 10) /
|
|
1828
|
+
return x.ticks(size.width / parseInt(d3.max(tickSize), 10) / 10);
|
|
1603
1829
|
}));
|
|
1604
1830
|
}
|
|
1605
1831
|
getLabelTransform() {
|
|
@@ -2752,7 +2978,8 @@ ChartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "1
|
|
|
2752
2978
|
BlockSeriesComponent,
|
|
2753
2979
|
BlockAreaSeriesComponent,
|
|
2754
2980
|
AnnotationComponent,
|
|
2755
|
-
CrosshairComponent
|
|
2981
|
+
CrosshairComponent,
|
|
2982
|
+
DraggablePointDirective], imports: [CommonModule, LetModule], exports: [ChartComponent,
|
|
2756
2983
|
LegendComponent,
|
|
2757
2984
|
SeriesBaseComponent,
|
|
2758
2985
|
LineSeriesComponent,
|
|
@@ -2788,6 +3015,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
|
|
|
2788
3015
|
BlockAreaSeriesComponent,
|
|
2789
3016
|
AnnotationComponent,
|
|
2790
3017
|
CrosshairComponent,
|
|
3018
|
+
DraggablePointDirective,
|
|
2791
3019
|
],
|
|
2792
3020
|
exports: [
|
|
2793
3021
|
ChartComponent,
|