@tetacom/svg-charts 1.2.26 → 1.2.27

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 { 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
- if (d.marker?.dragType === DragPointType.x ||
1121
- d.marker?.dragType === DragPointType.xy) {
1122
- d.x = this.x.invert(event.x);
1123
- }
1124
- if (d.marker?.dragType === DragPointType.y ||
1125
- d.marker?.dragType === DragPointType.xy) {
1126
- d.y = this.y.invert(event.y);
1127
- }
1128
- this.svc.emitPoint({
1129
- target: {
1130
- series: this.series,
1131
- point: d,
1132
- },
1133
- event,
1134
- });
1135
- this.cdr.detectChanges();
1136
- };
1137
- this.markerListeners = d3
1138
- .drag()
1139
- .subject(function (event, d) {
1140
- const node = d3.select(this);
1141
- return { x: node.attr('cx'), y: node.attr('cy') };
1142
- });
1143
- const dragMarkers = this.markerListeners.on('start drag end', function (event, d) {
1144
- const node = d3.select(this);
1145
- drag(node, event, d);
1146
- });
1147
- const draggableMarkers = this.series.data?.filter((_) => _?.marker && _?.marker?.draggable);
1148
- const element = d3
1149
- .select(this.element.nativeElement)
1150
- .selectAll('.draggable-marker')
1151
- .data(draggableMarkers);
1152
- element.call(dragMarkers);
1153
- this.svgElement = d3
1154
- .select(this.element.nativeElement)
1155
- .select('.line')
1156
- .node();
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,150 @@ 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
+ return;
1312
+ }
1313
+ if (this.transformCache) {
1314
+ this.transformCache.x = this.transformCache.x + deltaX;
1315
+ this.transformCache.y = this.transformCache.y + deltaY;
1316
+ }
1317
+ else {
1318
+ this.transformCache = {
1319
+ x: deltaX,
1320
+ y: deltaY
1321
+ };
1322
+ }
1323
+ this.moveEnd.emit({
1324
+ x: event.x,
1325
+ y: event.y,
1326
+ deltaX,
1327
+ deltaY
1328
+ });
1329
+ }
1330
+ this.startPosition = null;
1331
+ }
1332
+ mouseMove(event) {
1333
+ if (this.startPosition) {
1334
+ let deltaX = event.x - this.startPosition.x;
1335
+ let deltaY = event.y - this.startPosition.y;
1336
+ if (this.transformCache) {
1337
+ deltaX = this.transformCache.x + deltaX;
1338
+ deltaY = this.transformCache.y + deltaY;
1339
+ }
1340
+ if (this.allowDrag && !this.allowDrag({
1341
+ x: event.x,
1342
+ y: event.y,
1343
+ deltaX,
1344
+ deltaY
1345
+ })) {
1346
+ return;
1347
+ }
1348
+ if (this.dragDirection === DragPointType.x) {
1349
+ deltaY = 0;
1350
+ }
1351
+ if (this.dragDirection === DragPointType.y) {
1352
+ deltaX = 0;
1353
+ }
1354
+ this.setTransform(deltaX, deltaY);
1355
+ event.stopPropagation();
1356
+ event.preventDefault();
1357
+ this.moveProcess.emit({
1358
+ x: event.x,
1359
+ y: event.y,
1360
+ deltaX,
1361
+ deltaY
1362
+ });
1363
+ }
1364
+ }
1365
+ setTransform(x, y) {
1366
+ this._elementRef.nativeElement.style.transform = `translate(${x}px, ${y}px)`;
1367
+ }
1368
+ resetTransform() {
1369
+ this.setTransform(0, 0);
1370
+ this.transformCache = null;
1371
+ }
1372
+ }
1373
+ DraggablePointDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DraggablePointDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1374
+ 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 });
1375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DraggablePointDirective, decorators: [{
1376
+ type: Directive,
1377
+ args: [{
1378
+ selector: '[tetaDraggablePoint]',
1379
+ exportAs: 'tetaDraggablePoint'
1380
+ }]
1381
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { tetaDraggablePoint: [{
1382
+ type: Input
1383
+ }], dragDirection: [{
1384
+ type: Input
1385
+ }], allowDrag: [{
1386
+ type: Input
1387
+ }], moveStart: [{
1388
+ type: Output
1389
+ }], moveProcess: [{
1390
+ type: Output
1391
+ }], moveEnd: [{
1392
+ type: Output
1393
+ }], mouseDown: [{
1394
+ type: HostListener,
1395
+ args: ['mousedown', ['$event']]
1396
+ }, {
1397
+ type: HostListener,
1398
+ args: ['touchstart', ['$event']]
1399
+ }], mouseUp: [{
1400
+ type: HostListener,
1401
+ args: ['window:mouseup', ['$event']]
1402
+ }, {
1403
+ type: HostListener,
1404
+ args: ['window:touchend', ['$event']]
1405
+ }], mouseMove: [{
1406
+ type: HostListener,
1407
+ args: ['window:mousemove', ['$event']]
1408
+ }, {
1409
+ type: HostListener,
1410
+ args: ['window:touchmove', ['$event']]
1411
+ }] } });
1412
+
1255
1413
  class LineSeriesComponent extends LinearSeriesBase {
1256
1414
  constructor(svc, cdr, scaleService, zoomService, element) {
1257
1415
  super(svc, cdr, scaleService, zoomService, element);
@@ -1260,13 +1418,64 @@ class LineSeriesComponent extends LinearSeriesBase {
1260
1418
  this.scaleService = scaleService;
1261
1419
  this.zoomService = zoomService;
1262
1420
  this.element = element;
1421
+ this.allowDrag = (point) => {
1422
+ return (newPoint) => {
1423
+ if (point.marker.minX !== null && point.marker.minX !== undefined) {
1424
+ if (this.x.invert(this.x(this.start.x) + newPoint.deltaX) < point.marker.minX) {
1425
+ return false;
1426
+ }
1427
+ }
1428
+ if (point.marker.maxX !== null && point.marker.maxX !== undefined) {
1429
+ if (this.x.invert(this.x(this.start.x) + newPoint.deltaX) > point.marker.minX) {
1430
+ return false;
1431
+ }
1432
+ }
1433
+ if (point.marker.minY !== null && point.marker.minY !== undefined) {
1434
+ if (this.y.invert(this.y(this.start.y) + newPoint.deltaY) < point.marker.minY) {
1435
+ return false;
1436
+ }
1437
+ }
1438
+ if (point.marker.maxY !== null && point.marker.maxY !== undefined) {
1439
+ if (this.y.invert(this.y(this.start.y) + newPoint.deltaY) > point.marker.maxY) {
1440
+ return false;
1441
+ }
1442
+ }
1443
+ return true;
1444
+ };
1445
+ };
1446
+ }
1447
+ moveStart(event, point) {
1448
+ this.start = { x: point.x, y: point.y };
1449
+ }
1450
+ moveEnd(event, point) {
1451
+ point.x = this.x.invert(this.x(this.start.x) + event.deltaX);
1452
+ point.y = this.y.invert(this.y(this.start.y) + event.deltaY);
1453
+ this._update.next();
1454
+ this.svc.emitPoint({
1455
+ target: event
1456
+ });
1457
+ }
1458
+ moveProcess(event, point) {
1459
+ point.x = this.x.invert(this.x(this.start.x) + event.deltaX);
1460
+ point.y = this.y.invert(this.y(this.start.y) + event.deltaY);
1461
+ this._update.next();
1462
+ this.svc.emitPoint({
1463
+ target: event
1464
+ });
1465
+ }
1466
+ startLabel(event, label) {
1467
+ this.labelStart = { dx: label.dx, dy: label.dy };
1468
+ }
1469
+ moveLabel(event, label) {
1470
+ label.dx = this.labelStart.dx + event.deltaX;
1471
+ label.dy = this.labelStart.dy + event.deltaY;
1263
1472
  }
1264
1473
  }
1265
1474
  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: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 });
