@tetacom/svg-charts 1.0.1

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 (216) hide show
  1. package/.browserslistrc +16 -0
  2. package/README.md +24 -0
  3. package/dist/README.md +24 -0
  4. package/dist/chart/base/series-base.component.d.ts +22 -0
  5. package/dist/chart/chart/chart.component.d.ts +29 -0
  6. package/dist/chart/chart-container/chart-container.component.d.ts +42 -0
  7. package/dist/chart/chart-container/gridlines/gridlines.component.d.ts +23 -0
  8. package/dist/chart/chart-container/plotband/plotband.component.d.ts +33 -0
  9. package/dist/chart/chart-container/plotline/plotline.component.d.ts +30 -0
  10. package/dist/chart/chart-container/series/bar/bar-series.component.d.ts +25 -0
  11. package/dist/chart/chart-container/series/line/line-series.component.d.ts +28 -0
  12. package/dist/chart/chart-container/series-host/series-host.component.d.ts +20 -0
  13. package/dist/chart/chart-container/tooltip/tooltip.component.d.ts +29 -0
  14. package/dist/chart/chart-container/x-axis/x-axis.component.d.ts +23 -0
  15. package/dist/chart/chart-container/y-axis/y-axis.component.d.ts +24 -0
  16. package/dist/chart/chart.module.d.ts +22 -0
  17. package/dist/chart/core/axis/axis.d.ts +54 -0
  18. package/dist/chart/core/axis/builders/axis-size-builder.d.ts +8 -0
  19. package/dist/chart/core/axis/builders/extremes-builder.d.ts +7 -0
  20. package/dist/chart/core/axis/builders/public-api.d.ts +2 -0
  21. package/dist/chart/core/utils/generate-ticks.d.ts +1 -0
  22. package/dist/chart/core/utils/get-text-width.d.ts +1 -0
  23. package/dist/chart/core/utils/public-api.d.ts +2 -0
  24. package/dist/chart/directives/brushable.directive.d.ts +17 -0
  25. package/dist/chart/directives/zoomable.directive.d.ts +20 -0
  26. package/dist/chart/legend/legend.component.d.ts +14 -0
  27. package/dist/chart/model/axis-options.d.ts +17 -0
  28. package/dist/chart/model/base-point.d.ts +9 -0
  29. package/dist/chart/model/chart-bounds.d.ts +12 -0
  30. package/dist/chart/model/enum/axis-orientation.d.ts +4 -0
  31. package/dist/chart/model/enum/axis-type.d.ts +7 -0
  32. package/dist/chart/model/enum/brush-type.d.ts +5 -0
  33. package/dist/chart/model/enum/drag-point-type.d.ts +5 -0
  34. package/dist/chart/model/enum/series-type.d.ts +4 -0
  35. package/dist/chart/model/enum/tooltip-tracking.d.ts +4 -0
  36. package/dist/chart/model/enum/zoom-type.d.ts +5 -0
  37. package/dist/chart/model/i-broadcast-message.d.ts +5 -0
  38. package/dist/chart/model/i-builder.d.ts +3 -0
  39. package/dist/chart/model/i-chart-config.d.ts +32 -0
  40. package/dist/chart/model/i-chart-event.d.ts +4 -0
  41. package/dist/chart/model/i-display-tooltip.d.ts +6 -0
  42. package/dist/chart/model/i-point-move.d.ts +6 -0
  43. package/dist/chart/model/marker-options.d.ts +7 -0
  44. package/dist/chart/model/plotband.d.ts +31 -0
  45. package/dist/chart/model/plotline.d.ts +19 -0
  46. package/dist/chart/model/series.d.ts +17 -0
  47. package/dist/chart/model/svg-attributes.d.ts +14 -0
  48. package/dist/chart/model/tooltip-options.d.ts +8 -0
  49. package/dist/chart/service/axes.service.d.ts +11 -0
  50. package/dist/chart/service/broadcast.service.d.ts +11 -0
  51. package/dist/chart/service/brush.service.d.ts +17 -0
  52. package/dist/chart/service/chart.service.d.ts +38 -0
  53. package/dist/chart/service/scale.service.d.ts +14 -0
  54. package/dist/chart/service/zoom.service.d.ts +25 -0
  55. package/dist/esm2020/chart/base/series-base.component.mjs +34 -0
  56. package/dist/esm2020/chart/chart/chart.component.mjs +73 -0
  57. package/dist/esm2020/chart/chart-container/chart-container.component.mjs +151 -0
  58. package/dist/esm2020/chart/chart-container/gridlines/gridlines.component.mjs +41 -0
  59. package/dist/esm2020/chart/chart-container/plotband/plotband.component.mjs +139 -0
  60. package/dist/esm2020/chart/chart-container/plotline/plotline.component.mjs +79 -0
  61. package/dist/esm2020/chart/chart-container/series/bar/bar-series.component.mjs +48 -0
  62. package/dist/esm2020/chart/chart-container/series/line/line-series.component.mjs +148 -0
  63. package/dist/esm2020/chart/chart-container/series-host/series-host.component.mjs +59 -0
  64. package/dist/esm2020/chart/chart-container/tooltip/tooltip.component.mjs +81 -0
  65. package/dist/esm2020/chart/chart-container/x-axis/x-axis.component.mjs +56 -0
  66. package/dist/esm2020/chart/chart-container/y-axis/y-axis.component.mjs +63 -0
  67. package/dist/esm2020/chart/chart.module.mjs +62 -0
  68. package/dist/esm2020/chart/core/axis/axis.mjs +96 -0
  69. package/dist/esm2020/chart/core/axis/builders/axis-size-builder.mjs +24 -0
  70. package/dist/esm2020/chart/core/axis/builders/extremes-builder.mjs +32 -0
  71. package/dist/esm2020/chart/core/axis/builders/public-api.mjs +3 -0
  72. package/dist/esm2020/chart/core/utils/generate-ticks.mjs +11 -0
  73. package/dist/esm2020/chart/core/utils/get-text-width.mjs +6 -0
  74. package/dist/esm2020/chart/core/utils/public-api.mjs +3 -0
  75. package/dist/esm2020/chart/directives/brushable.directive.mjs +28 -0
  76. package/dist/esm2020/chart/directives/zoomable.directive.mjs +37 -0
  77. package/dist/esm2020/chart/legend/legend.component.mjs +30 -0
  78. package/dist/esm2020/chart/model/axis-options.mjs +2 -0
  79. package/dist/esm2020/chart/model/base-point.mjs +2 -0
  80. package/dist/esm2020/chart/model/chart-bounds.mjs +13 -0
  81. package/dist/esm2020/chart/model/enum/axis-orientation.mjs +6 -0
  82. package/dist/esm2020/chart/model/enum/axis-type.mjs +9 -0
  83. package/dist/esm2020/chart/model/enum/brush-type.mjs +7 -0
  84. package/dist/esm2020/chart/model/enum/drag-point-type.mjs +7 -0
  85. package/dist/esm2020/chart/model/enum/series-type.mjs +6 -0
  86. package/dist/esm2020/chart/model/enum/tooltip-tracking.mjs +6 -0
  87. package/dist/esm2020/chart/model/enum/zoom-type.mjs +7 -0
  88. package/dist/esm2020/chart/model/i-broadcast-message.mjs +2 -0
  89. package/dist/esm2020/chart/model/i-builder.mjs +2 -0
  90. package/dist/esm2020/chart/model/i-chart-config.mjs +2 -0
  91. package/dist/esm2020/chart/model/i-chart-event.mjs +2 -0
  92. package/dist/esm2020/chart/model/i-display-tooltip.mjs +2 -0
  93. package/dist/esm2020/chart/model/i-point-move.mjs +2 -0
  94. package/dist/esm2020/chart/model/marker-options.mjs +2 -0
  95. package/dist/esm2020/chart/model/plotband.mjs +16 -0
  96. package/dist/esm2020/chart/model/plotline.mjs +12 -0
  97. package/dist/esm2020/chart/model/series.mjs +2 -0
  98. package/dist/esm2020/chart/model/svg-attributes.mjs +2 -0
  99. package/dist/esm2020/chart/model/tooltip-options.mjs +2 -0
  100. package/dist/esm2020/chart/service/axes.service.mjs +29 -0
  101. package/dist/esm2020/chart/service/broadcast.service.mjs +25 -0
  102. package/dist/esm2020/chart/service/brush.service.mjs +67 -0
  103. package/dist/esm2020/chart/service/chart.service.mjs +76 -0
  104. package/dist/esm2020/chart/service/scale.service.mjs +64 -0
  105. package/dist/esm2020/chart/service/zoom.service.mjs +117 -0
  106. package/dist/esm2020/public-api.mjs +7 -0
  107. package/dist/esm2020/tetacom-svg-charts.mjs +5 -0
  108. package/dist/fesm2015/tetacom-svg-charts.mjs +1589 -0
  109. package/dist/fesm2015/tetacom-svg-charts.mjs.map +1 -0
  110. package/dist/fesm2020/tetacom-svg-charts.mjs +1575 -0
  111. package/dist/fesm2020/tetacom-svg-charts.mjs.map +1 -0
  112. package/dist/package.json +35 -0
  113. package/dist/public-api.d.ts +3 -0
  114. package/dist/tetacom-svg-charts.d.ts +5 -0
  115. package/karma.conf.js +44 -0
  116. package/ng-package.json +7 -0
  117. package/package.json +15 -0
  118. package/src/chart/Chart.stories.ts +397 -0
  119. package/src/chart/base/series-base.component.ts +41 -0
  120. package/src/chart/chart/chart.component.html +5 -0
  121. package/src/chart/chart/chart.component.scss +6 -0
  122. package/src/chart/chart/chart.component.spec.ts +25 -0
  123. package/src/chart/chart/chart.component.ts +97 -0
  124. package/src/chart/chart-container/chart-container.component.html +78 -0
  125. package/src/chart/chart-container/chart-container.component.scss +15 -0
  126. package/src/chart/chart-container/chart-container.component.spec.ts +25 -0
  127. package/src/chart/chart-container/chart-container.component.ts +242 -0
  128. package/src/chart/chart-container/gridlines/gridlines.component.html +7 -0
  129. package/src/chart/chart-container/gridlines/gridlines.component.scss +8 -0
  130. package/src/chart/chart-container/gridlines/gridlines.component.spec.ts +25 -0
  131. package/src/chart/chart-container/gridlines/gridlines.component.ts +55 -0
  132. package/src/chart/chart-container/plotband/plotband.component.html +58 -0
  133. package/src/chart/chart-container/plotband/plotband.component.scss +13 -0
  134. package/src/chart/chart-container/plotband/plotband.component.spec.ts +25 -0
  135. package/src/chart/chart-container/plotband/plotband.component.ts +206 -0
  136. package/src/chart/chart-container/plotline/plotline.component.html +22 -0
  137. package/src/chart/chart-container/plotline/plotline.component.scss +6 -0
  138. package/src/chart/chart-container/plotline/plotline.component.spec.ts +25 -0
  139. package/src/chart/chart-container/plotline/plotline.component.ts +113 -0
  140. package/src/chart/chart-container/series/bar/bar-series.component.html +3 -0
  141. package/src/chart/chart-container/series/bar/bar-series.component.scss +0 -0
  142. package/src/chart/chart-container/series/bar/bar-series.component.ts +71 -0
  143. package/src/chart/chart-container/series/line/line-series.component.html +38 -0
  144. package/src/chart/chart-container/series/line/line-series.component.scss +9 -0
  145. package/src/chart/chart-container/series/line/line-series.component.spec.ts +25 -0
  146. package/src/chart/chart-container/series/line/line-series.component.ts +245 -0
  147. package/src/chart/chart-container/series-host/series-host.component.ts +80 -0
  148. package/src/chart/chart-container/tooltip/tooltip.component.html +14 -0
  149. package/src/chart/chart-container/tooltip/tooltip.component.scss +7 -0
  150. package/src/chart/chart-container/tooltip/tooltip.component.spec.ts +25 -0
  151. package/src/chart/chart-container/tooltip/tooltip.component.ts +134 -0
  152. package/src/chart/chart-container/x-axis/x-axis.component.html +1 -0
  153. package/src/chart/chart-container/x-axis/x-axis.component.scss +3 -0
  154. package/src/chart/chart-container/x-axis/x-axis.component.spec.ts +25 -0
  155. package/src/chart/chart-container/x-axis/x-axis.component.ts +80 -0
  156. package/src/chart/chart-container/y-axis/y-axis.component.html +4 -0
  157. package/src/chart/chart-container/y-axis/y-axis.component.scss +13 -0
  158. package/src/chart/chart-container/y-axis/y-axis.component.spec.ts +25 -0
  159. package/src/chart/chart-container/y-axis/y-axis.component.ts +90 -0
  160. package/src/chart/chart.module.ts +40 -0
  161. package/src/chart/core/axis/axis.ts +132 -0
  162. package/src/chart/core/axis/builders/axis-size-builder.ts +37 -0
  163. package/src/chart/core/axis/builders/extremes-builder.ts +45 -0
  164. package/src/chart/core/axis/builders/public-api.ts +2 -0
  165. package/src/chart/core/utils/generate-ticks.ts +14 -0
  166. package/src/chart/core/utils/get-text-width.ts +10 -0
  167. package/src/chart/core/utils/public-api.ts +2 -0
  168. package/src/chart/default/default-chart-config.ts +12 -0
  169. package/src/chart/directives/brushable.directive.ts +30 -0
  170. package/src/chart/directives/zoomable.directive.ts +31 -0
  171. package/src/chart/legend/legend.component.html +6 -0
  172. package/src/chart/legend/legend.component.scss +20 -0
  173. package/src/chart/legend/legend.component.spec.ts +25 -0
  174. package/src/chart/legend/legend.component.ts +35 -0
  175. package/src/chart/model/axis-options.ts +18 -0
  176. package/src/chart/model/base-point.ts +10 -0
  177. package/src/chart/model/chart-bounds.ts +18 -0
  178. package/src/chart/model/enum/axis-orientation.ts +4 -0
  179. package/src/chart/model/enum/axis-type.ts +7 -0
  180. package/src/chart/model/enum/brush-type.ts +5 -0
  181. package/src/chart/model/enum/drag-point-type.ts +5 -0
  182. package/src/chart/model/enum/public-api.ts +7 -0
  183. package/src/chart/model/enum/series-type.ts +4 -0
  184. package/src/chart/model/enum/tooltip-tracking.ts +4 -0
  185. package/src/chart/model/enum/zoom-type.ts +5 -0
  186. package/src/chart/model/i-broadcast-message.ts +5 -0
  187. package/src/chart/model/i-builder.ts +3 -0
  188. package/src/chart/model/i-chart-config.ts +33 -0
  189. package/src/chart/model/i-chart-event.ts +4 -0
  190. package/src/chart/model/i-display-tooltip.ts +7 -0
  191. package/src/chart/model/i-drag-event.ts +5 -0
  192. package/src/chart/model/i-point-move.ts +7 -0
  193. package/src/chart/model/marker-options.ts +8 -0
  194. package/src/chart/model/plotband.ts +45 -0
  195. package/src/chart/model/plotline.ts +29 -0
  196. package/src/chart/model/public-api.ts +0 -0
  197. package/src/chart/model/series.ts +18 -0
  198. package/src/chart/model/svg-attributes.ts +14 -0
  199. package/src/chart/model/tooltip-options.ts +37 -0
  200. package/src/chart/service/axes.service.spec.ts +16 -0
  201. package/src/chart/service/axes.service.ts +27 -0
  202. package/src/chart/service/broadcast.service.spec.ts +16 -0
  203. package/src/chart/service/broadcast.service.ts +24 -0
  204. package/src/chart/service/brush.service.spec.ts +16 -0
  205. package/src/chart/service/brush.service.ts +87 -0
  206. package/src/chart/service/chart.service.spec.ts +16 -0
  207. package/src/chart/service/chart.service.ts +100 -0
  208. package/src/chart/service/scale.service.spec.ts +16 -0
  209. package/src/chart/service/scale.service.ts +74 -0
  210. package/src/chart/service/zoom.service.spec.ts +16 -0
  211. package/src/chart/service/zoom.service.ts +153 -0
  212. package/src/public-api.ts +7 -0
  213. package/src/test.ts +27 -0
  214. package/tsconfig.lib.json +15 -0
  215. package/tsconfig.lib.prod.json +10 -0
  216. package/tsconfig.spec.json +17 -0
