@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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Component, Input, ChangeDetectionStrategy, ChangeDetectorRef, HostListener, ElementRef, ViewChild, Directive, HostBinding, EventEmitter, Output, NgModule } from '@angular/core';
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 { __awaiter } from 'tslib';
@@ -1012,13 +1012,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
1012
1012
  type: Input
1013
1013
  }] } });
1014
1014
 
1015
- var DragPointType;
1016
- (function (DragPointType) {
1017
- DragPointType[DragPointType["x"] = 0] = "x";
1018
- DragPointType[DragPointType["y"] = 1] = "y";
1019
- DragPointType[DragPointType["xy"] = 2] = "xy";
1020
- })(DragPointType || (DragPointType = {}));
1021
-
1022
1015
  class LinearSeriesBase extends SeriesBaseComponent {
1023
1016
  constructor(svc, cdr, scaleService, zoomService, element) {
1024
1017
  super(svc, cdr, scaleService, zoomService, element);
@@ -1028,6 +1021,7 @@ class LinearSeriesBase extends SeriesBaseComponent {
1028
1021
  this.zoomService = zoomService;
1029
1022
  this.element = element;
1030
1023
  this.defaultClipPointsMapping = new Map();
1024
+ this._update = new BehaviorSubject(null);
1031
1025
  }
1032
1026
  set series(series) {
1033
1027
  var _a;
@@ -1068,8 +1062,9 @@ class LinearSeriesBase extends SeriesBaseComponent {
1068
1062
  const [event, { x, y }] = data;
1069
1063
  return this.getTransform(event, x.get(this.series.xAxisIndex).scale, y.get(this.series.yAxisIndex).scale);
1070
1064
  }), tap(() => setTimeout(() => this.cdr.detectChanges())));
1071
- this.path = this.scaleService.scales.pipe(map((data) => {
1065
+ this.path = combineLatest([this.scaleService.scales, this._update]).pipe(map(([data]) => {
1072
1066
  var _a, _b;
1067
+ // console.log(data);
1073
1068
  const { x, y } = data;
1074
1069
  this.x = (_a = x.get(this.series.xAxisIndex)) === null || _a === void 0 ? void 0 : _a.scale;
1075
1070
  this.y = (_b = y.get(this.series.yAxisIndex)) === null || _b === void 0 ? void 0 : _b.scale;
@@ -1101,18 +1096,18 @@ class LinearSeriesBase extends SeriesBaseComponent {
1101
1096
  filteredData = filteredData === null || filteredData === void 0 ? void 0 : filteredData.filter(filter(min, max));
1102
1097
  }
1103
1098
  return line(filteredData);
1104
- }), tap(() => {
1099
+ }), tap((_) => {
1100
+ // console.log(_)
1105
1101
  setTimeout(() => {
1106
1102
  var _a;
1107
1103
  if (((_a = this.markers) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1108
- this.addDragEvents();
1104
+ // this.addDragEvents();
1109
1105
  }
1110
1106
  });
1111
1107
  }));
1112
1108
  }
1113
1109
  ngOnDestroy() {
1114
- var _a;
1115
- (_a = this.markerListeners) === null || _a === void 0 ? void 0 : _a.on('start drag end', null);
1110
+ // this.markerListeners?.on('start drag end', null);
1116
1111
  this.svc.setTooltip({
1117
1112
  point: null,
1118
1113
  series: this.series,
@@ -1121,47 +1116,63 @@ class LinearSeriesBase extends SeriesBaseComponent {
1121
1116
  ngAfterViewInit() {
1122
1117
  }
1123
1118
  addDragEvents() {
1124
- var _a, _b;
1125
- (_a = this.markerListeners) === null || _a === void 0 ? void 0 : _a.on('start drag end', null);
1126
- const drag = (node, event, d) => {
1127
- var _a, _b, _c, _d;
1128
- if (((_a = d.marker) === null || _a === void 0 ? void 0 : _a.dragType) === DragPointType.x ||
1129
- ((_b = d.marker) === null || _b === void 0 ? void 0 : _b.dragType) === DragPointType.xy) {
1130
- d.x = this.x.invert(event.x);
1131
- }
1132
- if (((_c = d.marker) === null || _c === void 0 ? void 0 : _c.dragType) === DragPointType.y ||
1133
- ((_d = d.marker) === null || _d === void 0 ? void 0 : _d.dragType) === DragPointType.xy) {
1134
- d.y = this.y.invert(event.y);
1135
- }
1136
- this.svc.emitPoint({
1137
- target: {
1138
- series: this.series,
1139
- point: d,
1140
- },
1141
- event,
1142
- });
1143
- this.cdr.detectChanges();
1144
- };
1145
- this.markerListeners = d3
1146
- .drag()
1147
- .subject(function (event, d) {
1148
- const node = d3.select(this);
1149
- return { x: node.attr('cx'), y: node.attr('cy') };
1150
- });
1151
- const dragMarkers = this.markerListeners.on('start drag end', function (event, d) {
1152
- const node = d3.select(this);
1153
- drag(node, event, d);
1154
- });
1155
- const draggableMarkers = (_b = this.series.data) === null || _b === void 0 ? void 0 : _b.filter((_) => { var _a; return (_ === null || _ === void 0 ? void 0 : _.marker) && ((_a = _ === null || _ === void 0 ? void 0 : _.marker) === null || _a === void 0 ? void 0 : _a.draggable); });
1156
- const element = d3
1157
- .select(this.element.nativeElement)
1158
- .selectAll('.draggable-marker')
1159
- .data(draggableMarkers);
1160
- element.call(dragMarkers);
1161
- this.svgElement = d3
1162
- .select(this.element.nativeElement)
1163
- .select('.line')
1164
- .node();
1119
+ // this.markerListeners?.on('start drag end', null);
1120
+ // const drag = (node, event: d3.D3DragEvent<any, any, any>, d: BasePoint) => {
1121
+ // if (
1122
+ // d.marker?.dragType === DragPointType.x ||
1123
+ // d.marker?.dragType === DragPointType.xy
1124
+ // ) {
1125
+ // d.x = this.x.invert(event.x);
1126
+ // }
1127
+ //
1128
+ // if (
1129
+ // d.marker?.dragType === DragPointType.y ||
1130
+ // d.marker?.dragType === DragPointType.xy
1131
+ // ) {
1132
+ // d.y = this.y.invert(event.y);
1133
+ // }
1134
+ //
1135
+ // this.svc.emitPoint({
1136
+ // target: {
1137
+ // series: this.series,
1138
+ // point: d,
1139
+ // },
1140
+ // event,
1141
+ // });
1142
+ //
1143
+ // this.cdr.detectChanges();
1144
+ // };
1145
+ // this.markerListeners = d3
1146
+ // .drag()
1147
+ // .subject(function (event, d: BasePoint) {
1148
+ // const node = d3.select(this);
1149
+ // return {x: node.attr('cx'), y: node.attr('cy')};
1150
+ // });
1151
+ // const dragMarkers =
1152
+ // this.markerListeners.on(
1153
+ // 'start drag end',
1154
+ // function (event: d3.D3DragEvent<any, any, any>, d: BasePoint) {
1155
+ // const node = d3.select(this);
1156
+ //
1157
+ // drag(node, event, d);
1158
+ // }
1159
+ // );
1160
+ //
1161
+ // const draggableMarkers = this.series.data?.filter(
1162
+ // (_) => _?.marker && _?.marker?.draggable
1163
+ // );
1164
+ //
1165
+ // const element = d3
1166
+ // .select(this.element.nativeElement)
1167
+ // .selectAll('.draggable-marker')
1168
+ // .data(draggableMarkers);
1169
+ //
1170
+ // element.call(dragMarkers as any);
1171
+ //
1172
+ // this.svgElement = d3
1173
+ // .select(this.element.nativeElement)
1174
+ // .select('.line')
1175
+ // .node() as SVGGeometryElement;
1165
1176
  }
1166
1177
  getTransform(event, scaleX, scaleY) {
1167
1178
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -1261,6 +1272,151 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
1261
1272
  type: Input
1262
1273
  }] } });
1263
1274
 
1275
+ var DragPointType;
1276
+ (function (DragPointType) {
1277
+ DragPointType[DragPointType["x"] = 0] = "x";
1278
+ DragPointType[DragPointType["y"] = 1] = "y";
1279
+ DragPointType[DragPointType["xy"] = 2] = "xy";
1280
+ })(DragPointType || (DragPointType = {}));
1281
+
1282
+ class DraggablePointDirective {
1283
+ constructor(_elementRef) {
1284
+ this._elementRef = _elementRef;
1285
+ this.moveStart = new EventEmitter();
1286
+ this.moveProcess = new EventEmitter();
1287
+ this.moveEnd = new EventEmitter();
1288
+ }
1289
+ mouseDown(event) {
1290
+ if (!this.tetaDraggablePoint) {
1291
+ return;
1292
+ }
1293
+ event.stopPropagation();
1294
+ event.preventDefault();
1295
+ this.startPosition = {
1296
+ x: event.x,
1297
+ y: event.y
1298
+ };
1299
+ this.moveStart.emit(this.startPosition);
1300
+ }
1301
+ mouseUp(event) {
1302
+ if (this.startPosition !== null && this.startPosition !== undefined) {
1303
+ let deltaX = event.x - this.startPosition.x;
1304
+ let deltaY = event.y - this.startPosition.y;
1305
+ if (this.dragDirection === DragPointType.x) {
1306
+ deltaY = 0;
1307
+ }
1308
+ if (this.dragDirection === DragPointType.y) {
1309
+ deltaX = 0;
1310
+ }
1311
+ if (this.allowDrag && !this.allowDrag({
1312
+ x: event.x,
1313
+ y: event.y,
1314
+ deltaX,
1315
+ deltaY
1316
+ })) {
1317
+ this.startPosition = null;
1318
+ return;
1319
+ }
1320
+ if (this.transformCache) {
1321
+ this.transformCache.x = this.transformCache.x + deltaX;
1322
+ this.transformCache.y = this.transformCache.y + deltaY;
1323
+ }
1324
+ else {
1325
+ this.transformCache = {
1326
+ x: deltaX,
1327
+ y: deltaY
1328
+ };
1329
+ }
1330
+ this.moveEnd.emit({
1331
+ x: event.x,
1332
+ y: event.y,
1333
+ deltaX,
1334
+ deltaY
1335
+ });
1336
+ }
1337
+ this.startPosition = null;
1338
+ }
1339
+ mouseMove(event) {
1340
+ if (this.startPosition) {
1341
+ let deltaX = event.x - this.startPosition.x;
1342
+ let deltaY = event.y - this.startPosition.y;
1343
+ if (this.transformCache) {
1344
+ deltaX = this.transformCache.x + deltaX;
1345
+ deltaY = this.transformCache.y + deltaY;
1346
+ }
1347
+ if (this.allowDrag && !this.allowDrag({
1348
+ x: event.x,
1349
+ y: event.y,
1350
+ deltaX,
1351
+ deltaY
1352
+ })) {
1353
+ return;
1354
+ }
1355
+ if (this.dragDirection === DragPointType.x) {
1356
+ deltaY = 0;
1357
+ }
1358
+ if (this.dragDirection === DragPointType.y) {
1359
+ deltaX = 0;
1360
+ }
1361
+ this.setTransform(deltaX, deltaY);
1362
+ event.stopPropagation();
1363
+ event.preventDefault();
1364
+ this.moveProcess.emit({
1365
+ x: event.x,
1366
+ y: event.y,
1367
+ deltaX,
1368
+ deltaY
1369
+ });
1370
+ }
1371
+ }
1372
+ setTransform(x, y) {
1373
+ this._elementRef.nativeElement.style.transform = `translate(${x}px, ${y}px)`;
1374
+ }
1375
+ resetTransform() {
1376
+ this.setTransform(0, 0);
1377
+ this.transformCache = null;
1378
+ }
1379
+ }
1380
+ DraggablePointDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DraggablePointDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1381
+ 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 });
1382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DraggablePointDirective, decorators: [{
1383
+ type: Directive,
1384
+ args: [{
1385
+ selector: '[tetaDraggablePoint]',
1386
+ exportAs: 'tetaDraggablePoint'
1387
+ }]
1388
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { tetaDraggablePoint: [{
1389
+ type: Input
1390
+ }], dragDirection: [{
1391
+ type: Input
1392
+ }], allowDrag: [{
1393
+ type: Input
1394
+ }], moveStart: [{
1395
+ type: Output
1396
+ }], moveProcess: [{
1397
+ type: Output
1398
+ }], moveEnd: [{
1399
+ type: Output
1400
+ }], mouseDown: [{
1401
+ type: HostListener,
1402
+ args: ['mousedown', ['$event']]
1403
+ }, {
1404
+ type: HostListener,
1405
+ args: ['touchstart', ['$event']]
1406
+ }], mouseUp: [{
1407
+ type: HostListener,
1408
+ args: ['window:mouseup', ['$event']]
1409
+ }, {
1410
+ type: HostListener,
1411
+ args: ['window:touchend', ['$event']]
1412
+ }], mouseMove: [{
1413
+ type: HostListener,
1414
+ args: ['window:mousemove', ['$event']]
1415
+ }, {
1416
+ type: HostListener,
1417
+ args: ['window:touchmove', ['$event']]
1418
+ }] } });
1419
+
1264
1420
  class LineSeriesComponent extends LinearSeriesBase {
1265
1421
  constructor(svc, cdr, scaleService, zoomService, element) {
1266
1422
  super(svc, cdr, scaleService, zoomService, element);
@@ -1269,13 +1425,80 @@ class LineSeriesComponent extends LinearSeriesBase {
1269
1425
  this.scaleService = scaleService;
1270
1426
  this.zoomService = zoomService;
1271
1427
  this.element = element;
1428
+ this.allowDrag = (point) => {
1429
+ return (newPoint) => {
1430
+ if (point.marker.minX !== null && point.marker.minX !== undefined) {
1431
+ if (this.x.invert(this.x(this.start.x) + newPoint.deltaX) < point.marker.minX) {
1432
+ return false;
1433
+ }
1434
+ }
1435
+ if (point.marker.maxX !== null && point.marker.maxX !== undefined) {
1436
+ if (this.x.invert(this.x(this.start.x) + newPoint.deltaX) > point.marker.maxX) {
1437
+ return false;
1438
+ }
1439
+ }
1440
+ if (point.marker.minY !== null && point.marker.minY !== undefined) {
1441
+ if (this.y.invert(this.y(this.start.y) + newPoint.deltaY) < point.marker.minY) {
1442
+ return false;
1443
+ }
1444
+ }
1445
+ if (point.marker.maxY !== null && point.marker.maxY !== undefined) {
1446
+ if (this.y.invert(this.y(this.start.y) + newPoint.deltaY) > point.marker.maxY) {
1447
+ return false;
1448
+ }
1449
+ }
1450
+ return true;
1451
+ };
1452
+ };
1453
+ }
1454
+ moveStart(event, point) {
1455
+ this.start = { x: point.x, y: point.y };
1456
+ }
1457
+ moveEnd(event, point) {
1458
+ point.x = this.x.invert(this.x(this.start.x) + event.deltaX);
1459
+ point.y = this.y.invert(this.y(this.start.y) + event.deltaY);
1460
+ this._update.next();
1461
+ const emitEvent = {
1462
+ type: 'end',
1463
+ sourceEvent: event
1464
+ };
1465
+ this.svc.emitPoint({
1466
+ target: {
1467
+ series: this.series,
1468
+ point: point,
1469
+ },
1470
+ event: emitEvent,
1471
+ });
1472
+ }
1473
+ moveProcess(event, point) {
1474
+ point.x = this.x.invert(this.x(this.start.x) + event.deltaX);
1475
+ point.y = this.y.invert(this.y(this.start.y) + event.deltaY);
1476
+ this._update.next();
1477
+ const emitEvent = {
1478
+ type: 'drag',
1479
+ sourceEvent: event
1480
+ };
1481
+ this.svc.emitPoint({
1482
+ target: {
1483
+ series: this.series,
1484
+ point: point,
1485
+ },
1486
+ event: emitEvent,
1487
+ });
1488
+ }
1489
+ startLabel(event, label) {
1490
+ this.labelStart = { dx: label.dx, dy: label.dy };
1491
+ }
1492
+ moveLabel(event, label) {
1493
+ label.dx = this.labelStart.dx + event.deltaX;
1494
+ label.dy = this.labelStart.dy + event.deltaY;
1272
1495
  }
1273
1496
  }
1274
1497
  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 });
1275
- 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:circle\n class=\"marker\"\n *ngFor=\"let point of draggablePoints\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\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: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1498
+ 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 });
1276
1499
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: LineSeriesComponent, decorators: [{
1277
1500
  type: Component,
1278
- 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:circle\n class=\"marker\"\n *ngFor=\"let point of draggablePoints\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n</ng-container>\n\n\n\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
1501
+ 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"] }]
1279
1502
  }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; } });
