@devexperts/dxcharts-lite 1.0.2 → 2.0.0

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 (255) hide show
  1. package/README.md +2 -2
  2. package/dist/chart/animation/canvas-animation.js +134 -1
  3. package/dist/chart/animation/types/animation.js +43 -1
  4. package/dist/chart/animation/types/color-alpha-animation.d.ts +1 -1
  5. package/dist/chart/animation/types/color-alpha-animation.js +60 -1
  6. package/dist/chart/animation/types/color-transition-animation.d.ts +1 -1
  7. package/dist/chart/animation/types/color-transition-animation.js +86 -1
  8. package/dist/chart/animation/types/viewport-movement-animation.js +63 -1
  9. package/dist/chart/animation/viewport-model-animation.js +20 -1
  10. package/dist/chart/bootstrap.d.ts +51 -48
  11. package/dist/chart/bootstrap.js +449 -1
  12. package/dist/chart/canvas/canvas-bounds-container.d.ts +0 -5
  13. package/dist/chart/canvas/canvas-bounds-container.js +815 -1
  14. package/dist/chart/canvas/canvas-chart-html.js +16 -18
  15. package/dist/chart/canvas/chart-elements.d.ts +1 -4
  16. package/dist/chart/canvas/chart-elements.js +22 -1
  17. package/dist/chart/canvas/cursor.handler.js +122 -1
  18. package/dist/chart/canvas/layout-creator.js +34 -1
  19. package/dist/chart/canvas/y-axis-bounds.container.d.ts +2 -2
  20. package/dist/chart/canvas/y-axis-bounds.container.js +67 -1
  21. package/dist/chart/chart-container.js +1 -1
  22. package/dist/chart/chart.config.d.ts +4 -5
  23. package/dist/chart/chart.config.js +645 -1
  24. package/dist/chart/chart.d.ts +62 -0
  25. package/dist/chart/chart.js +106 -0
  26. package/dist/chart/components/chart/basic-scale.d.ts +2 -2
  27. package/dist/chart/components/chart/basic-scale.js +31 -1
  28. package/dist/chart/components/chart/candle-transformer.functions.js +15 -1
  29. package/dist/chart/components/chart/candle-width-calculator.functions.js +2 -1
  30. package/dist/chart/components/chart/candle.functions.js +44 -1
  31. package/dist/chart/components/chart/chart-area-pan.handler.d.ts +3 -3
  32. package/dist/chart/components/chart/chart-area-pan.handler.js +197 -1
  33. package/dist/chart/components/chart/chart-base.model.js +66 -1
  34. package/dist/chart/components/chart/chart.component.d.ts +7 -3
  35. package/dist/chart/components/chart/chart.component.js +408 -1
  36. package/dist/chart/components/chart/chart.model.d.ts +4 -11
  37. package/dist/chart/components/chart/chart.model.js +954 -1
  38. package/dist/chart/components/chart/data-series.high-low-provider.js +34 -1
  39. package/dist/chart/components/chart/fake-candles.js +97 -1
  40. package/dist/chart/components/chart/price.formatter.js +35 -1
  41. package/dist/chart/components/chart/secondary-chart-colors-pool.js +68 -1
  42. package/dist/chart/components/cross_tool/cross-tool.component.js +85 -1
  43. package/dist/chart/components/cross_tool/cross-tool.drawer.js +32 -1
  44. package/dist/chart/components/cross_tool/cross-tool.model.js +107 -1
  45. package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +137 -1
  46. package/dist/chart/components/cross_tool/types/none.drawer.js +3 -1
  47. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +28 -1
  48. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +24 -1
  49. package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +53 -1
  50. package/dist/chart/components/dynamic-objects/dynamic-objects.component.d.ts +13 -0
  51. package/dist/chart/components/dynamic-objects/dynamic-objects.component.js +20 -0
  52. package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.d.ts +18 -0
  53. package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.js +23 -0
  54. package/dist/chart/components/dynamic-objects/dynamic-objects.model.d.ts +63 -0
  55. package/dist/chart/components/dynamic-objects/dynamic-objects.model.js +136 -0
  56. package/dist/chart/components/events/events-hit-test.drawer.js +63 -1
  57. package/dist/chart/components/events/events.component.js +61 -1
  58. package/dist/chart/components/events/events.drawer.js +195 -1
  59. package/dist/chart/components/events/events.model.js +69 -1
  60. package/dist/chart/components/grid/grid.component.d.ts +2 -2
  61. package/dist/chart/components/grid/grid.component.js +31 -1
  62. package/dist/chart/components/grid/grid.drawer.d.ts +4 -3
  63. package/dist/chart/components/grid/grid.drawer.js +106 -1
  64. package/dist/chart/components/high_low/high-low.component.js +12 -1
  65. package/dist/chart/components/high_low/high-low.drawer.js +126 -1
  66. package/dist/chart/components/highlights/highlights.component.js +46 -1
  67. package/dist/chart/components/highlights/highlights.drawer.js +154 -1
  68. package/dist/chart/components/highlights/highlights.model.js +75 -1
  69. package/dist/chart/components/labels_generator/numeric-axis-labels.generator.d.ts +1 -1
  70. package/dist/chart/components/labels_generator/numeric-axis-labels.generator.js +199 -1
  71. package/dist/chart/components/navigation_map/navigation-map-move.handler.d.ts +2 -2
  72. package/dist/chart/components/navigation_map/navigation-map-move.handler.js +108 -1
  73. package/dist/chart/components/navigation_map/navigation-map.component.js +112 -1
  74. package/dist/chart/components/navigation_map/navigation-map.drawer.js +244 -1
  75. package/dist/chart/components/navigation_map/navigation-map.model.js +33 -2
  76. package/dist/chart/components/pan/chart-pan.component.d.ts +2 -2
  77. package/dist/chart/components/pan/chart-pan.component.js +51 -1
  78. package/dist/chart/components/pane/extent/y-extent-component.d.ts +12 -18
  79. package/dist/chart/components/pane/extent/y-extent-component.js +120 -1
  80. package/dist/chart/components/pane/pane-hit-test.controller.js +55 -1
  81. package/dist/chart/components/pane/pane-manager.component.d.ts +10 -5
  82. package/dist/chart/components/pane/pane-manager.component.js +148 -1
  83. package/dist/chart/components/pane/pane.component.d.ts +16 -32
  84. package/dist/chart/components/pane/pane.component.js +278 -1
  85. package/dist/chart/components/resizer/bar-resizer.component.js +139 -1
  86. package/dist/chart/components/resizer/bar-resizer.drawer.js +46 -1
  87. package/dist/chart/components/snapshot/snapshot.component.js +48 -1
  88. package/dist/chart/components/volumes/separate-volumes.component.d.ts +6 -10
  89. package/dist/chart/components/volumes/separate-volumes.component.js +63 -1
  90. package/dist/chart/components/volumes/volume-color-resolvers.functions.js +18 -1
  91. package/dist/chart/components/volumes/volumes.component.d.ts +6 -7
  92. package/dist/chart/components/volumes/volumes.component.js +94 -1
  93. package/dist/chart/components/volumes/volumes.drawer.d.ts +5 -12
  94. package/dist/chart/components/volumes/volumes.drawer.js +140 -1
  95. package/dist/chart/components/volumes/volumes.formatter.js +31 -1
  96. package/dist/chart/components/volumes/volumes.model.d.ts +2 -2
  97. package/dist/chart/components/volumes/volumes.model.js +43 -1
  98. package/dist/chart/components/watermark/water-mark.component.js +103 -1
  99. package/dist/chart/components/watermark/water-mark.drawer.js +187 -1
  100. package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.js +27 -1
  101. package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.js +187 -1
  102. package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.js +76 -1
  103. package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.js +79 -1
  104. package/dist/chart/components/x_axis/time/parser/time-formats.model.js +14 -1
  105. package/dist/chart/components/x_axis/time/x-axis-weights.functions.d.ts +1 -1
  106. package/dist/chart/components/x_axis/time/x-axis-weights.functions.js +143 -1
  107. package/dist/chart/components/x_axis/time/x-axis-weights.generator.js +73 -1
  108. package/dist/chart/components/x_axis/x-axis-draw.functions.js +49 -1
  109. package/dist/chart/components/x_axis/x-axis-labels.drawer.js +70 -1
  110. package/dist/chart/components/x_axis/x-axis-labels.generator.d.ts +2 -2
  111. package/dist/chart/components/x_axis/x-axis-labels.generator.js +332 -1
  112. package/dist/chart/components/x_axis/x-axis-labels.model.js +35 -1
  113. package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +2 -2
  114. package/dist/chart/components/x_axis/x-axis-scale.handler.js +60 -1
  115. package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +82 -1
  116. package/dist/chart/components/x_axis/x-axis.component.d.ts +2 -2
  117. package/dist/chart/components/x_axis/x-axis.component.js +119 -1
  118. package/dist/chart/components/y_axis/label-color.functions.js +53 -1
  119. package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.d.ts +4 -4
  120. package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.js +33 -1
  121. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +3 -3
  122. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +67 -1
  123. package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +56 -1
  124. package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +95 -1
  125. package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +2 -2
  126. package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +119 -1
  127. package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +9 -8
  128. package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +201 -1
  129. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +6 -7
  130. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +58 -1
  131. package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +6 -4
  132. package/dist/chart/components/y_axis/y-axis-base-labels.model.js +47 -1
  133. package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +4 -4
  134. package/dist/chart/components/y_axis/y-axis-labels.drawer.js +161 -1
  135. package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +2 -2
  136. package/dist/chart/components/y_axis/y-axis-scale.handler.js +72 -1
  137. package/dist/chart/components/y_axis/y-axis.component.d.ts +32 -41
  138. package/dist/chart/components/y_axis/y-axis.component.js +220 -1
  139. package/dist/chart/components/y_axis/y-axis.drawer.d.ts +9 -12
  140. package/dist/chart/components/y_axis/y-axis.drawer.js +96 -1
  141. package/dist/chart/components/y_axis/y-axis.model.d.ts +9 -17
  142. package/dist/chart/components/y_axis/y-axis.model.js +33 -1
  143. package/dist/chart/drawers/chart-background.drawer.js +69 -1
  144. package/dist/chart/drawers/chart-type-drawers/area.drawer.js +69 -1
  145. package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +57 -1
  146. package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +84 -1
  147. package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +162 -1
  148. package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +57 -1
  149. package/dist/chart/drawers/chart-type-drawers/line.drawer.js +38 -1
  150. package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +19 -1
  151. package/dist/chart/drawers/clear-canvas.drawer.js +14 -1
  152. package/dist/chart/drawers/composite.drawer.js +67 -1
  153. package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +50 -1
  154. package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +35 -1
  155. package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.js +16 -1
  156. package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +106 -1
  157. package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +23 -1
  158. package/dist/chart/drawers/data-series-drawers/linear.drawer.js +19 -1
  159. package/dist/chart/drawers/data-series-drawers/points.drawer.js +19 -1
  160. package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.js +7 -1
  161. package/dist/chart/drawers/data-series-drawers/text.drawer.js +25 -1
  162. package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +35 -1
  163. package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +22 -1
  164. package/dist/chart/drawers/data-series.drawer.d.ts +5 -7
  165. package/dist/chart/drawers/data-series.drawer.js +56 -1
  166. package/dist/chart/drawers/drawing-manager.d.ts +1 -1
  167. package/dist/chart/drawers/drawing-manager.js +177 -1
  168. package/dist/chart/drawers/ht-data-series.drawer.js +37 -1
  169. package/dist/chart/events/event-bus.js +73 -1
  170. package/dist/chart/events/events.js +3 -1
  171. package/dist/chart/inputhandlers/candle-tap.handler.js +46 -1
  172. package/dist/chart/inputhandlers/chart-resize.handler.js +98 -1
  173. package/dist/chart/inputhandlers/cross-event-producer.component.js +67 -1
  174. package/dist/chart/inputhandlers/hover-producer.component.d.ts +2 -2
  175. package/dist/chart/inputhandlers/hover-producer.component.js +228 -1
  176. package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +2 -2
  177. package/dist/chart/inputhandlers/main-canvas-touch.handler.js +80 -1
  178. package/dist/chart/inputlisteners/canvas-input-listener.component.js +629 -1
  179. package/dist/chart/model/baseline.model.js +88 -1
  180. package/dist/chart/model/bounds.model.js +1 -1
  181. package/dist/chart/model/candle-hover.js +70 -1
  182. package/dist/chart/model/candle-series-high-low.provider.js +45 -1
  183. package/dist/chart/model/candle-series.model.d.ts +3 -3
  184. package/dist/chart/model/candle-series.model.js +245 -1
  185. package/dist/chart/model/candle.model.js +69 -1
  186. package/dist/chart/model/canvas.model.js +228 -1
  187. package/dist/chart/model/chart-base-element.js +129 -1
  188. package/dist/chart/model/compare-series-hover.js +25 -1
  189. package/dist/chart/model/data-series-view.d.ts +5 -5
  190. package/dist/chart/model/data-series-view.js +111 -1
  191. package/dist/chart/model/data-series.config.js +14 -1
  192. package/dist/chart/model/data-series.model.d.ts +4 -4
  193. package/dist/chart/model/data-series.model.js +281 -1
  194. package/dist/chart/model/date-time.formatter.js +151 -1
  195. package/dist/chart/model/hit-test-canvas.model.d.ts +1 -1
  196. package/dist/chart/model/hit-test-canvas.model.js +256 -1
  197. package/dist/chart/model/main-candle-series.model.d.ts +1 -1
  198. package/dist/chart/model/main-candle-series.model.js +29 -1
  199. package/dist/chart/model/scale.model.d.ts +2 -1
  200. package/dist/chart/model/scale.model.js +316 -1
  201. package/dist/chart/model/scaling/auto-scale.model.js +97 -1
  202. package/dist/chart/model/scaling/constrait.functions.js +61 -1
  203. package/dist/chart/model/scaling/lock-ratio.model.js +17 -1
  204. package/dist/chart/model/scaling/move-chart.functions.js +22 -1
  205. package/dist/chart/model/scaling/viewport.model.d.ts +2 -2
  206. package/dist/chart/model/scaling/viewport.model.js +279 -1
  207. package/dist/chart/model/scaling/x-zooming.functions.js +35 -1
  208. package/dist/chart/model/time-zone.model.js +109 -1
  209. package/dist/chart/model/visual-candle.js +134 -1
  210. package/dist/chart/utils/__tests__/array.utils.test.js +135 -1
  211. package/dist/chart/utils/__tests__/math.utils.test.js +14 -1
  212. package/dist/chart/utils/__tests__/object.utils.test.js +11 -1
  213. package/dist/chart/utils/__tests__/priceIncrementsUtils.test.js +29 -1
  214. package/dist/chart/utils/array.utils.d.ts +1 -1
  215. package/dist/chart/utils/array.utils.js +269 -1
  216. package/dist/chart/utils/auto-period-detector.utils.js +39 -1
  217. package/dist/chart/utils/candles-generator-ts.utils.js +20 -1
  218. package/dist/chart/utils/candles-generator.utils.js +161 -1
  219. package/dist/chart/utils/candles.utils.js +42 -1
  220. package/dist/chart/utils/canvas/canvas-drawing-functions.utils.js +144 -1
  221. package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.js +51 -1
  222. package/dist/chart/utils/canvas/canvas-text-functions.utils.js +156 -1
  223. package/dist/chart/utils/color.utils.js +31 -1
  224. package/dist/chart/utils/device/browser.utils.js +10 -1
  225. package/dist/chart/utils/device/device-detector.utils.js +24 -1
  226. package/dist/chart/utils/device/device-pixel-ratio.utils.js +21 -1
  227. package/dist/chart/utils/device/touchpad.utils.js +91 -1
  228. package/dist/chart/utils/dom.utils.js +15 -1
  229. package/dist/chart/utils/function.utils.js +16 -1
  230. package/dist/chart/utils/linkedList.utils.d.ts +28 -0
  231. package/dist/chart/utils/linkedList.utils.js +138 -0
  232. package/dist/chart/utils/math.utils.js +115 -1
  233. package/dist/chart/utils/merge.utils.js +56 -1
  234. package/dist/chart/utils/object.utils.js +43 -1
  235. package/dist/chart/utils/performance/animation-frame-cache.utils.js +77 -0
  236. package/dist/chart/utils/{perfomance → performance}/debounce.utils.js +7 -1
  237. package/dist/chart/utils/performance/memoize.utils.js +74 -0
  238. package/dist/chart/utils/performance/request-animation-frame-throttle.utils.js +43 -0
  239. package/dist/chart/utils/performance/throttle.utils.js +26 -0
  240. package/dist/chart/utils/price-increments.utils.d.ts +1 -0
  241. package/dist/chart/utils/price-increments.utils.js +127 -1
  242. package/dist/chart/utils/uuid.utils.js +4 -1
  243. package/dist/dxchart.min.js +9 -12
  244. package/dist/index.d.ts +3 -3
  245. package/dist/index.js +20 -1
  246. package/package.json +4 -4
  247. package/dist/chart/utils/perfomance/animation-frame-cache.utils.js +0 -6
  248. package/dist/chart/utils/perfomance/memoize.utils.js +0 -6
  249. package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.js +0 -6
  250. package/dist/chart/utils/perfomance/throttle.utils.js +0 -6
  251. /package/dist/chart/utils/{perfomance → performance}/animation-frame-cache.utils.d.ts +0 -0
  252. /package/dist/chart/utils/{perfomance → performance}/debounce.utils.d.ts +0 -0
  253. /package/dist/chart/utils/{perfomance → performance}/memoize.utils.d.ts +0 -0
  254. /package/dist/chart/utils/{perfomance → performance}/request-animation-frame-throttle.utils.d.ts +0 -0
  255. /package/dist/chart/utils/{perfomance → performance}/throttle.utils.d.ts +0 -0
