@tetacom/ng-components 1.0.27 → 1.0.30

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.
Files changed (115) hide show
  1. package/component/filter/filter.module.d.ts +2 -1
  2. package/component/public-api.d.ts +0 -1
  3. package/component/table/table-body/table-body.component.d.ts +0 -4
  4. package/component/table/table.module.d.ts +5 -6
  5. package/directive/hint/hint.directive.d.ts +1 -0
  6. package/esm2020/component/date-picker/date-picker/date-picker.component.mjs +2 -2
  7. package/esm2020/component/filter/filter.module.mjs +6 -2
  8. package/esm2020/component/filter/numeric-filter/numeric-filter.component.mjs +4 -3
  9. package/esm2020/component/message/message.service.mjs +3 -3
  10. package/esm2020/component/public-api.mjs +1 -3
  11. package/esm2020/component/table/table-body/table-body.component.mjs +1 -31
  12. package/esm2020/component/table/table.module.mjs +1 -5
  13. package/esm2020/directive/click-outside/click-outside.directive.mjs +1 -3
  14. package/esm2020/directive/hint/hint.directive.mjs +4 -1
  15. package/esm2020/directive/only-number/only-number.directive.mjs +3 -2
  16. package/esm2020/pipe/public-api.mjs +2 -1
  17. package/esm2020/util/date-util.mjs +8 -5
  18. package/fesm2015/tetacom-ng-components.mjs +46 -2346
  19. package/fesm2015/tetacom-ng-components.mjs.map +1 -1
  20. package/fesm2020/tetacom-ng-components.mjs +46 -2337
  21. package/fesm2020/tetacom-ng-components.mjs.map +1 -1
  22. package/package.json +1 -1
  23. package/pipe/public-api.d.ts +1 -0
  24. package/component/chart/chart/chart.component.d.ts +0 -39
  25. package/component/chart/chart.module.d.ts +0 -8
  26. package/component/chart/core/axis-creator.d.ts +0 -29
  27. package/component/chart/core/chart.d.ts +0 -70
  28. package/component/chart/core/public-api.d.ts +0 -2
  29. package/component/chart/drawer/area-drawer.d.ts +0 -7
  30. package/component/chart/drawer/bar-drawer.d.ts +0 -8
  31. package/component/chart/drawer/contour-drawer.d.ts +0 -7
  32. package/component/chart/drawer/default-drawer-mapping.d.ts +0 -4
  33. package/component/chart/drawer/line-drawer.d.ts +0 -11
  34. package/component/chart/drawer/pie-drawer.d.ts +0 -7
  35. package/component/chart/drawer/public-api.d.ts +0 -6
  36. package/component/chart/drawer/scatter-drawer.d.ts +0 -15
  37. package/component/chart/drawer/spline-drawer.d.ts +0 -7
  38. package/component/chart/legend-drawer/default-drawer-legend-mapping.d.ts +0 -3
  39. package/component/chart/legend-drawer/gradient-drawer.d.ts +0 -5
  40. package/component/chart/legend-drawer/swatch-drawer.d.ts +0 -6
  41. package/component/chart/model/annotation.d.ts +0 -59
  42. package/component/chart/model/axis-options.d.ts +0 -43
  43. package/component/chart/model/chart-bounds.d.ts +0 -12
  44. package/component/chart/model/chart-options.d.ts +0 -51
  45. package/component/chart/model/enum/axis-type.d.ts +0 -4
  46. package/component/chart/model/enum/dispatch-type.d.ts +0 -4
  47. package/component/chart/model/enum/drag-point-type.d.ts +0 -5
  48. package/component/chart/model/enum/legend-type.d.ts +0 -4
  49. package/component/chart/model/enum/public-api.d.ts +0 -7
  50. package/component/chart/model/enum/scale-type.d.ts +0 -7
  51. package/component/chart/model/enum/scale.d.ts +0 -5
  52. package/component/chart/model/enum/series-type.d.ts +0 -10
  53. package/component/chart/model/enum/zoom-type.d.ts +0 -5
  54. package/component/chart/model/i-drag-event.d.ts +0 -5
  55. package/component/chart/model/i-drawer-legend.d.ts +0 -12
  56. package/component/chart/model/i-drawer.d.ts +0 -9
  57. package/component/chart/model/i-zoom-event.d.ts +0 -8
  58. package/component/chart/model/plot-band.d.ts +0 -28
  59. package/component/chart/model/plot-line.d.ts +0 -20
  60. package/component/chart/model/point/bar-point.d.ts +0 -6
  61. package/component/chart/model/point/base-point.d.ts +0 -9
  62. package/component/chart/model/point/contour-point.d.ts +0 -4
  63. package/component/chart/model/point/marker-options.d.ts +0 -11
  64. package/component/chart/model/point/public-api.d.ts +0 -3
  65. package/component/chart/model/point/scatter-point.d.ts +0 -5
  66. package/component/chart/model/public-api.d.ts +0 -15
  67. package/component/chart/model/series.d.ts +0 -62
  68. package/component/chart/model/tooltip-options.d.ts +0 -14
  69. package/component/chart/public-api.d.ts +0 -5
  70. package/esm2020/component/chart/chart/chart.component.mjs +0 -164
  71. package/esm2020/component/chart/chart.module.mjs +0 -18
  72. package/esm2020/component/chart/core/axis-creator.mjs +0 -82
  73. package/esm2020/component/chart/core/chart.mjs +0 -1339
  74. package/esm2020/component/chart/core/public-api.mjs +0 -3
  75. package/esm2020/component/chart/drawer/area-drawer.mjs +0 -20
  76. package/esm2020/component/chart/drawer/bar-drawer.mjs +0 -23
  77. package/esm2020/component/chart/drawer/contour-drawer.mjs +0 -29
  78. package/esm2020/component/chart/drawer/default-drawer-mapping.mjs +0 -17
  79. package/esm2020/component/chart/drawer/line-drawer.mjs +0 -152
  80. package/esm2020/component/chart/drawer/pie-drawer.mjs +0 -4
  81. package/esm2020/component/chart/drawer/public-api.mjs +0 -7
  82. package/esm2020/component/chart/drawer/scatter-drawer.mjs +0 -93
  83. package/esm2020/component/chart/drawer/spline-drawer.mjs +0 -23
  84. package/esm2020/component/chart/legend-drawer/default-drawer-legend-mapping.mjs +0 -7
  85. package/esm2020/component/chart/legend-drawer/gradient-drawer.mjs +0 -45
  86. package/esm2020/component/chart/legend-drawer/swatch-drawer.mjs +0 -62
  87. package/esm2020/component/chart/model/annotation.mjs +0 -30
  88. package/esm2020/component/chart/model/axis-options.mjs +0 -26
  89. package/esm2020/component/chart/model/chart-bounds.mjs +0 -13
  90. package/esm2020/component/chart/model/chart-options.mjs +0 -37
  91. package/esm2020/component/chart/model/enum/axis-type.mjs +0 -6
  92. package/esm2020/component/chart/model/enum/dispatch-type.mjs +0 -6
  93. package/esm2020/component/chart/model/enum/drag-point-type.mjs +0 -7
  94. package/esm2020/component/chart/model/enum/legend-type.mjs +0 -6
  95. package/esm2020/component/chart/model/enum/public-api.mjs +0 -8
  96. package/esm2020/component/chart/model/enum/scale-type.mjs +0 -9
  97. package/esm2020/component/chart/model/enum/scale.mjs +0 -7
  98. package/esm2020/component/chart/model/enum/series-type.mjs +0 -12
  99. package/esm2020/component/chart/model/enum/zoom-type.mjs +0 -7
  100. package/esm2020/component/chart/model/i-drag-event.mjs +0 -2
  101. package/esm2020/component/chart/model/i-drawer-legend.mjs +0 -2
  102. package/esm2020/component/chart/model/i-drawer.mjs +0 -2
  103. package/esm2020/component/chart/model/i-zoom-event.mjs +0 -2
  104. package/esm2020/component/chart/model/plot-band.mjs +0 -18
  105. package/esm2020/component/chart/model/plot-line.mjs +0 -13
  106. package/esm2020/component/chart/model/point/bar-point.mjs +0 -2
  107. package/esm2020/component/chart/model/point/base-point.mjs +0 -2
  108. package/esm2020/component/chart/model/point/contour-point.mjs +0 -2
  109. package/esm2020/component/chart/model/point/marker-options.mjs +0 -2
  110. package/esm2020/component/chart/model/point/public-api.mjs +0 -4
  111. package/esm2020/component/chart/model/point/scatter-point.mjs +0 -2
  112. package/esm2020/component/chart/model/public-api.mjs +0 -16
  113. package/esm2020/component/chart/model/series.mjs +0 -27
  114. package/esm2020/component/chart/model/tooltip-options.mjs +0 -19
  115. package/esm2020/component/chart/public-api.mjs +0 -6
@@ -16,14 +16,9 @@ import { TranslocoModule, TRANSLOCO_SCOPE } from '@ngneat/transloco';
16
16
  import { __awaiter } from 'tslib';
17
17
  import * as hash from 'object-hash';
18
18
  import hash__default from 'object-hash';
19
- import { SizeStrategy, Datasource, UiScrollModule } from 'ngx-ui-scroll';
20
- import * as d3 from 'd3';
21
- import { zoomIdentity } from 'd3';
22
- import * as d3annotation from 'd3-svg-annotation';
23
- import { annotationBadge, annotationLabel, annotationCallout, annotationCalloutCircle, annotationCalloutCurve, annotationCalloutElbow, annotationCalloutRect, annotationCustomType, annotationXYThreshold } from 'd3-svg-annotation';
24
- import { tricontour } from 'd3-tricontour';
25
19
  import * as THREE from 'three';
26
20
  import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
21
+ import * as d3 from 'd3';
27
22
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
28
23
 
29
24
  class AccordionComponent {
@@ -538,6 +533,31 @@ var DatePickerMode;
538
533
  DatePickerMode[DatePickerMode["year"] = 2] = "year";
539
534
  })(DatePickerMode || (DatePickerMode = {}));
540
535
 