1280
1503
 
1281
1504
  class BarSeriesComponent extends SeriesBaseComponent {
@@ -1615,7 +1838,7 @@ class XAxisComponent {
1615
1838
  this.ticks = this.x.pipe(withLatestFrom(this._svc.size), map((_) => {
1616
1839
  const [x, size] = _;
1617
1840
  const tickSize = x.ticks().map((_) => getTextWidth(this.axis.options.tickFormat ? this.axis.options.tickFormat(_) : this.axis.defaultFormatter()(_), 0.45, 11));
1618
- return x.ticks(size.width / parseInt(d3.max(tickSize), 10) / 3);
1841
+ return x.ticks(size.width / parseInt(d3.max(tickSize), 10) / 10);
1619
1842
  }));
1620
1843
  }
1621
1844
  getLabelTransform() {
@@ -2794,7 +3017,8 @@ ChartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "1
2794
3017
  BlockSeriesComponent,
2795
3018
  BlockAreaSeriesComponent,
2796
3019
  AnnotationComponent,
2797
- CrosshairComponent], imports: [CommonModule, LetModule], exports: [ChartComponent,
3020
+ CrosshairComponent,
3021
+ DraggablePointDirective], imports: [CommonModule, LetModule], exports: [ChartComponent,
2798
3022
  LegendComponent,
2799
3023
  SeriesBaseComponent,
2800
3024
  LineSeriesComponent,
@@ -2830,6 +3054,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
2830
3054
  BlockAreaSeriesComponent,
2831
3055
  AnnotationComponent,
2832
3056
  CrosshairComponent,
3057
+ DraggablePointDirective,
2833
3058
  ],
2834
3059
  exports: [
2835
3060
  ChartComponent,