@@ -3,4 +3,31 @@
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- import{defaultDragComponentOptions as a,DragNDropComponent as o}from"./drag-n-drop.component";export class DragNDropXComponent extends o{constructor(t,s,r,e,i=a){super(t,s,r,e,i)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasInputListener.observeXDragStart(this.hitTest).subscribe(this.onDragStart)),this.addRxSubscription(this.canvasInputListener.observeXDrag().subscribe(this.onDragTick)),this.addRxSubscription(this.canvasInputListener.observeXDragEnd().subscribe(this.onDragEnd))}doDeactivate(){super.doDeactivate()}}
6
+ import { defaultDragComponentOptions, DragNDropComponent, } from './drag-n-drop.component';
7
+ export class DragNDropXComponent extends DragNDropComponent {
8
+ constructor(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions = defaultDragComponentOptions) {
9
+ super(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions);
10
+ }
11
+ /**
12
+ * This method is used to activate the component and add the necessary subscriptions to the canvasInputListener.
13
+ * It calls the super method doActivate() and then adds the following subscriptions:
14
+ * - observeXDragStart() subscription with hitTest() as parameter and onDragStart() as callback function
15
+ * - observeXDrag() subscription with onDragTick() as callback function
16
+ * - observeXDragEnd() subscription with onDragEnd() as callback function
17
+ * @returns {void}
18
+ */
19
+ doActivate() {
20
+ super.doActivate();
21
+ this.addRxSubscription(this.canvasInputListener.observeXDragStart(this.hitTest).subscribe(this.onDragStart));
22
+ this.addRxSubscription(this.canvasInputListener.observeXDrag().subscribe(this.onDragTick));
23
+ this.addRxSubscription(this.canvasInputListener.observeXDragEnd().subscribe(this.onDragEnd));
24
+ }
25
+ /**
26
+ * This method overrides the doDeactivate method of the parent class and calls it using the super keyword.
27
+ * It is used to deactivate the current object and perform any necessary cleanup operations.
28
+ * @protected
29
+ */
30
+ doDeactivate() {
31
+ super.doDeactivate();
32
+ }
33
+ }
@@ -3,4 +3,27 @@
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- import{defaultDragComponentOptions as a,DragNDropComponent as o}from"./drag-n-drop.component";export class DragNDropYComponent extends o{constructor(t,s,r,e,i=a){super(t,s,r,e,i)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasInputListener.observeYDragStart(this.hitTest).subscribe(this.onDragStart)),this.addRxSubscription(this.canvasInputListener.observeYDrag().subscribe(this.onDragTick)),this.addRxSubscription(this.canvasInputListener.observeYDragEnd().subscribe(this.onDragEnd))}doDeactivate(){super.doDeactivate()}}
6
+ import { defaultDragComponentOptions, DragNDropComponent, } from './drag-n-drop.component';
7
+ export class DragNDropYComponent extends DragNDropComponent {
8
+ constructor(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions = defaultDragComponentOptions) {
9
+ super(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions);
10
+ }
11
+ /**
12
+ * This method activates the component and adds subscriptions to the canvasInputListener.
13
+ * @protected
14
+ * @returns {void}
15
+ */
16
+ doActivate() {
17
+ super.doActivate();
18
+ this.addRxSubscription(this.canvasInputListener.observeYDragStart(this.hitTest).subscribe(this.onDragStart));
19
+ this.addRxSubscription(this.canvasInputListener.observeYDrag().subscribe(this.onDragTick));
20
+ this.addRxSubscription(this.canvasInputListener.observeYDragEnd().subscribe(this.onDragEnd));
21
+ }
22
+ /**
23
+ * This method overrides the doDeactivate method of the parent class and calls the parent method before executing its own code.
24
+ * It is a protected method, which means it can only be accessed within the class and its subclasses.
25
+ */
26
+ doDeactivate() {
27
+ super.doDeactivate();
28
+ }
29
+ }
@@ -3,4 +3,56 @@
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- import{ChartBaseElement as e}from"../../model/chart-base-element";export const defaultDragComponentOptions={disableChartPanning:!0};export class DragNDropComponent extends e{constructor(t,s,i,n,r){super(),this.hitTest=t,this.dragCallbacks=s,this.canvasInputListener=i,this.chartPanComponent=n,this.dragComponentOptions=r,this.dragging=!1,this.draggedPixels=0,this.onDragStart=a=>{this.dragging=!0,this.draggedPixels=0,this.dragCallbacks.onDragStart&&this.dragCallbacks.onDragStart(a),this.dragComponentOptions.disableChartPanning&&this.chartPanComponent.deactivatePanHandlers()},this.onDragTick=a=>{this.dragging&&(this.draggedPixels+=a,this.dragCallbacks.onDragTick({delta:a,draggedPixels:this.draggedPixels}))},this.onDragEnd=()=>{this.dragging&&(this.dragging=!1,this.dragCallbacks.onDragEnd&&this.dragCallbacks.onDragEnd(this.draggedPixels),this.dragComponentOptions.disableChartPanning&&this.chartPanComponent.activateChartPanHandlers())}}doActivate(){super.doActivate()}doDeactivate(){super.doDeactivate()}}
6
+ import { ChartBaseElement } from '../../model/chart-base-element';
7
+ export const defaultDragComponentOptions = {
8
+ disableChartPanning: true,
9
+ };
10
+ export class DragNDropComponent extends ChartBaseElement {
11
+ constructor(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions) {
12
+ super();
13
+ this.hitTest = hitTest;
14
+ this.dragCallbacks = dragCallbacks;
15
+ this.canvasInputListener = canvasInputListener;
16
+ this.chartPanComponent = chartPanComponent;
17
+ this.dragComponentOptions = dragComponentOptions;
18
+ this.dragging = false;
19
+ this.draggedPixels = 0;
20
+ this.onDragStart = (point) => {
21
+ this.dragging = true;
22
+ this.draggedPixels = 0;
23
+ this.dragCallbacks.onDragStart && this.dragCallbacks.onDragStart(point);
24
+ this.dragComponentOptions.disableChartPanning && this.chartPanComponent.deactivatePanHandlers();
25
+ };
26
+ this.onDragTick = (yDelta) => {
27
+ if (this.dragging) {
28
+ this.draggedPixels += yDelta;
29
+ this.dragCallbacks.onDragTick({
30
+ delta: yDelta,
31
+ draggedPixels: this.draggedPixels,
32
+ });
33
+ }
34
+ };
35
+ this.onDragEnd = () => {
36
+ if (this.dragging) {
37
+ this.dragging = false;
38
+ this.dragCallbacks.onDragEnd && this.dragCallbacks.onDragEnd(this.draggedPixels);
39
+ this.dragComponentOptions.disableChartPanning && this.chartPanComponent.activateChartPanHandlers();
40
+ }
41
+ };
42
+ }
43
+ /**
44
+ * Calls the parent class's doActivate method and performs any additional activation logic.
45
+ * This method is protected and can only be accessed by the class itself and its subclasses.
46
+ */
47
+ doActivate() {
48
+ super.doActivate();
49
+ }
50
+ /**
51
+ * This method overrides the doDeactivate method of the parent class and calls it using the super keyword.
52
+ * It is a protected method that can only be accessed within the class and its subclasses.
53
+ * This method is responsible for deactivating the current object.
54
+ */
55
+ doDeactivate() {
56
+ super.doDeactivate();
57
+ }
58
+ }
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ import { DrawingManager } from '../../drawers/drawing-manager';
7
+ import { CanvasModel } from '../../model/canvas.model';
8
+ import { ChartBaseElement } from '../../model/chart-base-element';
9
+ import { DynamicObjectsModel } from './dynamic-objects.model';
10
+ export declare class DynamicObjectsComponent extends ChartBaseElement {
11
+ model: DynamicObjectsModel;
12
+ constructor(canvasModel: CanvasModel, drawingManager: DrawingManager);
13
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ import { ChartBaseElement } from '../../model/chart-base-element';
7
+ import { DynamicObjectsDrawer } from './dynamic-objects.drawer';
8
+ import { DynamicObjectsModel } from './dynamic-objects.model';
9
+ export class DynamicObjectsComponent extends ChartBaseElement {
10
+ constructor(canvasModel, drawingManager) {
11
+ super();
12
+ // model
13
+ const dynamicObjectsModel = new DynamicObjectsModel();
14
+ this.model = dynamicObjectsModel;
15
+ this.addChildEntity(dynamicObjectsModel);
16
+ // drawer
17
+ const dynamicObjectsDrawer = new DynamicObjectsDrawer(dynamicObjectsModel, canvasModel);
18
+ drawingManager.addDrawer(dynamicObjectsDrawer, 'DYNAMIC_OBJECTS');
19
+ }
20
+ }
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ import { Drawer } from '../../drawers/drawing-manager';
7
+ import { CanvasModel } from '../../model/canvas.model';
8
+ import { DynamicObjectsModel } from './dynamic-objects.model';
9
+ export interface DynamicModelDrawer<T> {
10
+ draw(canvasModel: CanvasModel, model: T, paneUUID?: string): void;
11
+ }
12
+ export declare class DynamicObjectsDrawer implements Drawer {
13
+ private dynamicObjectsModel;
14
+ private canvasModel;
15
+ constructor(dynamicObjectsModel: DynamicObjectsModel, canvasModel: CanvasModel);
16
+ draw(): void;
17
+ getCanvasIds(): string[];
18
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ export class DynamicObjectsDrawer {
7
+ constructor(dynamicObjectsModel, canvasModel) {
8
+ this.dynamicObjectsModel = dynamicObjectsModel;
9
+ this.canvasModel = canvasModel;
10
+ }
11
+ draw() {
12
+ const objects = this.dynamicObjectsModel.objects;
13
+ Object.entries(objects).forEach(([paneUUID, list]) => {
14
+ for (const obj of list) {
15
+ const { model, drawer } = obj;
16
+ drawer.draw(this.canvasModel, model, paneUUID);
17
+ }
18
+ });
19
+ }
20
+ getCanvasIds() {
21
+ return [this.canvasModel.canvasId];
22
+ }
23
+ }
@@ -0,0 +1,63 @@
1
+ /*
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ import { ChartBaseElement } from '../../model/chart-base-element';
7
+ import { LinkedList, ListNode } from '../../utils/linkedList.utils';
8
+ import { DynamicModelDrawer } from './dynamic-objects.drawer';
9
+ export type PaneId = string;
10
+ export interface DynamicObject<T = unknown> {
11
+ readonly drawer: DynamicModelDrawer<T>;
12
+ readonly model: T;
13
+ }
14
+ export declare class DynamicObjectsModel extends ChartBaseElement {
15
+ private _objects;
16
+ private modelToObjectMap;
17
+ constructor();
18
+ /**
19
+ * Adds an object from outside chart-core into model
20
+ * @param obj
21
+ * @param paneId
22
+ */
23
+ addObject(obj: DynamicObject, paneId: PaneId): void;
24
+ /**
25
+ * Removes an object from model
26
+ * @param model
27
+ * @param paneId
28
+ */
29
+ removeObject(model: unknown, paneId: PaneId): void;
30
+ /**
31
+ * Moves the object inside the drawing order so it's being drawn before the other elements
32
+ * @param paneId
33
+ * @param listNode
34
+ */
35
+ bringToFront(paneId: PaneId, listNode: ListNode<DynamicObject>): void;
36
+ /**
37
+ * Moves the object inside the drawing order so it's being drawn after the other elements
38
+ * @param paneId
39
+ * @param listNode
40
+ */
41
+ bringToBack(paneId: PaneId, listNode: ListNode<DynamicObject>): void;
42
+ /**
43
+ * Moves the object inside the drawing order so it's being drawn one layer ahead
44
+ * @param obj
45
+ * @param paneId
46
+ */
47
+ moveForward(paneId: PaneId, listNode: ListNode<DynamicObject>): void;
48
+ /**
49
+ * Moves the object inside the drawing order so it's being drawn one layer closer to the back
50
+ * @param obj
51
+ * @param paneId
52
+ */
53
+ moveBackwards(paneId: PaneId, listNode: ListNode<DynamicObject>): void;
54
+ /**
55
+ * Getter for the objects
56
+ */
57
+ get objects(): Record<string, LinkedList<DynamicObject<unknown>>>;
58
+ /**
59
+ * Sets the objects
60
+ * @param objects
61
+ */
62
+ setDynamicObjects(objects: Record<PaneId, LinkedList<DynamicObject>>): void;
63
+ }
@@ -0,0 +1,136 @@
1
+ /*
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ import { BehaviorSubject } from 'rxjs';
7
+ import { ChartBaseElement } from '../../model/chart-base-element';
8
+ import { LinkedList, ListNode } from '../../utils/linkedList.utils';
9
+ export class DynamicObjectsModel extends ChartBaseElement {
10
+ constructor() {
11
+ super();
12
+ this.modelToObjectMap = new Map();
13
+ this._objects = new BehaviorSubject({});
14
+ }
15
+ /**
16
+ * Adds an object from outside chart-core into model
17
+ * @param obj
18
+ * @param paneId
19
+ */
20
+ addObject(obj, paneId) {
21
+ var _a;
22
+ const objects = this.objects;
23
+ const paneList = (_a = objects[paneId]) !== null && _a !== void 0 ? _a : new LinkedList();
24
+ if (!Object.keys(objects).find(pane => pane === paneId)) {
25
+ objects[paneId] = paneList;
26
+ }
27
+ paneList.insertAtEnd(obj);
28
+ this.modelToObjectMap.set(obj.model, obj);
29
+ this.setDynamicObjects(objects);
30
+ }
31
+ /**
32
+ * Removes an object from model
33
+ * @param model
34
+ * @param paneId
35
+ */
36
+ removeObject(model, paneId) {
37
+ const objects = this.objects;
38
+ const paneList = objects[paneId];
39
+ const obj = this.modelToObjectMap.get(model);
40
+ if (paneList && obj) {
41
+ const targetNode = new ListNode(obj);
42
+ const targetPos = paneList.getNodePosition(targetNode);
43
+ paneList.removeAt(targetPos);
44
+ this.modelToObjectMap.delete(model);
45
+ if (paneList.size() === 0) {
46
+ delete objects[paneId];
47
+ }
48
+ this.setDynamicObjects(objects);
49
+ }
50
+ }
51
+ /**
52
+ * Moves the object inside the drawing order so it's being drawn before the other elements
53
+ * @param paneId
54
+ * @param listNode
55
+ */
56
+ bringToFront(paneId, listNode) {
57
+ const list = this.objects[paneId];
58
+ if (list) {
59
+ const targetPos = list.getNodePosition(listNode);
60
+ if (targetPos >= 0 && targetPos < list.size()) {
61
+ const nodeToReplace = list.removeAt(targetPos);
62
+ if (nodeToReplace) {
63
+ list.insertAtEnd(nodeToReplace.data);
64
+ }
65
+ }
66
+ this.setDynamicObjects(this.objects);
67
+ }
68
+ }
69
+ /**
70
+ * Moves the object inside the drawing order so it's being drawn after the other elements
71
+ * @param paneId
72
+ * @param listNode
73
+ */
74
+ bringToBack(paneId, listNode) {
75
+ const list = this.objects[paneId];
76
+ if (list) {
77
+ const targetPos = list.getNodePosition(listNode);
78
+ if (targetPos > 0 && targetPos <= list.size()) {
79
+ const nodeToReplace = list.removeAt(targetPos);
80
+ if (nodeToReplace) {
81
+ list.insertAt(0, nodeToReplace === null || nodeToReplace === void 0 ? void 0 : nodeToReplace.data);
82
+ }
83
+ }
84
+ this.setDynamicObjects(this.objects);
85
+ }
86
+ }
87
+ /**
88
+ * Moves the object inside the drawing order so it's being drawn one layer ahead
89
+ * @param obj
90
+ * @param paneId
91
+ */
92
+ moveForward(paneId, listNode) {
93
+ const list = this.objects[paneId];
94
+ if (list) {
95
+ const targetPos = list.getNodePosition(listNode);
96
+ if (targetPos >= 0 && targetPos < list.size()) {
97
+ const nodeToReplace = list.removeAt(targetPos);
98
+ if (nodeToReplace) {
99
+ list.insertAt(targetPos + 1, nodeToReplace.data);
100
+ }
101
+ }
102
+ this.setDynamicObjects(this.objects);
103
+ }
104
+ }
105
+ /**
106
+ * Moves the object inside the drawing order so it's being drawn one layer closer to the back
107
+ * @param obj
108
+ * @param paneId
109
+ */
110
+ moveBackwards(paneId, listNode) {
111
+ const list = this.objects[paneId];
112
+ if (list) {
113
+ const targetPos = list.getNodePosition(listNode);
114
+ if (targetPos > 0 && targetPos <= list.size()) {
115
+ const nodeToReplace = list.removeAt(targetPos);
116
+ if (nodeToReplace) {
117
+ list.insertAt(targetPos - 1, nodeToReplace === null || nodeToReplace === void 0 ? void 0 : nodeToReplace.data);
118
+ }
119
+ }
120
+ this.setDynamicObjects(this.objects);
121
+ }
122
+ }
123
+ /**
124
+ * Getter for the objects
125
+ */
126
+ get objects() {
127
+ return this._objects.getValue();
128
+ }
129
+ /**
130
+ * Sets the objects
131
+ * @param objects
132
+ */
133
+ setDynamicObjects(objects) {
134
+ this._objects.next(objects);
135
+ }
136
+ }
@@ -3,4 +3,66 @@
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- import{CanvasElement as f}from"../../canvas/canvas-bounds-container";import{getEventSize as v}from"./events.drawer";const r=5;export class EventsHitTestDrawer{constructor(e,t,s,c,o){this.hitTestCanvasModel=e,this.chartModel=t,this.config=s,this.canvasBoundsContainer=c,this.model=o}draw(){const e=this.hitTestCanvasModel.ctx,t=this.canvasBoundsContainer.getBounds(f.EVENTS);e.save(),this.model.events.forEach((s,c)=>{const o=this.model.events[c-1],l=o&&this.chartModel.candleFromTimestamp(o.timestamp).xCenter(this.chartModel.scaleModel),i=this.chartModel.candleFromTimestamp(s.timestamp).xCenter(this.chartModel.scaleModel);if(i>t.x&&i<t.x+t.width){const h=this.config.colors.events[s.type].color;e.strokeStyle=h,e.fillStyle=h;const n=v(s);e.fillStyle=this.hitTestCanvasModel.idToColor(s.id);const a=(n+r)*2;if(l!==void 0){const d=v(o);if(l+d>i-a/2){const m=n*2+r;e.fillRect(l+d,t.y,m,t.height)}else e.fillRect(i-n-r,t.y,a,t.height)}else e.fillRect(i-n-r,t.y,a,t.height)}}),e.restore()}getCanvasIds(){return[this.hitTestCanvasModel.canvasId]}}
6
+ import { CanvasElement } from '../../canvas/canvas-bounds-container';
7
+ import { getEventSize } from './events.drawer';
8
+ const hoverExtendedAreaPixels = 5;
9
+ export class EventsHitTestDrawer {
10
+ constructor(hitTestCanvasModel, chartModel, config, canvasBoundsContainer, model) {
11
+ this.hitTestCanvasModel = hitTestCanvasModel;
12
+ this.chartModel = chartModel;
13
+ this.config = config;
14
+ this.canvasBoundsContainer = canvasBoundsContainer;
15
+ this.model = model;
16
+ }
17
+ /**
18
+ * Draws events on the hit test canvas.
19
+ * @function
20
+ * @name draw
21
+ * @memberof CanvasElement.EVENTS
22
+ * @instance
23
+ * @returns {void}
24
+
25
+ */
26
+ draw() {
27
+ const ctx = this.hitTestCanvasModel.ctx;
28
+ const bounds = this.canvasBoundsContainer.getBounds(CanvasElement.EVENTS);
29
+ ctx.save();
30
+ this.model.events.forEach((event, idx) => {
31
+ const prevEvent = this.model.events[idx - 1];
32
+ const prevX = prevEvent &&
33
+ this.chartModel.candleFromTimestamp(prevEvent.timestamp).xCenter(this.chartModel.scale);
34
+ const x = this.chartModel.candleFromTimestamp(event.timestamp).xCenter(this.chartModel.scale);
35
+ if (x > bounds.x && x < bounds.x + bounds.width) {
36
+ const color = this.config.colors.events[event.type].color;
37
+ ctx.strokeStyle = color;
38
+ ctx.fillStyle = color;
39
+ const size = getEventSize(event);
40
+ // draw hit test
41
+ ctx.fillStyle = this.hitTestCanvasModel.idToColor(event.id);
42
+ const hoverSize = (size + hoverExtendedAreaPixels) * 2;
43
+ if (prevX !== undefined) {
44
+ const prevSize = getEventSize(prevEvent);
45
+ const isIntersectsWithPrev = prevX + prevSize > x - hoverSize / 2;
46
+ if (isIntersectsWithPrev) {
47
+ const hoverSize = size * 2 + hoverExtendedAreaPixels;
48
+ ctx.fillRect(prevX + prevSize, bounds.y, hoverSize, bounds.height);
49
+ }
50
+ else {
51
+ ctx.fillRect(x - size - hoverExtendedAreaPixels, bounds.y, hoverSize, bounds.height);
52
+ }
53
+ }
54
+ else {
55
+ ctx.fillRect(x - size - hoverExtendedAreaPixels, bounds.y, hoverSize, bounds.height);
56
+ }
57
+ }
58
+ });
59
+ ctx.restore();
60
+ }
61
+ /**
62
+ * Returns an array of string containing the canvas ID of the hitTestCanvasModel.
63
+ * @returns {Array<string>} An array of string containing the canvas ID of the hitTestCanvasModel.
64
+ */
65
+ getCanvasIds() {
66
+ return [this.hitTestCanvasModel.canvasId];
67
+ }
68
+ }
@@ -3,4 +3,64 @@
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- import{CanvasElement as E}from"../../canvas/canvas-bounds-container";import{ChartBaseElement as h}from"../../model/chart-base-element";import{recalculateXFormatter as c}from"../../model/date-time.formatter";import{merge as f}from"../../utils/merge.utils";import{EventsHitTestDrawer as p}from"./events-hit-test.drawer";import{EventsDrawer as w}from"./events.drawer";import{EventsModel as b}from"./events.model";export class EventsComponent extends h{constructor(e,s,n,r,i,o,a,v,m){super(),this.config=e,this.canvasModel=s,this.canvasBoundsContainer=i,this.drawingManager=o,this.formatterFactory=a,this.eventsXAxisLabelFormatterProvider=()=>c(this.config.components.events.xAxisLabelFormat,r.getPeriod(),this.formatterFactory);const t=new b(s);this.eventsModel=t,this.addChildEntity(t),n.addSubscriber(t);const d=new w(m,s,r,e,i,t,this.eventsXAxisLabelFormatterProvider);this.drawingManager.addDrawer(d,"EVENTS");const l=new p(n,r,e,i,t);this.drawingManager.addDrawerBefore(l,"HIT_TEST_EVENTS","HIT_TEST_DRAWINGS"),v.setCursorForCanvasEl(E.EVENTS,e.components.events.cursor)}setEvents(e){this.eventsModel.setEvents(e),this.canvasModel.fireDraw()}setVisible(e){this.config.components.events.visible=e,this.canvasBoundsContainer.recalculateBounds(),this.canvasModel.fireDraw()}setEventTypeVisible(e){f(this.config.components.events.eventsVisibility,e,{overrideExisting:!0,addIfMissing:!1}),this.canvasModel.fireDraw()}observeEventHovered(){return this.eventsModel.hoveredEvent.asObservable()}}
6
+ import { CanvasElement } from '../../canvas/canvas-bounds-container';
7
+ import { ChartBaseElement } from '../../model/chart-base-element';
8
+ import { recalculateXFormatter } from '../../model/date-time.formatter';
9
+ import { merge } from '../../utils/merge.utils';
10
+ import { EventsHitTestDrawer } from './events-hit-test.drawer';
11
+ import { EventsDrawer } from './events.drawer';
12
+ import { EventsModel } from './events.model';
13
+ export class EventsComponent extends ChartBaseElement {
14
+ constructor(config, canvasModel, hitTestCanvasModel, chartModel, canvasBoundsContainer, drawingManager, formatterFactory, cursorHandler, backgroundCanvasModel) {
15
+ super();
16
+ this.config = config;
17
+ this.canvasModel = canvasModel;
18
+ this.canvasBoundsContainer = canvasBoundsContainer;
19
+ this.drawingManager = drawingManager;
20
+ this.formatterFactory = formatterFactory;
21
+ this.eventsXAxisLabelFormatterProvider = () => recalculateXFormatter(this.config.components.events.xAxisLabelFormat, chartModel.getPeriod(), this.formatterFactory);
22
+ const eventsModel = new EventsModel(canvasModel);
23
+ this.eventsModel = eventsModel;
24
+ this.addChildEntity(eventsModel);
25
+ hitTestCanvasModel.addSubscriber(eventsModel);
26
+ const eventsDrawer = new EventsDrawer(backgroundCanvasModel, canvasModel, chartModel, config, canvasBoundsContainer, eventsModel, this.eventsXAxisLabelFormatterProvider);
27
+ this.drawingManager.addDrawer(eventsDrawer, 'EVENTS');
28
+ const eventsHitTestDrawer = new EventsHitTestDrawer(hitTestCanvasModel, chartModel, config, canvasBoundsContainer, eventsModel);
29
+ this.drawingManager.addDrawerBefore(eventsHitTestDrawer, 'HIT_TEST_EVENTS', 'HIT_TEST_DRAWINGS');
30
+ cursorHandler.setCursorForCanvasEl(CanvasElement.EVENTS, config.components.events.cursor);
31
+ }
32
+ /**
33
+ * Sets the new event list.
34
+ * @param events
35
+ */
36
+ setEvents(events) {
37
+ this.eventsModel.setEvents(events);
38
+ this.canvasModel.fireDraw();
39
+ }
40
+ /**
41
+ * Changes the component visibility.
42
+ * @param visible
43
+ */
44
+ setVisible(visible) {
45
+ this.config.components.events.visible = visible;
46
+ this.canvasBoundsContainer.recalculateBounds();
47
+ this.canvasModel.fireDraw();
48
+ }
49
+ /**
50
+ * Changes visibility for the specific event type.
51
+ * For example, to turn off dividends visibility you can call this method with { dividends: false } argument
52
+ */
53
+ setEventTypeVisible(eventsVisibility) {
54
+ merge(this.config.components.events.eventsVisibility, eventsVisibility, {
55
+ overrideExisting: true,
56
+ addIfMissing: false,
57
+ });
58
+ this.canvasModel.fireDraw();
59
+ }
60
+ /**
61
+ * Observes hovered event when mouse moves in, and provides null when mouse moves out.
62
+ */
63
+ observeEventHovered() {
64
+ return this.eventsModel.hoveredEvent.asObservable();
65
+ }
66
+ }