@@ -0,0 +1,1575 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, Input, ChangeDetectionStrategy, ViewChild, ChangeDetectorRef, Directive, HostBinding, EventEmitter, Output, NgModule } from '@angular/core';
3
+ import * as i4 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import { Subject, map, filter, merge, of, tap, takeWhile } from 'rxjs';
6
+ import * as d3 from 'd3';
7
+ import { zoomIdentity } from 'd3';
8
+ import { maxIndex } from 'd3-array';
9
+ import { throttleTime } from 'rxjs/operators';
10
+ import * as i3 from '@angular/platform-browser';
11
+
12
+ var AxisOrientation;
13
+ (function (AxisOrientation) {
14
+ AxisOrientation[AxisOrientation["x"] = 0] = "x";
15
+ AxisOrientation[AxisOrientation["y"] = 1] = "y";
16
+ })(AxisOrientation || (AxisOrientation = {}));
17
+
18
+ const getTextWidth = (inputText, backupRatio = 0.5, fontSize = 11) => {
19
+ let text = inputText ?? '';
20
+ text = text.toString();
21
+ return fontSize * backupRatio * text.length;
22
+ };
23
+
24
+ function generateTicks(extremes) {
25
+ const [min, max] = extremes;
26
+ const tickCount = 10;
27
+ const tickStep = (max - min) / tickCount;
28
+ const ticks = d3
29
+ .range(min, max + tickStep, tickStep)
30
+ .filter((step) => step <= max);
31
+ return ticks;
32
+ }
33
+
34
+ class AxisSizeBuilder {
35
+ constructor() {
36
+ this.titlePadding = 8;
37
+ this.basePadding = 16;
38
+ this.backupRatio = 0.58;
39
+ }
40
+ build(settings) {
41
+ let finalPadding = this.basePadding;
42
+ if (settings.orientation === AxisOrientation.y) {
43
+ const formatter = settings.defaultFormatter();
44
+ finalPadding += settings.options.title ? this.titlePadding : 0;
45
+ const maxElementLengthIndex = maxIndex(settings.tickValues, (_) => formatter(_).length);
46
+ finalPadding += getTextWidth(formatter(settings.tickValues[maxElementLengthIndex]), this.backupRatio);
47
+ }
48
+ if (settings.orientation === AxisOrientation.x) {
49
+ finalPadding += finalPadding + 20;
50
+ }
51
+ return finalPadding;
52
+ }
53
+ }
54
+
55
+ class ExtremesBuilder {
56
+ constructor() {
57
+ this.extentAccessorMap = new Map()
58
+ .set(AxisOrientation.x, (_) => _.x)
59
+ .set(AxisOrientation.y, (_) => _.y);
60
+ this.extremes = [0, 0];
61
+ }
62
+ build(settings) {
63
+ const options = settings.options;
64
+ const hasMin = options?.min != null;
65
+ const hasMax = options?.max != null;
66
+ if (!hasMin || !hasMax) {
67
+ const linkedSeries = settings.linkedSeries();
68
+ const data = linkedSeries.reduce((acc, current) => {
69
+ return acc.concat(current.data);
70
+ }, []);
71
+ const accessor = this.extentAccessorMap.get(settings.orientation);
72
+ // add negative axis!
73
+ this.extremes = d3.extent(data, accessor);
74
+ }
75
+ if (hasMin) {
76
+ this.extremes[0] = options?.min;
77
+ }
78
+ if (hasMax) {
79
+ this.extremes[1] = options?.max;
80
+ }
81
+ return this.extremes;
82
+ }
83
+ }
84
+
85
+ var AxisType;
86
+ (function (AxisType) {
87
+ AxisType[AxisType["number"] = 0] = "number";
88
+ AxisType[AxisType["time"] = 1] = "time";
89
+ AxisType[AxisType["category"] = 2] = "category";
90
+ AxisType[AxisType["log"] = 3] = "log";
91
+ AxisType[AxisType["pow"] = 4] = "pow";
92
+ })(AxisType || (AxisType = {}));
93
+
94
+ class Axis {
95
+ constructor(config) {
96
+ this._extremes = [0, 0];
97
+ this.defaultFormatters = new Map()
98
+ .set(AxisType.number, d3.format(',.2f'))
99
+ .set(AxisType.time, d3.timeFormat('%B %d, %Y'))
100
+ .set(AxisType.log, d3.format(',.2f'));
101
+ this.chartConfig = config;
102
+ }
103
+ /**
104
+ * Factory for creating x,y axes
105
+ * @param {AxisOrientation} orientation
106
+ * Axis type
107
+ * @param {IChartConfig} config
108
+ * Chart config
109
+ * @param {number} index
110
+ * Index axis
111
+ * @return {Axis}
112
+ * New generated axis
113
+ */
114
+ static createAxis(orientation, config, index) {
115
+ const axis = new Axis(config);
116
+ axis.setLocate(orientation);
117
+ axis.setIndex(index);
118
+ axis.setExtremes();
119
+ axis.setTicksValues();
120
+ axis.setSelfSize();
121
+ return axis;
122
+ }
123
+ /**
124
+ *
125
+ * @param {orientation} orientation
126
+ * Set locate axis x or y
127
+ */
128
+ setLocate(orientation) {
129
+ this._orientation = orientation;
130
+ }
131
+ /**
132
+ *
133
+ * @param {number | string} index
134
+ * Index axis
135
+ */
136
+ setIndex(index) {
137
+ this._index = index;
138
+ }
139
+ /**
140
+ * @return {Array<Series<BasePoint>>}
141
+ * Linked series
142
+ */
143
+ linkedSeries() {
144
+ const linkedFilter = (serie) => serie[this._orientation === AxisOrientation.y ? 'yAxisIndex' : 'xAxisIndex'] === this._index;
145
+ return this.chartConfig?.series.filter(linkedFilter);
146
+ }
147
+ setExtremes() {
148
+ const builder = new ExtremesBuilder();
149
+ this._extremes = builder.build(this);
150
+ this._extremes = d3.nice(this._extremes[0], this._extremes[1], 10);
151
+ }
152
+ setSelfSize() {
153
+ const builder = new AxisSizeBuilder();
154
+ this._selfSize = builder.build(this);
155
+ }
156
+ setTicksValues() {
157
+ const ticks = generateTicks(this._extremes);
158
+ this._ticksValues = ticks;
159
+ }
160
+ get extremes() {
161
+ return this._extremes;
162
+ }
163
+ get orientation() {
164
+ return this._orientation;
165
+ }
166
+ get selfSize() {
167
+ return this._selfSize;
168
+ }
169
+ get tickValues() {
170
+ return this._ticksValues;
171
+ }
172
+ get index() {
173
+ return this._index;
174
+ }
175
+ get options() {
176
+ return this.orientation === AxisOrientation.x
177
+ ? this.chartConfig.xAxis[this.index]
178
+ : this.chartConfig.yAxis[this.index];
179
+ }
180
+ defaultFormatter() {
181
+ return this.defaultFormatters.get(this.options.type);
182
+ }
183
+ }
184
+
185
+ class AxesService {
186
+ constructor() {
187
+ this.yAxis = new Map();
188
+ this.xAxis = new Map();
189
+ }
190
+ init(config) {
191
+ config?.yAxis.forEach((_, index) => {
192
+ const axis = Axis.createAxis(AxisOrientation.y, config, index);
193
+ this.yAxis.set(index, axis);
194
+ });
195
+ config?.xAxis.forEach((_, index) => {
196
+ const axis = Axis.createAxis(AxisOrientation.x, config, index);
197
+ this.xAxis.set(index, axis);
198
+ });
199
+ }
200
+ }
201
+ AxesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AxesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
202
+ AxesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AxesService, providedIn: 'root' });
203
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AxesService, decorators: [{
204
+ type: Injectable,
205
+ args: [{
206
+ providedIn: 'root',
207
+ }]
208
+ }], ctorParameters: function () { return []; } });
209
+
210
+ class ScaleService {
211
+ constructor(axesService) {
212
+ this.axesService = axesService;
213
+ this.yScales = new Map();
214
+ this.xScales = new Map();
215
+ this.scaleMapping = new Map()
216
+ .set(AxisType.number, d3.scaleLinear)
217
+ .set(AxisType.time, d3.scaleTime)
218
+ .set(AxisType.category, d3.scaleOrdinal)
219
+ .set(AxisType.log, d3.scaleLog);
220
+ }
221
+ createScales(size, config) {
222
+ this.yScales.clear();
223
+ this.xScales.clear();
224
+ const topBound = [...this.axesService.xAxis.values()]
225
+ .filter((_) => _.options?.visible && _.options?.opposite)
226
+ .reduce((acc, cur) => acc + cur.selfSize, 0);
227
+ const bottomBound = [...this.axesService.xAxis.values()]
228
+ .filter((_) => _.options?.visible && _.options?.opposite !== true)
229
+ .reduce((acc, cur) => acc + cur.selfSize, 0);
230
+ const leftBound = [...this.axesService.yAxis.values()]
231
+ .filter((_) => _.options?.visible && _.options.opposite !== true)
232
+ .reduce((acc, cur) => acc + cur.selfSize, 0);
233
+ const rightBound = [...this.axesService.yAxis.values()]
234
+ .filter((_) => _.options?.visible && _.options.opposite)
235
+ .reduce((acc, cur) => acc + cur.selfSize, 0);
236
+ this.axesService.yAxis.forEach((axis) => {
237
+ const scale = this.getScale(axis).range([
238
+ 0,
239
+ size.height - topBound - bottomBound,
240
+ ]);
241
+ this.yScales.set(axis.index, scale);
242
+ });
243
+ this.axesService.xAxis.forEach((axis) => {
244
+ const scale = this.getScale(axis).range([
245
+ 0,
246
+ size.width - leftBound - rightBound,
247
+ ]);
248
+ this.xScales.set(axis.index, scale);
249
+ });
250
+ }
251
+ getScale(axis) {
252
+ return this.scaleMapping
253
+ .get(axis.options?.type)()
254
+ .domain(axis.orientation === AxisOrientation.y
255
+ ? [...axis.extremes].reverse()
256
+ : axis.extremes);
257
+ }
258
+ }
259
+ ScaleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ScaleService, deps: [{ token: AxesService }], target: i0.ɵɵFactoryTarget.Injectable });
260
+ ScaleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ScaleService, providedIn: 'root' });
261
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ScaleService, decorators: [{
262
+ type: Injectable,
263
+ args: [{
264
+ providedIn: 'root',
265
+ }]
266
+ }], ctorParameters: function () { return [{ type: AxesService }]; } });
267
+
268
+ class ChartService {
269
+ constructor(axesService, scaleService) {
270
+ this.axesService = axesService;
271
+ this.scaleService = scaleService;
272
+ this.size$ = new Subject();
273
+ this.pointerMove$ = new Subject();
274
+ this.tooltips$ = new Subject();
275
+ this.plotbandMove$ = new Subject();
276
+ this.plotlineMove$ = new Subject();
277
+ this.pointMove$ = new Subject();
278
+ this.size = this.size$.asObservable();
279
+ this.pointerMove = this.pointerMove$.asObservable();
280
+ this.tooltips = this.tooltips$.asObservable();
281
+ this.plotbandMove = this.plotbandMove$.asObservable();
282
+ this.plotlineMove = this.plotlineMove$.asObservable();
283
+ this.pointMove = this.pointMove$.asObservable();
284
+ this.size
285
+ .pipe(map((size) => {
286
+ this.scaleService.createScales(size, this._config);
287
+ }))
288
+ .subscribe();
289
+ }
290
+ init(config) {
291
+ this._config = config;
292
+ if (config.inverted) {
293
+ this._config.series = this._config?.series?.map((serie) => {
294
+ return {
295
+ ...serie,
296
+ data: serie?.data?.map((point) => {
297
+ return {
298
+ ...point,
299
+ x: point?.y,
300
+ y: point?.x,
301
+ };
302
+ }),
303
+ };
304
+ });
305
+ }
306
+ this.axesService.init(this._config);
307
+ }
308
+ setSize(size) {
309
+ this.size$.next(size);
310
+ }
311
+ setPointerMove(event) {
312
+ this.pointerMove$.next({ event });
313
+ }
314
+ setTooltip(tooltip) {
315
+ this.tooltips$.next(tooltip);
316
+ }
317
+ emitPlotband(event) {
318
+ this.plotbandMove$.next(event);
319
+ }
320
+ emitPlotline(event) {
321
+ this.plotlineMove$.next(event);
322
+ }
323
+ emitPoint(event) {
324
+ this.pointMove$.next(event);
325
+ }
326
+ get config() {
327
+ return this._config;
328
+ }
329
+ }
330
+ ChartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartService, deps: [{ token: AxesService }, { token: ScaleService }], target: i0.ɵɵFactoryTarget.Injectable });
331
+ ChartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartService, providedIn: 'root' });
332
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartService, decorators: [{
333
+ type: Injectable,
334
+ args: [{
335
+ providedIn: 'root',
336
+ }]
337
+ }], ctorParameters: function () { return [{ type: AxesService }, { type: ScaleService }]; } });
338
+
339
+ var ZoomType;
340
+ (function (ZoomType) {
341
+ ZoomType[ZoomType["x"] = 0] = "x";
342
+ ZoomType[ZoomType["y"] = 1] = "y";
343
+ ZoomType[ZoomType["xy"] = 2] = "xy";
344
+ })(ZoomType || (ZoomType = {}));
345
+
346
+ var BrushType;
347
+ (function (BrushType) {
348
+ BrushType[BrushType["x"] = 0] = "x";
349
+ BrushType[BrushType["y"] = 1] = "y";
350
+ BrushType[BrushType["xy"] = 2] = "xy";
351
+ })(BrushType || (BrushType = {}));
352
+
353
+ class BroadcastService {
354
+ constructor() {
355
+ this.emitter = new Subject();
356
+ }
357
+ broadcast(value) {
358
+ this.emitter.next(value);
359
+ }
360
+ subscribeToChannel(channel) {
361
+ return this.emitter
362
+ .asObservable()
363
+ .pipe(filter((msg) => channel && msg.channel === channel));
364
+ }
365
+ }
366
+ BroadcastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BroadcastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
367
+ BroadcastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BroadcastService, providedIn: 'root' });
368
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BroadcastService, decorators: [{
369
+ type: Injectable,
370
+ args: [{
371
+ providedIn: 'root',
372
+ }]
373
+ }], ctorParameters: function () { return []; } });
374
+
375
+ class ZoomService {
376
+ constructor(scaleService, broadcastService, chartService) {
377
+ this.scaleService = scaleService;
378
+ this.broadcastService = broadcastService;
379
+ this.chartService = chartService;
380
+ this.zoomed$ = new Subject();
381
+ this.x = new Map();
382
+ this.y = new Map();
383
+ this.initialZoom = zoomIdentity;
384
+ this.zoomed = this.zoomed$.asObservable();
385
+ merge(of(1), this.chartService.size)
386
+ .pipe(map((_) => {
387
+ this.x = new Map(this.scaleService.xScales);
388
+ this.y = new Map(this.scaleService.yScales);
389
+ if (this.svg) {
390
+ const currentTransform = d3.zoomTransform(this.svg.node());
391
+ this.setZoom(currentTransform);
392
+ }
393
+ }))
394
+ .subscribe();
395
+ }
396
+ applyZoom(svgElement, config, size) {
397
+ this.broadcastSubscribtion?.unsubscribe();
398
+ this.svg = d3.select(svgElement.nativeElement);
399
+ const zoomType = config?.zoom?.type;
400
+ const enable = config?.zoom?.enable;
401
+ const zoomed = (event) => {
402
+ const { transform } = event;
403
+ if (zoomType === ZoomType.x || zoomType === ZoomType.xy) {
404
+ for (let [index, scale] of this.x.entries()) {
405
+ this.scaleService.xScales.set(index, transform.rescaleX(scale));
406
+ }
407
+ }
408
+ if (zoomType === ZoomType.y || zoomType === ZoomType.xy) {
409
+ for (let [index, scale] of this.y.entries()) {
410
+ this.scaleService.yScales.set(index, transform.rescaleY(scale));
411
+ }
412
+ }
413
+ if (enable) {
414
+ this.zoomed$.next({ event });
415
+ if (event.sourceEvent) {
416
+ this.broadcastService.broadcast({
417
+ channel: config?.zoom?.syncChannel,
418
+ message: event,
419
+ domain: this.scaleService[config?.zoom?.type === ZoomType.x ? 'xScales' : 'yScales']
420
+ .get(config.brush?.axisIndex ?? 0)
421
+ .domain(),
422
+ });
423
+ }
424
+ }
425
+ };
426
+ if (enable) {
427
+ this.zoom = d3
428
+ .zoom()
429
+ .scaleExtent([1, Infinity])
430
+ .extent([
431
+ [0, 0],
432
+ [size.width, size.height],
433
+ ]);
434
+ this.zoom.on('start zoom end', zoomed);
435
+ this.svg.call(this.zoom);
436
+ this.svg.call(this.zoom.transform, this.initialZoom);
437
+ const sc = config?.zoom?.type === ZoomType.x
438
+ ? this.x.get(config.brush?.axisIndex ?? 0)
439
+ : this.y.get(config.brush?.axisIndex ?? 0);
440
+ this.broadcastSubscribtion = this.broadcastService
441
+ .subscribeToChannel(config?.zoom?.syncChannel)
442
+ .pipe(map((_) => {
443
+ const currentTransform = d3.zoomTransform(this.svg.node());
444
+ const { message } = _;
445
+ if (currentTransform !== message?.transform) {
446
+ if (message.selection) {
447
+ const s = message.selection;
448
+ const domain = sc.domain();
449
+ const scale = (domain[1] - domain[0]) / (s[1] - s[0]);
450
+ let transform = zoomIdentity.scale(scale);
451
+ if (message?.brushType === BrushType.x) {
452
+ transform = transform.translate(-sc(s[0]), 0);
453
+ }
454
+ if (message?.brushType === BrushType.y) {
455
+ transform = transform.translate(0, -sc(s[0]));
456
+ }
457
+ this.setZoom(transform);
458
+ return;
459
+ }
460
+ this.setZoom(message?.transform);
461
+ }
462
+ }))
463
+ .subscribe();
464
+ }
465
+ }
466
+ setZoom(transform) {
467
+ // requestAnimationFrame(() => {
468
+ //
469
+ // });
470
+ this.svg?.call(this.zoom.transform, transform);
471
+ }
472
+ }
473
+ ZoomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ZoomService, deps: [{ token: ScaleService }, { token: BroadcastService }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Injectable });
474
+ ZoomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ZoomService, providedIn: 'root' });
475
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ZoomService, decorators: [{
476
+ type: Injectable,
477
+ args: [{
478
+ providedIn: 'root',
479
+ }]
480
+ }], ctorParameters: function () { return [{ type: ScaleService }, { type: BroadcastService }, { type: ChartService }]; } });
481
+
482
+ class BrushService {
483
+ constructor(broadcastService, scaleService) {
484
+ this.broadcastService = broadcastService;
485
+ this.scaleService = scaleService;
486
+ this.brushMap = new Map()
487
+ .set(BrushType.x, d3.brushX())
488
+ .set(BrushType.y, d3.brushY());
489
+ this.scaleMap = new Map()
490
+ .set(BrushType.x, 'xScales')
491
+ .set(BrushType.y, 'yScales');
492
+ }
493
+ applyBrush(svgElement, config, size) {
494
+ this.broadcastSubscribtion?.unsubscribe();
495
+ if (config.brush?.enable) {
496
+ const s = this.scaleService[this.scaleMap.get(config?.brush?.type ?? BrushType.x)].get(config?.brush?.axisIndex ?? 0);
497
+ const brush = this.brushMap.get(config?.brush?.type ?? BrushType.x);
498
+ const container = d3.select(svgElement.nativeElement);
499
+ const brushBehavior = brush.on('start brush end', (_) => {
500
+ if (_.sourceEvent) {
501
+ const [from, to] = _.selection;
502
+ if (to - from < 5) {
503
+ container.call(brush.move, [from, to]);
504
+ return;
505
+ }
506
+ this.broadcastService.broadcast({
507
+ channel: config?.zoom?.syncChannel,
508
+ message: {
509
+ ..._,
510
+ selection: [s.invert(from), s.invert(to)],
511
+ brushType: config?.brush?.type ?? BrushType.x,
512
+ },
513
+ });
514
+ }
515
+ });
516
+ container.call(brushBehavior);
517
+ setTimeout(() => {
518
+ container.call(brush.move, s.domain().map(s), {});
519
+ });
520
+ this.broadcastSubscribtion = this.broadcastService
521
+ .subscribeToChannel(config?.zoom?.syncChannel)
522
+ .pipe(map((_) => {
523
+ if (_.message?.transform) {
524
+ const s = this.scaleService[this.scaleMap.get(config?.brush?.type ?? BrushType.x)].get(config?.brush?.axisIndex ?? 0);
525
+ const domain = _.domain;
526
+ container.call(brush.move, [s(domain[0]), s(domain[1])]);
527
+ }
528
+ }))
529
+ .subscribe();
530
+ }
531
+ }
532
+ }
533
+ BrushService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BrushService, deps: [{ token: BroadcastService }, { token: ScaleService }], target: i0.ɵɵFactoryTarget.Injectable });
534
+ BrushService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BrushService, providedIn: 'root' });
535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BrushService, decorators: [{
536
+ type: Injectable,
537
+ args: [{
538
+ providedIn: 'root',
539
+ }]
540
+ }], ctorParameters: function () { return [{ type: BroadcastService }, { type: ScaleService }]; } });
541
+
542
+ class ChartBounds {
543
+ constructor(options) {
544
+ this.top = 0;
545
+ this.right = 30;
546
+ this.bottom = 0;
547
+ this.left = 0;
548
+ this.top = options?.top || this.top;
549
+ this.right = options?.right || this.right;
550
+ this.bottom = options?.bottom || this.bottom;
551
+ this.left = options?.left || this.left;
552
+ }
553
+ }
554
+
555
+ class TooltipComponent {
556
+ constructor(svc, cdr, zoomService, sanitizer) {
557
+ this.svc = svc;
558
+ this.cdr = cdr;
559
+ this.zoomService = zoomService;
560
+ this.sanitizer = sanitizer;
561
+ this.tooltips = [];
562
+ this.alive = true;
563
+ }
564
+ ngOnInit() {
565
+ this.display = merge(this.svc.pointerMove, this.zoomService.zoomed).pipe(map(({ event }) => {
566
+ const opacity = event?.type === 'mousemove' ? 1 : 0;
567
+ return opacity;
568
+ }), tap(() => {
569
+ requestAnimationFrame(() => {
570
+ this.cdr.detectChanges();
571
+ });
572
+ }));
573
+ this.position = this.svc.pointerMove.pipe(filter(({ event }) => event), map((_) => {
574
+ return this.getPoisition(_);
575
+ }), tap((_) => this.cdr.detectChanges()));
576
+ const transformHtml = (html) => {
577
+ return this.sanitizer.bypassSecurityTrustHtml(html);
578
+ };
579
+ const defaultFormatter = (tooltips) => {
580
+ let html = '';
581
+ tooltips.forEach((_) => {
582
+ const indicatorStyle = `display:block; width: 10px; height: 2px; background-color: ${_?.series?.color}`;
583
+ html += `<div class="display-flex align-center"><span class="margin-right-1" style="${indicatorStyle}"></span>
584
+ <span class="font-title-3">${_.series.name}
585
+ <span class="font-body-3">x: ${_.point.x?.toFixed(2)} y: ${_.point.y?.toFixed(2)}</span></span></div>`;
586
+ });
587
+ return transformHtml(html);
588
+ };
589
+ const formatter = this.svc.config?.tooltip?.format;
590
+ this.displayTooltips = merge(this.svc.pointerMove.pipe(tap((_) => (this.tooltips = []))), this.svc.tooltips).pipe(takeWhile((_) => this.alive), filter((_) => !_['event']), map((tooltip) => {
591
+ if (tooltip) {
592
+ this.tooltips.push(tooltip);
593
+ }
594
+ const formatted = formatter
595
+ ? formatter(this.tooltips)
596
+ : defaultFormatter(this.tooltips);
597
+ return formatted;
598
+ }));
599
+ }
600
+ getPoisition({ event }) {
601
+ const centerX = this.size.width / 2;
602
+ const centerY = this.size.height / 2;
603
+ const padding = { x: 10, y: 10 };
604
+ const scene = {
605
+ left: event.pageX > centerX ? 'initial' : `${event.pageX + padding.x}px`,
606
+ top: event.pageY > centerY ? 'initial' : `${event.pageY + padding.y}px`,
607
+ bottom: event.pageY > centerY
608
+ ? `${window.innerHeight - event.pageY}px`
609
+ : 'initial',
610
+ right: event.pageX > centerX
611
+ ? `${window.innerWidth - event.pageX + padding.x}px`
612
+ : 'initial',
613
+ };
614
+ return scene;
615
+ }
616
+ ngOnDestroy() {
617
+ this.alive = false;
618
+ }
619
+ }
620
+ TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: TooltipComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ZoomService }, { token: i3.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
621
+ TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: TooltipComponent, selector: "teta-tooltip", inputs: { size: "size" }, ngImport: i0, template: "<ng-container *ngIf=\"position | async as p\">\n\n <div class=\"chart-tooltip color-text-90 bg-background-50 shadow-2 padding-2 border-radius-1\"\n [style.position]=\"'fixed'\"\n [style.opacity]=\"display | async\"\n style=\"pointer-events: none;\"\n [style.left]=\"p.left\"\n [style.top]=\"p.top\"\n [style.bottom]=\"p.bottom\"\n [style.right]=\"p.right\"\n [innerHTML]=\"displayTooltips | async\">\n </div>\n</ng-container>\n\n", styles: [":host{position:absolute}.chart-tooltip{transition:all .1s ease}\n"], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i4.AsyncPipe } });
622
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: TooltipComponent, decorators: [{
623
+ type: Component,
624
+ args: [{ selector: 'teta-tooltip', template: "<ng-container *ngIf=\"position | async as p\">\n\n <div class=\"chart-tooltip color-text-90 bg-background-50 shadow-2 padding-2 border-radius-1\"\n [style.position]=\"'fixed'\"\n [style.opacity]=\"display | async\"\n style=\"pointer-events: none;\"\n [style.left]=\"p.left\"\n [style.top]=\"p.top\"\n [style.bottom]=\"p.bottom\"\n [style.right]=\"p.right\"\n [innerHTML]=\"displayTooltips | async\">\n </div>\n</ng-container>\n\n", styles: [":host{position:absolute}.chart-tooltip{transition:all .1s ease}\n"] }]
625
+ }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ZoomService }, { type: i3.DomSanitizer }]; }, propDecorators: { size: [{
626
+ type: Input
627
+ }] } });
628
+
629
+ class YAxisComponent {
630
+ constructor(scaleService, chartService, cdr, zoomService) {
631
+ this.scaleService = scaleService;
632
+ this.chartService = chartService;
633
+ this.cdr = cdr;
634
+ this.zoomService = zoomService;
635
+ this._alive = true;
636
+ merge(this.zoomService.zoomed, this.chartService.size)
637
+ .pipe(takeWhile(() => this._alive), tap((_) => {
638
+ this.draw();
639
+ this.cdr.markForCheck();
640
+ }))
641
+ .subscribe();
642
+ }
643
+ ngOnInit() { }
644
+ ngOnDestroy() {
645
+ this._alive = false;
646
+ }
647
+ ngAfterViewInit() {
648
+ this.draw();
649
+ }
650
+ getLabelTransform() {
651
+ return `translate(${this.axis.options.opposite
652
+ ? this.axis.selfSize - 24
653
+ : -this.axis.selfSize + 24}, ${this.size.height / 2}) rotate(${this.axis.options.opposite ? '90' : '-90'})`;
654
+ }
655
+ draw() {
656
+ const scale = this.scaleService.yScales.get(this.axis.index);
657
+ const axis = this.axis.options.opposite
658
+ ? d3
659
+ .axisRight(scale)
660
+ // .tickValues(this.axis.tickValues)
661
+ .tickFormat(this.axis.options.tickFormat ?? this.axis.defaultFormatter())
662
+ : d3
663
+ .axisLeft(scale)
664
+ // .tickValues(this.axis.tickValues)
665
+ .tickFormat(this.axis.options.tickFormat ?? this.axis.defaultFormatter());
666
+ d3.select(this.node.nativeElement)
667
+ .call(axis)
668
+ .call((_) => _.select('.domain').remove());
669
+ }
670
+ }
671
+ YAxisComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: YAxisComponent, deps: [{ token: ScaleService }, { token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ZoomService }], target: i0.ɵɵFactoryTarget.Component });
672
+ YAxisComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: YAxisComponent, selector: "[teta-y-axis]", inputs: { axis: "axis", size: "size" }, viewQueries: [{ propertyName: "node", first: true, predicate: ["svg"], descendants: true }], ngImport: i0, template: "<svg:g #svg></svg:g>\n<svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text dy=\"-8px\" text-anchor=\"middle\" dominant-baseline=\"middle\">{{ axis.options.title }}</text>\n</svg:g>\n", styles: [":host{shape-rendering:crispEdges}::ng-deep .tick text{fill:var(--color-text-70)}::ng-deep .tick line{stroke:var(--color-text-20)}:host .label-axis{fill:var(--color-text-70)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: YAxisComponent, decorators: [{
674
+ type: Component,
675
+ args: [{ selector: '[teta-y-axis]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g #svg></svg:g>\n<svg:g class=\"label-axis font-caption\" [attr.transform]=\"getLabelTransform()\">\n <text dy=\"-8px\" text-anchor=\"middle\" dominant-baseline=\"middle\">{{ axis.options.title }}</text>\n</svg:g>\n", styles: [":host{shape-rendering:crispEdges}::ng-deep .tick text{fill:var(--color-text-70)}::ng-deep .tick line{stroke:var(--color-text-20)}:host .label-axis{fill:var(--color-text-70)}\n"] }]
676
+ }], ctorParameters: function () { return [{ type: ScaleService }, { type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ZoomService }]; }, propDecorators: { axis: [{
677
+ type: Input
678
+ }], size: [{
679
+ type: Input
680
+ }], node: [{
681
+ type: ViewChild,
682
+ args: ['svg']
683
+ }] } });
684
+
685
+ class XAxisComponent {
686
+ constructor(scaleService, chartService, cdr, zoomService) {
687
+ this.scaleService = scaleService;
688
+ this.chartService = chartService;
689
+ this.cdr = cdr;
690
+ this.zoomService = zoomService;
691
+ this._alive = true;
692
+ merge(this.zoomService.zoomed, this.chartService.size)
693
+ .pipe(takeWhile(() => this._alive), tap((_) => {
694
+ this.draw();
695
+ this.cdr.detectChanges();
696
+ }))
697
+ .subscribe();
698
+ }
699
+ ngOnInit() { }
700
+ ngOnDestroy() {
701
+ this._alive = false;
702
+ }
703
+ ngAfterViewInit() {
704
+ this.draw();
705
+ }
706
+ draw() {
707
+ const scale = this.scaleService.xScales.get(this.axis.index);
708
+ const axis = this.axis.options.opposite
709
+ ? d3
710
+ .axisTop(scale)
711
+ .tickFormat(this.axis.options.tickFormat ?? this.axis.defaultFormatter())
712
+ : d3
713
+ .axisBottom(scale)
714
+ .tickFormat(this.axis.options.tickFormat ?? this.axis.defaultFormatter());
715
+ d3.select(this.node.nativeElement)
716
+ .call(axis)
717
+ .call((_) => _.select('.domain').remove());
718
+ }
719
+ }
720
+ XAxisComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: XAxisComponent, deps: [{ token: ScaleService }, { token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ZoomService }], target: i0.ɵɵFactoryTarget.Component });
721
+ XAxisComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: XAxisComponent, selector: "[teta-x-axis]", inputs: { axis: "axis", size: "size" }, viewQueries: [{ propertyName: "node", first: true, predicate: ["svg"], descendants: true }], ngImport: i0, template: "<svg:g #svg></svg:g>\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
722
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: XAxisComponent, decorators: [{
723
+ type: Component,
724
+ args: [{ selector: '[teta-x-axis]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g #svg></svg:g>\n", styles: [":host .tick{stroke:var(--color-text-20)}\n"] }]
725
+ }], ctorParameters: function () { return [{ type: ScaleService }, { type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ZoomService }]; }, propDecorators: { axis: [{
726
+ type: Input
727
+ }], size: [{
728
+ type: Input
729
+ }], node: [{
730
+ type: ViewChild,
731
+ args: ['svg']
732
+ }] } });
733
+
734
+ class GridlinesComponent {
735
+ constructor(scaleService, axesService, chartService, zoomService, cdr) {
736
+ this.scaleService = scaleService;
737
+ this.axesService = axesService;
738
+ this.chartService = chartService;
739
+ this.zoomService = zoomService;
740
+ this.cdr = cdr;
741
+ merge(this.chartService.size, this.zoomService.zoomed)
742
+ .pipe(tap(() => {
743
+ this.draw();
744
+ this.cdr.detectChanges();
745
+ }))
746
+ .subscribe();
747
+ }
748
+ draw() {
749
+ this.y = this.scaleService.yScales.get(0);
750
+ this.x = this.scaleService.xScales.get(0);
751
+ this.tickYValues = this.y.ticks();
752
+ this.tickXValues = this.x.ticks();
753
+ }
754
+ ngOnInit() {
755
+ this.draw();
756
+ }
757
+ }
758
+ GridlinesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GridlinesComponent, deps: [{ token: ScaleService }, { token: AxesService }, { token: ChartService }, { token: ZoomService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
759
+ GridlinesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: GridlinesComponent, selector: "[teta-gridlines]", inputs: { size: "size" }, ngImport: i0, template: "<ng-container *ngFor=\"let tick of tickYValues\">\n <svg:line [attr.x1]=\"0\" stroke=\"red\" [attr.y1]=\"y(tick)\" [attr.x2]=\"size?.width\" [attr.y2]=\"y(tick)\"></svg:line>\n</ng-container>\n\n<ng-container *ngFor=\"let tick of tickXValues\">\n <svg:line [attr.x1]=\"x(tick)\" stroke=\"red\" [attr.y1]=\"0\" [attr.x2]=\"x(tick)\" [attr.y2]=\"size?.height\"></svg:line>\n</ng-container>\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke-dasharray:1,4;stroke:var(--color-text-20)}\n"], directives: [{ type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
760
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GridlinesComponent, decorators: [{
761
+ type: Component,
762
+ args: [{ selector: '[teta-gridlines]', template: "<ng-container *ngFor=\"let tick of tickYValues\">\n <svg:line [attr.x1]=\"0\" stroke=\"red\" [attr.y1]=\"y(tick)\" [attr.x2]=\"size?.width\" [attr.y2]=\"y(tick)\"></svg:line>\n</ng-container>\n\n<ng-container *ngFor=\"let tick of tickXValues\">\n <svg:line [attr.x1]=\"x(tick)\" stroke=\"red\" [attr.y1]=\"0\" [attr.x2]=\"x(tick)\" [attr.y2]=\"size?.height\"></svg:line>\n</ng-container>\n", styles: [":host{shape-rendering:crispEdges}:host line{stroke-dasharray:1,4;stroke:var(--color-text-20)}\n"] }]
763
+ }], ctorParameters: function () { return [{ type: ScaleService }, { type: AxesService }, { type: ChartService }, { type: ZoomService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { size: [{
764
+ type: Input
765
+ }] } });
766
+
767
+ class PlotlineComponent {
768
+ constructor(cdr, zoomService, scaleService, chartService, element) {
769
+ this.cdr = cdr;
770
+ this.zoomService = zoomService;
771
+ this.scaleService = scaleService;
772
+ this.chartService = chartService;
773
+ this.element = element;
774
+ this.orientation = AxisOrientation;
775
+ this.zoomService.zoomed.subscribe(() => {
776
+ this.scale = this.scaleService[this.axis.orientation === AxisOrientation.x ? 'xScales' : 'yScales'].get(this.axis.index);
777
+ this.cdr.detectChanges();
778
+ });
779
+ }
780
+ ngOnInit() {
781
+ this.scale = this.scaleService[this.axis.orientation === AxisOrientation.x ? 'xScales' : 'yScales'].get(this.axis.index);
782
+ this.domain = this.scale.domain();
783
+ const plotlineElement = d3
784
+ .select(this.element.nativeElement)
785
+ .select('.plotline');
786
+ const grabElement = d3
787
+ .select(this.element.nativeElement)
788
+ .selectAll('.grabber');
789
+ const drag = d3
790
+ .drag()
791
+ .subject(() => {
792
+ if (this.axis.orientation === AxisOrientation.y) {
793
+ return { y: plotlineElement.attr('y1') };
794
+ }
795
+ if (this.axis.orientation === AxisOrientation.x) {
796
+ return { x: plotlineElement.attr('x1') };
797
+ }
798
+ })
799
+ .on('start drag end', (event, d) => {
800
+ d.value = this.scale.invert(event[AxisOrientation[this.axis.orientation]]);
801
+ this.emit({
802
+ event,
803
+ target: d,
804
+ });
805
+ this.cdr.detectChanges();
806
+ });
807
+ plotlineElement.datum(this.plotline);
808
+ grabElement.datum(this.plotline);
809
+ if (this.plotline.draggable) {
810
+ grabElement.call(drag);
811
+ }
812
+ }
813
+ emit(event) {
814
+ this.chartService.emitPlotline(event);
815
+ }
816
+ get value() {
817
+ return this.scale(this.plotline.value);
818
+ }
819
+ get height() {
820
+ return this.size.height;
821
+ }
822
+ get width() {
823
+ return this.size.width;
824
+ }
825
+ }
826
+ PlotlineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PlotlineComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: ZoomService }, { token: ScaleService }, { token: ChartService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
827
+ PlotlineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: PlotlineComponent, selector: "[teta-plot-line]", inputs: { plotline: "plotline", size: "size", axis: "axis" }, ngImport: i0, template: "<svg:line class=\"plotline\"\n [attr.stroke]=\"plotline.style?.stroke || 'red'\"\n [attr.stroke-width]=\"plotline.style?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotline.style?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? value : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? value : width\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : value\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : value\">\n</svg:line>\n\n<svg:line class=\"grabber\"\n\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [attr.stroke]=\"'red'\"\n [attr.stroke-width]=\"8\"\n opacity=\"0\"\n [attr.x1]=\"axis.orientation === orientation.x ? value : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? value : width\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : value\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : value\">\n</svg:line>\n", styles: [":host .x-grabber{cursor:col-resize}:host .y-grabber{cursor:row-resize}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
828
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PlotlineComponent, decorators: [{
829
+ type: Component,
830
+ args: [{ selector: '[teta-plot-line]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:line class=\"plotline\"\n [attr.stroke]=\"plotline.style?.stroke || 'red'\"\n [attr.stroke-width]=\"plotline.style?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotline.style?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? value : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? value : width\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : value\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : value\">\n</svg:line>\n\n<svg:line class=\"grabber\"\n\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [attr.stroke]=\"'red'\"\n [attr.stroke-width]=\"8\"\n opacity=\"0\"\n [attr.x1]=\"axis.orientation === orientation.x ? value : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? value : width\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : value\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : value\">\n</svg:line>\n", styles: [":host .x-grabber{cursor:col-resize}:host .y-grabber{cursor:row-resize}\n"] }]
831
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: ZoomService }, { type: ScaleService }, { type: ChartService }, { type: i0.ElementRef }]; }, propDecorators: { plotline: [{
832
+ type: Input
833
+ }], size: [{
834
+ type: Input
835
+ }], axis: [{
836
+ type: Input
837
+ }] } });
838
+
839
+ class PlotbandComponent {
840
+ constructor(scaleService, zoomService, chartService, cdr, element) {
841
+ this.scaleService = scaleService;
842
+ this.zoomService = zoomService;
843
+ this.chartService = chartService;
844
+ this.cdr = cdr;
845
+ this.element = element;
846
+ this.orientation = AxisOrientation;
847
+ this.zoomService.zoomed.subscribe(() => {
848
+ this.scale = this.scaleService[this.axis.orientation === AxisOrientation.x ? 'xScales' : 'yScales'].get(this.axis.index);
849
+ this.cdr.detectChanges();
850
+ });
851
+ }
852
+ emit(event) {
853
+ this.chartService.emitPlotband(event);
854
+ }
855
+ ngOnInit() {
856
+ this.scale = this.scaleService[this.axis.orientation === AxisOrientation.x ? 'xScales' : 'yScales'].get(this.axis.index);
857
+ this.domain = this.scale.domain();
858
+ const plotbandElement = d3
859
+ .select(this.element.nativeElement)
860
+ .select('.plotband');
861
+ const grabElements = d3
862
+ .select(this.element.nativeElement)
863
+ .selectAll('.grabber');
864
+ const drag = d3
865
+ .drag()
866
+ .subject(() => {
867
+ if (this.axis.orientation === AxisOrientation.x) {
868
+ return { x: plotbandElement.attr('x') };
869
+ }
870
+ if (this.axis.orientation === AxisOrientation.y) {
871
+ return { y: plotbandElement.attr('y') };
872
+ }
873
+ })
874
+ .on('start drag end', (event, d) => {
875
+ requestAnimationFrame(() => {
876
+ let bandSize = parseFloat(plotbandElement.attr(this.axis.orientation === AxisOrientation.x ? 'width' : 'height'));
877
+ d.to = this.scale.invert(event[AxisOrientation[this.axis.orientation]] +
878
+ (this.axis.orientation === AxisOrientation.x ? bandSize : 0));
879
+ d.from = this.scale.invert(event[AxisOrientation[this.axis.orientation]] +
880
+ (this.axis.orientation === AxisOrientation.y ? bandSize : 0));
881
+ this.emit({
882
+ event,
883
+ target: d,
884
+ });
885
+ this.cdr.detectChanges();
886
+ });
887
+ });
888
+ let grabberKey;
889
+ const resize = d3
890
+ .drag()
891
+ .on('start drag end', (event, d) => {
892
+ requestAnimationFrame(() => {
893
+ if (event?.type === 'start') {
894
+ const { grabber } = event?.sourceEvent?.target?.dataset;
895
+ grabberKey = grabber;
896
+ }
897
+ const min = Math.min(...this.domain);
898
+ const max = Math.max(...this.domain);
899
+ const minValue = d.min ?? min;
900
+ const maxValue = d.max ?? max;
901
+ d[grabberKey] = this.scale.invert(event[AxisOrientation[this.axis.orientation]]);
902
+ if (grabberKey === 'from') {
903
+ const borderMin = d.from <= minValue;
904
+ if (d.from >= d.to) {
905
+ d.from = d.to;
906
+ }
907
+ if (borderMin) {
908
+ d.from = minValue;
909
+ }
910
+ }
911
+ if (grabberKey === 'to') {
912
+ const borderMax = d.to >= maxValue;
913
+ if (borderMax) {
914
+ d.to = maxValue;
915
+ }
916
+ if (d.to <= d.from) {
917
+ d.to = d.from;
918
+ }
919
+ }
920
+ this.emit({
921
+ event,
922
+ target: d,
923
+ });
924
+ this.cdr.detectChanges();
925
+ });
926
+ });
927
+ plotbandElement.datum(this.plotband);
928
+ grabElements.datum(this.plotband);
929
+ if (this.plotband.draggable) {
930
+ plotbandElement.call(drag);
931
+ }
932
+ if (this.plotband.resizable) {
933
+ grabElements.call(resize);
934
+ }
935
+ }
936
+ get bandSize() {
937
+ return Math.abs(this.scale(this.plotband.to) - this.scale(this.plotband.from));
938
+ }
939
+ get height() {
940
+ return this.size.height;
941
+ }
942
+ get width() {
943
+ return this.size.width;
944
+ }
945
+ get from() {
946
+ return this.scale(this.plotband.from);
947
+ }
948
+ get to() {
949
+ return this.scale(this.plotband.to);
950
+ }
951
+ getFill(d) {
952
+ if (d.style?.plotband?.patternImage) {
953
+ return `url(#${d.style.plotband?.patternImage})`;
954
+ }
955
+ return d.style.plotband?.fill;
956
+ }
957
+ }
958
+ PlotbandComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PlotbandComponent, deps: [{ token: ScaleService }, { token: ZoomService }, { token: ChartService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
959
+ PlotbandComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: PlotbandComponent, selector: "[teta-plot-band]", inputs: { plotband: "plotband", axis: "axis", size: "size" }, ngImport: i0, template: "<svg:rect class=\"plotband\"\n [attr.fill]=\"getFill(plotband)\"\n [attr.opacity]=\"plotband.style?.plotband?.opacity\"\n [attr.height]=\"axis.orientation === orientation.x ? height : bandSize\"\n [attr.width]=\"axis.orientation === orientation.x ? bandSize : width\"\n [attr.y]=\"axis.orientation === orientation.y ? to : null\"\n [attr.x]=\"axis.orientation === orientation.x ? from : null\">\n</svg:rect>\n\n<svg:line class=\"display-grabber\"\n [attr.stroke]=\"plotband.style?.grabbers?.stroke || 'red'\"\n [attr.stroke-width]=\"plotband.style?.grabbers?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotband.style?.grabbers?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? from : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? from : width\"\n [attr.data-grabber]=\"'from'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : from\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : from\">\n</svg:line>\n\n<svg:line class=\"display-grabber\"\n [attr.stroke]=\"plotband.style?.grabbers?.stroke || 'red'\"\n [attr.stroke-width]=\"plotband.style?.grabbers?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotband.style?.grabbers?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? to : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? to : width\"\n [attr.data-grabber]=\"'to'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : to\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : to\">\n</svg:line>\n\n<svg:line class=\"grabber\"\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [attr.stroke]=\"'red'\"\n [attr.stroke-width]=\"8\"\n opacity=\"0\"\n [attr.x1]=\"axis.orientation === orientation.x ? from : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? from : width\"\n [attr.data-grabber]=\"'from'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : from\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : from\">\n</svg:line>\n\n<svg:line class=\"grabber\"\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [attr.stroke]=\"'red'\"\n [attr.stroke-width]=\"8\"\n opacity=\"0\"\n [attr.x1]=\"axis.orientation === orientation.x ? to : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? to : width\"\n [attr.data-grabber]=\"'to'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : to\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : to\">\n</svg:line>\n\n\n", styles: [":host rect:hover{cursor:grab}:host rect:active{cursor:grabbing}:host .x-grabber{cursor:col-resize}:host .y-grabber{cursor:row-resize}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
960
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PlotbandComponent, decorators: [{
961
+ type: Component,
962
+ args: [{ selector: '[teta-plot-band]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:rect class=\"plotband\"\n [attr.fill]=\"getFill(plotband)\"\n [attr.opacity]=\"plotband.style?.plotband?.opacity\"\n [attr.height]=\"axis.orientation === orientation.x ? height : bandSize\"\n [attr.width]=\"axis.orientation === orientation.x ? bandSize : width\"\n [attr.y]=\"axis.orientation === orientation.y ? to : null\"\n [attr.x]=\"axis.orientation === orientation.x ? from : null\">\n</svg:rect>\n\n<svg:line class=\"display-grabber\"\n [attr.stroke]=\"plotband.style?.grabbers?.stroke || 'red'\"\n [attr.stroke-width]=\"plotband.style?.grabbers?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotband.style?.grabbers?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? from : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? from : width\"\n [attr.data-grabber]=\"'from'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : from\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : from\">\n</svg:line>\n\n<svg:line class=\"display-grabber\"\n [attr.stroke]=\"plotband.style?.grabbers?.stroke || 'red'\"\n [attr.stroke-width]=\"plotband.style?.grabbers?.strokeWidth || 4\"\n [attr.stroke-dasharray]=\"plotband.style?.grabbers?.strokeDasharray\"\n [attr.x1]=\"axis.orientation === orientation.x ? to : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? to : width\"\n [attr.data-grabber]=\"'to'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : to\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : to\">\n</svg:line>\n\n<svg:line class=\"grabber\"\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [attr.stroke]=\"'red'\"\n [attr.stroke-width]=\"8\"\n opacity=\"0\"\n [attr.x1]=\"axis.orientation === orientation.x ? from : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? from : width\"\n [attr.data-grabber]=\"'from'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : from\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : from\">\n</svg:line>\n\n<svg:line class=\"grabber\"\n [class.x-grabber]=\"axis.orientation === orientation.x\"\n [class.y-grabber]=\"axis.orientation === orientation.y\"\n [attr.stroke]=\"'red'\"\n [attr.stroke-width]=\"8\"\n opacity=\"0\"\n [attr.x1]=\"axis.orientation === orientation.x ? to : 0\"\n [attr.x2]=\"axis.orientation === orientation.x ? to : width\"\n [attr.data-grabber]=\"'to'\"\n [attr.y1]=\"axis.orientation === orientation.x ? 0 : to\"\n [attr.y2]=\"axis.orientation === orientation.x ? height : to\">\n</svg:line>\n\n\n", styles: [":host rect:hover{cursor:grab}:host rect:active{cursor:grabbing}:host .x-grabber{cursor:col-resize}:host .y-grabber{cursor:row-resize}\n"] }]
963
+ }], ctorParameters: function () { return [{ type: ScaleService }, { type: ZoomService }, { type: ChartService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { plotband: [{
964
+ type: Input
965
+ }], axis: [{
966
+ type: Input
967
+ }], size: [{
968
+ type: Input
969
+ }] } });
970
+
971
+ class SeriesBaseComponent {
972
+ constructor(svc, cdr, scaleService, zoomService, element) {
973
+ this.svc = svc;
974
+ this.cdr = cdr;
975
+ this.scaleService = scaleService;
976
+ this.zoomService = zoomService;
977
+ this.element = element;
978
+ this.zoomService.zoomed
979
+ .pipe(tap((_) => {
980
+ this.cdr.detectChanges();
981
+ }))
982
+ .subscribe();
983
+ }
984
+ ngOnInit() { }
985
+ }
986
+ SeriesBaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SeriesBaseComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
987
+ SeriesBaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: SeriesBaseComponent, selector: "ng-component", inputs: { series: "series", size: "size" }, ngImport: i0, template: '', isInline: true });
988
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SeriesBaseComponent, decorators: [{
989
+ type: Component,
990
+ args: [{
991
+ template: '',
992
+ }]
993
+ }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; }, propDecorators: { series: [{
994
+ type: Input
995
+ }], size: [{
996
+ type: Input
997
+ }] } });
998
+
999
+ var TooltipTracking;
1000
+ (function (TooltipTracking) {
1001
+ TooltipTracking[TooltipTracking["x"] = 0] = "x";
1002
+ TooltipTracking[TooltipTracking["y"] = 1] = "y";
1003
+ })(TooltipTracking || (TooltipTracking = {}));
1004
+
1005
+ var DragPointType;
1006
+ (function (DragPointType) {
1007
+ DragPointType[DragPointType["x"] = 0] = "x";
1008
+ DragPointType[DragPointType["y"] = 1] = "y";
1009
+ DragPointType[DragPointType["xy"] = 2] = "xy";
1010
+ })(DragPointType || (DragPointType = {}));
1011
+
1012
+ class LineSeriesComponent extends SeriesBaseComponent {
1013
+ constructor(svc, cdr, scaleService, zoomService, element) {
1014
+ super(svc, cdr, scaleService, zoomService, element);
1015
+ this.svc = svc;
1016
+ this.cdr = cdr;
1017
+ this.scaleService = scaleService;
1018
+ this.zoomService = zoomService;
1019
+ this.element = element;
1020
+ }
1021
+ ngOnInit() {
1022
+ this.display = this.zoomService.zoomed.pipe(map(({ event }) => {
1023
+ return event?.type === 'end' ? 1 : 0;
1024
+ }));
1025
+ this.transform = this.svc.pointerMove.pipe(filter(({ event }) => event), map(({ event }) => {
1026
+ return this.getTransform(event);
1027
+ }), tap((_) => this.cdr.detectChanges()));
1028
+ }
1029
+ ngAfterViewInit() {
1030
+ const drag = (node, event, d) => {
1031
+ if (d.marker?.dragType === DragPointType.x ||
1032
+ d.marker?.dragType === DragPointType.xy) {
1033
+ d.x = this.x.invert(event.x);
1034
+ }
1035
+ if (d.marker?.dragType === DragPointType.y ||
1036
+ d.marker?.dragType === DragPointType.xy) {
1037
+ d.y = this.y.invert(event.y);
1038
+ }
1039
+ this.svc.emitPoint({
1040
+ target: {
1041
+ series: this.series,
1042
+ point: d,
1043
+ },
1044
+ event,
1045
+ });
1046
+ this.cdr.detectChanges();
1047
+ };
1048
+ const dragMarkers = d3
1049
+ .drag()
1050
+ .subject(function (event, d) {
1051
+ const node = d3.select(this);
1052
+ return { x: node.attr('cx'), y: node.attr('cy') };
1053
+ })
1054
+ .on('start drag end', function (event, d) {
1055
+ const node = d3.select(this);
1056
+ drag(node, event, d);
1057
+ });
1058
+ const draggableMarkers = this.series.data?.filter((_) => _?.marker && _?.marker?.draggable);
1059
+ const element = d3
1060
+ .select(this.element.nativeElement)
1061
+ .selectAll('.draggable-marker')
1062
+ .data(draggableMarkers);
1063
+ element.call(dragMarkers);
1064
+ this.svgElement = d3
1065
+ .select(this.element.nativeElement)
1066
+ .select('.line')
1067
+ .node();
1068
+ }
1069
+ getPath() {
1070
+ this.x = this.scaleService.xScales.get(this.series.xAxisIndex);
1071
+ this.y = this.scaleService.yScales.get(this.series.yAxisIndex);
1072
+ const line = d3
1073
+ .line()
1074
+ .defined((point) => point.x !== null || point.y !== null)
1075
+ .x((point) => this.x(point.x))
1076
+ .y((point) => this.y(point.y));
1077
+ const path = line(this.series.data);
1078
+ return path;
1079
+ }
1080
+ getMarkers() {
1081
+ return this.series.data?.filter((_) => _?.marker);
1082
+ }
1083
+ getTransform(event) {
1084
+ const mouse = d3.pointer(event);
1085
+ const foundX = this.scaleService.xScales.get(this.series.xAxisIndex);
1086
+ const foundY = this.scaleService.yScales.get(this.series.yAxisIndex);
1087
+ const tooltipTracking = this.svc.config?.tooltip?.tracking;
1088
+ const lineIntersection = (p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y) => {
1089
+ const rV = {};
1090
+ let s1_x, s1_y, s2_x, s2_y;
1091
+ s1_x = p1_x - p0_x;
1092
+ s1_y = p1_y - p0_y;
1093
+ s2_x = p3_x - p2_x;
1094
+ s2_y = p3_y - p2_y;
1095
+ let s, t;
1096
+ s =
1097
+ (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) /
1098
+ (-s2_x * s1_y + s1_x * s2_y);
1099
+ t =
1100
+ (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) /
1101
+ (-s2_x * s1_y + s1_x * s2_y);
1102
+ if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
1103
+ // Collision detected
1104
+ rV.x = p0_x + t * s1_x;
1105
+ rV.y = p0_y + t * s1_y;
1106
+ }
1107
+ return rV;
1108
+ };
1109
+ if (tooltipTracking === TooltipTracking.x) {
1110
+ const bisect = d3.bisector((_) => _.x).right;
1111
+ const x0 = foundX.invert(mouse[0]);
1112
+ const rightId = bisect(this.series.data, x0);
1113
+ const range = foundY.range();
1114
+ const intersect = lineIntersection(mouse[0], range[0], mouse[0], range[1], foundX(this.series.data[rightId - 1]?.x), foundY(this.series.data[rightId - 1]?.y), foundX(this.series.data[rightId]?.x), foundY(this.series.data[rightId]?.y));
1115
+ console.log(intersect);
1116
+ this.svc.setTooltip({
1117
+ point: { x: foundX.invert(intersect.x), y: foundY.invert(intersect.y) },
1118
+ series: this.series,
1119
+ });
1120
+ return {
1121
+ x: intersect.x,
1122
+ y: intersect.y,
1123
+ };
1124
+ }
1125
+ if (tooltipTracking === TooltipTracking.y) {
1126
+ const bisect = d3.bisector((_) => _.y).right;
1127
+ const y0 = foundY.invert(mouse[1]);
1128
+ const rightId = bisect(this.series.data, y0);
1129
+ const range = foundX.range();
1130
+ const intersect = lineIntersection(range[0], mouse[1], range[1], mouse[1], foundX(this.series.data[rightId - 1]?.x), foundY(this.series.data[rightId - 1]?.y), foundX(this.series.data[rightId]?.x), foundY(this.series.data[rightId]?.y));
1131
+ this.svc.setTooltip({
1132
+ point: { x: foundX.invert(intersect.x), y: foundY.invert(intersect.y) },
1133
+ series: this.series,
1134
+ });
1135
+ return {
1136
+ x: intersect.x,
1137
+ y: intersect.y,
1138
+ };
1139
+ }
1140
+ }
1141
+ }
1142
+ LineSeriesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: LineSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1143
+ LineSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: LineSeriesComponent, selector: "svg:svg[teta-line-series]", usesInheritance: true, ngImport: i0, template: "<svg:path\n class=\"line\"\n [attr.d]=\"getPath()\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n\n<ng-container *ngIf=\"transform | async as t\">\n <svg:circle\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n [attr.opacity]=\"display | async\">\n </svg:circle>\n</ng-container>\n\n<ng-container *ngIf=\"getMarkers() as markers\">\n\n <svg:circle\n class=\"marker\"\n *ngFor=\"let point of markers\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n\n\n</ng-container>\n\n\n\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1144
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: LineSeriesComponent, decorators: [{
1145
+ type: Component,
1146
+ args: [{ selector: 'svg:svg[teta-line-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:path\n class=\"line\"\n [attr.d]=\"getPath()\"\n [attr.stroke]=\"series.color\"\n [attr.stroke-width]=\"series.style?.strokeWidth\"\n fill=\"none\">\n</svg:path>\n\n<ng-container *ngIf=\"transform | async as t\">\n <svg:circle\n r=\"3\"\n [attr.fill]=\"series.color\"\n [attr.transform]=\"'translate('+ t.x +', '+ t.y +')'\"\n [attr.opacity]=\"display | async\">\n </svg:circle>\n</ng-container>\n\n<ng-container *ngIf=\"getMarkers() as markers\">\n\n <svg:circle\n class=\"marker\"\n *ngFor=\"let point of markers\"\n [class.draggable-marker]=\"point?.marker?.draggable\"\n [attr.r]=\"point.marker.style?.radius ?? 5\"\n [attr.fill]=\"point.marker.style?.fill ?? 'transparent'\"\n [attr.stroke]=\"point.marker.style?.stroke ?? 'none'\"\n [attr.stroke-width]=\"point.marker.style?.strokeWidth\"\n [attr.stroke-dasharray]=\"point.marker.style?.strokeDasharray\"\n [attr.cx]=\"x(point.x)\"\n [attr.cy]=\"y(point.y)\"\n >\n </svg:circle>\n\n\n</ng-container>\n\n\n\n", styles: [".draggable-marker{cursor:move}.active{stroke-opacity:.5}.marker-grab{opacity:0}\n"] }]
1147
+ }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; } });
1148
+
1149
+ class BarSeriesComponent extends SeriesBaseComponent {
1150
+ constructor(svc, cdr, scaleService, zoomService, element) {
1151
+ super(svc, cdr, scaleService, zoomService, element);
1152
+ this.svc = svc;
1153
+ this.cdr = cdr;
1154
+ this.scaleService = scaleService;
1155
+ this.zoomService = zoomService;
1156
+ this.element = element;
1157
+ }
1158
+ ngOnInit() {
1159
+ const x = this.scaleService.xScales.get(this.series.xAxisIndex);
1160
+ const y = this.scaleService.yScales.get(this.series.yAxisIndex);
1161
+ const domain = this.series.data?.map((_) => _.x);
1162
+ const range = [x(domain[0]), x(domain[domain?.length - 1])];
1163
+ this.scaleBand = d3.scaleBand().domain(domain).range(range);
1164
+ this.y = y;
1165
+ }
1166
+ width() {
1167
+ return this.scaleBand.bandwidth();
1168
+ }
1169
+ height(point) {
1170
+ return Math.abs(this.y(0) - this.y(point.y));
1171
+ }
1172
+ getX(point) {
1173
+ return this.scaleBand(point.x);
1174
+ }
1175
+ getY(point) {
1176
+ return this.y(point.y);
1177
+ }
1178
+ ngOnChanges(changes) {
1179
+ console.log(changes);
1180
+ }
1181
+ }
1182
+ BarSeriesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BarSeriesComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: ScaleService }, { token: ZoomService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1183
+ BarSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: BarSeriesComponent, selector: "svg:svg[teta-bar-series]", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<svg:rect *ngFor=\"let point of series.data\" [attr.y]=\"getY(point)\" [attr.x]=\"getX(point)\" [attr.width]=\"width()\"\n [attr.height]=\"height(point)\"\n [attr.fill]=\"point.color\"></svg:rect>\n", styles: [""], directives: [{ type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1184
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BarSeriesComponent, decorators: [{
1185
+ type: Component,
1186
+ args: [{ selector: 'svg:svg[teta-bar-series]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:rect *ngFor=\"let point of series.data\" [attr.y]=\"getY(point)\" [attr.x]=\"getX(point)\" [attr.width]=\"width()\"\n [attr.height]=\"height(point)\"\n [attr.fill]=\"point.color\"></svg:rect>\n", styles: [""] }]
1187
+ }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: ScaleService }, { type: ZoomService }, { type: i0.ElementRef }]; } });
1188
+
1189
+ var SeriesType;
1190
+ (function (SeriesType) {
1191
+ SeriesType[SeriesType["line"] = 0] = "line";
1192
+ SeriesType[SeriesType["bar"] = 1] = "bar";
1193
+ })(SeriesType || (SeriesType = {}));
1194
+
1195
+ class SeriesHostComponent {
1196
+ constructor(viewContainerRef, chartService) {
1197
+ this.viewContainerRef = viewContainerRef;
1198
+ this.chartService = chartService;
1199
+ this.defaultSeriesTypeMapping = new Map()
1200
+ .set(SeriesType.line, LineSeriesComponent)
1201
+ .set(SeriesType.bar, BarSeriesComponent);
1202
+ this._init = false;
1203
+ this.chartService.size
1204
+ .pipe(throttleTime(100, null, { trailing: true }), tap(() => {
1205
+ this._componentRef?.injector.get(ChangeDetectorRef).detectChanges();
1206
+ }))
1207
+ .subscribe();
1208
+ }
1209
+ ngOnInit() {
1210
+ if (!SeriesBaseComponent.isPrototypeOf(this.series.component)) {
1211
+ this.series.component =
1212
+ this.defaultSeriesTypeMapping.get(this.series.type) ||
1213
+ LineSeriesComponent;
1214
+ }
1215
+ this._componentRef = this.viewContainerRef.createComponent(this.series.component);
1216
+ this._componentRef.instance.series = this.series;
1217
+ this._componentRef.instance.size = this.size;
1218
+ this._init = true;
1219
+ }
1220
+ ngOnDestroy() { }
1221
+ ngOnChanges(changes) {
1222
+ if (this._init && changes.hasOwnProperty('series')) {
1223
+ this._componentRef.instance.series = this.series;
1224
+ this._componentRef.instance.size = this.size;
1225
+ this._componentRef.injector.get(ChangeDetectorRef).markForCheck();
1226
+ this._componentRef.injector.get(ChangeDetectorRef).detectChanges();
1227
+ }
1228
+ }
1229
+ }
1230
+ SeriesHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SeriesHostComponent, deps: [{ token: i0.ViewContainerRef }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Component });
1231
+ SeriesHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: SeriesHostComponent, selector: "[teta-series-host]", inputs: { series: "series", size: "size" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1232
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SeriesHostComponent, decorators: [{
1233
+ type: Component,
1234
+ args: [{
1235
+ selector: '[teta-series-host]',
1236
+ template: '',
1237
+ changeDetection: ChangeDetectionStrategy.OnPush,
1238
+ }]
1239
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: ChartService }]; }, propDecorators: { series: [{
1240
+ type: Input
1241
+ }], size: [{
1242
+ type: Input
1243
+ }] } });
1244
+
1245
+ class BrushableDirective {
1246
+ constructor(brushService, chartService, element) {
1247
+ this.brushService = brushService;
1248
+ this.chartService = chartService;
1249
+ this.element = element;
1250
+ }
1251
+ ngOnInit() { }
1252
+ ngAfterViewInit() {
1253
+ this.brushService.applyBrush(this.element, this.config, this.size);
1254
+ }
1255
+ }
1256
+ BrushableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BrushableDirective, deps: [{ token: BrushService }, { token: ChartService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1257
+ BrushableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: BrushableDirective, selector: "svg:svg[tetaBrushable]", inputs: { config: "config", size: "size" }, ngImport: i0 });
1258
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: BrushableDirective, decorators: [{
1259
+ type: Directive,
1260
+ args: [{
1261
+ selector: 'svg:svg[tetaBrushable]',
1262
+ }]
1263
+ }], ctorParameters: function () { return [{ type: BrushService }, { type: ChartService }, { type: i0.ElementRef }]; }, propDecorators: { config: [{
1264
+ type: Input
1265
+ }], size: [{
1266
+ type: Input
1267
+ }] } });
1268
+
1269
+ class ZoomableDirective {
1270
+ constructor(element, svc, chartService) {
1271
+ this.element = element;
1272
+ this.svc = svc;
1273
+ this.chartService = chartService;
1274
+ this.zoomable = false;
1275
+ }
1276
+ ngOnInit() {
1277
+ if (this.config?.zoom?.enable || this.axis?.options?.zoom) {
1278
+ this.zoomable = true;
1279
+ this.svc.applyZoom(this.element, this.chartService.config, this.size);
1280
+ }
1281
+ }
1282
+ ngAfterViewInit() { }
1283
+ }
1284
+ ZoomableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ZoomableDirective, deps: [{ token: i0.ElementRef }, { token: ZoomService }, { token: ChartService }], target: i0.ɵɵFactoryTarget.Directive });
1285
+ ZoomableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: ZoomableDirective, selector: "[tetaZoomable]", inputs: { config: "config", axis: "axis", size: "size" }, host: { properties: { "class.zoomable": "this.zoomable" } }, ngImport: i0 });
1286
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ZoomableDirective, decorators: [{
1287
+ type: Directive,
1288
+ args: [{
1289
+ selector: '[tetaZoomable]',
1290
+ }]
1291
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ZoomService }, { type: ChartService }]; }, propDecorators: { config: [{
1292
+ type: Input
1293
+ }], axis: [{
1294
+ type: Input
1295
+ }], size: [{
1296
+ type: Input
1297
+ }], zoomable: [{
1298
+ type: HostBinding,
1299
+ args: ['class.zoomable']
1300
+ }] } });
1301
+
1302
+ class ChartContainerComponent {
1303
+ constructor(_svc, _cdr, _elementRef, _axesService) {
1304
+ this._svc = _svc;
1305
+ this._cdr = _cdr;
1306
+ this._elementRef = _elementRef;
1307
+ this._axesService = _axesService;
1308
+ this.filterPositionMap = new Map()
1309
+ .set(true, (axis) => (_) => _.options.opposite && _.options.visible && axis.index <= _.index)
1310
+ .set(false, (axis) => (_) => _.options.opposite !== true &&
1311
+ _.options.visible &&
1312
+ _.index <= axis.index);
1313
+ this.sumSize = (acc, curr) => acc + curr.selfSize;
1314
+ this.size = this._svc.size.pipe(throttleTime(100, undefined, { trailing: true }), tap(() => {
1315
+ setTimeout(() => {
1316
+ this._cdr.detectChanges();
1317
+ });
1318
+ }));
1319
+ this.yAxes = this._axesService.yAxis;
1320
+ this.xAxes = this._axesService.xAxis;
1321
+ this.uniqId = (Date.now() + Math.random()).toString(36);
1322
+ }
1323
+ ngOnInit() {
1324
+ this._observer = new ResizeObserver((entries) => {
1325
+ this._svc.setSize(entries[0].contentRect);
1326
+ });
1327
+ this._observer.observe(this._elementRef.nativeElement);
1328
+ this._svc.init(this.config);
1329
+ }
1330
+ oppositeFilter(axis) {
1331
+ return (_) => _.options.opposite && _.options.visible && axis.index <= _.index;
1332
+ }
1333
+ nonOppositeFilter(axis) {
1334
+ return (_) => _.options.opposite !== true && _.options.visible && _.index <= axis.index;
1335
+ }
1336
+ getVisibleRect(size) {
1337
+ const yAxesArray = [...this.yAxes.values()];
1338
+ const xAxesArray = [...this.xAxes.values()];
1339
+ const left = yAxesArray
1340
+ .filter((_) => _.options.opposite !== true && _.options.visible)
1341
+ .reduce(this.sumSize, 0);
1342
+ const right = yAxesArray
1343
+ .filter((_) => _.options.opposite && _.options.visible)
1344
+ .reduce(this.sumSize, 0);
1345
+ const bottom = xAxesArray
1346
+ .filter((_) => _.options.opposite !== true && _.options.visible)
1347
+ .reduce(this.sumSize, 0);
1348
+ const top = xAxesArray
1349
+ .filter((_) => _.options.opposite && _.options.visible)
1350
+ .reduce(this.sumSize, 0);
1351
+ const rect = {
1352
+ left,
1353
+ top,
1354
+ width: size.width - left - right + 1,
1355
+ height: size.height - top - bottom + 1,
1356
+ };
1357
+ return rect;
1358
+ }
1359
+ getYAxisTranslate(axis, size) {
1360
+ const yAxesArray = [...this.yAxes.values()];
1361
+ const translateOpposite = yAxesArray
1362
+ .filter(this.nonOppositeFilter(axis))
1363
+ .reduce(this.sumSize, 0);
1364
+ const translateNonOpposite = yAxesArray
1365
+ .filter(this.oppositeFilter(axis))
1366
+ .reduce(this.sumSize, 0);
1367
+ return `translate(${axis.options.opposite
1368
+ ? size.width - translateNonOpposite
1369
+ : translateOpposite}, 0)`;
1370
+ }
1371
+ getXAxisTranslate(axis, size) {
1372
+ const xAxesArray = [...this.xAxes.values()];
1373
+ const translateNonOpposite = xAxesArray
1374
+ .filter(this.nonOppositeFilter(axis))
1375
+ .reduce(this.sumSize, 0);
1376
+ const translateOpposite = xAxesArray
1377
+ .filter(this.oppositeFilter(axis))
1378
+ .reduce(this.sumSize, 0);
1379
+ return `translate(0, ${axis.options.opposite
1380
+ ? translateOpposite
1381
+ : size.height - translateNonOpposite})`;
1382
+ }
1383
+ getTranslate(axis, size) {
1384
+ const xAxesArray = [...this.xAxes.values()];
1385
+ const yAxesArray = [...this.yAxes.values()];
1386
+ const oppositeFilter = this.filterPositionMap.get(true);
1387
+ const nonOppositeFilter = this.filterPositionMap.get(false);
1388
+ const oppositeOffsetY = yAxesArray.filter(oppositeFilter(axis));
1389
+ const nonOppositeOffsetY = yAxesArray.filter(nonOppositeFilter(axis));
1390
+ const oppositeOffsetX = xAxesArray.filter(oppositeFilter(axis));
1391
+ const nonOppositeOffsetX = xAxesArray.filter(nonOppositeFilter(axis));
1392
+ const oppositeTranslateY = oppositeOffsetY.reduce((acc, curr) => acc + curr.selfSize, 0);
1393
+ const nonOppisteTranslateY = nonOppositeOffsetY.reduce((acc, curr) => acc + curr.selfSize, 0);
1394
+ const oppositeTranslateX = oppositeOffsetX.reduce((acc, curr) => acc + curr.selfSize, 0);
1395
+ const nonOppisteTranslateX = nonOppositeOffsetX.reduce((acc, curr) => acc + curr.selfSize, 0);
1396
+ const left = yAxesArray
1397
+ .filter((_) => _.options.visible && _.options.opposite !== true)
1398
+ .reduce((acc, curr) => acc + curr.selfSize, 0);
1399
+ const top = xAxesArray
1400
+ .filter((_) => _.options.visible && _.options.opposite === true)
1401
+ .reduce((acc, curr) => acc + curr.selfSize, 0);
1402
+ if (axis.orientation === AxisOrientation.x) {
1403
+ return `translate(${left}, ${axis.options.opposite
1404
+ ? oppositeTranslateX
1405
+ : size.height - nonOppisteTranslateX})`;
1406
+ }
1407
+ if (axis.orientation === AxisOrientation.y) {
1408
+ return `translate(${axis.options.opposite
1409
+ ? size.width - oppositeTranslateY
1410
+ : nonOppisteTranslateY}, ${top})`;
1411
+ }
1412
+ return 'translate(0, 0)';
1413
+ }
1414
+ mouseMove(event) {
1415
+ this._svc.setPointerMove(event);
1416
+ }
1417
+ mouseLeave(event) {
1418
+ this._svc.setPointerMove(event);
1419
+ }
1420
+ id() {
1421
+ return this.uniqId;
1422
+ }
1423
+ ngAfterContentChecked() { }
1424
+ ngAfterViewChecked() { }
1425
+ ngOnChanges(changes) { }
1426
+ }
1427
+ ChartContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartContainerComponent, deps: [{ token: ChartService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: AxesService }], target: i0.ɵɵFactoryTarget.Component });
1428
+ ChartContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChartContainerComponent, selector: "teta-chart-container", inputs: { config: "config" }, usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"size | async as s\">\n <teta-tooltip [size]=\"s\"></teta-tooltip>\n <svg\n [tetaZoomable]\n [tetaBrushable]\n [size]=\"s\"\n [config]=\"config\"\n [attr.width]=\"s.width\"\n [attr.height]=\"s.height\"\n [attr.viewBox]=\"'0 0 '+s.width+' '+s.height\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousemove)=\"mouseMove($event)\">\n <ng-container *ngIf=\"getVisibleRect(s) as rect\">\n <defs>\n <clipPath [attr.id]=\"'visible-window-' + id()\">\n <rect [attr.x]=\"rect.left\" [attr.y]=\"rect.top\" [attr.width]=\"rect.width\" [attr.height]=\"rect.height\"></rect>\n </clipPath>\n </defs>\n\n <g class=\"y-axis-container\">\n <g *ngFor=\"let item of yAxes | keyvalue\"\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"s\"\n [attr.transform]=\"getTranslate(item.value, s)\"></g>\n </g>\n <g class=\"x-axis-container\">\n <g *ngFor=\"let item of xAxes | keyvalue\"\n teta-x-axis\n\n [axis]=\"item.value\"\n [size]=\"s\"\n [attr.transform]=\"getTranslate(item.value, s)\"></g>\n </g>\n <g [attr.clip-path]=\"'url(#visible-window-'+ id() +')'\">\n <g [attr.transform]=\"'translate('+ rect.left +', '+ rect.top +')'\">\n <g class=\"gridlines\" teta-gridlines [size]=\"s\"></g>\n\n <g class=\"x-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of config.xAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotline of axis.plotlines\" [plotline]=\"plotline\" [size]=\"s\"\n [axis]=\"xAxes.get(i)\"></g>\n </ng-container>\n </g>\n\n <g class=\"y-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of config.yAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotline of axis.plotlines\" [plotline]=\"plotline\" [size]=\"s\"\n [axis]=\"yAxes.get(i)\"></g>\n </ng-container>\n </g>\n\n <g class=\"x-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of config.xAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotband of axis.plotbands\" [plotband]=\"plotband\" [size]=\"s\"\n [axis]=\"xAxes.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of config.yAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotband of axis.plotbands\" [plotband]=\"plotband\" [size]=\"s\"\n [axis]=\"yAxes.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"series-tooltip-line-marker\"></g>\n <g class=\"series-container\">\n <g teta-series-host\n *ngFor=\"let series of config.series\"\n [series]=\"series\"\n [size]=\"s\"></g>\n </g>\n </g>\n </g>\n </ng-container>\n </svg>\n\n\n</ng-container>\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-width:0;min-height:0}:host .zoomable:hover{cursor:grab}:host .zoomable:active{cursor:grabbing}\n"], components: [{ type: TooltipComponent, selector: "teta-tooltip", inputs: ["size"] }, { type: YAxisComponent, selector: "[teta-y-axis]", inputs: ["axis", "size"] }, { type: XAxisComponent, selector: "[teta-x-axis]", inputs: ["axis", "size"] }, { type: GridlinesComponent, selector: "[teta-gridlines]", inputs: ["size"] }, { type: PlotlineComponent, selector: "[teta-plot-line]", inputs: ["plotline", "size", "axis"] }, { type: PlotbandComponent, selector: "[teta-plot-band]", inputs: ["plotband", "axis", "size"] }, { type: SeriesHostComponent, selector: "[teta-series-host]", inputs: ["series", "size"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BrushableDirective, selector: "svg:svg[tetaBrushable]", inputs: ["config", "size"] }, { type: ZoomableDirective, selector: "[tetaZoomable]", inputs: ["config", "axis", "size"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe, "keyvalue": i4.KeyValuePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1429
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartContainerComponent, decorators: [{
1430
+ type: Component,
1431
+ args: [{ selector: 'teta-chart-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"size | async as s\">\n <teta-tooltip [size]=\"s\"></teta-tooltip>\n <svg\n [tetaZoomable]\n [tetaBrushable]\n [size]=\"s\"\n [config]=\"config\"\n [attr.width]=\"s.width\"\n [attr.height]=\"s.height\"\n [attr.viewBox]=\"'0 0 '+s.width+' '+s.height\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousemove)=\"mouseMove($event)\">\n <ng-container *ngIf=\"getVisibleRect(s) as rect\">\n <defs>\n <clipPath [attr.id]=\"'visible-window-' + id()\">\n <rect [attr.x]=\"rect.left\" [attr.y]=\"rect.top\" [attr.width]=\"rect.width\" [attr.height]=\"rect.height\"></rect>\n </clipPath>\n </defs>\n\n <g class=\"y-axis-container\">\n <g *ngFor=\"let item of yAxes | keyvalue\"\n teta-y-axis\n [axis]=\"item.value\"\n [size]=\"s\"\n [attr.transform]=\"getTranslate(item.value, s)\"></g>\n </g>\n <g class=\"x-axis-container\">\n <g *ngFor=\"let item of xAxes | keyvalue\"\n teta-x-axis\n\n [axis]=\"item.value\"\n [size]=\"s\"\n [attr.transform]=\"getTranslate(item.value, s)\"></g>\n </g>\n <g [attr.clip-path]=\"'url(#visible-window-'+ id() +')'\">\n <g [attr.transform]=\"'translate('+ rect.left +', '+ rect.top +')'\">\n <g class=\"gridlines\" teta-gridlines [size]=\"s\"></g>\n\n <g class=\"x-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of config.xAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotline of axis.plotlines\" [plotline]=\"plotline\" [size]=\"s\"\n [axis]=\"xAxes.get(i)\"></g>\n </ng-container>\n </g>\n\n <g class=\"y-axis-plotline-container\">\n <ng-container *ngFor=\"let axis of config.yAxis; let i = index\">\n <g teta-plot-line *ngFor=\"let plotline of axis.plotlines\" [plotline]=\"plotline\" [size]=\"s\"\n [axis]=\"yAxes.get(i)\"></g>\n </ng-container>\n </g>\n\n <g class=\"x-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of config.xAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotband of axis.plotbands\" [plotband]=\"plotband\" [size]=\"s\"\n [axis]=\"xAxes.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"y-axis-plotband-container\">\n <ng-container *ngFor=\"let axis of config.yAxis; let i = index\">\n <g teta-plot-band *ngFor=\"let plotband of axis.plotbands\" [plotband]=\"plotband\" [size]=\"s\"\n [axis]=\"yAxes.get(i)\"></g>\n </ng-container>\n </g>\n <g class=\"series-tooltip-line-marker\"></g>\n <g class=\"series-container\">\n <g teta-series-host\n *ngFor=\"let series of config.series\"\n [series]=\"series\"\n [size]=\"s\"></g>\n </g>\n </g>\n </g>\n </ng-container>\n </svg>\n\n\n</ng-container>\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-width:0;min-height:0}:host .zoomable:hover{cursor:grab}:host .zoomable:active{cursor:grabbing}\n"] }]
1432
+ }], ctorParameters: function () { return [{ type: ChartService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: AxesService }]; }, propDecorators: { config: [{
1433
+ type: Input
1434
+ }] } });
1435
+
1436
+ class LegendComponent {
1437
+ constructor() {
1438
+ this.sizeMapping = new Map()
1439
+ .set(SeriesType.line, 2)
1440
+ .set(SeriesType.bar, 12);
1441
+ this.classLegend = true;
1442
+ }
1443
+ ngOnInit() {
1444
+ this.series = this.series?.filter((_) => _.showInLegend !== false);
1445
+ }
1446
+ getHeight(serie) {
1447
+ return this.sizeMapping.get(serie.type);
1448
+ }
1449
+ }
1450
+ LegendComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: LegendComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1451
+ LegendComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: LegendComponent, selector: "teta-legend", inputs: { series: "series" }, host: { properties: { "class.padding-bottom-4": "this.classLegend" } }, ngImport: i0, template: "<div *ngFor=\"let serie of series\">\n <div class=\"legend-item\">\n <div class=\"legend-icon-form\" [style.height.px]=\"getHeight(serie)\" [style.background-color]=\"serie.color\"></div>\n <div class=\"legend-label\">{{ serie.name }}</div>\n </div>\n</div>\n", styles: [":host{display:flex;grid-gap:8px;flex-wrap:wrap;align-items:center;justify-content:space-evenly}:host .legend-item{display:flex;align-items:center}:host .legend-icon-form{width:12px}:host .legend-label{margin-left:5px}\n"], directives: [{ type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1452
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: LegendComponent, decorators: [{
1453
+ type: Component,
1454
+ args: [{ selector: 'teta-legend', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngFor=\"let serie of series\">\n <div class=\"legend-item\">\n <div class=\"legend-icon-form\" [style.height.px]=\"getHeight(serie)\" [style.background-color]=\"serie.color\"></div>\n <div class=\"legend-label\">{{ serie.name }}</div>\n </div>\n</div>\n", styles: [":host{display:flex;grid-gap:8px;flex-wrap:wrap;align-items:center;justify-content:space-evenly}:host .legend-item{display:flex;align-items:center}:host .legend-icon-form{width:12px}:host .legend-label{margin-left:5px}\n"] }]
1455
+ }], ctorParameters: function () { return []; }, propDecorators: { series: [{
1456
+ type: Input
1457
+ }], classLegend: [{
1458
+ type: HostBinding,
1459
+ args: ['class.padding-bottom-4']
1460
+ }] } });
1461
+
1462
+ class ChartComponent {
1463
+ constructor(svc, zoomService) {
1464
+ this.svc = svc;
1465
+ this.zoomService = zoomService;
1466
+ this.plotBandsMove = new EventEmitter();
1467
+ this.plotLinesMove = new EventEmitter();
1468
+ this.pointMove = new EventEmitter();
1469
+ }
1470
+ set config(config) {
1471
+ this._config = Object.assign({
1472
+ bounds: new ChartBounds(),
1473
+ }, config);
1474
+ }
1475
+ get config() {
1476
+ return this._config;
1477
+ }
1478
+ ngOnChanges(changes) { }
1479
+ ngOnInit() {
1480
+ this.svc.plotbandMove.subscribe((_) => {
1481
+ this.plotBandsMove.emit(_);
1482
+ });
1483
+ this.svc.plotlineMove.subscribe((_) => {
1484
+ this.plotLinesMove.emit(_);
1485
+ });
1486
+ this.svc.pointMove.subscribe((_) => {
1487
+ this.pointMove.emit(_);
1488
+ });
1489
+ }
1490
+ ngAfterViewInit() { }
1491
+ ngOnDestroy() {
1492
+ this.zoomService.broadcastSubscribtion?.unsubscribe();
1493
+ }
1494
+ }
1495
+ ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartComponent, deps: [{ token: ChartService }, { token: ZoomService }], target: i0.ɵɵFactoryTarget.Component });
1496
+ ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChartComponent, selector: "teta-chart", inputs: { config: "config" }, outputs: { plotBandsMove: "plotBandsMove", plotLinesMove: "plotLinesMove", pointMove: "pointMove" }, providers: [
1497
+ ChartService,
1498
+ ZoomService,
1499
+ ScaleService,
1500
+ AxesService,
1501
+ BrushService,
1502
+ ], usesOnChanges: true, ngImport: i0, template: "<div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container\" [config]=\"config\"></teta-chart-container>\n</div>\n\n<teta-legend *ngIf=\"config.legend?.enable === true\" [series]=\"config.series\"></teta-legend>\n", styles: [":host{display:flex;flex-direction:column;height:100%;width:100%}\n"], components: [{ type: ChartContainerComponent, selector: "teta-chart-container", inputs: ["config"] }, { type: LegendComponent, selector: "teta-legend", inputs: ["series"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1503
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartComponent, decorators: [{
1504
+ type: Component,
1505
+ args: [{ selector: 'teta-chart', providers: [
1506
+ ChartService,
1507
+ ZoomService,
1508
+ ScaleService,
1509
+ AxesService,
1510
+ BrushService,
1511
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"column column_auto\">\n <teta-chart-container class=\"chart-container\" [config]=\"config\"></teta-chart-container>\n</div>\n\n<teta-legend *ngIf=\"config.legend?.enable === true\" [series]=\"config.series\"></teta-legend>\n", styles: [":host{display:flex;flex-direction:column;height:100%;width:100%}\n"] }]
1512
+ }], ctorParameters: function () { return [{ type: ChartService }, { type: ZoomService }]; }, propDecorators: { plotBandsMove: [{
1513
+ type: Output
1514
+ }], plotLinesMove: [{
1515
+ type: Output
1516
+ }], pointMove: [{
1517
+ type: Output
1518
+ }], config: [{
1519
+ type: Input
1520
+ }] } });
1521
+
1522
+ class ChartModule {
1523
+ }
1524
+ ChartModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1525
+ ChartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, declarations: [ChartComponent,
1526
+ SeriesHostComponent,
1527
+ ChartContainerComponent,
1528
+ LegendComponent,
1529
+ SeriesBaseComponent,
1530
+ LineSeriesComponent,
1531
+ GridlinesComponent,
1532
+ XAxisComponent,
1533
+ YAxisComponent,
1534
+ PlotlineComponent,
1535
+ PlotbandComponent,
1536
+ BarSeriesComponent,
1537
+ TooltipComponent,
1538
+ ZoomableDirective,
1539
+ BrushableDirective], imports: [CommonModule], exports: [ChartComponent] });
1540
+ ChartModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, imports: [[CommonModule]] });
1541
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartModule, decorators: [{
1542
+ type: NgModule,
1543
+ args: [{
1544
+ declarations: [
1545
+ ChartComponent,
1546
+ SeriesHostComponent,
1547
+ ChartContainerComponent,
1548
+ LegendComponent,
1549
+ SeriesBaseComponent,
1550
+ LineSeriesComponent,
1551
+ GridlinesComponent,
1552
+ XAxisComponent,
1553
+ YAxisComponent,
1554
+ PlotlineComponent,
1555
+ PlotbandComponent,
1556
+ BarSeriesComponent,
1557
+ TooltipComponent,
1558
+ ZoomableDirective,
1559
+ BrushableDirective,
1560
+ ],
1561
+ exports: [ChartComponent],
1562
+ imports: [CommonModule],
1563
+ }]
1564
+ }] });
1565
+
1566
+ /*
1567
+ * Public API Surface of chart
1568
+ */
1569
+
1570
+ /**
1571
+ * Generated bundle index. Do not edit.
1572
+ */
1573
+
1574
+ export { ChartComponent, ChartModule, ChartService };
1575
+ //# sourceMappingURL=tetacom-svg-charts.mjs.map