536
+ const getPrecision = (a) => {
537
+ if (!isFinite(a)) {
538
+ return 0;
539
+ }
540
+ let e = 1;
541
+ let p = 0;
542
+ while (Math.round(a * e) / e !== a) {
543
+ e *= 10;
544
+ p++;
545
+ }
546
+ return p;
547
+ };
548
+ const formatNumber = (value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength) => {
549
+ const abs = Math.abs(value);
550
+ if (0 < abs && 1 > abs) {
551
+ const firstDigitIndex = Math.floor(Math.abs(Math.log10(abs)));
552
+ decimalLength += firstDigitIndex;
553
+ }
554
+ const precision = Math.min(getPrecision(value), Math.floor(decimalLength));
555
+ const result = '\\d(?=(\\d{' + chunkLength + '})+' + (precision > 0 ? '\\D' : '$') + ')';
556
+ const num = value.toFixed(precision);
557
+ return (decimalDelimiter ? num.replace('.', decimalDelimiter) : num).replace(new RegExp(result, 'g'), '$&' + chunkDelimiter);
558
+ };
559
+ const prependZero = (input, length) => ('0'.repeat(length) + input).slice(-length);
560
+
541
561
  class DateUtil {
542
562
  /**
543
563
  * Вычесть n-дней
@@ -586,10 +606,12 @@ class DateUtil {
586
606
  return '';
587
607
  }
588
608
  const month = dat.getMonth() + 1;
589
- const monthString = month < 10 ? '0' + month.toString() : month.toString();
590
- return `${dat.getDate().toString()}.${monthString}.${dat
591
- .getFullYear()
592
- .toString()} ${dat.getHours()}:${dat.getMinutes()}:${dat.getSeconds()}`;
609
+ return `${prependZero(dat.getDate(), 2)}.
610
+ ${prependZero(month, 2)}.
611
+ ${dat.getFullYear()}
612
+ ${prependZero(dat.getHours(), 2)}:
613
+ ${prependZero(dat.getMinutes(), 2)}:
614
+ ${prependZero(dat.getSeconds(), 2)}`;
593
615
  }
594
616
  /**
595
617
  * Подготовка даты к отправке на сервер, чтобы небыло смещения часов
@@ -1525,31 +1547,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
1525
1547
  type: Output
1526
1548
  }] } });
1527
1549
 
1528
- const getPrecision = (a) => {
1529
- if (!isFinite(a)) {
1530
- return 0;
1531
- }
1532
- let e = 1;
1533
- let p = 0;
1534
- while (Math.round(a * e) / e !== a) {
1535
- e *= 10;
1536
- p++;
1537
- }
1538
- return p;
1539
- };
1540
- const formatNumber = (value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength) => {
1541
- const abs = Math.abs(value);
1542
- if (0 < abs && 1 > abs) {
1543
- const firstDigitIndex = Math.floor(Math.abs(Math.log10(abs)));
1544
- decimalLength += firstDigitIndex;
1545
- }
1546
- const precision = Math.min(getPrecision(value), Math.floor(decimalLength));
1547
- const result = '\\d(?=(\\d{' + chunkLength + '})+' + (precision > 0 ? '\\D' : '$') + ')';
1548
- const num = value.toFixed(precision);
1549
- return (decimalDelimiter ? num.replace('.', decimalDelimiter) : num).replace(new RegExp(result, 'g'), '$&' + chunkDelimiter);
1550
- };
1551
- const prependZero = (input, length) => ('0'.repeat(length) + input).slice(-length);
1552
-
1553
1550
  class PrependZeroPipe {
1554
1551
  transform(value, length) {
1555
1552
  if (value === null || value === undefined) {
@@ -2120,7 +2117,7 @@ class DatePickerComponent {
2120
2117
  applyValue(date) {
2121
2118
  this.setDate(date);
2122
2119
  this.value = this.currentValue;
2123
- this.onChange(this.value);
2120
+ this.onChange(new Date(this.value));
2124
2121
  this.open = false;
2125
2122
  }
2126
2123
  focus() {
@@ -2510,7 +2507,6 @@ class ClickOutsideDirective {
2510
2507
  }
2511
2508
  const clickedInside = DomUtil.clickedInside(this._elementRef.nativeElement, click);
2512
2509
  if (!clickedInside) {
2513
- console.log('clickedInside', clickedInside);
2514
2510
  this.clickOutside.emit(click);
2515
2511
  }
2516
2512
  };
@@ -2536,7 +2532,6 @@ class ClickOutsideDirective {
2536
2532
  }
2537
2533
  addListener(handleRightClick) {
2538
2534
  window.addEventListener('click', this.listener);
2539
- console.log('handleRightClick', handleRightClick);
2540
2535
  if (handleRightClick) {
2541
2536
  window.addEventListener('contextmenu', this.listener);
2542
2537
  }
@@ -2673,7 +2668,8 @@ class OnlyNumberDirective {
2673
2668
  }
2674
2669
  else {
2675
2670
  if (e.key === ',' && originalValue.indexOf('.') < 0) {
2676
- this._elementRef.nativeElement.value = originalValue + '.';
2671
+ this._elementRef.nativeElement.value =
2672
+ `${originalValue.slice(0, cursorPosition)}.${originalValue.slice(cursorPosition)}`;
2677
2673
  }
2678
2674
  e.preventDefault();
2679
2675
  }
@@ -3483,10 +3479,10 @@ class NumericFilterComponent extends FilterComponentBase {
3483
3479
  }
3484
3480
  }
3485
3481
  NumericFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NumericFilterComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3486
- NumericFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: NumericFilterComponent, selector: "teta-numeric-filter", inputs: { column: "column", filterOptions: "filterOptions", state: "state" }, outputs: { filterChanged: "filterChanged" }, usesInheritance: true, ngImport: i0, template: "<div class=\"form-row padding-3\">\n <teta-input [label]=\"'\u041E\u0442'\">\n <input class=\"input\" type=\"text\"\n style=\"width: 110px\"\n [ngModel]=\"filter.value?.greaterThan\"\n (ngModelChange)=\"filter.value.greaterThan=$event\"/>\n </teta-input>\n <teta-input [label]=\"'\u0414\u043E'\">\n <input class=\"input\" type=\"text\"\n style=\"width: 110px\"\n [ngModel]=\"filter.value?.lessThan\"\n (ngModelChange)=\"filter.value.lessThan=$event\"/>\n </teta-input>\n</div>\n", styles: [""], components: [{ type: InputComponent, selector: "teta-input", inputs: ["label", "horizontal", "required"] }], directives: [{ type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3482
+ NumericFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: NumericFilterComponent, selector: "teta-numeric-filter", inputs: { column: "column", filterOptions: "filterOptions", state: "state" }, outputs: { filterChanged: "filterChanged" }, usesInheritance: true, ngImport: i0, template: "<div class=\"form-row padding-3\">\n <teta-input [label]=\"'\u041E\u0442'\">\n <input class=\"input\" type=\"text\"\n style=\"width: 110px\"\n [tetaOnlyNumber]=\"true\"\n [ngModel]=\"filter.value?.greaterThan\"\n (ngModelChange)=\"filter.value.greaterThan=$event\"/>\n </teta-input>\n <teta-input [label]=\"'\u0414\u043E'\">\n <input class=\"input\" type=\"text\"\n style=\"width: 110px\"\n [tetaOnlyNumber]=\"true\"\n [ngModel]=\"filter.value?.lessThan\"\n (ngModelChange)=\"filter.value.lessThan=$event\"/>\n </teta-input>\n</div>\n", styles: [""], components: [{ type: InputComponent, selector: "teta-input", inputs: ["label", "horizontal", "required"] }], directives: [{ type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: OnlyNumberDirective, selector: "[tetaOnlyNumber]", inputs: ["tetaOnlyNumber", "allowDecimals", "allowSign", "decimalSeparator", "commaSeparator"] }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3487
3483
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NumericFilterComponent, decorators: [{
3488
3484
  type: Component,
3489
- args: [{ selector: 'teta-numeric-filter', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-row padding-3\">\n <teta-input [label]=\"'\u041E\u0442'\">\n <input class=\"input\" type=\"text\"\n style=\"width: 110px\"\n [ngModel]=\"filter.value?.greaterThan\"\n (ngModelChange)=\"filter.value.greaterThan=$event\"/>\n </teta-input>\n <teta-input [label]=\"'\u0414\u043E'\">\n <input class=\"input\" type=\"text\"\n style=\"width: 110px\"\n [ngModel]=\"filter.value?.lessThan\"\n (ngModelChange)=\"filter.value.lessThan=$event\"/>\n </teta-input>\n</div>\n", styles: [""] }]
3485
+ args: [{ selector: 'teta-numeric-filter', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-row padding-3\">\n <teta-input [label]=\"'\u041E\u0442'\">\n <input class=\"input\" type=\"text\"\n style=\"width: 110px\"\n [tetaOnlyNumber]=\"true\"\n [ngModel]=\"filter.value?.greaterThan\"\n (ngModelChange)=\"filter.value.greaterThan=$event\"/>\n </teta-input>\n <teta-input [label]=\"'\u0414\u043E'\">\n <input class=\"input\" type=\"text\"\n style=\"width: 110px\"\n [tetaOnlyNumber]=\"true\"\n [ngModel]=\"filter.value?.lessThan\"\n (ngModelChange)=\"filter.value.lessThan=$event\"/>\n </teta-input>\n</div>\n", styles: [""] }]
3490
3486
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { column: [{
3491
3487
  type: Input
3492
3488
  }], filterOptions: [{
@@ -4702,7 +4698,8 @@ FilterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
4702
4698
  DatePickerModule,
4703
4699
  RadioModule,
4704
4700
  InputModule,
4705
- CheckboxModule], exports: [FilterPanelComponent,
4701
+ CheckboxModule,
4702
+ OnlyNumberModule], exports: [FilterPanelComponent,
4706
4703
  NumericFilterComponent,
4707
4704
  StringFilterComponent,
4708
4705
  ListFilterComponent,
@@ -4717,6 +4714,7 @@ FilterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
4717
4714
  RadioModule,
4718
4715
  InputModule,
4719
4716
  CheckboxModule,
4717
+ OnlyNumberModule,
4720
4718
  ]] });
4721
4719
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FilterModule, decorators: [{
4722
4720
  type: NgModule,
@@ -4747,6 +4745,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
4747
4745
  RadioModule,
4748
4746
  InputModule,
4749
4747
  CheckboxModule,
4748
+ OnlyNumberModule,
4750
4749
  ],
4751
4750
  }]
4752
4751
  }] });
@@ -4934,7 +4933,7 @@ class FilterState {
4934
4933
 
4935
4934
  class MessageService {
4936
4935
  constructor() {
4937
- this._message = new Subject();
4936
+ this._message = new ReplaySubject(1);
4938
4937
  this._clear = new Subject();
4939
4938
  this.message = this._message.asObservable();
4940
4939
  this.clear = this._clear.asObservable();
@@ -6179,6 +6178,9 @@ class HintDirective extends DynamicContentBaseDirective {
6179
6178
  'hint',
6180
6179
  ];
6181
6180
  }
6181
+ ngOnDestroy() {
6182
+ super.ngOnDestroy();
6183
+ }
6182
6184
  }
6183
6185
  HintDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HintDirective, deps: [{ token: DOCUMENT }, { token: i0.ElementRef }, { token: DynamicComponentService }, { token: i0.Injector }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
6184
6186
  HintDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: HintDirective, selector: "[tetaHint]", inputs: { tetaHint: "tetaHint", align: "align", verticalAlign: "verticalAlign", delay: "delay" }, host: { listeners: { "mouseenter": "mouseenter($event)", "mouseleave": "mouseleave($event)", "click": "click($event)" } }, usesInheritance: true, ngImport: i0 });
@@ -9126,10 +9128,6 @@ class TableBodyComponent {
9126
9128
  }
9127
9129
  set data(data) {
9128
9130
  this._data = data;
9129
- if (!this.dataSource) {
9130
- this.createAdapter();
9131
- }
9132
- this.resetAdapter();
9133
9131
  }
9134
9132
  get data() {
9135
9133
  return this._data;
@@ -9230,34 +9228,6 @@ class TableBodyComponent {
9230
9228
  ? accum
9231
9229
  : current.data[columnName], null);
9232
9230
  }
9233
- resetAdapter() {
9234
- var _a;
9235
- return __awaiter(this, void 0, void 0, function* () {
9236
- yield this.dataSource.adapter.relax();
9237
- yield this.dataSource.adapter.reset({
9238
- get: this.getData,
9239
- settings: {
9240
- minIndex: 0,
9241
- maxIndex: ((_a = this._data) === null || _a === void 0 ? void 0 : _a.length) ? this._data.length - 1 : 0,
9242
- startIndex: 0,
9243
- itemSize: 24,
9244
- sizeStrategy: SizeStrategy.Constant,
9245
- },
9246
- });
9247
- yield this.dataSource.adapter.check();
9248
- });
9249
- }
9250
- createAdapter() {
9251
- this.dataSource = new Datasource({
9252
- get: this.getData,
9253
- settings: {
9254
- startIndex: 0,
9255
- bufferSize: 2,
9256
- sizeStrategy: SizeStrategy.Constant,
9257
- itemSize: 24,
9258
- },
9259
- });
9260
- }
9261
9231
  }
9262
9232
  TableBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: TableBodyComponent, deps: [{ token: TableService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
9263
9233
  TableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: TableBodyComponent, selector: "teta-table-body", inputs: { virtual: "virtual", activeRow: "activeRow", rowHeight: "rowHeight", additionalComponent: "additionalComponent", tree: "tree", aggregate: "aggregate", grouping: "grouping", groupRowComponent: "groupRowComponent", openLevels: "openLevels", selectType: "selectType", rowClass: "rowClass" }, host: { properties: { "class.table-body": "this.tableBodyClass" } }, viewQueries: [{ propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], ngImport: i0, template: "<!--<div #viewport class=\"table-body-container table-body-container-virtual\"-->\n<!-- *ngIf=\"virtual\"-->\n<!-- [style.grid-template-columns]=\"getTemplateColumns()\"-->\n<!-- style=\"height: 100%;\">-->\n<!-- <ng-container-->\n<!-- *uiScroll=\"let row of dataSource; let rowIndex = index; let last = last;\" style=\"display: flex;flex-grow: 1\">-->\n<!-- <ng-container *ngTemplateOutlet=\"bodyTemplate; context: {row: row, rowIndex: rowIndex}\"></ng-container>-->\n<!-- </ng-container>-->\n<!-- <ng-container *ngIf=\"aggregate\">-->\n<!-- <ng-container *ngTemplateOutlet=\"aggTemplate;\"></ng-container>-->\n<!-- </ng-container>-->\n<!--</div>-->\n\n<cdk-virtual-scroll-viewport *ngIf=\"virtual\"\n class=\"table-body-container\"\n [itemSize]=\"24\">\n <ng-container *cdkVirtualFor=\"let row of data;templateCacheSize: 0; let rowIndex = index; trackBy: trackRow;\">\n <ng-container *ngTemplateOutlet=\"bodyTemplate; context: {row: row, rowIndex: rowIndex}\"></ng-container>\n </ng-container>\n</cdk-virtual-scroll-viewport>\n\n\n<div *ngIf=\"!virtual\"\n class=\"table-body-container\"\n [style.grid-template-rows]=\"rowHeight + 'px'\"\n [style.grid-auto-rows]=\"rowHeight + 'px'\"\n [style.grid-template-columns]=\"getTemplateColumns()\">\n <ng-container *ngFor=\"let row of data; let rowIndex = index; trackBy: trackRow;\">\n <ng-container *ngTemplateOutlet=\"bodyTemplate; context: {row: row, rowIndex: rowIndex}\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"aggregate\">\n <ng-container *ngTemplateOutlet=\"aggTemplate;\"></ng-container>\n </ng-container>\n</div>\n\n<ng-template #bodyTemplate let-row=\"row\" let-rowIndex=\"rowIndex\">\n <div class=\"table-row\"\n (click)=\"setActiveRow(row)\"\n [attr.data-row]=\"rowIndex\"\n [ngClass]=\"rowClass ? rowClass(row, rowIndex) : ''\"\n [class.table-row_virtual]=\"virtual\"\n [style.grid-template-columns]=\"virtual ? getTemplateColumns() : ''\"\n [class.table-row_active]=\"row === activeRow || selectedRows.indexOf(row) >= 0\">\n <ng-container *ngIf=\"!grouping\">\n <div class=\"table-row_locked\"\n *ngIf=\"locked.length > 0\"\n [style.grid-template-columns]=\"getLockedGridTemplateColumns(locked)\"\n [style.zIndex]=\"row === activeRow ? 1 : 'unset'\"\n [style.grid-column-end]=\"getSpan()\">\n <teta-selection-cell *ngIf=\"selectType !== selectTypeEnum.none && locked.length\"\n [row]=\"row\"></teta-selection-cell>\n <teta-cell\n *ngFor=\"let column of locked; let colIndex = index; trackBy: trackColumns;\"\n [attr.data-row]=\"rowIndex\"\n [attr.data-column]=\"column.name\"\n [column]=\"column\"\n [filterOptions]=\"dict[column.name]\"\n [dict]=\"dict\"\n [row]=\"row\"\n [ngClass]=\"column.cellClass\"\n [attr.tabindex]=\"0\"\n ></teta-cell>\n </div>\n <teta-selection-cell *ngIf=\"selectType !== selectTypeEnum.none && locked.length < 1\"\n [row]=\"row\"></teta-selection-cell>\n <teta-cell\n *ngFor=\"let column of unlocked; let colIndex = index; trackBy: trackColumns;\"\n [attr.data-row]=\"rowIndex\"\n [attr.data-column]=\"column.name\"\n [column]=\"column\"\n [filterOptions]=\"dict[column.name]\"\n [dict]=\"dict\"\n [row]=\"row\"\n [ngClass]=\"column.cellClass\"\n [attr.tabindex]=\"0\"\n ></teta-cell>\n </ng-container>\n <ng-container *ngIf=\"grouping\">\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #aggTemplate>\n <div class=\"table-row\"\n *ngIf=\"aggregate\"\n [class.table-row_virtual]=\"virtual\"\n [style.grid-template-columns]=\"virtual ? getTemplateColumns() : ''\">\n <div class=\"table-row_locked\"\n *ngIf=\"locked.length > 0\"\n [style.grid-template-columns]=\"getLockedGridTemplateColumns(locked)\"\n [style.grid-column-end]=\"getSpan()\">\n <div class=\"cell align-center justify-content-center\">\n <teta-icon [name]=\"'sumColor'\"></teta-icon>\n </div>\n <div class=\"cell cell-component justify-content-end\"\n *ngFor=\"let column of locked; let colIndex = index; trackBy: trackColumns;\"\n [attr.data-column]=\"column.name\"\n [ngClass]=\"column.cellClass\"\n [attr.tabindex]=\"0\">\n <span class=\"cell-text cell-text_numeric font-title-3\">\n {{getAggregateText(column)}}:\n {{getAggregateValue(column) | tetaNumber : 2}}\n </span>\n </div>\n </div>\n <div class=\"cell align-center justify-content-center\"\n *ngIf=\"selectType !== selectTypeEnum.none && locked.length < 1\">\n <teta-icon [name]=\"'sumColor'\"></teta-icon>\n </div>\n <div class=\"cell cell-component justify-content-end\"\n *ngFor=\"let column of unlocked; let colIndex = index; trackBy: trackColumns;\"\n [attr.data-column]=\"column.name\"\n [ngClass]=\"column.cellClass\"\n [attr.tabindex]=\"0\">\n <span class=\"cell-text cell-text_numeric font-title-3\">\n {{getAggregateText(column)}}\n {{getAggregateValue(column) | tetaNumber : 2}}\n </span>\n </div>\n </div>\n</ng-template>\n", styles: [""], components: [{ type: i4.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { type: SelectionCellComponent, selector: "teta-selection-cell", inputs: ["row"] }, { type: CellComponent, selector: "teta-cell", inputs: ["column", "filterOptions", "dict", "row"] }, { type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { type: i4.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "tetaNumber": NumberPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -9857,7 +9827,6 @@ TableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "1
9857
9827
  HintModule,
9858
9828
  TreeModule,
9859
9829
  OnlyNumberModule,
9860
- UiScrollModule,
9861
9830
  ToolbarModule,
9862
9831
  ClickOutsideModule,
9863
9832
  ResizeDragModule,
@@ -9889,7 +9858,6 @@ TableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "1
9889
9858
  HintModule,
9890
9859
  TreeModule,
9891
9860
  OnlyNumberModule,
9892
- UiScrollModule,
9893
9861
  ToolbarModule,
9894
9862
  ClickOutsideModule,
9895
9863
  ResizeDragModule,
@@ -9949,7 +9917,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
9949
9917
  HintModule,
9950
9918
  TreeModule,
9951
9919
  OnlyNumberModule,
9952
- UiScrollModule,
9953
9920
  ToolbarModule,
9954
9921
  ClickOutsideModule,
9955
9922
  ResizeDragModule,
@@ -10039,2273 +10006,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
10039
10006
  }]
10040
10007
  }] });
10041
10008
 
10042
- var Scale;
10043
- (function (Scale) {
10044
- Scale["time"] = "time";
10045
- Scale["number"] = "number";
10046
- Scale["category"] = "category";
10047
- })(Scale || (Scale = {}));
10048
-
10049
- var SeriesType;
10050
- (function (SeriesType) {
10051
- SeriesType[SeriesType["area"] = 0] = "area";
10052
- SeriesType[SeriesType["bar"] = 1] = "bar";
10053
- SeriesType[SeriesType["line"] = 2] = "line";
10054
- SeriesType[SeriesType["pie"] = 3] = "pie";
10055
- SeriesType[SeriesType["scatter"] = 4] = "scatter";
10056
- SeriesType[SeriesType["spline"] = 5] = "spline";
10057
- SeriesType[SeriesType["contour"] = 6] = "contour";
10058
- SeriesType[SeriesType["custom"] = 7] = "custom";
10059
- })(SeriesType || (SeriesType = {}));
10060
-
10061
- class AreaDrawer {
10062
- draw(series, context, scaleX, scaleY) {
10063
- const points = series.data;
10064
- const path = d3
10065
- .area()
10066
- .x1((d) => (d.x1 != null ? scaleX(d.x1) : scaleX(0)))
10067
- .x0((d) => scaleX(d.x))
10068
- .y((d) => scaleY(d.y));
10069
- context
10070
- .append('path')
10071
- .attr('transform', `translate(${0}, 0)`)
10072
- .attr('fill', series.color)
10073
- .attr('stroke', series.color)
10074
- .attr('stroke-width', series.strokeWidth ? series.strokeWidth : 1)
10075
- .datum(points)
10076
- .attr('d', path);
10077
- }
10078
- }
10079
-
10080
- class BarDrawer {
10081
- draw(series, context, scaleX, scaleY) {
10082
- const points = series.data.filter((_) => _.visible);
10083
- const barScale = d3
10084
- .scaleBand()
10085
- .domain(d3.range(points.length))
10086
- .range(scaleX.range())
10087
- .paddingInner(0.2)
10088
- .paddingOuter(0.2);
10089
- const u = context.selectAll('rect').data(points);
10090
- u.enter()
10091
- .append('rect')
10092
- .merge(u)
10093
- .attr('x', (d, i) => barScale(i))
10094
- .attr('y', (d) => scaleY(d.y))
10095
- .attr('width', barScale.bandwidth())
10096
- .attr('height', (d) => Math.abs(scaleY(0) - scaleY(d.y)))
10097
- .attr('fill', (d) => d.color);
10098
- u.exit().remove();
10099
- }
10100
- }
10101
-
10102
- var DispatchType;
10103
- (function (DispatchType) {
10104
- DispatchType["moveLine"] = "moveLine";
10105
- DispatchType["movePoint"] = "movePoint";
10106
- })(DispatchType || (DispatchType = {}));
10107
-
10108
- var DragPointType;
10109
- (function (DragPointType) {
10110
- DragPointType[DragPointType["x"] = 0] = "x";
10111
- DragPointType[DragPointType["y"] = 1] = "y";
10112
- DragPointType[DragPointType["xy"] = 2] = "xy";
10113
- })(DragPointType || (DragPointType = {}));
10114
-
10115
- class LineDrawer {
10116
- constructor() {
10117
- this.dispatch = d3.dispatch(DispatchType.moveLine, DispatchType.movePoint);
10118
- }
10119
- draw(series, context, scaleX, scaleY, options) {
10120
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
10121
- const points = series.data;
10122
- const markerPoints = points.filter((_) => _.marker);
10123
- const path = d3
10124
- .line()
10125
- .curve(series.curveType)
10126
- .defined((d) => d.x != null && d.y != null)
10127
- .x((d) => scaleX(d.x))
10128
- .y((d) => scaleY(d.y));
10129
- const seriesIndex = options.series.findIndex((_) => _.id === series.id);
10130
- context
10131
- .append('path')
10132
- .attr('class', (d) => (series === null || series === void 0 ? void 0 : series.drag.enable) ? 'draggable' : `series-${seriesIndex}`)
10133
- .attr('data-draggable-id', seriesIndex)
10134
- .attr('fill', 'none')
10135
- .attr('stroke', series.color)
10136
- .attr('stroke-dasharray', series === null || series === void 0 ? void 0 : series.strokeDasharray)
10137
- .attr('stroke-width', series.strokeWidth ? series.strokeWidth : 1)
10138
- .style('cursor', ((_a = series === null || series === void 0 ? void 0 : series.drag) === null || _a === void 0 ? void 0 : _a.enable) ? 'move' : 'default')
10139
- .datum(points)
10140
- .attr('d', path);
10141
- const u = context.append('g').attr('class', 'grabbers');
10142
- const emit = (event, target) => {
10143
- this.dispatch.apply(DispatchType.moveLine, {
10144
- target,
10145
- event,
10146
- });
10147
- };
10148
- if (series.drag.enable) {
10149
- u.selectAll('circle')
10150
- .data(points)
10151
- .enter()
10152
- .append('circle')
10153
- .attr('data-grabber-id', seriesIndex)
10154
- .attr('stroke', (_d = (_c = (_b = series === null || series === void 0 ? void 0 : series.drag) === null || _b === void 0 ? void 0 : _b.grabbers) === null || _c === void 0 ? void 0 : _c.stroke) !== null && _d !== void 0 ? _d : series === null || series === void 0 ? void 0 : series.color)
10155
- .attr('stroke-width', (_g = (_f = (_e = series === null || series === void 0 ? void 0 : series.drag) === null || _e === void 0 ? void 0 : _e.grabbers) === null || _f === void 0 ? void 0 : _f.strokeWidth) !== null && _g !== void 0 ? _g : 1)
10156
- .attr('fill', (_k = (_j = (_h = series === null || series === void 0 ? void 0 : series.drag) === null || _h === void 0 ? void 0 : _h.grabbers) === null || _j === void 0 ? void 0 : _j.fill) !== null && _k !== void 0 ? _k : series === null || series === void 0 ? void 0 : series.color)
10157
- .attr('r', (_o = (_m = (_l = series === null || series === void 0 ? void 0 : series.drag) === null || _l === void 0 ? void 0 : _l.grabbers) === null || _m === void 0 ? void 0 : _m.radius) !== null && _o !== void 0 ? _o : 4)
10158
- .attr('cx', function (d) {
10159
- return scaleX(d.x);
10160
- })
10161
- .attr('cy', function (d) {
10162
- return scaleY(d.y);
10163
- })
10164
- .style('cursor', 'move')
10165
- .call(d3.drag().on('start drag end', function (event, d) {
10166
- var _a, _b, _c;
10167
- d.x = scaleX.invert((_a = event.sourceEvent) === null || _a === void 0 ? void 0 : _a.offsetX);
10168
- d.y = scaleY.invert((_b = event.sourceEvent) === null || _b === void 0 ? void 0 : _b.offsetY);
10169
- d3.select(this).attr('cx', scaleX(d.x)).attr('cy', scaleY(d.y));
10170
- context
10171
- .select(`[data-draggable-id='${seriesIndex}']`)
10172
- .attr('d', path);
10173
- emit(event, series);
10174
- if ((_c = series === null || series === void 0 ? void 0 : series.drag) === null || _c === void 0 ? void 0 : _c.extendLine) {
10175
- drawExtendedLine();
10176
- }
10177
- }));
10178
- u.exit().remove();
10179
- }
10180
- const drawExtendedLine = () => {
10181
- context.selectAll(`[data-extended-id='${seriesIndex}']`).remove();
10182
- const p1 = points[0];
10183
- const p2 = points[points.length - 1];
10184
- const distance = Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p2.y, 2));
10185
- if (distance <= 0) {
10186
- return;
10187
- }
10188
- const extendLength = 50;
10189
- const extendedEndX = p2.x + ((p2.x - p1.x) / distance) * extendLength;
10190
- const extendedEndY = p2.y + ((p2.y - p1.y) / distance) * extendLength;
10191
- const extendedStartX = p1.x - ((p2.x - p1.x) / distance) * extendLength;
10192
- const extendedStartY = p1.y - ((p2.y - p1.y) / distance) * extendLength;
10193
- context
10194
- .append('line')
10195
- .attr('class', 'extendedLine')
10196
- .attr('data-extended-id', seriesIndex)
10197
- .attr('stroke', series === null || series === void 0 ? void 0 : series.color)
10198
- .attr('stroke-width', series === null || series === void 0 ? void 0 : series.strokeWidth)
10199
- .attr('stroke-dasharray', series === null || series === void 0 ? void 0 : series.strokeDasharray)
10200
- .attr('x1', scaleX(p1.x))
10201
- .attr('y1', scaleY(p1.y))
10202
- .attr('x2', scaleX(extendedStartX))
10203
- .attr('y2', scaleY(extendedStartY));
10204
- context
10205
- .append('line')
10206
- .attr('class', 'extendedLine')
10207
- .attr('data-extended-id', seriesIndex)
10208
- .attr('stroke', series === null || series === void 0 ? void 0 : series.color)
10209
- .attr('stroke-width', series === null || series === void 0 ? void 0 : series.strokeWidth)
10210
- .attr('stroke-dasharray', series === null || series === void 0 ? void 0 : series.strokeDasharray)
10211
- .attr('x1', scaleX(p2.x))
10212
- .attr('y1', scaleY(p2.y))
10213
- .attr('x2', scaleX(extendedEndX))
10214
- .attr('y2', scaleY(extendedEndY));
10215
- };
10216
- if (((_p = series === null || series === void 0 ? void 0 : series.drag) === null || _p === void 0 ? void 0 : _p.extendLine) && (points === null || points === void 0 ? void 0 : points.length)) {
10217
- drawExtendedLine();
10218
- }
10219
- if (markerPoints === null || markerPoints === void 0 ? void 0 : markerPoints.length) {
10220
- const emit = (event, target) => {
10221
- this.dispatch.apply(DispatchType.movePoint, {
10222
- target: series,
10223
- point: Object.assign({}, target),
10224
- event,
10225
- });
10226
- };
10227
- context
10228
- .selectAll(`draggable-marker-${seriesIndex}`)
10229
- .data(markerPoints)
10230
- .enter()
10231
- .append('circle')
10232
- .attr('class', `draggable-marker-${seriesIndex}`)
10233
- .attr('r', (d) => { var _a, _b; return ((_b = (_a = d.marker) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.radius) || 5; })
10234
- .attr('cx', function (d) {
10235
- return scaleX(d.x);
10236
- })
10237
- .attr('cy', function (d) {
10238
- return scaleY(d.y);
10239
- })
10240
- .style('cursor', 'pointer')
10241
- .style('fill', (d) => { var _a, _b; return ((_b = (_a = d.marker) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.color) || 'none'; })
10242
- .attr('stroke', (d) => { var _a, _b; return ((_b = (_a = d.marker) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.stroke) || 'none'; })
10243
- .attr('stroke-width', (d) => { var _a, _b; return ((_b = (_a = d.marker) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.strokeWidth) || 0; });
10244
- context.selectAll(`.draggable-marker-${seriesIndex}`).call(d3.drag().on('drag start end', function dragged(event, d) {
10245
- var _a, _b, _c, _d;
10246
- const node = d3.select(this);
10247
- if (event.type === 'start') {
10248
- node.raise().classed('active', true);
10249
- }
10250
- if (((_a = d.marker) === null || _a === void 0 ? void 0 : _a.dragType) === DragPointType.x) {
10251
- d.x = scaleX.invert((_b = event.sourceEvent) === null || _b === void 0 ? void 0 : _b.offsetX);
10252
- node.attr('cx', scaleX(d.x));
10253
- }
10254
- if (((_c = d.marker) === null || _c === void 0 ? void 0 : _c.dragType) === DragPointType.y) {
10255
- d.y = scaleY.invert((_d = event.sourceEvent) === null || _d === void 0 ? void 0 : _d.offsetY);
10256
- node.attr('cy', scaleY(d.y));
10257
- }
10258
- context.select(`.series-${seriesIndex}`).attr('d', path);
10259
- emit(event, d);
10260
- }));
10261
- }
10262
- }
10263
- }
10264
-
10265
- class PieDrawer {
10266
- draw(series, context, scaleX, scaleY) { }
10267
- }
10268
-
10269
- class SplineDrawer {
10270
- draw(series, context, scaleX, scaleY) {
10271
- const points = series.data;
10272
- const path = d3
10273
- .line()
10274
- .curve(d3.curveCatmullRom)
10275
- .defined((d) => d.x != null && d.y != null)
10276
- .x((d) => scaleX(d.x))
10277
- .y((d) => scaleY(d.y));
10278
- context
10279
- .append('path')
10280
- .attr('transform', `translate(${0}, 0)`)
10281
- .attr('fill', 'none')
10282
- .attr('stroke', series.color)
10283
- .attr('stroke-width', series.strokeWidth ? series.strokeWidth : 1)
10284
- .datum(points)
10285
- .attr('d', path)
10286
- .transition()
10287
- .duration(750);
10288
- }
10289
- }
10290
-
10291
- class ScatterDrawer {
10292
- constructor() {
10293
- this._colorToData = {};
10294
- }
10295
- draw(series, context, scaleX, scaleY, options) {
10296
- this._options = options;
10297
- d3.select(context.node().parentNode).select('.virtual-canvas').remove();
10298
- if (series.renderTo === 'canvas') {
10299
- this._context = context;
10300
- const height = context.node().clientHeight;
10301
- const width = context.node().clientWidth;
10302
- const points = series.data;
10303
- const context2D = context.node().getContext('2d');
10304
- this._virtualCanvas = d3
10305
- .select(context.node().parentNode)
10306
- .append('canvas')
10307
- .attr('class', 'virtual-canvas')
10308
- .style('display', 'none');
10309
- this._virtualCanvas.attr('width', width).attr('height', height);
10310
- const virtualContext = this._virtualCanvas.node().getContext('2d');
10311
- context.on('mouseout', () => {
10312
- d3.select(this._context.node().parentNode)
10313
- .select('.tooltip-chart')
10314
- .style('display', 'none');
10315
- context.on('mousemove', null);
10316
- });
10317
- context.on('mouseenter', () => {
10318
- d3.select(this._context.node().parentNode)
10319
- .select('.tooltip-chart')
10320
- .style('display', null);
10321
- context.on('mousemove', (e) => this.handleMouseMove(e));
10322
- });
10323
- points.forEach((d, idx) => {
10324
- const color = this.getColor(idx);
10325
- this._colorToData[color] = d;
10326
- virtualContext.fillStyle = color;
10327
- context2D.fillStyle = d.color;
10328
- const cx = scaleX(d.x);
10329
- const cy = scaleY(d.y);
10330
- context2D.beginPath();
10331
- context2D.arc(cx, cy, d.radius, 0, 2 * Math.PI);
10332
- context2D.closePath();
10333
- context2D.fill();
10334
- virtualContext.beginPath();
10335
- virtualContext.arc(cx, cy, d.radius, 0, 2 * Math.PI);
10336
- virtualContext.closePath();
10337
- virtualContext.fill();
10338
- });
10339
- }
10340
- }
10341
- getColor(index) {
10342
- return d3
10343
- .rgb(Math.floor(index / 256 / 256) % 256, Math.floor(index / 256) % 256, index % 256)
10344
- .toString();
10345
- }
10346
- tooltipPosition(event) {
10347
- const centerX = this._context.node().clientWidth / 2;
10348
- const centerY = this._context.node().clientHeight / 2;
10349
- const padding = { x: 10, y: 10 };
10350
- const scene = {
10351
- left: event.pageX > centerX ? 'initial' : `${event.pageX + padding.x}px`,
10352
- top: event.pageY > centerY ? 'initial' : `${event.pageY + padding.y}px`,
10353
- bottom: event.pageY > centerY
10354
- ? `${window.innerHeight - event.pageY}px`
10355
- : 'initial',
10356
- right: event.pageX > centerX
10357
- ? `${window.innerWidth - event.pageX + padding.x}px`
10358
- : 'initial',
10359
- };
10360
- return scene;
10361
- }
10362
- handleMouseMove(event) {
10363
- var _a;
10364
- const mouse = d3.pointer(event);
10365
- const virtualContext = this._virtualCanvas.node().getContext('2d');
10366
- const image = virtualContext.getImageData(mouse[0], mouse[1], 1, 1);
10367
- const color = d3.rgb.apply(null, image.data).toString();
10368
- const possibleDatum = this._colorToData[color];
10369
- const { top, right, bottom, left } = this.tooltipPosition(event);
10370
- if (possibleDatum) {
10371
- const formatted = (_a = this._options.tooltip) === null || _a === void 0 ? void 0 : _a.format([possibleDatum]);
10372
- d3.select(this._context.node().parentNode)
10373
- .select('.tooltip-chart')
10374
- .style('z-index', 3)
10375
- .style('top', top)
10376
- .style('right', right)
10377
- .style('bottom', bottom)
10378
- .style('left', left)
10379
- .html(formatted);
10380
- }
10381
- }
10382
- }
10383
-
10384
- class ContourDrawer {
10385
- draw(series, context, scaleX, scaleY) {
10386
- const points = series.data;
10387
- const tricontourFn = tricontour()
10388
- .x((d) => scaleX(d.x))
10389
- .y((d) => scaleY(d.y))
10390
- .value((d) => d.value)
10391
- .thresholds(30);
10392
- let contours = tricontourFn(points);
10393
- const geoFn = d3.geoPath();
10394
- const color = series === null || series === void 0 ? void 0 : series.colorScale.domain(d3.extent(contours, (d) => d.value));
10395
- contours = contours.map((_) => (Object.assign(Object.assign({}, _), { color: color(_.value) })));
10396
- const u = context.selectAll('path').data(contours);
10397
- u.enter()
10398
- .append('path')
10399
- .merge(u)
10400
- .attr('d', (_) => geoFn(_))
10401
- .attr('stroke', 'rgba(255, 255,255,0.5)')
10402
- .attr('stroke-width', 0.5)
10403
- .attr('fill', (_) => _.color);
10404
- u.exit().remove();
10405
- }
10406
- }
10407
-
10408
- const defaultDrawerMapping = new Map()
10409
- .set(SeriesType.area, new AreaDrawer())
10410
- .set(SeriesType.bar, new BarDrawer())
10411
- .set(SeriesType.line, new LineDrawer())
10412
- .set(SeriesType.pie, new PieDrawer())
10413
- .set(SeriesType.scatter, new ScatterDrawer())
10414
- .set(SeriesType.spline, new SplineDrawer())
10415
- .set(SeriesType.contour, new ContourDrawer());
10416
-
10417
- var LegendType;
10418
- (function (LegendType) {
10419
- LegendType[LegendType["swatches"] = 0] = "swatches";
10420
- LegendType[LegendType["gradient"] = 1] = "gradient";
10421
- })(LegendType || (LegendType = {}));
10422
-
10423
- const classTypeLegendMapping = new Map()
10424
- .set(SeriesType.line, 'line')
10425
- .set(SeriesType.spline, 'line');
10426
- class SwatchDrawer {
10427
- draw(options) {
10428
- var _a, _b;
10429
- d3.select(options.context.parentElement)
10430
- .select('.legend-container')
10431
- .selectAll('.legend')
10432
- .remove();
10433
- const defaultData = (_a = options.series) === null || _a === void 0 ? void 0 : _a.filter((serie) => serie.type !== SeriesType.bar);
10434
- const barData = (_b = options === null || options === void 0 ? void 0 : options.series) === null || _b === void 0 ? void 0 : _b.filter((serie) => serie.type === SeriesType.bar).reduce((acc, serie) => {
10435
- const data = serie.data.map((_) => (Object.assign(Object.assign({}, _), { serieType: serie.type, serieIndex: serie.id })));
10436
- return acc.concat(data);
10437
- }, []);
10438
- const legendContainer = d3
10439
- .select(options.context.parentElement)
10440
- .select('.legend-container')
10441
- .append('div')
10442
- .attr('class', 'legend padding-bottom-4');
10443
- const defaultLegend = legendContainer
10444
- .selectAll('div')
10445
- .data(defaultData)
10446
- .enter()
10447
- .append('div')
10448
- .attr('class', 'item')
10449
- .style('user-select', 'none');
10450
- const barLegend = legendContainer
10451
- .selectAll('.bar')
10452
- .data(barData)
10453
- .enter()
10454
- .append('div')
10455
- .attr('class', 'item bar')
10456
- .style('user-select', 'none');
10457
- defaultLegend
10458
- .append('div')
10459
- .attr('class', (_) => classTypeLegendMapping.get(_.type) || 'swatch')
10460
- .style('background', (_) => { var _a; return _.visible ? (_a = _.color) !== null && _a !== void 0 ? _a : 'black' : 'var(--color-text-10)'; });
10461
- defaultLegend
10462
- .append('div')
10463
- .attr('class', 'label')
10464
- .text((_) => { var _a; return (_a = _.name) !== null && _a !== void 0 ? _a : 'Без названия'; })
10465
- .style('text-decoration', (_) => (_.visible ? 'unset' : 'line-through'));
10466
- barLegend
10467
- .append('div')
10468
- .attr('class', 'swatch')
10469
- .style('background', (_) => { var _a; return _.visible ? (_a = _.color) !== null && _a !== void 0 ? _a : 'black' : 'var(--color-text-10)'; });
10470
- barLegend
10471
- .append('div')
10472
- .attr('class', 'label')
10473
- .text((_) => { var _a; return (_a = _.label) !== null && _a !== void 0 ? _a : 'Без названия'; })
10474
- .style('text-decoration', (_) => (_.visible ? 'unset' : 'line-through'));
10475
- }
10476
- }
10477
-
10478
- class GradientDrawer {
10479
- draw(options) {
10480
- var _a, _b;
10481
- const container = d3
10482
- .select(options.context.parentElement)
10483
- .select('.legend-container');
10484
- container.selectAll('.gradient-legend').remove();
10485
- const svg = container
10486
- .append('svg')
10487
- .attr('class', 'gradient-legend')
10488
- .attr('width', options.width)
10489
- .attr('height', 32);
10490
- svg.selectAll('.legend-defs').remove();
10491
- const extent = d3.extent((_a = options.series[0]) === null || _a === void 0 ? void 0 : _a.data, (d) => d.value);
10492
- const defs = svg.append('defs').attr('class', 'legend-defs');
10493
- const linearGradient = defs
10494
- .append('linearGradient')
10495
- .attr('id', 'legend-gradient');
10496
- linearGradient
10497
- .selectAll('stop')
10498
- .data([...(_b = options.series[0]) === null || _b === void 0 ? void 0 : _b.data].reverse())
10499
- .enter()
10500
- .append('stop')
10501
- .attr('offset', (d) => ((d.value - extent[0]) / (extent[1] - extent[0])) * 100 + '%')
10502
- .attr('stop-color', (d) => d.color);
10503
- const g = svg.append('g').attr('class', 'gradient-legend');
10504
- g.append('rect')
10505
- .attr('width', options.width - 80)
10506
- .attr('transform', 'translate(40, 0)')
10507
- .attr('height', 4)
10508
- .style('fill', 'url(#legend-gradient)');
10509
- const xScale = d3
10510
- .scaleLinear()
10511
- .range([80, options.width - 80])
10512
- .domain(extent)
10513
- .nice();
10514
- const tickCount = options.width / 80;
10515
- const xAxis = d3.axisBottom(xScale).tickSize(8).ticks(tickCount);
10516
- g.call(xAxis).call((node) => {
10517
- node.select('.domain').remove();
10518
- node.selectAll('line').remove();
10519
- });
10520
- }
10521
- }
10522
-
10523
- const defaultLegendDrawerMapping = new Map()
10524
- .set(LegendType.swatches, new SwatchDrawer())
10525
- .set(LegendType.gradient, new GradientDrawer());
10526
-
10527
- var AxisType;
10528
- (function (AxisType) {
10529
- AxisType[AxisType["abscissa"] = 0] = "abscissa";
10530
- AxisType[AxisType["ordinatus"] = 1] = "ordinatus";
10531
- })(AxisType || (AxisType = {}));
10532
-
10533
- class Axis {
10534
- constructor(options) {
10535
- this._extents = [0, 0];
10536
- this._type = options === null || options === void 0 ? void 0 : options.type;
10537
- this._index = (options === null || options === void 0 ? void 0 : options.index) || 0;
10538
- this._chartOptions = options === null || options === void 0 ? void 0 : options.chartOptions;
10539
- this._height = options === null || options === void 0 ? void 0 : options.height;
10540
- if (this._chartOptions == null) {
10541
- throw new Error(`No chartOptions for axis ${AxisType[this._type]}`);
10542
- }
10543
- this.createExtents();
10544
- this.width = this.calculateAxisWidth();
10545
- }
10546
- get index() {
10547
- return this._index;
10548
- }
10549
- get options() {
10550
- return this._type === AxisType.abscissa
10551
- ? this._chartOptions.xAxis[this.index]
10552
- : this._chartOptions.yAxis[this.index];
10553
- }
10554
- get extent() {
10555
- return this._extents;
10556
- }
10557
- get type() {
10558
- return this._type;
10559
- }
10560
- get offset() {
10561
- return this._offset;
10562
- }
10563
- get ticks() {
10564
- return this._ticks;
10565
- }
10566
- setOffset(offset) {
10567
- this._offset = offset;
10568
- }
10569
- calculateAxisWidth() {
10570
- if (this.type === AxisType.abscissa) {
10571
- return 0;
10572
- }
10573
- const y = d3
10574
- .scaleLinear()
10575
- .domain([this.extent[0], this.extent[1]])
10576
- .range([0, this._height])
10577
- .nice();
10578
- const body = d3
10579
- .select('body')
10580
- .append('svg')
10581
- .attr('class', 'calculate-offset')
10582
- .style('position', 'absolute')
10583
- .style('left', '-9999px');
10584
- const axis = d3.axisRight(y).tickValues(this.ticks);
10585
- const element = body.append('g').attr('class', 'font-caption').call(axis);
10586
- const bBox = element.node().getBBox();
10587
- d3.selectAll('.calculate-offset').remove();
10588
- return bBox.width;
10589
- }
10590
- createExtents() {
10591
- var _a, _b, _c, _d, _e, _f;
10592
- const hasMin = ((_a = this.options) === null || _a === void 0 ? void 0 : _a.min) != null;
10593
- const hasMax = ((_b = this.options) === null || _b === void 0 ? void 0 : _b.max) != null;
10594
- if (!hasMin || !hasMax) {
10595
- const filtered = (_d = (_c = this._chartOptions) === null || _c === void 0 ? void 0 : _c.series) === null || _d === void 0 ? void 0 : _d.filter((serie) => this._index ===
10596
- serie[this._type === AxisType.abscissa ? 'xAxisIndex' : 'yAxisIndex']);
10597
- const raw = filtered.map((series) => d3.extent(series === null || series === void 0 ? void 0 : series.data, (point) => this._type === AxisType.abscissa ? point.x : point.y));
10598
- const merged = [].concat(...(raw !== null && raw !== void 0 ? raw : []));
10599
- const abs = (num) => Math.abs(num);
10600
- this._extents = this.options.negative
10601
- ? [-Math.abs(d3.max(merged.map(abs))), d3.max(merged.map(abs))]
10602
- : [d3.min(merged), d3.max(merged)];
10603
- }
10604
- if (hasMin) {
10605
- this._extents[0] = (_e = this.options) === null || _e === void 0 ? void 0 : _e.min;
10606
- }
10607
- if (hasMax) {
10608
- this._extents[1] = (_f = this.options) === null || _f === void 0 ? void 0 : _f.max;
10609
- }
10610
- }
10611
- }
10612
- Axis.offsetFactor = 22;
10613
-
10614
- var ScaleType;
10615
- (function (ScaleType) {
10616
- ScaleType[ScaleType["linear"] = 0] = "linear";
10617
- ScaleType[ScaleType["log"] = 1] = "log";
10618
- ScaleType[ScaleType["pow"] = 2] = "pow";
10619
- ScaleType[ScaleType["sqrt"] = 3] = "sqrt";
10620
- ScaleType[ScaleType["time"] = 4] = "time";
10621
- })(ScaleType || (ScaleType = {}));
10622
-
10623
- var ZoomType;
10624
- (function (ZoomType) {
10625
- ZoomType[ZoomType["x"] = 0] = "x";
10626
- ZoomType[ZoomType["y"] = 1] = "y";
10627
- ZoomType[ZoomType["xy"] = 2] = "xy";
10628
- })(ZoomType || (ZoomType = {}));
10629
-
10630
- class TetaChart {
10631
- constructor(options, element) {
10632
- this.plotLinesMove$ = new Subject();
10633
- this.plotBandsMove$ = new Subject();
10634
- this.seriesMove$ = new Subject();
10635
- this.pointMove$ = new Subject();
10636
- this.zoom$ = new Subject();
10637
- this._container = null;
10638
- this._width = 0;
10639
- this._height = 0;
10640
- this._zoomYCache = new Map();
10641
- this._zoomXCache = new Map();
10642
- this._zoom = d3.zoom();
10643
- this.visibleChartWindowWidth = 0;
10644
- this._xScales = new Map();
10645
- this._yScales = new Map();
10646
- this._clonedX = new Map();
10647
- this._clonedY = new Map();
10648
- this.offsetOpposite = 0;
10649
- this.offsetNonOpposite = 0;
10650
- this._zoomAdded = false;
10651
- this._options = options;
10652
- this.selectNode(element);
10653
- this.createTooltip();
10654
- this.plotLinesMove = this.plotLinesMove$.asObservable();
10655
- this.plotBandsMove = this.plotBandsMove$.asObservable();
10656
- this.seriesMove = this.seriesMove$.asObservable();
10657
- this.pointMove = this.pointMove$.asObservable();
10658
- this.zoom = this.zoom$.asObservable();
10659
- }
10660
- redraw(options) {
10661
- if (options) {
10662
- this._options = options;
10663
- }
10664
- this.createAxis();
10665
- this.createScales();
10666
- this.createMarkers();
10667
- this.createVisibleWindow();
10668
- this._redraw();
10669
- this.drawLegend();
10670
- if (this._commonZoomTransform) {
10671
- this._chart.call(this._zoom.transform, this._commonZoomTransform);
10672
- }
10673
- if (!this._zoomAdded) {
10674
- this.addZoom();
10675
- this._zoomAdded = true;
10676
- }
10677
- this.addAxesZoom();
10678
- }
10679
- setZoom(zoom) {
10680
- var _a;
10681
- if (!this._zoom) {
10682
- return;
10683
- }
10684
- this._chart.call(this._zoom.transform, (_a = zoom === null || zoom === void 0 ? void 0 : zoom.zoomTransform) !== null && _a !== void 0 ? _a : zoomIdentity);
10685
- }
10686
- setSize(size = { width: 0, height: 0 }) {
10687
- this._height = size.height;
10688
- this._width = size.width;
10689
- this._chart.attr('width', this._width).attr('height', this._height);
10690
- this._canvas.attr('width', this._width).attr('height', this._height);
10691
- const extent = [
10692
- [
10693
- this.offsetNonOpposite
10694
- ? this.offsetNonOpposite
10695
- : this._options.bounds.left,
10696
- this._options.bounds.top,
10697
- ],
10698
- [
10699
- this._width -
10700
- (this.offsetOpposite
10701
- ? this.offsetOpposite
10702
- : this._options.bounds.right),
10703
- this._height - this._options.bounds.bottom,
10704
- ],
10705
- ];
10706
- this._zoom
10707
- .scaleExtent([1, Infinity])
10708
- .translateExtent(extent)
10709
- .extent(extent);
10710
- }
10711
- createVisibleWindow() {
10712
- this.uniqId = (Date.now() + Math.random()).toString(36);
10713
- this._chart.selectAll('defs').remove();
10714
- this._chart
10715
- .append('defs')
10716
- .append('clipPath')
10717
- .attr('id', `draw-window-${this.uniqId}`)
10718
- .append('rect')
10719
- .attr('x', this.offsetNonOpposite === 0
10720
- ? this._options.bounds.left
10721
- : this.offsetNonOpposite)
10722
- .attr('y', this._options.bounds.top)
10723
- .attr('width', this.visibleChartWindowWidth + 1)
10724
- .attr('height', this._height -
10725
- this._options.bounds.bottom -
10726
- this._options.bounds.top +
10727
- 1 >
10728
- 0
10729
- ? this._height -
10730
- this._options.bounds.bottom -
10731
- this._options.bounds.top +
10732
- 1
10733
- : 0);
10734
- }
10735
- createAxis() {
10736
- this._xAxisList = this._options.xAxis.map((_, index) => new Axis({
10737
- type: AxisType.abscissa,
10738
- index,
10739
- chartOptions: this._options,
10740
- }));
10741
- this._yAxisList = this._options.yAxis.map((_, index) => {
10742
- const axis = new Axis({
10743
- type: AxisType.ordinatus,
10744
- index,
10745
- chartOptions: this._options,
10746
- height: this._height,
10747
- });
10748
- return axis;
10749
- });
10750
- const nonTitleOffset = 6;
10751
- this.offsetNonOpposite = d3.reduce(this._yAxisList.filter((_) => { var _a, _b; return ((_a = _.options) === null || _a === void 0 ? void 0 : _a.opposite) !== true && ((_b = _.options) === null || _b === void 0 ? void 0 : _b.visible); }), (sum, axis) => {
10752
- var _a;
10753
- const offset = sum +
10754
- axis.width +
10755
- (((_a = axis === null || axis === void 0 ? void 0 : axis.options) === null || _a === void 0 ? void 0 : _a.title) ? Axis.offsetFactor : nonTitleOffset);
10756
- axis.setOffset(offset);
10757
- return offset;
10758
- }, 0);
10759
- this.offsetOpposite = d3.reduce(this._yAxisList.filter((_) => { var _a, _b; return ((_a = _.options) === null || _a === void 0 ? void 0 : _a.opposite) === true && ((_b = _.options) === null || _b === void 0 ? void 0 : _b.visible); }), (sum, axis) => {
10760
- var _a;
10761
- const offset = sum +
10762
- axis.width +
10763
- (((_a = axis === null || axis === void 0 ? void 0 : axis.options) === null || _a === void 0 ? void 0 : _a.title) ? Axis.offsetFactor : nonTitleOffset);
10764
- axis.setOffset(offset);
10765
- return offset;
10766
- }, 0);
10767
- this.visibleChartWindowWidth = this.caluclateChartWidth();
10768
- }
10769
- _redraw() {
10770
- this.drawPlotBands();
10771
- this.drawPlotLines();
10772
- this.drawChart();
10773
- this.drawAxis();
10774
- this.drawGridLines();
10775
- this.drawAnnotations();
10776
- }
10777
- addZoom() {
10778
- var _a, _b;
10779
- if ((_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.zoom) === null || _b === void 0 ? void 0 : _b.enable) {
10780
- const hasXZoom = [ZoomType.x, ZoomType.xy].includes(this._options.zoom.zoomType);
10781
- const hasYZoom = [ZoomType.y, ZoomType.xy].includes(this._options.zoom.zoomType);
10782
- this._chart.call(this._zoom.on('start end zoom', (event) => {
10783
- if (hasXZoom) {
10784
- for (const [key, value] of this._clonedX.entries()) {
10785
- const rescaled = event.transform.rescaleX(value);
10786
- this._xScales.set(key, rescaled);
10787
- if (event.sourceEvent) {
10788
- this.zoom$.next({
10789
- domain: rescaled.domain(),
10790
- zoomTransform: event.transform,
10791
- zoomType: ZoomType.x,
10792
- event,
10793
- });
10794
- }
10795
- }
10796
- }
10797
- if (hasYZoom) {
10798
- for (const [key, value] of this._clonedY.entries()) {
10799
- const rescaled = event.transform.rescaleY(value);
10800
- this._yScales.set(key, rescaled);
10801
- if (event.type === 'zoom') {
10802
- if (event.sourceEvent) {
10803
- this.zoom$.next({
10804
- domain: rescaled.domain(),
10805
- zoomTransform: event.transform,
10806
- zoomType: ZoomType.y,
10807
- event,
10808
- });
10809
- }
10810
- }
10811
- }
10812
- }
10813
- if (event.type === 'end') {
10814
- this._commonZoomTransform = event.transform;
10815
- }
10816
- this._redraw();
10817
- }));
10818
- }
10819
- }
10820
- addAxesZoom() {
10821
- this._chart.selectAll('.zoom-behavior').remove();
10822
- [...this._yAxisList, ...this._xAxisList]
10823
- .filter((axis) => axis.options.visible && axis.options.zoom)
10824
- .forEach((axis) => {
10825
- const foundNode = this._chart
10826
- .select(`[data-${axis.type === AxisType.abscissa ? 'x' : 'y'}-scale-id='${axis.index}']`)
10827
- .node();
10828
- if (!foundNode) {
10829
- return;
10830
- }
10831
- const bBox = foundNode.getBBox();
10832
- const translateX = axis.type === AxisType.abscissa
10833
- ? this.offsetNonOpposite
10834
- ? this.offsetNonOpposite
10835
- : this._options.bounds.left + this.offsetNonOpposite
10836
- : axis.options.opposite
10837
- ? this._width - axis.offset
10838
- : axis.offset - bBox.width;
10839
- const zoom = d3
10840
- .zoom()
10841
- .scaleExtent([1, Infinity])
10842
- .on('zoom end', (event) => {
10843
- if (axis.type === AxisType.abscissa) {
10844
- const scale = this._clonedX.get(axis.index);
10845
- this._xScales.set(axis.index, event.transform.rescaleX(scale));
10846
- }
10847
- else {
10848
- const scale = this._clonedY.get(axis.index);
10849
- this._yScales.set(axis.index, event.transform.rescaleY(scale));
10850
- }
10851
- if (event.type === 'end') {
10852
- if (axis.type === AxisType.ordinatus) {
10853
- this._zoomYCache.set(axis.index, event.transform);
10854
- }
10855
- if (axis.type === AxisType.abscissa) {
10856
- this._zoomXCache.set(axis.index, event.transform);
10857
- this._chart.call(this._zoom.transform, event.transform);
10858
- }
10859
- }
10860
- this._redraw();
10861
- });
10862
- const restoredTransform = axis.type === AxisType.ordinatus
10863
- ? this._zoomYCache.get(axis.index)
10864
- : this._zoomXCache.get(axis.index);
10865
- this._chart
10866
- .append('rect')
10867
- .attr('class', 'zoom-behavior')
10868
- .attr('height', bBox.height)
10869
- .attr('width', bBox.width)
10870
- .attr('transform', `translate(${translateX}, ${axis.type === AxisType.abscissa
10871
- ? this._height - this._options.bounds.bottom
10872
- : this._options.bounds.top})`)
10873
- .style('opacity', '0')
10874
- .style('pointer-events', 'all')
10875
- .call(zoom.transform, restoredTransform !== null && restoredTransform !== void 0 ? restoredTransform : d3.zoomIdentity)
10876
- .call(zoom);
10877
- });
10878
- }
10879
- selectNode(element) {
10880
- this._container = element;
10881
- d3.select(element.nativeElement).selectAll('.tooltip-chart').remove();
10882
- d3.select(element.nativeElement).selectAll('svg').remove();
10883
- d3.select(element.nativeElement).selectAll('canvas').remove();
10884
- this._chart = d3
10885
- .select(element.nativeElement)
10886
- .append('svg')
10887
- .attr('position', 'relative')
10888
- .style('z-index', 0);
10889
- this._canvas = d3
10890
- .select(element.nativeElement)
10891
- .append('canvas')
10892
- .attr('class', 'main-canvas')
10893
- .style('transform', 'translate(35, 0)')
10894
- .style('position', 'absolute')
10895
- .style('z-index', 1);
10896
- }
10897
- drawAnnotations() {
10898
- var _a;
10899
- this._chart.selectAll('.annotations').remove();
10900
- const annotations = (_a = this._options.annotations) === null || _a === void 0 ? void 0 : _a.map((annotation) => {
10901
- var _a, _b;
10902
- const x = this._xScales.get(annotation.xAxisIndex);
10903
- const y = this._yScales.get(annotation.yAxisIndex);
10904
- return {
10905
- note: annotation.note,
10906
- connector: annotation.connector,
10907
- x: x((_a = annotation.point) === null || _a === void 0 ? void 0 : _a.x),
10908
- y: y((_b = annotation.point) === null || _b === void 0 ? void 0 : _b.y),
10909
- dx: annotation.dx,
10910
- dy: annotation.dy,
10911
- type: annotation.type,
10912
- className: annotation.className,
10913
- };
10914
- });
10915
- const makeAnnotations = d3annotation
10916
- .annotation()
10917
- .annotations(annotations !== null && annotations !== void 0 ? annotations : []);
10918
- this._chart
10919
- .append('g')
10920
- .attr('class', 'annotations')
10921
- .attr('clip-path', `url(#draw-window-${this.uniqId})`)
10922
- .call(makeAnnotations)
10923
- .lower();
10924
- }
10925
- drawPlotLines() {
10926
- this._chart.selectAll('.plotlines').remove();
10927
- const plotlineGroup = this._chart
10928
- .append('g')
10929
- .attr('class', 'plotlines')
10930
- .style('shape-rendering', 'crispEdges')
10931
- .attr('clip-path', `url(#draw-window-${this.uniqId})`);
10932
- this._xAxisList
10933
- .filter((_) => _.options.plotLines.length > 0)
10934
- .forEach((axis) => {
10935
- const [min, max] = axis.extent;
10936
- const x = this._xScales.get(axis.index);
10937
- const plotlinesPoints = axis.options.plotLines;
10938
- const getTextCenterPointPx = (d, idx) => {
10939
- var _a;
10940
- return x(((d === null || d === void 0 ? void 0 : d.value) +
10941
- (plotlinesPoints[idx - 1]
10942
- ? (_a = plotlinesPoints[idx - 1]) === null || _a === void 0 ? void 0 : _a.value
10943
- : 0)) /
10944
- 2);
10945
- };
10946
- const opacity = (d, idx) => {
10947
- var _a;
10948
- const displayWidth = 20;
10949
- const width = x(d === null || d === void 0 ? void 0 : d.value) -
10950
- x(plotlinesPoints[idx - 1] ? (_a = plotlinesPoints[idx - 1]) === null || _a === void 0 ? void 0 : _a.value : 0);
10951
- return width <= displayWidth ? 0 : 1;
10952
- };
10953
- plotlineGroup
10954
- .selectAll('.label')
10955
- .data(plotlinesPoints)
10956
- .join('text')
10957
- .attr('class', 'label font-body-3 fill-text-70')
10958
- .attr('x', getTextCenterPointPx)
10959
- .attr('y', (d) => this._height / 2)
10960
- .attr('text-anchor', 'middle')
10961
- .attr('dominant-baseline', 'central')
10962
- .attr('transform', (d, idx) => `rotate(-90, ${getTextCenterPointPx(d, idx)}, ${this._height / 2})`)
10963
- .text((d) => { var _a; return (_a = d === null || d === void 0 ? void 0 : d.label) !== null && _a !== void 0 ? _a : ''; })
10964
- .style('opacity', opacity);
10965
- plotlineGroup
10966
- .selectAll('.plotline')
10967
- .data(plotlinesPoints)
10968
- .join('line')
10969
- .attr('class', 'plotline')
10970
- .attr('data-plotline-id', (d) => d.id)
10971
- .attr('x1', (d) => x(d.value))
10972
- .attr('x2', (d) => x(d.value))
10973
- .attr('y1', 0)
10974
- .attr('y2', this._height -
10975
- this._options.bounds.top -
10976
- this._options.bounds.bottom)
10977
- .attr('transform', `translate(0, ${this._options.bounds.top})`)
10978
- .style('stroke-width', (d) => d.width)
10979
- .style('stroke', (d) => d.color)
10980
- .style('stroke-dasharray', (d) => (d.dashed ? '8, 8' : '0, 0'));
10981
- const emit = (event, plotLine) => {
10982
- this.plotLinesMove$.next({ event, target: plotLine });
10983
- };
10984
- plotlineGroup
10985
- .selectAll('.drag-plotline')
10986
- .data(plotlinesPoints)
10987
- .join('line')
10988
- .attr('class', 'drag-plotline')
10989
- .attr('x1', (d) => x(d.value))
10990
- .attr('x2', (d) => x(d.value))
10991
- .attr('y1', 0)
10992
- .attr('y2', this._height -
10993
- this._options.bounds.top -
10994
- this._options.bounds.bottom)
10995
- .attr('transform', `translate(0, ${this._options.bounds.top})`)
10996
- .style('stroke-width', 8)
10997
- .style('stroke', 'rgba(0, 0, 0, 0)')
10998
- .style('cursor', 'col-resize')
10999
- .call(d3
11000
- .drag()
11001
- .on('drag', function (event, d) {
11002
- var _a, _b;
11003
- const group = d3.select(this).node().parentElement;
11004
- const draggedPlotLine = d3
11005
- .select(group)
11006
- .select(`[data-plotline-id='${d.id}']`);
11007
- d.value = x.invert(event.x);
11008
- const minValue = (_a = d.min) !== null && _a !== void 0 ? _a : min;
11009
- const maxValue = (_b = d.max) !== null && _b !== void 0 ? _b : max;
11010
- const borderLeftReached = d.value <= minValue;
11011
- const borderRightReached = d.value >= maxValue;
11012
- if (borderLeftReached) {
11013
- d.value = minValue;
11014
- }
11015
- if (borderRightReached) {
11016
- d.value = maxValue;
11017
- }
11018
- d3.select(this).attr('x1', x(d.value)).attr('x2', x(d.value));
11019
- draggedPlotLine.attr('x1', x(d.value)).attr('x2', x(d.value));
11020
- emit(event, d);
11021
- })
11022
- .on('end', (event, d) => {
11023
- emit(event, d);
11024
- }));
11025
- });
11026
- this._yAxisList
11027
- .filter((_) => _.options.plotLines.length > 0)
11028
- .forEach((axis) => {
11029
- const [min, max] = axis.extent;
11030
- const y = this._yScales.get(axis.index);
11031
- const plotlinesPoints = axis.options.plotLines;
11032
- plotlineGroup
11033
- .selectAll('.plotline')
11034
- .data(plotlinesPoints)
11035
- .join('line')
11036
- .attr('class', 'plotline')
11037
- .attr('data-plotline-id', (d) => d.id)
11038
- .attr('y1', (d) => y(d.value))
11039
- .attr('y2', (d) => y(d.value))
11040
- .attr('x1', 0)
11041
- .attr('x2', this._width - this._options.bounds.left - this._options.bounds.right)
11042
- .attr('transform', `translate(${this._options.bounds.left}, 0)`)
11043
- .style('stroke-width', (d) => d.width)
11044
- .style('stroke', (d) => d.color)
11045
- .style('stroke-dasharray', (d) => (d.dashed ? '8, 8' : '0, 0'));
11046
- const emit = (event, plotLine) => {
11047
- this.plotLinesMove$.next({ event, target: plotLine });
11048
- };
11049
- plotlineGroup
11050
- .selectAll('.drag-plotline')
11051
- .data(plotlinesPoints)
11052
- .join('line')
11053
- .attr('class', 'drag-plotline')
11054
- .attr('y1', (d) => y(d.value))
11055
- .attr('y2', (d) => y(d.value))
11056
- .attr('x1', 0)
11057
- .attr('x2', this._width - this._options.bounds.left - this._options.bounds.right)
11058
- .attr('transform', `translate(${this._options.bounds.left}, 0)`)
11059
- .style('stroke-width', 8)
11060
- .style('stroke', 'rgba(0, 0, 0, 0)')
11061
- .style('cursor', 'row-resize')
11062
- .call(d3
11063
- .drag()
11064
- .on('drag', function (event, d) {
11065
- var _a, _b;
11066
- const group = d3.select(this).node().parentElement;
11067
- const draggedPlotLine = d3
11068
- .select(group)
11069
- .select(`[data-plotline-id='${d.id}']`);
11070
- d.value = y.invert(event.y);
11071
- const minValue = (_a = d.min) !== null && _a !== void 0 ? _a : min;
11072
- const maxValue = (_b = d.max) !== null && _b !== void 0 ? _b : max;
11073
- const borderTopReached = d.value <= minValue;
11074
- const borderBottomReached = d.value >= maxValue;
11075
- if (borderTopReached) {
11076
- d.value = minValue;
11077
- }
11078
- if (borderBottomReached) {
11079
- d.value = maxValue;
11080
- }
11081
- d3.select(this).attr('y1', y(d.value)).attr('y2', y(d.value));
11082
- draggedPlotLine.attr('y1', y(d.value)).attr('y2', y(d.value));
11083
- emit(event, d);
11084
- })
11085
- .on('end', (event, d) => {
11086
- emit(event, d);
11087
- }));
11088
- });
11089
- }
11090
- drawPlotBands() {
11091
- this._chart.selectAll('.plotbands').remove();
11092
- const plotBandGroup = this._chart
11093
- .append('g')
11094
- .attr('class', 'plotbands')
11095
- .attr('clip-path', `url(#draw-window-${this.uniqId})`);
11096
- this._xAxisList
11097
- .filter((_) => _.options.plotBands.length > 0)
11098
- .forEach((axis) => {
11099
- const x = this._xScales.get(axis.index);
11100
- const [min, max] = axis.extent;
11101
- const plotband = plotBandGroup
11102
- .append('g')
11103
- .style('shape-rendering', 'crispEdges');
11104
- const plotBandHeight = this._height - this._options.bounds.top - this._options.bounds.bottom;
11105
- const emit = (event, plotBand) => {
11106
- this.plotBandsMove$.next({
11107
- event,
11108
- target: plotBand,
11109
- });
11110
- };
11111
- plotband
11112
- .selectAll('rect')
11113
- .data(axis.options.plotBands)
11114
- .on('start', (_) => {
11115
- this._chart.selectAll('.marker').style('display', 'none');
11116
- d3.select(this._container.nativeElement)
11117
- .select('.tooltip-chart')
11118
- .style('display', 'none');
11119
- })
11120
- .join('rect')
11121
- .attr('data-plotband-id', (d) => d.id)
11122
- .attr('x', (d) => x(d.from))
11123
- .attr('y', 0)
11124
- .attr('width', (d) => Math.abs(x(d.to) - x(d.from)))
11125
- .attr('fill', (d) => {
11126
- if (d.image) {
11127
- return `url(#${d.image})`;
11128
- }
11129
- return d.color;
11130
- })
11131
- .style('opacity', (d) => { var _a; return (_a = d.opacity) !== null && _a !== void 0 ? _a : 1; })
11132
- .attr('height', plotBandHeight > 0 ? plotBandHeight : 0)
11133
- .attr('transform', `translate(0, ${this._options.bounds.top})`);
11134
- plotband
11135
- .selectAll('.line-left')
11136
- .data(axis.options.plotBands)
11137
- .join('line')
11138
- .attr('data-line-left-id', (d) => d.id)
11139
- .attr('class', 'line-left')
11140
- .attr('x1', (d) => x(d.from))
11141
- .attr('x2', (d) => x(d.from))
11142
- .attr('y1', 0)
11143
- .attr('y2', this._height -
11144
- this._options.bounds.top -
11145
- this._options.bounds.bottom)
11146
- .attr('transform', `translate(0, ${this._options.bounds.top})`)
11147
- .style('stroke-width', 1)
11148
- .style('stroke-dasharray', '8, 8')
11149
- .style('stroke', 'var(--color-text-90)')
11150
- .style('opacity', (d) => (d.showGrabbers ? 1 : 0));
11151
- plotband
11152
- .selectAll('.drag-left')
11153
- .data(axis.options.plotBands)
11154
- .join('line')
11155
- .attr('x1', (d) => x(d.from))
11156
- .attr('x2', (d) => x(d.from))
11157
- .attr('y1', 0)
11158
- .attr('y2', this._height -
11159
- this._options.bounds.top -
11160
- this._options.bounds.bottom)
11161
- .style('display', (d) => ((d === null || d === void 0 ? void 0 : d.resizable) ? 'unset' : 'none'))
11162
- .attr('transform', `translate(0, ${this._options.bounds.top})`)
11163
- .style('stroke-width', 8)
11164
- .style('stroke', 'rgba(0, 0, 0, 0)')
11165
- .style('cursor', 'col-resize')
11166
- .call(d3
11167
- .drag()
11168
- .on('drag', function (event, d) {
11169
- var _a;
11170
- const group = d3.select(this).node().parentElement;
11171
- const draggedBand = d3
11172
- .select(group)
11173
- .select(`[data-plotband-id='${d.id}']`);
11174
- const draggedLine = d3
11175
- .select(group)
11176
- .select(`[data-line-left-id='${d.id}']`);
11177
- d.from = x.invert(event.x);
11178
- const minValue = (_a = d.min) !== null && _a !== void 0 ? _a : min;
11179
- const borderReached = d.from <= minValue;
11180
- if (borderReached) {
11181
- d.from = minValue;
11182
- }
11183
- if (d.from >= d.to) {
11184
- d.from = d.to;
11185
- }
11186
- d3.select(this).attr('x1', x(d.from)).attr('x2', x(d.from));
11187
- draggedBand
11188
- .attr('x', x(d.from))
11189
- .attr('width', x(d.to) - x(d.from));
11190
- draggedLine.attr('x1', x(d.from)).attr('x2', x(d.from));
11191
- emit(event, d);
11192
- })
11193
- .on('end', (event, d) => emit(event, d)));
11194
- plotband
11195
- .selectAll('.line-right')
11196
- .data(axis.options.plotBands)
11197
- .join('line')
11198
- .attr('data-line-right-id', (d) => d.id)
11199
- .attr('class', 'line-right')
11200
- .attr('x1', (d) => x(d.to))
11201
- .attr('x2', (d) => x(d.to))
11202
- .attr('y1', 0)
11203
- .attr('y2', this._height -
11204
- this._options.bounds.top -
11205
- this._options.bounds.bottom)
11206
- .attr('transform', `translate(0, ${this._options.bounds.top})`)
11207
- .style('stroke-width', 1)
11208
- .style('stroke-dasharray', '8, 8')
11209
- .style('stroke', 'var(--color-text-90)')
11210
- .style('opacity', (d) => (d.showGrabbers ? 1 : 0));
11211
- plotband
11212
- .selectAll('.drag-right')
11213
- .data(axis.options.plotBands)
11214
- .join('line')
11215
- .attr('class', 'drag-right')
11216
- .style('display', (d) => ((d === null || d === void 0 ? void 0 : d.resizable) ? 'unset' : 'none'))
11217
- .attr('x1', (d) => x(d.to))
11218
- .attr('x2', (d) => x(d.to))
11219
- .attr('y1', 0)
11220
- .attr('y2', this._height -
11221
- this._options.bounds.top -
11222
- this._options.bounds.bottom)
11223
- .attr('transform', `translate(0, ${this._options.bounds.top})`)
11224
- .style('stroke-width', 8)
11225
- .style('stroke', 'rgba(0, 0, 0, 0)')
11226
- .style('cursor', 'col-resize')
11227
- .call(d3
11228
- .drag()
11229
- .on('drag', function (event, d) {
11230
- var _a;
11231
- const group = d3.select(this).node().parentElement;
11232
- const draggedBand = d3
11233
- .select(group)
11234
- .select(`[data-plotband-id='${d.id}']`);
11235
- const draggedLine = d3
11236
- .select(group)
11237
- .select(`[data-line-right-id='${d.id}']`);
11238
- d.to = x.invert(event.x);
11239
- const maxValue = (_a = d.max) !== null && _a !== void 0 ? _a : max;
11240
- const borderReached = d.to >= maxValue;
11241
- if (borderReached) {
11242
- d.to = maxValue;
11243
- }
11244
- if (d.to <= d.from) {
11245
- d.to = d.from;
11246
- }
11247
- d3.select(this).attr('x1', x(d.to)).attr('x2', x(d.to));
11248
- draggedBand.attr('width', x(d.to) - x(d.from));
11249
- draggedLine.attr('x1', x(d.to)).attr('x2', x(d.to));
11250
- emit(event, d);
11251
- })
11252
- .on('end', (event, d) => emit(event, d)));
11253
- });
11254
- this._yAxisList
11255
- .filter((_) => _.options.plotBands.length > 0)
11256
- .forEach((axis) => {
11257
- const y = this._yScales.get(axis.index);
11258
- const [min, max] = axis.extent;
11259
- const plotband = plotBandGroup
11260
- .append('g')
11261
- .style('shape-rendering', 'crispEdges');
11262
- const plotBandWidth = this._width - this._options.bounds.left - this._options.bounds.right; // TODO add multiaxis support width
11263
- const emit = (event, plotBand) => {
11264
- this.plotBandsMove$.next({
11265
- event,
11266
- target: plotBand,
11267
- });
11268
- };
11269
- const dragPlotband = d3
11270
- .drag()
11271
- .subject(function () {
11272
- const element = d3.select(this);
11273
- return { y: element.attr('y') };
11274
- })
11275
- .on('start drag end', function (event, d) {
11276
- var _a, _b;
11277
- const element = d3.select(this);
11278
- const height = parseFloat(element.attr('height'));
11279
- d.to = y.invert(event.y + height);
11280
- d.from = y.invert(event.y);
11281
- const minValue = (_a = d.min) !== null && _a !== void 0 ? _a : min;
11282
- const maxValue = (_b = d.max) !== null && _b !== void 0 ? _b : max;
11283
- const borderReachedMin = d.from <= minValue;
11284
- const borderReachedMax = d.to >= maxValue;
11285
- if (borderReachedMin) {
11286
- d.to = y.invert(y(minValue) + height);
11287
- d.from = minValue;
11288
- }
11289
- if (borderReachedMax) {
11290
- d.to = maxValue;
11291
- d.from = y.invert(y(maxValue) - height);
11292
- }
11293
- element.attr('y', y(d.from));
11294
- const group = element.node().parentElement;
11295
- d3.select(group)
11296
- .select(`[data-line-left-id='${d.id}']`)
11297
- .attr('y1', y(d.from))
11298
- .attr('y2', y(d.from));
11299
- d3.select(group)
11300
- .select(`[data-grab-left-id='${d.id}']`)
11301
- .attr('y1', y(d.from))
11302
- .attr('y2', y(d.from));
11303
- d3.select(group)
11304
- .select(`[data-line-right-id='${d.id}']`)
11305
- .attr('y1', y(d.to))
11306
- .attr('y2', y(d.to));
11307
- d3.select(group)
11308
- .select(`[data-grab-right-id='${d.id}']`)
11309
- .attr('y1', y(d.to))
11310
- .attr('y2', y(d.to));
11311
- emit(event, d);
11312
- });
11313
- const leftGrabDrag = d3
11314
- .drag()
11315
- .on('drag', function (event, d) {
11316
- var _a;
11317
- const group = d3.select(this).node().parentElement;
11318
- const draggedBand = d3
11319
- .select(group)
11320
- .select(`[data-plotband-id='${d.id}']`);
11321
- const draggedLine = d3
11322
- .select(group)
11323
- .select(`[data-line-left-id='${d.id}']`);
11324
- d.from = y.invert(event.y);
11325
- const minValue = (_a = d.min) !== null && _a !== void 0 ? _a : min;
11326
- const borderReached = d.from <= minValue;
11327
- if (borderReached) {
11328
- d.from = minValue;
11329
- }
11330
- if (d.from >= d.to) {
11331
- d.from = d.to;
11332
- }
11333
- d3.select(this).attr('y1', y(d.from)).attr('y2', y(d.from));
11334
- draggedBand
11335
- .attr('y', y(d.from))
11336
- .attr('height', Math.abs(y(d.to) - y(d.from)));
11337
- draggedLine.attr('y1', y(d.from)).attr('y2', y(d.from));
11338
- emit(event, d);
11339
- })
11340
- .on('end', (event, d) => emit(event, d));
11341
- const rightGrabDrag = d3
11342
- .drag()
11343
- .on('drag', function (event, d) {
11344
- var _a;
11345
- const group = d3.select(this).node().parentElement;
11346
- const draggedBand = d3
11347
- .select(group)
11348
- .select(`[data-plotband-id='${d.id}']`);
11349
- const draggedLine = d3
11350
- .select(group)
11351
- .select(`[data-line-right-id='${d.id}']`);
11352
- d.to = y.invert(event.y);
11353
- const maxValue = (_a = d.max) !== null && _a !== void 0 ? _a : max;
11354
- const borderReached = d.to >= maxValue;
11355
- if (borderReached) {
11356
- d.to = maxValue;
11357
- }
11358
- if (d.to <= d.from) {
11359
- d.to = d.from;
11360
- }
11361
- d3.select(this).attr('y1', y(d.to)).attr('y2', y(d.to));
11362
- draggedBand
11363
- .attr('y', y(d.from))
11364
- .attr('height', Math.abs(y(d.to) - y(d.from)));
11365
- draggedLine.attr('y1', y(d.to)).attr('y2', y(d.to));
11366
- emit(event, d);
11367
- })
11368
- .on('end', (event, d) => emit(event, d));
11369
- plotband
11370
- .selectAll('rect')
11371
- .data(axis.options.plotBands)
11372
- .join('rect')
11373
- .attr('data-plotband-id', (d) => d.id)
11374
- .attr('x', 0)
11375
- .attr('y', (d) => y(d.from))
11376
- .attr('width', (d) => plotBandWidth)
11377
- .attr('fill', (d) => {
11378
- if (d.image) {
11379
- return `url(#${d.image})`;
11380
- }
11381
- return d.color;
11382
- })
11383
- .style('opacity', (d) => { var _a; return (_a = d.opacity) !== null && _a !== void 0 ? _a : 1; })
11384
- .attr('height', (d) => Math.abs(y(d.to) - y(d.from)))
11385
- .attr('cursor', (d) => (d.draggable ? 'move' : 'default'));
11386
- plotband
11387
- .selectAll('.line-left')
11388
- .data(axis.options.plotBands.filter((d) => d.resizable))
11389
- .join('line')
11390
- .attr('data-line-left-id', (d) => d.id)
11391
- .attr('class', 'line-left')
11392
- .attr('y1', (d) => y(d.from))
11393
- .attr('y2', (d) => y(d.from))
11394
- .attr('x1', 0)
11395
- .attr('x2', plotBandWidth)
11396
- .style('stroke-width', 1)
11397
- .style('stroke-dasharray', '8, 8')
11398
- .style('stroke', 'var(--color-text-90)')
11399
- .style('opacity', (d) => (d.showGrabbers ? 1 : 0));
11400
- plotband
11401
- .selectAll('.drag-left')
11402
- .data(axis.options.plotBands.filter((d) => d.resizable))
11403
- .join('line')
11404
- .attr('data-grab-left-id', (d) => d.id)
11405
- .attr('y1', (d) => y(d.from))
11406
- .attr('y2', (d) => y(d.from))
11407
- .attr('x1', 0)
11408
- .attr('x2', plotBandWidth)
11409
- .style('stroke-width', 8)
11410
- .style('stroke', 'rgba(0, 0, 0, 0)')
11411
- .style('cursor', (d) => (d.resizable ? 'row-resize' : 'default'));
11412
- plotband
11413
- .selectAll('.line-right')
11414
- .data(axis.options.plotBands.filter((d) => d.resizable))
11415
- .join('line')
11416
- .attr('data-line-right-id', (d) => d.id)
11417
- .attr('class', 'line-right')
11418
- .attr('y1', (d) => y(d.to))
11419
- .attr('y2', (d) => y(d.to))
11420
- .attr('x1', 0)
11421
- .attr('x2', plotBandWidth)
11422
- .style('stroke-width', 1)
11423
- .style('stroke-dasharray', '8, 8')
11424
- .style('stroke', 'var(--color-text-90)')
11425
- .style('opacity', (d) => (d.showGrabbers ? 1 : 0));
11426
- plotband
11427
- .selectAll('.drag-right')
11428
- .data(axis.options.plotBands.filter((d) => d.resizable))
11429
- .join('line')
11430
- .attr('class', 'drag-right')
11431
- .attr('data-grab-right-id', (d) => d.id)
11432
- .attr('y1', (d) => y(d.to))
11433
- .attr('y2', (d) => y(d.to))
11434
- .attr('x1', 0)
11435
- .attr('x2', plotBandWidth)
11436
- .style('stroke-width', 8)
11437
- .style('stroke', 'rgba(0, 0, 0, 0)')
11438
- .style('cursor', (d) => (d.resizable ? 'row-resize' : 'default'));
11439
- axis.options.plotBands.forEach((_) => {
11440
- if (_.draggable) {
11441
- plotband.select(`[data-plotband-id='${_.id}']`).call(dragPlotband);
11442
- }
11443
- if (_.resizable) {
11444
- plotband.select(`[data-grab-left-id='${_.id}']`).call(leftGrabDrag);
11445
- plotband
11446
- .select(`[data-grab-right-id='${_.id}']`)
11447
- .call(rightGrabDrag);
11448
- }
11449
- });
11450
- });
11451
- }
11452
- drawChart() {
11453
- var _a;
11454
- const series = (_a = this._options.series) === null || _a === void 0 ? void 0 : _a.filter((_) => _.visible);
11455
- this._chart.selectAll('.series').remove();
11456
- if (!series || series.length < 1) {
11457
- d3.select(this._container.nativeElement)
11458
- .select('canvas')
11459
- .style('display', 'none');
11460
- }
11461
- const group = this._chart
11462
- .append('g')
11463
- .attr('class', 'series')
11464
- .attr('clip-path', `url(#draw-window-${this.uniqId})`);
11465
- series === null || series === void 0 ? void 0 : series.forEach((seriesItem, index) => {
11466
- var _a, _b;
11467
- if (seriesItem.renderTo === 'canvas') {
11468
- d3.select(this._container.nativeElement)
11469
- .select('canvas')
11470
- .style('display', null);
11471
- d3.select(this._container.nativeElement)
11472
- .select('svg')
11473
- .style('position', 'absolute');
11474
- }
11475
- else {
11476
- d3.select(this._container.nativeElement)
11477
- .select('canvas')
11478
- .style('display', 'none');
11479
- }
11480
- if (!this._xScales.has(seriesItem.xAxisIndex) ||
11481
- !this._yScales.has(seriesItem.yAxisIndex)) {
11482
- return;
11483
- }
11484
- const foundX = this._xScales.get(seriesItem.xAxisIndex);
11485
- const foundY = this._yScales.get(seriesItem.yAxisIndex);
11486
- const drawer = seriesItem.drawer != null
11487
- ? seriesItem.drawer
11488
- : defaultDrawerMapping.get(seriesItem.type);
11489
- if (!drawer) {
11490
- throw new Error(`No drawer for series ${seriesItem.name}, type ${SeriesType[seriesItem.type]}`);
11491
- }
11492
- if (seriesItem.renderTo === 'canvas') {
11493
- const context = this._canvas.node().getContext('2d');
11494
- context.clearRect(0, 0, this._width, this._height);
11495
- }
11496
- let [xMin, xMax] = foundX.domain();
11497
- let [yMin, yMax] = foundY.domain();
11498
- xMin = xMin instanceof Date ? xMin.getTime() : xMin;
11499
- xMax = xMax instanceof Date ? xMax.getTime() : xMax;
11500
- yMin = yMin instanceof Date ? yMin.getTime() : yMin;
11501
- yMax = yMax instanceof Date ? yMax.getTime() : yMax;
11502
- const visiblePoints = (point, idx, arr) => (point.x <= xMax ||
11503
- point.x1 <= xMax ||
11504
- (arr[idx - 1] && arr[idx - 1].x <= xMax) ||
11505
- (arr[idx - 1] && arr[idx - 1].x1 <= xMax)) &&
11506
- (point.x >= xMin ||
11507
- point.x1 >= xMin ||
11508
- (arr[idx + 1] && arr[idx + 1].x >= xMin) ||
11509
- (arr[idx + 1] && arr[idx + 1].x1 >= xMin)) &&
11510
- (point.y <= yMax ||
11511
- point.y1 <= yMax ||
11512
- (arr[idx - 1] && arr[idx - 1].y <= yMax) ||
11513
- (arr[idx - 1] && arr[idx - 1].y1 <= yMax)) &&
11514
- (point.y >= yMin ||
11515
- point.y1 >= yMin ||
11516
- (arr[idx + 1] && arr[idx + 1].y >= yMin) ||
11517
- (arr[idx + 1] && arr[idx + 1].y1 >= yMin));
11518
- const filteredData = seriesItem.data; //.filter(visiblePoints);
11519
- const serie = Object.assign(Object.assign({}, seriesItem), { data: filteredData });
11520
- drawer.draw(serie, seriesItem.renderTo === 'canvas' ? this._canvas : group, foundX, foundY, this._options);
11521
- const emit = (event) => {
11522
- this.seriesMove$.next(event);
11523
- };
11524
- const emitPoint = (event) => {
11525
- this.pointMove$.next(event);
11526
- };
11527
- (_a = drawer === null || drawer === void 0 ? void 0 : drawer.dispatch) === null || _a === void 0 ? void 0 : _a.on(DispatchType.moveLine, function () {
11528
- emit(this);
11529
- });
11530
- (_b = drawer === null || drawer === void 0 ? void 0 : drawer.dispatch) === null || _b === void 0 ? void 0 : _b.on(DispatchType.movePoint, function () {
11531
- emitPoint(this);
11532
- });
11533
- });
11534
- }
11535
- createTooltip() {
11536
- d3.select(this._container.nativeElement)
11537
- .append('div')
11538
- .attr('class', 'tooltip-chart color-text-90 bg-background-50 shadow-2')
11539
- .style('position', 'fixed')
11540
- .style('top', 'unset')
11541
- .style('right', 'unset')
11542
- .style('bottom', 'unset')
11543
- .style('left', 'unset')
11544
- .style('pointer-events', 'none')
11545
- .style('display', 'none');
11546
- }
11547
- handleMouseMove(options) {
11548
- var _a, _b;
11549
- const mouse = d3.pointer(options.event);
11550
- const { top, right, bottom, left } = this.tooltipPosition(options.event);
11551
- const tooltipsData = [];
11552
- this._chart
11553
- .select('.marker-line')
11554
- .attr('transform', `translate(${0}, ${mouse[1] - 2})`);
11555
- this._chart
11556
- .selectAll('.marker')
11557
- .attr('transform', (d) => {
11558
- if (!d.data.length) {
11559
- return;
11560
- }
11561
- if (!this._xScales.has(d.xAxisIndex) ||
11562
- !this._yScales.has(d.yAxisIndex)) {
11563
- return;
11564
- }
11565
- const foundX = this._xScales.get(d.xAxisIndex);
11566
- const foundY = this._yScales.get(d.yAxisIndex);
11567
- if (this._options.tooltip.tracking === 'x') {
11568
- const [min, max] = foundX.domain();
11569
- const filteredData = d.data.filter((point) => point.x <= max && point.x >= min);
11570
- const sorted = [...filteredData].sort((a, b) => d3.ascending(a.x, b.x));
11571
- const bisect = d3.bisector((dd) => dd.x).left;
11572
- const x0 = foundX.invert(mouse[0]);
11573
- const index = bisect(sorted, x0);
11574
- const data = sorted[index] ? sorted[index] : sorted[index - 1];
11575
- tooltipsData.push({
11576
- point: data,
11577
- color: d.color,
11578
- name: d.name,
11579
- });
11580
- return `translate(${!isNaN(data === null || data === void 0 ? void 0 : data.x) && (data === null || data === void 0 ? void 0 : data.x) != null ? foundX(data.x) : -10}, ${!isNaN(data === null || data === void 0 ? void 0 : data.y) && (data === null || data === void 0 ? void 0 : data.y) != null ? foundY(data.y) : -10})`;
11581
- }
11582
- if (this._options.tooltip.tracking === 'y') {
11583
- const sorted = [...d.data].sort((a, b) => d3.ascending(a.y, b.y));
11584
- const bisect = d3.bisector((dd) => dd.y).left;
11585
- const y0 = foundY.invert(mouse[1]);
11586
- const index = bisect(sorted, y0, 0);
11587
- const data = sorted[index] ? sorted[index] : sorted[index - 1];
11588
- tooltipsData.push({
11589
- point: data,
11590
- color: d.color,
11591
- name: d.name,
11592
- });
11593
- return `translate(${!isNaN(data === null || data === void 0 ? void 0 : data.x) && (data === null || data === void 0 ? void 0 : data.x) != null ? foundX(data.x) : -10}, ${!isNaN(data === null || data === void 0 ? void 0 : data.y) && (data === null || data === void 0 ? void 0 : data.y) != null ? foundY(data.y) : -10})`;
11594
- }
11595
- });
11596
- if ((_a = this._options.tooltip) === null || _a === void 0 ? void 0 : _a.format) {
11597
- const formatted = (_b = this._options.tooltip) === null || _b === void 0 ? void 0 : _b.format(tooltipsData);
11598
- d3.select(this._container.nativeElement)
11599
- .select('.tooltip-chart')
11600
- .style('top', top)
11601
- .style('right', right)
11602
- .style('bottom', bottom)
11603
- .style('left', left)
11604
- .html(formatted);
11605
- }
11606
- }
11607
- tooltipPosition(event) {
11608
- const centerX = this._width / 2;
11609
- const centerY = this._height / 2;
11610
- const padding = { x: 10, y: 10 };
11611
- const scene = {
11612
- left: event.pageX > centerX ? 'initial' : `${event.pageX + padding.x}px`,
11613
- top: event.pageY > centerY ? 'initial' : `${event.pageY + padding.y}px`,
11614
- bottom: event.pageY > centerY
11615
- ? `${window.innerHeight - event.pageY}px`
11616
- : 'initial',
11617
- right: event.pageX > centerX
11618
- ? `${window.innerWidth - event.pageX + padding.x}px`
11619
- : 'initial',
11620
- };
11621
- return scene;
11622
- }
11623
- createMarkers() {
11624
- if (this._options.tooltip === undefined) {
11625
- return;
11626
- }
11627
- if (!this._options.tooltip.enable) {
11628
- return;
11629
- }
11630
- this._chart.selectAll('.marker').remove();
11631
- this._chart.select('.marker-line').remove();
11632
- this._chart
11633
- .append('line')
11634
- .attr('class', 'marker-line')
11635
- .attr('x1', 35)
11636
- .attr('x2', this._width)
11637
- .style('stroke-width', 0.5)
11638
- .style('stroke', 'var(--color-text-40)')
11639
- .style('display', 'none');
11640
- const { series } = this._options;
11641
- if (!series) {
11642
- return;
11643
- }
11644
- const markers = this._chart
11645
- .selectAll()
11646
- .data(series.filter((_) => _.visible));
11647
- markers
11648
- .enter()
11649
- .append('circle')
11650
- .attr('class', 'marker')
11651
- .attr('pointer-events', 'none')
11652
- .attr('r', 3)
11653
- .attr('fill', (_, i) => _.color)
11654
- .style('display', 'none');
11655
- const mouseoutEvent = () => {
11656
- this._chart.selectAll('.marker').style('display', 'none');
11657
- this._chart.select('.marker-line').style('display', 'none');
11658
- d3.select(this._container.nativeElement)
11659
- .select('.tooltip-chart')
11660
- .style('display', 'none');
11661
- };
11662
- const mouseMoveEvent = (event) => {
11663
- const options = {
11664
- event,
11665
- series,
11666
- };
11667
- this.handleMouseMove(options);
11668
- };
11669
- const mouseOverEvent = () => {
11670
- if (this._options.tooltip.showMarkers) {
11671
- this._chart
11672
- .selectAll('.marker')
11673
- .style('display', (d) => {
11674
- if (d.data.length) {
11675
- return null;
11676
- }
11677
- return 'none';
11678
- });
11679
- }
11680
- if (this._options.tooltip.showLine) {
11681
- this._chart.select('.marker-line').style('display', null);
11682
- }
11683
- d3.select(this._container.nativeElement)
11684
- .select('.tooltip-chart')
11685
- .style('display', null);
11686
- };
11687
- this._chart
11688
- .on('mouseover', mouseOverEvent)
11689
- .on('mousemove', mouseMoveEvent)
11690
- .on('mouseleave', mouseoutEvent);
11691
- }
11692
- drawLegend() {
11693
- var _a, _b;
11694
- if (((_a = this._options.legend) === null || _a === void 0 ? void 0 : _a.visible) === false) {
11695
- return;
11696
- }
11697
- this._chart.selectAll('.legend').remove();
11698
- const drawer = ((_b = this._options.legend) === null || _b === void 0 ? void 0 : _b.type)
11699
- ? defaultLegendDrawerMapping.get(this._options.legend.type)
11700
- : defaultLegendDrawerMapping.get(LegendType.swatches);
11701
- const context = this._container.nativeElement;
11702
- if (!drawer) {
11703
- throw new Error(`No drawer for legend
11704
- }`);
11705
- }
11706
- drawer.draw({
11707
- context,
11708
- series: this._options.series.filter((_) => _.showInLegend),
11709
- width: this._width,
11710
- height: this._height,
11711
- });
11712
- }
11713
- caluclateChartWidth() {
11714
- let width = -this._width;
11715
- if (this.offsetOpposite > 0) {
11716
- width = -this._width + this.offsetOpposite + this.offsetNonOpposite;
11717
- }
11718
- if (this.offsetNonOpposite > 0) {
11719
- width =
11720
- -this._width + this._options.bounds.right + this.offsetNonOpposite;
11721
- }
11722
- if (this.offsetOpposite >= Axis.offsetFactor &&
11723
- this.offsetNonOpposite === 0) {
11724
- width = -this._width + this.offsetOpposite + this._options.bounds.left;
11725
- }
11726
- if (this.offsetOpposite > 0 && this.offsetNonOpposite > 0) {
11727
- width = -this._width + this.offsetOpposite + this.offsetNonOpposite;
11728
- }
11729
- return Math.abs(width);
11730
- }
11731
- drawGridLines() {
11732
- if (this._options.gridLines === false) {
11733
- return;
11734
- }
11735
- const translateX = this.offsetNonOpposite > 0
11736
- ? this.offsetNonOpposite
11737
- : this._options.bounds.left + this.offsetNonOpposite;
11738
- this._chart.selectAll('.grid').remove();
11739
- const yList = this._yAxisList.filter((_) => _.options.visible && !_.options.opposite);
11740
- const y = (yList === null || yList === void 0 ? void 0 : yList.length) > 0
11741
- ? this._yScales.get(yList[yList.length - 1].index)
11742
- : this._yScales.get(0);
11743
- const x = this._xScales.get(0);
11744
- if (!y || !x) {
11745
- return;
11746
- }
11747
- const TICK_HEIGHT = 40;
11748
- const TICK_WIDTH = 60;
11749
- const tickCount = Math.round(this._height / TICK_HEIGHT);
11750
- const tickCountX = Math.round(this._width / TICK_WIDTH);
11751
- const gridY = this._chart
11752
- .append('g')
11753
- .attr('class', 'grid color-text-10')
11754
- .style('shape-rendering', 'crispEdges');
11755
- const gridlinesY = d3
11756
- .axisLeft(y)
11757
- .tickFormat('')
11758
- .tickSize(-this.visibleChartWindowWidth);
11759
- const hasBarSeriesType = this._options.series.some((_) => _.type === SeriesType.bar);
11760
- if (!hasBarSeriesType) {
11761
- const gridX = this._chart
11762
- .append('g')
11763
- .attr('class', 'grid color-text-10')
11764
- .style('shape-rendering', 'crispEdges');
11765
- const gridlinesX = d3
11766
- .axisBottom(x)
11767
- .ticks(tickCountX)
11768
- .tickFormat('')
11769
- .tickSize(this._height - this._options.bounds.bottom - this._options.bounds.top);
11770
- gridX
11771
- .call(gridlinesX)
11772
- .attr('transform', `translate(0, ${this._options.bounds.top})`)
11773
- .lower();
11774
- }
11775
- gridY
11776
- .call(gridlinesY)
11777
- .attr('transform', `translate(${translateX}, ${0})`)
11778
- .lower();
11779
- this._chart.selectAll('.grid path').remove();
11780
- }
11781
- createScales() {
11782
- this._xScales.clear();
11783
- this._yScales.clear();
11784
- const defaultScaleMapping = new Map()
11785
- .set(ScaleType.linear, d3.scaleLinear)
11786
- .set(ScaleType.log, d3.scaleLog)
11787
- .set(ScaleType.sqrt, d3.scaleSqrt)
11788
- .set(ScaleType.pow, d3.scalePow);
11789
- const xRange = [
11790
- this.offsetNonOpposite
11791
- ? this.offsetNonOpposite
11792
- : this._options.bounds.left,
11793
- this._width -
11794
- (this.offsetOpposite
11795
- ? this.offsetOpposite
11796
- : this._options.bounds.right),
11797
- ];
11798
- const yRange = [
11799
- this._height - this._options.bounds.bottom,
11800
- this._options.bounds.top,
11801
- ];
11802
- this._xAxisList.forEach((axis, index) => {
11803
- let scale = null;
11804
- if (axis.options.type === Scale.time) {
11805
- scale = d3
11806
- .scaleTime()
11807
- .domain(axis.extent)
11808
- .range(axis.options.inverted ? [...xRange].reverse() : xRange);
11809
- }
11810
- if (axis.options.type === Scale.number) {
11811
- scale = defaultScaleMapping
11812
- .get(axis.options.scaleOptions.type)()
11813
- .domain(axis.extent)
11814
- .range(axis.options.inverted ? [...xRange].reverse() : xRange);
11815
- }
11816
- if (axis.options.niceTicks) {
11817
- scale.nice();
11818
- }
11819
- if (axis.options.scaleOptions.type === ScaleType.log) {
11820
- scale.base(axis.options.scaleOptions.base);
11821
- }
11822
- if (axis.options.scaleOptions.type === ScaleType.pow) {
11823
- scale.exponent(axis.options.scaleOptions.base);
11824
- }
11825
- this._xScales.set(index, scale);
11826
- });
11827
- this._yAxisList.forEach((axis, index) => {
11828
- let scale = null;
11829
- if (axis.options.type === Scale.number) {
11830
- scale = defaultScaleMapping
11831
- .get(axis.options.scaleOptions.type)()
11832
- .domain(axis.extent)
11833
- .range(axis.options.inverted ? [...yRange].reverse() : yRange);
11834
- }
11835
- if (axis.options.type === Scale.time) {
11836
- scale = d3
11837
- .scaleTime()
11838
- .domain(axis.extent)
11839
- .range(axis.options.inverted ? [...yRange].reverse() : yRange);
11840
- }
11841
- if (axis.options.niceTicks) {
11842
- scale.nice();
11843
- }
11844
- if (axis.options.scaleOptions.type === ScaleType.log) {
11845
- scale.base(axis.options.scaleOptions.base);
11846
- }
11847
- if (axis.options.scaleOptions.type === ScaleType.pow) {
11848
- scale.exponent(axis.options.scaleOptions.base);
11849
- }
11850
- this._yScales.set(index, scale);
11851
- });
11852
- for (const [key, value] of this._yScales) {
11853
- this._clonedY.set(key, value.copy());
11854
- }
11855
- for (const [key, value] of this._xScales) {
11856
- this._clonedX.set(key, value.copy());
11857
- }
11858
- }
11859
- drawAxis() {
11860
- const hasVisibleAxis = [...this._xAxisList, ...this._yAxisList].filter((axis) => axis.options.visible);
11861
- if (!hasVisibleAxis) {
11862
- return;
11863
- }
11864
- const negative = false;
11865
- this._chart.selectAll('.axes').remove();
11866
- const axes = this._chart
11867
- .append('g')
11868
- .attr('class', 'axes')
11869
- .style('shape-rendering', 'crispEdges');
11870
- const TICK_HEIGHT = 40;
11871
- const TICK_WIDTH = 60;
11872
- const tickCount = Math.round(this._height / TICK_HEIGHT);
11873
- const tickCountX = Math.round(this._width / TICK_WIDTH);
11874
- this._xAxisList.forEach((axis) => {
11875
- var _a, _b;
11876
- const options = axis.options;
11877
- const translate = `translate(${0}, ${this._height - this._options.bounds.bottom})`;
11878
- const x = this._xScales.get(axis.index);
11879
- const xAxis = d3.axisBottom(x).ticks(tickCountX);
11880
- if ((_a = axis.options) === null || _a === void 0 ? void 0 : _a.tickFormat) {
11881
- xAxis.tickFormat(axis.options.tickFormat);
11882
- }
11883
- if (options.visible !== false) {
11884
- const translateX = this.offsetNonOpposite
11885
- ? this.offsetNonOpposite
11886
- : this._options.bounds.left + this.offsetNonOpposite;
11887
- axes
11888
- .append('g')
11889
- .attr('class', 'x-axis-label')
11890
- .append('text')
11891
- .style('fill', 'var(--color-text-50)')
11892
- .attr('transform', 'translate(' +
11893
- this._width / 2 +
11894
- ' ,' +
11895
- (this._height - this._options.bounds.bottom) +
11896
- ')')
11897
- .style('text-anchor', 'middle')
11898
- .attr('dy', '3em')
11899
- .text((_b = options.title) !== null && _b !== void 0 ? _b : '');
11900
- axes
11901
- .append('g')
11902
- .attr('class', 'x-axis font-caption')
11903
- .attr('data-x-scale-id', axis.index)
11904
- .attr('transform', translate)
11905
- .style('pointer-events', 'none')
11906
- .call(xAxis)
11907
- .call((_) => {
11908
- _.select('.domain').remove();
11909
- _.selectAll('.tick').attr('class', 'color-text-50');
11910
- if (negative) {
11911
- _.append('line')
11912
- .attr('y1', 0)
11913
- .attr('y2', this._height)
11914
- .attr('transform', `translate(${x(0)}, -${this._height})`)
11915
- .style('stroke-width', 0.5)
11916
- .style('stroke', 'var(--color-text-50)');
11917
- }
11918
- _.append('line')
11919
- .attr('x1', 0)
11920
- .attr('x2', this.visibleChartWindowWidth)
11921
- .attr('transform', `translate(${translateX}, ${0})`)
11922
- .style('stroke-width', 0.5)
11923
- .style('stroke', 'var(--color-text-50)');
11924
- });
11925
- }
11926
- });
11927
- this._yAxisList.forEach((axis) => {
11928
- var _a;
11929
- const translate = axis.options.opposite
11930
- ? `translate(${this._width - axis.offset}, ${0})`
11931
- : `translate(${axis.offset}, ${0})`;
11932
- const y = this._yScales.get(axis.index);
11933
- const yAxis = axis.options.opposite ? d3.axisRight(y) : d3.axisLeft(y);
11934
- if (axis.options.visible !== false) {
11935
- const labelOffset = axis.options.opposite
11936
- ? this._width - axis.offset + axis.width
11937
- : axis.offset - axis.width;
11938
- axes
11939
- .append('g')
11940
- .attr('class', 'y-axis-label')
11941
- .append('text')
11942
- .style('fill', 'var(--color-text-50)')
11943
- .attr('transform', 'rotate(-90)')
11944
- .attr('y', labelOffset)
11945
- .attr('x', 0 - this._height / 2)
11946
- .attr('dy', axis.options.opposite ? '12px' : '-3px')
11947
- .style('text-anchor', 'middle')
11948
- .text((_a = axis.options.title) !== null && _a !== void 0 ? _a : '');
11949
- axes
11950
- .append('g')
11951
- .attr('class', 'y-axis font-caption')
11952
- .attr('data-y-scale-id', axis.index)
11953
- .attr('transform', translate)
11954
- .call(yAxis)
11955
- .style('pointer-events', 'none')
11956
- .call((_) => {
11957
- _.select('.domain').remove();
11958
- _.selectAll('.tick').attr('class', 'color-text-50');
11959
- if (!negative) {
11960
- _.append('line')
11961
- .attr('y1', 0)
11962
- .attr('y2', this._height -
11963
- this._options.bounds.top -
11964
- this._options.bounds.bottom)
11965
- .attr('transform', `translate(${0}, ${this._options.bounds.top})`)
11966
- .style('stroke-width', 0.5)
11967
- .style('stroke', 'var(--color-text-50)');
11968
- }
11969
- });
11970
- }
11971
- });
11972
- }
11973
- }
11974
-
11975
- class ChartComponent {
11976
- constructor(_zone) {
11977
- this._zone = _zone;
11978
- this.plotLinesMove = new EventEmitter();
11979
- this.plotBandsMove = new EventEmitter();
11980
- this.seriesMove = new EventEmitter();
11981
- this.pointMove = new EventEmitter();
11982
- this.zoomChange = new EventEmitter();
11983
- this._alive = true;
11984
- this.size$ = new Subject();
11985
- }
11986
- click(event) {
11987
- var _a, _b, _c, _d;
11988
- const composedPath = event.composedPath();
11989
- const triggerToken = 'legend';
11990
- const isLegend = composedPath.some((_) => { var _a; return (_a = _.classList) === null || _a === void 0 ? void 0 : _a.contains(triggerToken); });
11991
- if (isLegend) {
11992
- const clickedElement = (_a = event.target) === null || _a === void 0 ? void 0 : _a.__data__;
11993
- if (!clickedElement) {
11994
- return;
11995
- }
11996
- const serieIndex = (_c = (_b = this._config) === null || _b === void 0 ? void 0 : _b.series) === null || _c === void 0 ? void 0 : _c.indexOf(clickedElement);
11997
- if (clickedElement.serieType === SeriesType.bar) {
11998
- const foundSerie = this._config.series[clickedElement.serieIndex];
11999
- this._config.series[foundSerie.id].data = this._config.series[foundSerie.id].data.map((_) => {
12000
- if (clickedElement.id === _.id) {
12001
- return Object.assign(Object.assign({}, _), { visible: !_.visible });
12002
- }
12003
- return _;
12004
- });
12005
- this.redraw(this._config);
12006
- }
12007
- if (serieIndex !== -1) {
12008
- const foundSerie = this._config.series[serieIndex];
12009
- const yAxisIndex = foundSerie === null || foundSerie === void 0 ? void 0 : foundSerie.yAxisIndex;
12010
- this._config.series[serieIndex].visible = !foundSerie.visible;
12011
- const attachedYAxes = (_d = this._config.series) === null || _d === void 0 ? void 0 : _d.filter((_) => _.visible).map((_) => _.yAxisIndex);
12012
- const shouldVisibleYAxis = attachedYAxes === null || attachedYAxes === void 0 ? void 0 : attachedYAxes.includes(yAxisIndex);
12013
- this._config.yAxis[yAxisIndex].visible = shouldVisibleYAxis;
12014
- this.redraw(this._config);
12015
- }
12016
- }
12017
- }
12018
- ngOnChanges(changes) {
12019
- var _a, _b;
12020
- if (this.config && changes.hasOwnProperty('config')) {
12021
- this.setConfig(this.config);
12022
- if (this.zoom) {
12023
- (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setZoom(this.zoom);
12024
- }
12025
- }
12026
- if (this.zoom && changes.hasOwnProperty('zoom')) {
12027
- (_b = this._chart) === null || _b === void 0 ? void 0 : _b.setZoom(this.zoom);
12028
- }
12029
- }
12030
- ngOnInit() { }
12031
- ngAfterViewInit() {
12032
- this._observer = new ResizeObserver((entries) => {
12033
- const { contentRect } = entries[0];
12034
- this.size$.next(contentRect);
12035
- });
12036
- this._observer.observe(this.chart.nativeElement);
12037
- this.size$
12038
- .pipe(throttleTime(100, undefined, { trailing: true }))
12039
- .pipe(takeWhile((_) => this._alive), map((_) => {
12040
- this.resize(_);
12041
- this.redraw(this._config);
12042
- }))
12043
- .subscribe();
12044
- }
12045
- get showLegend() {
12046
- var _a, _b;
12047
- return (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.legend) === null || _b === void 0 ? void 0 : _b.visible;
12048
- }
12049
- ngOnDestroy() {
12050
- var _a;
12051
- this._alive = false;
12052
- (_a = this._observer) === null || _a === void 0 ? void 0 : _a.unobserve(this.chart.nativeElement);
12053
- }
12054
- redraw(config) {
12055
- if (config) {
12056
- this._chart.redraw(config);
12057
- }
12058
- }
12059
- resize(contentRect) {
12060
- const { width, height } = contentRect;
12061
- this._chart.setSize({
12062
- width,
12063
- height,
12064
- });
12065
- }
12066
- setConfig(config) {
12067
- var _a, _b, _c, _d;
12068
- if (config) {
12069
- this._config = config;
12070
- this.hasSeriesData = !!((_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.series) === null || _b === void 0 ? void 0 : _b.some((_) => _.data.length));
12071
- if (!this._chart) {
12072
- this._chart = new TetaChart(this._config, this.chart);
12073
- this._chart.plotLinesMove
12074
- .pipe(takeWhile((_) => this._alive))
12075
- .subscribe((_) => this.plotLinesMove.emit(_));
12076
- this._chart.plotBandsMove
12077
- .pipe(takeWhile((_) => this._alive))
12078
- .subscribe((_) => this.plotBandsMove.emit(_));
12079
- this._chart.seriesMove
12080
- .pipe(takeWhile((_) => this._alive))
12081
- .subscribe((_) => this.seriesMove.emit(_));
12082
- this._chart.pointMove
12083
- .pipe(takeWhile((_) => this._alive))
12084
- .subscribe((_) => {
12085
- this.pointMove.emit(_);
12086
- });
12087
- this._chart.zoom
12088
- .pipe(takeWhile((_) => this._alive), map((_) => {
12089
- this.zoomChange.emit(_);
12090
- }))
12091
- .subscribe();
12092
- }
12093
- if (this.chart) {
12094
- if (this.hasSeriesData) {
12095
- if (!this._zoom || ((_d = (_c = this._zoom) === null || _c === void 0 ? void 0 : _c.event) === null || _d === void 0 ? void 0 : _d.type) === 'end') {
12096
- this.redraw(this._config);
12097
- }
12098
- }
12099
- }
12100
- }
12101
- }
12102
- }
12103
- ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
12104
- ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChartComponent, selector: "teta-chart", inputs: { zoom: "zoom", config: "config" }, outputs: { plotLinesMove: "plotLinesMove", plotBandsMove: "plotBandsMove", seriesMove: "seriesMove", pointMove: "pointMove", zoomChange: "zoomChange" }, host: { listeners: { "click": "click($event)" } }, viewQueries: [{ propertyName: "chart", first: true, predicate: ["chart"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div [style.display]=\"hasSeriesData ? 'contents' : 'none'\">\n <div #chart class=\"chart-container\"></div>\n <div *ngIf=\"showLegend\" class=\"legend-container\"></div>\n</div>\n<div [style.display]=\"!hasSeriesData ? 'block' : 'none'\" class=\"chart-placeholder text-align-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\n\n", styles: [":host{display:flex;width:100%;height:100%;flex-direction:column}.chart-container{position:relative;min-height:0;flex-grow:1;flex-basis:1px}.chart-placeholder{margin:auto;width:100%}.chart-placeholder span{text-overflow:ellipsis;overflow:hidden;display:block}.legend-container{flex-shrink:0;flex-basis:1px}::ng-deep .grid line{stroke-dasharray:1,4}::ng-deep .tooltip-chart{padding:8px 12px;border-radius:2px}::ng-deep .legend{grid-gap:8px;padding-bottom:5px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-evenly}::ng-deep .legend .item{display:flex;align-items:center;cursor:pointer}::ng-deep .legend .item .swatch{width:10px;height:10px}::ng-deep .legend .item .line{width:12px;height:2px}::ng-deep .legend .item .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-left:5px}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
12105
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartComponent, decorators: [{
12106
- type: Component,
12107
- args: [{ selector: 'teta-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.display]=\"hasSeriesData ? 'contents' : 'none'\">\n <div #chart class=\"chart-container\"></div>\n <div *ngIf=\"showLegend\" class=\"legend-container\"></div>\n</div>\n<div [style.display]=\"!hasSeriesData ? 'block' : 'none'\" class=\"chart-placeholder text-align-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\n\n", styles: [":host{display:flex;width:100%;height:100%;flex-direction:column}.chart-container{position:relative;min-height:0;flex-grow:1;flex-basis:1px}.chart-placeholder{margin:auto;width:100%}.chart-placeholder span{text-overflow:ellipsis;overflow:hidden;display:block}.legend-container{flex-shrink:0;flex-basis:1px}::ng-deep .grid line{stroke-dasharray:1,4}::ng-deep .tooltip-chart{padding:8px 12px;border-radius:2px}::ng-deep .legend{grid-gap:8px;padding-bottom:5px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-evenly}::ng-deep .legend .item{display:flex;align-items:center;cursor:pointer}::ng-deep .legend .item .swatch{width:10px;height:10px}::ng-deep .legend .item .line{width:12px;height:2px}::ng-deep .legend .item .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-left:5px}\n"] }]
12108
- }], ctorParameters: function () { return [{ type: i0.NgZone }]; }, propDecorators: { zoom: [{
12109
- type: Input
12110
- }], config: [{
12111
- type: Input
12112
- }], plotLinesMove: [{
12113
- type: Output
12114
- }], plotBandsMove: [{
12115
- type: Output
12116
- }], seriesMove: [{
12117
- type: Output
12118
- }], pointMove: [{
12119
- type: Output
12120
- }], zoomChange: [{
12121
- type: Output
12122
- }], chart: [{
12123
- type: ViewChild,
12124
- args: ['chart', {
12125
- static: true,
12126
- }]
12127
- }], click: [{
12128
- type: HostListener,
12129
- args: ['click', ['$event']]
12130
- }] } });
12131
-
12132
- class ChartModule {
12133
- }
12134
- ChartModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
12135
- ChartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, declarations: [ChartComponent], imports: [CommonModule], exports: [ChartComponent] });
12136
- ChartModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, imports: [[CommonModule]] });
12137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, decorators: [{
12138
- type: NgModule,
12139
- args: [{
12140
- declarations: [ChartComponent],
12141
- exports: [ChartComponent],
12142
- imports: [CommonModule],
12143
- }]
12144
- }] });
12145
-
12146
- class AxisOptions {
12147
- constructor(options) {
12148
- var _a, _b;
12149
- this.niceTicks = true;
12150
- this.title = options === null || options === void 0 ? void 0 : options.title;
12151
- this.min = options === null || options === void 0 ? void 0 : options.min;
12152
- this.max = options === null || options === void 0 ? void 0 : options.max;
12153
- this.visible = (_a = options === null || options === void 0 ? void 0 : options.visible) !== null && _a !== void 0 ? _a : true;
12154
- this.tickFormat = options === null || options === void 0 ? void 0 : options.tickFormat;
12155
- this.transform = options === null || options === void 0 ? void 0 : options.transform;
12156
- this.zoom = options === null || options === void 0 ? void 0 : options.zoom;
12157
- this.type = (_b = options === null || options === void 0 ? void 0 : options.type) !== null && _b !== void 0 ? _b : 'number';
12158
- this.scaleOptions = Object.assign({ type: ScaleType.linear, base: 10 }, options === null || options === void 0 ? void 0 : options.scaleOptions);
12159
- this.inverted = options === null || options === void 0 ? void 0 : options.inverted;
12160
- this.negative = options === null || options === void 0 ? void 0 : options.negative;
12161
- this.opposite = options === null || options === void 0 ? void 0 : options.opposite;
12162
- this.niceTicks = (options === null || options === void 0 ? void 0 : options.niceTicks) == null ? true : options.niceTicks;
12163
- this.plotLines = (options === null || options === void 0 ? void 0 : options.plotLines) || [];
12164
- this.plotBands = (options === null || options === void 0 ? void 0 : options.plotBands) || [];
12165
- }
12166
- }
12167
-
12168
- class Series {
12169
- constructor(options) {
12170
- var _a, _b, _c, _d;
12171
- this.id = options === null || options === void 0 ? void 0 : options.id;
12172
- this.renderTo = (_a = options === null || options === void 0 ? void 0 : options.renderTo) !== null && _a !== void 0 ? _a : 'svg';
12173
- this.type = (options === null || options === void 0 ? void 0 : options.type) != null ? options === null || options === void 0 ? void 0 : options.type : SeriesType.line;
12174
- this.curveType =
12175
- (options === null || options === void 0 ? void 0 : options.curveType) != null ? options === null || options === void 0 ? void 0 : options.curveType : d3.curveLinear;
12176
- this.data = (_b = options === null || options === void 0 ? void 0 : options.data) === null || _b === void 0 ? void 0 : _b.filter((_) => !isNaN(_.x) && !isNaN(_.y));
12177
- this.axisFormat = options === null || options === void 0 ? void 0 : options.axisFormat;
12178
- this.name = options === null || options === void 0 ? void 0 : options.name;
12179
- this.xAxisIndex = (options === null || options === void 0 ? void 0 : options.xAxisIndex) != null ? options === null || options === void 0 ? void 0 : options.xAxisIndex : 0;
12180
- this.yAxisIndex = (options === null || options === void 0 ? void 0 : options.yAxisIndex) != null ? options === null || options === void 0 ? void 0 : options.yAxisIndex : 0;
12181
- this.drawer = options === null || options === void 0 ? void 0 : options.drawer;
12182
- this.strokeWidth = options === null || options === void 0 ? void 0 : options.strokeWidth;
12183
- this.strokeDasharray = (_c = options === null || options === void 0 ? void 0 : options.strokeDasharray) !== null && _c !== void 0 ? _c : null;
12184
- this.visible = (options === null || options === void 0 ? void 0 : options.visible) || true;
12185
- this.color = (_d = options === null || options === void 0 ? void 0 : options.color) !== null && _d !== void 0 ? _d : 'cyan';
12186
- this.colorScale = options === null || options === void 0 ? void 0 : options.colorScale;
12187
- this.drag = Object.assign({ enable: false, extendLine: false }, options === null || options === void 0 ? void 0 : options.drag);
12188
- this.showInLegend =
12189
- (options === null || options === void 0 ? void 0 : options.showInLegend) != null ? options === null || options === void 0 ? void 0 : options.showInLegend : true;
12190
- this.extend = (options === null || options === void 0 ? void 0 : options.extend) != null ? options === null || options === void 0 ? void 0 : options.extend : false;
12191
- }
12192
- }
12193
-
12194
- class TooltipOptions {
12195
- constructor(options) {
12196
- var _a, _b, _c, _d, _e;
12197
- const defaultFormatter = (tooltips) => {
12198
- let html = '';
12199
- tooltips
12200
- .filter((_) => _.point)
12201
- .forEach((_) => {
12202
- var _a, _b, _c, _d, _e;
12203
- html += `<div>${(_a = _.name) !== null && _a !== void 0 ? _a : 'Без названия'} x: ${(_c = (_b = _.point) === null || _b === void 0 ? void 0 : _b.x) === null || _c === void 0 ? void 0 : _c.toFixed(2)} y: ${(_e = (_d = _.point) === null || _d === void 0 ? void 0 : _d.y) === null || _e === void 0 ? void 0 : _e.toFixed(2)}</div>`;
12204
- });
12205
- return html;
12206
- };
12207
- this.enable = (_a = options === null || options === void 0 ? void 0 : options.enable) !== null && _a !== void 0 ? _a : true;
12208
- this.showMarkers = (_b = options === null || options === void 0 ? void 0 : options.showMarkers) !== null && _b !== void 0 ? _b : true;
12209
- this.showLine = (_c = options === null || options === void 0 ? void 0 : options.showLine) !== null && _c !== void 0 ? _c : false;
12210
- this.tracking = (_d = options === null || options === void 0 ? void 0 : options.tracking) !== null && _d !== void 0 ? _d : 'x';
12211
- this.format = (_e = options === null || options === void 0 ? void 0 : options.format) !== null && _e !== void 0 ? _e : defaultFormatter;
12212
- }
12213
- }
12214
-
12215
- class ChartBounds {
12216
- constructor(options) {
12217
- this.top = 35;
12218
- this.right = 50;
12219
- this.bottom = 50;
12220
- this.left = 35;
12221
- this.top = (options === null || options === void 0 ? void 0 : options.top) || this.top;
12222
- this.right = (options === null || options === void 0 ? void 0 : options.right) || this.right;
12223
- this.bottom = (options === null || options === void 0 ? void 0 : options.bottom) || this.bottom;
12224
- this.left = (options === null || options === void 0 ? void 0 : options.left) || this.left;
12225
- }
12226
- }
12227
-
12228
- class ChartOptions {
12229
- constructor(options) {
12230
- var _a, _b, _c, _d;
12231
- this.bounds = new ChartBounds();
12232
- this.name = options === null || options === void 0 ? void 0 : options.name;
12233
- this.zoom = Object.assign({ enable: false, zoomType: ZoomType.x }, options === null || options === void 0 ? void 0 : options.zoom);
12234
- this.series = (_a = options === null || options === void 0 ? void 0 : options.series) === null || _a === void 0 ? void 0 : _a.map((series, idx) => (Object.assign(Object.assign({}, series), { id: idx })));
12235
- this.zoom = Object.assign({ enable: false, zoomType: ZoomType.x }, options === null || options === void 0 ? void 0 : options.zoom);
12236
- this.series = (_b = options === null || options === void 0 ? void 0 : options.series) === null || _b === void 0 ? void 0 : _b.map((series, idx) => new Series(series));
12237
- this.tooltip = new TooltipOptions(Object.assign({}, options === null || options === void 0 ? void 0 : options.tooltip));
12238
- this.xAxis = (_c = options === null || options === void 0 ? void 0 : options.xAxis) === null || _c === void 0 ? void 0 : _c.map((_) => new AxisOptions(_));
12239
- this.yAxis = (_d = options === null || options === void 0 ? void 0 : options.yAxis) === null || _d === void 0 ? void 0 : _d.map((_) => new AxisOptions(_));
12240
- this.gridLines = (options === null || options === void 0 ? void 0 : options.gridLines) == null ? true : options.gridLines;
12241
- this.width = options === null || options === void 0 ? void 0 : options.width;
12242
- this.height = options === null || options === void 0 ? void 0 : options.height;
12243
- this.legend = Object.assign({ visible: true, type: LegendType.swatches }, options === null || options === void 0 ? void 0 : options.legend);
12244
- this.bounds = Object.assign(Object.assign({}, this.bounds), options === null || options === void 0 ? void 0 : options.bounds);
12245
- this.annotations = options === null || options === void 0 ? void 0 : options.annotations;
12246
- }
12247
- }
12248
-
12249
- const annotationMap = [
12250
- annotationBadge,
12251
- annotationLabel,
12252
- annotationCallout,
12253
- annotationCalloutCircle,
12254
- annotationCalloutCurve,
12255
- annotationCalloutElbow,
12256
- annotationCalloutRect,
12257
- annotationCustomType,
12258
- annotationXYThreshold,
12259
- ];
12260
- class Annotation {
12261
- constructor(options) {
12262
- this.point = options === null || options === void 0 ? void 0 : options.point;
12263
- this.yAxisIndex = options === null || options === void 0 ? void 0 : options.yAxisIndex;
12264
- this.xAxisIndex = options === null || options === void 0 ? void 0 : options.xAxisIndex;
12265
- this.type = (options === null || options === void 0 ? void 0 : options.type) || annotationLabel;
12266
- this.enabled = options === null || options === void 0 ? void 0 : options.enabled;
12267
- this.className = options === null || options === void 0 ? void 0 : options.className;
12268
- this.fillColor = options === null || options === void 0 ? void 0 : options.fillColor;
12269
- this.borderColor = options === null || options === void 0 ? void 0 : options.borderColor;
12270
- this.borderWidth = options === null || options === void 0 ? void 0 : options.borderWidth;
12271
- this.note = options === null || options === void 0 ? void 0 : options.note;
12272
- this.connector = options === null || options === void 0 ? void 0 : options.connector;
12273
- this.dx = options === null || options === void 0 ? void 0 : options.dx;
12274
- this.dy = options === null || options === void 0 ? void 0 : options.dy;
12275
- }
12276
- }
12277
-
12278
- class PlotLine {
12279
- constructor(options) {
12280
- this.id = options === null || options === void 0 ? void 0 : options.id;
12281
- this.width = (options === null || options === void 0 ? void 0 : options.width) || 1;
12282
- this.value = options === null || options === void 0 ? void 0 : options.value;
12283
- this.label = options === null || options === void 0 ? void 0 : options.label;
12284
- this.dashed = (options === null || options === void 0 ? void 0 : options.dashed) || false;
12285
- this.color = (options === null || options === void 0 ? void 0 : options.color) || 'var(--color-text-70)';
12286
- this.min = options === null || options === void 0 ? void 0 : options.min;
12287
- this.max = options === null || options === void 0 ? void 0 : options.max;
12288
- }
12289
- }
12290
-
12291
- class PlotBand {
12292
- constructor(options) {
12293
- this.id = options === null || options === void 0 ? void 0 : options.id;
12294
- this.from = options === null || options === void 0 ? void 0 : options.from;
12295
- this.to = options === null || options === void 0 ? void 0 : options.to;
12296
- this.label = options === null || options === void 0 ? void 0 : options.label;
12297
- this.color = (options === null || options === void 0 ? void 0 : options.color) || '#59AE501A';
12298
- this.image = options === null || options === void 0 ? void 0 : options.image;
12299
- this.showGrabbers =
12300
- (options === null || options === void 0 ? void 0 : options.showGrabbers) != null ? options.showGrabbers : true;
12301
- this.draggable = (options === null || options === void 0 ? void 0 : options.draggable) != null ? options === null || options === void 0 ? void 0 : options.draggable : false;
12302
- this.resizable = (options === null || options === void 0 ? void 0 : options.resizable) != null ? options === null || options === void 0 ? void 0 : options.resizable : true;
12303
- this.min = options === null || options === void 0 ? void 0 : options.min;
12304
- this.max = options === null || options === void 0 ? void 0 : options.max;
12305
- this.opacity = options === null || options === void 0 ? void 0 : options.opacity;
12306
- }
12307
- }
12308
-
12309
10009
  class Chart3dComponent {
12310
10010
  constructor(_elementRef, _themeService) {
12311
10011
  this._elementRef = _elementRef;
@@ -13348,5 +11048,5 @@ class StringUtil {
13348
11048
  * Generated bundle index. Do not edit.
13349
11049
  */
13350
11050
 
13351
- export { AccordionComponent, AccordionContentDirective, AccordionHeadComponent, AccordionItemComponent, AccordionModule, AggregationType, Align, Annotation, AreaDrawer, ArrayUtil, Axis, AxisOptions, AxisType, BarDrawer, BooleanCellComponent, BooleanFilter, BooleanFilterComponent, ButtonComponent, ButtonModule, CHECKBOX_CONTROL_VALUE_ACCESSOR, CellComponent, CellComponentBase, CellHostComponent, Chart3dComponent, Chart3dModule, Chart3dOptions, ChartBounds, ChartComponent, ChartModule, ChartOptions, CheckboxComponent, CheckboxModule, ClickOutsideDirective, ClickOutsideModule, ClickService, ColumnReorderEvent, ColumnResizeEvent, ContextMenuDirective, ContextMenuModule, CurrentModal, DATE_PICKER_CONTROL_VALUE_ACCESSOR, DAY_SELECT_CONTROL_VALUE_ACCESSOR, DateCellComponent, DateFilter, DateFilterComponent, DateFilterValue, DatePeriod, DatePickerComponent, DatePickerModule, DateTimeCellComponent, DateUtil, DaySelectComponent, DelimiterComponent, DelimiterModule, DetailComponentBase, DialogComponent, DialogService, DisableControlDirective, DisableControlModule, DomUtil, DragPointType, DragSortContainerDirective, DragSortItemDirective, DragSortModule, DropdownComponent, DropdownContentDirective, DropdownDirective, DropdownHeadDirective, DropdownModule, DynamicComponentModule, DynamicComponentService, DynamicContentBaseDirective, DynamicData, EditEvent, EditType, ExpandPanelComponent, ExpandPanelContentDirective, ExpandPanelHeadDirective, ExpandPanelModule, FileItemComponent, FileUploadAreaComponent, FileUploadModule, FilterBase, FilterComponentBase, FilterHostComponent, FilterItem, FilterModule, FilterPanelComponent, FilterState, FilterType, FormGroupTitleComponent, FormsUtil, GroupRowComponent, HeadCellComponentBase, HeadCellHostComponent, HighlightDirective, HighlightModule, HintDirective, HintModule, IconComponent, IconModule, IconService, IconSpriteDirective, InputComponent, InputModule, LegendType, LineDrawer, ListCellComponent, ListFilter, ListFilterComponent, ListFilterType, LoaderDirective, LoaderModule, MONTH_PICKER_CONTROL_VALUE_ACCESSOR, Message, MessageComponent, MessageHostComponent, MessageModule, MessageService, ModalCloseReason, ModalContainerComponent, ModalInstance, ModalModule, ModalService, MonthPickerComponent, NoAutofillDirective, NoAutofillModule, NumberPipe, NumberPipeModule, NumericCellComponent, NumericFilter, NumericFilterComponent, NumericFilterValue, OnlyNumberDirective, OnlyNumberModule, OverlayContainerService, PagerComponent, PagerModule, PagerState, PagerUtil, PanelComponent, PanelModule, PieDrawer, PlotBand, PlotLine, PopupContentComponent, PositionUtil, ProgressBarComponent, ProgressBarModule, PropertyGridComponent, PropertyGridModule, RadioButtonComponent, RadioComponent, RadioModule, ResizeDragDirective, ResizeDragModule, ResizePanelComponent, ResizePanelModule, SLIDER_CONTROL_VALUE_ACCESSOR, SWITCH_CONTROL_VALUE_ACCESSOR, Scale, ScaleType, ScatterDrawer, SelectComponent, SelectModule, SelectOptionDirective, SelectType, SelectValueDirective, Series, SeriesType, SidebarComponent, SidebarModule, SidebarPosition, SortEvent, SortParam, SplineDrawer, StateUtil, StringCellComponent, StringFilter, StringFilterComponent, StringFilterType, StringUtil, SwitchButtonComponent, SwitchComponent, SwitchModule, TOGGLE_CONTROL_VALUE_ACCESSOR, TabComponent, TabContentDirective, TabTitleDirective, TableBodyComponent, TableColumn, TableColumnStore, TableComponent, TableContextMenuConfig, TableHeadComponent, TableModule, TableRow, TableService, TableUtil, TabsComponent, TabsModule, TetaChart, TetaContentRef, TetaSize, TetaTemplateDirective, TetaTemplateModule, TextFieldComponent, ThemeSwitchComponent, ThemeSwitchModule, ThemeSwitchService, ToggleComponent, ToggleModule, ToolbarComponent, ToolbarModule, TooltipDirective, TooltipModule, TooltipOptions, TreeComponent, TreeItemToggleComponent, TreeModule, TreeService, VerticalAlign, ZoomType, getCellComponent };
11051
+ export { AccordionComponent, AccordionContentDirective, AccordionHeadComponent, AccordionItemComponent, AccordionModule, AggregationType, Align, ArrayUtil, BooleanCellComponent, BooleanFilter, BooleanFilterComponent, ButtonComponent, ButtonModule, CHECKBOX_CONTROL_VALUE_ACCESSOR, CellComponent, CellComponentBase, CellHostComponent, Chart3dComponent, Chart3dModule, Chart3dOptions, CheckboxComponent, CheckboxModule, ClickOutsideDirective, ClickOutsideModule, ClickService, ColumnReorderEvent, ColumnResizeEvent, ContextMenuDirective, ContextMenuModule, CurrentModal, DATE_PICKER_CONTROL_VALUE_ACCESSOR, DAY_SELECT_CONTROL_VALUE_ACCESSOR, DateCellComponent, DateFilter, DateFilterComponent, DateFilterValue, DatePeriod, DatePickerComponent, DatePickerModule, DateTimeCellComponent, DateUtil, DaySelectComponent, DelimiterComponent, DelimiterModule, DetailComponentBase, DialogComponent, DialogService, DisableControlDirective, DisableControlModule, DomUtil, DragSortContainerDirective, DragSortItemDirective, DragSortModule, DropdownComponent, DropdownContentDirective, DropdownDirective, DropdownHeadDirective, DropdownModule, DynamicComponentModule, DynamicComponentService, DynamicContentBaseDirective, DynamicData, EditEvent, EditType, ExpandPanelComponent, ExpandPanelContentDirective, ExpandPanelHeadDirective, ExpandPanelModule, FileItemComponent, FileUploadAreaComponent, FileUploadModule, FilterBase, FilterComponentBase, FilterHostComponent, FilterItem, FilterModule, FilterPanelComponent, FilterState, FilterType, FormGroupTitleComponent, FormsUtil, GroupRowComponent, HeadCellComponentBase, HeadCellHostComponent, HighlightDirective, HighlightModule, HintDirective, HintModule, IconComponent, IconModule, IconService, IconSpriteDirective, InputComponent, InputModule, ListCellComponent, ListFilter, ListFilterComponent, ListFilterType, LoaderDirective, LoaderModule, MONTH_PICKER_CONTROL_VALUE_ACCESSOR, Message, MessageComponent, MessageHostComponent, MessageModule, MessageService, ModalCloseReason, ModalContainerComponent, ModalInstance, ModalModule, ModalService, MonthPickerComponent, NoAutofillDirective, NoAutofillModule, NumberPipe, NumberPipeModule, NumericCellComponent, NumericFilter, NumericFilterComponent, NumericFilterValue, OnlyNumberDirective, OnlyNumberModule, OverlayContainerService, PagerComponent, PagerModule, PagerState, PagerUtil, PanelComponent, PanelModule, PopupContentComponent, PositionUtil, ProgressBarComponent, ProgressBarModule, PropertyGridComponent, PropertyGridModule, RadioButtonComponent, RadioComponent, RadioModule, ResizeDragDirective, ResizeDragModule, ResizePanelComponent, ResizePanelModule, SLIDER_CONTROL_VALUE_ACCESSOR, SWITCH_CONTROL_VALUE_ACCESSOR, SelectComponent, SelectModule, SelectOptionDirective, SelectType, SelectValueDirective, SidebarComponent, SidebarModule, SidebarPosition, SortEvent, SortParam, StateUtil, StringCellComponent, StringFilter, StringFilterComponent, StringFilterType, StringUtil, SwitchButtonComponent, SwitchComponent, SwitchModule, TOGGLE_CONTROL_VALUE_ACCESSOR, TabComponent, TabContentDirective, TabTitleDirective, TableBodyComponent, TableColumn, TableColumnStore, TableComponent, TableContextMenuConfig, TableHeadComponent, TableModule, TableRow, TableService, TableUtil, TabsComponent, TabsModule, TetaContentRef, TetaSize, TetaTemplateDirective, TetaTemplateModule, TextFieldComponent, ThemeSwitchComponent, ThemeSwitchModule, ThemeSwitchService, ToggleComponent, ToggleModule, ToolbarComponent, ToolbarModule, TooltipDirective, TooltipModule, TreeComponent, TreeItemToggleComponent, TreeModule, TreeService, VerticalAlign, formatNumber, getCellComponent, getPrecision, prependZero };
13352
11052
  //# sourceMappingURL=tetacom-ng-components.mjs.map