1475
+ 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
1476
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: LineSeriesComponent, decorators: [{
1268
1477
  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: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"] }]
1478
+ 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
1479
  }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; } });
1271
1480
 
1272
1481
  class BarSeriesComponent extends SeriesBaseComponent {
@@ -1599,7 +1808,7 @@ class XAxisComponent {
1599
1808
  this.ticks = this.x.pipe(withLatestFrom(this._svc.size), map((_) => {
1600
1809
  const [x, size] = _;
1601
1810
  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) / 3);
1811
+ return x.ticks(size.width / parseInt(d3.max(tickSize), 10) / 10);
1603
1812
  }));
1604
1813
  }
1605
1814
  getLabelTransform() {
@@ -2752,7 +2961,8 @@ ChartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "1
2752
2961
  BlockSeriesComponent,
2753
2962
  BlockAreaSeriesComponent,
2754
2963
  AnnotationComponent,
2755
- CrosshairComponent], imports: [CommonModule, LetModule], exports: [ChartComponent,
2964
+ CrosshairComponent,
2965
+ DraggablePointDirective], imports: [CommonModule, LetModule], exports: [ChartComponent,
2756
2966
  LegendComponent,
2757
2967
  SeriesBaseComponent,
2758
2968
  LineSeriesComponent,
@@ -2788,6 +2998,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
2788
2998
  BlockAreaSeriesComponent,
2789
2999
  AnnotationComponent,
2790
3000
  CrosshairComponent,
3001
+ DraggablePointDirective,
2791
3002
  ],
2792
3003
  exports: [
2793
3004
  ChartComponent,