@devexperts/dxcharts-lite 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 (364) hide show
  1. package/LICENSE +151 -0
  2. package/README.md +184 -0
  3. package/dist/chart/animation/canvas-animation.d.ts +96 -0
  4. package/dist/chart/animation/canvas-animation.js +6 -0
  5. package/dist/chart/animation/types/animation.d.ts +35 -0
  6. package/dist/chart/animation/types/animation.js +6 -0
  7. package/dist/chart/animation/types/color-alpha-animation.d.ts +43 -0
  8. package/dist/chart/animation/types/color-alpha-animation.js +6 -0
  9. package/dist/chart/animation/types/color-transition-animation.d.ts +59 -0
  10. package/dist/chart/animation/types/color-transition-animation.js +6 -0
  11. package/dist/chart/animation/types/viewport-movement-animation.d.ts +44 -0
  12. package/dist/chart/animation/types/viewport-movement-animation.js +6 -0
  13. package/dist/chart/animation/viewport-model-animation.d.ts +15 -0
  14. package/dist/chart/animation/viewport-model-animation.js +6 -0
  15. package/dist/chart/bootstrap.d.ts +266 -0
  16. package/dist/chart/bootstrap.js +6 -0
  17. package/dist/chart/canvas/canvas-bounds-container.d.ts +347 -0
  18. package/dist/chart/canvas/canvas-bounds-container.js +6 -0
  19. package/dist/chart/canvas/canvas-chart-html.d.ts +7 -0
  20. package/dist/chart/canvas/canvas-chart-html.js +23 -0
  21. package/dist/chart/canvas/chart-elements.d.ts +22 -0
  22. package/dist/chart/canvas/chart-elements.js +6 -0
  23. package/dist/chart/canvas/cursor.handler.d.ts +71 -0
  24. package/dist/chart/canvas/cursor.handler.js +6 -0
  25. package/dist/chart/canvas/layout-creator.d.ts +20 -0
  26. package/dist/chart/canvas/layout-creator.js +6 -0
  27. package/dist/chart/canvas/y-axis-bounds.container.d.ts +54 -0
  28. package/dist/chart/canvas/y-axis-bounds.container.js +6 -0
  29. package/dist/chart/chart-container.d.ts +18 -0
  30. package/dist/chart/chart-container.js +6 -0
  31. package/dist/chart/chart.config.d.ts +774 -0
  32. package/dist/chart/chart.config.js +6 -0
  33. package/dist/chart/components/chart/basic-scale.d.ts +22 -0
  34. package/dist/chart/components/chart/basic-scale.js +6 -0
  35. package/dist/chart/components/chart/candle-transformer.functions.d.ts +11 -0
  36. package/dist/chart/components/chart/candle-transformer.functions.js +6 -0
  37. package/dist/chart/components/chart/candle-width-calculator.functions.d.ts +7 -0
  38. package/dist/chart/components/chart/candle-width-calculator.functions.js +6 -0
  39. package/dist/chart/components/chart/candle.functions.d.ts +19 -0
  40. package/dist/chart/components/chart/candle.functions.js +6 -0
  41. package/dist/chart/components/chart/chart-area-pan.handler.d.ts +88 -0
  42. package/dist/chart/components/chart/chart-area-pan.handler.js +6 -0
  43. package/dist/chart/components/chart/chart-base.model.d.ts +55 -0
  44. package/dist/chart/components/chart/chart-base.model.js +6 -0
  45. package/dist/chart/components/chart/chart.component.d.ts +251 -0
  46. package/dist/chart/components/chart/chart.component.js +6 -0
  47. package/dist/chart/components/chart/chart.model.d.ts +448 -0
  48. package/dist/chart/components/chart/chart.model.js +6 -0
  49. package/dist/chart/components/chart/data-series.high-low-provider.d.ts +25 -0
  50. package/dist/chart/components/chart/data-series.high-low-provider.js +6 -0
  51. package/dist/chart/components/chart/fake-candles.d.ts +18 -0
  52. package/dist/chart/components/chart/fake-candles.js +6 -0
  53. package/dist/chart/components/chart/price.formatter.d.ts +12 -0
  54. package/dist/chart/components/chart/price.formatter.js +6 -0
  55. package/dist/chart/components/chart/secondary-chart-colors-pool.d.ts +43 -0
  56. package/dist/chart/components/chart/secondary-chart-colors-pool.js +6 -0
  57. package/dist/chart/components/cross_tool/cross-tool.component.d.ts +69 -0
  58. package/dist/chart/components/cross_tool/cross-tool.component.js +6 -0
  59. package/dist/chart/components/cross_tool/cross-tool.drawer.d.ts +32 -0
  60. package/dist/chart/components/cross_tool/cross-tool.drawer.js +6 -0
  61. package/dist/chart/components/cross_tool/cross-tool.model.d.ts +63 -0
  62. package/dist/chart/components/cross_tool/cross-tool.model.js +6 -0
  63. package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.d.ts +44 -0
  64. package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +6 -0
  65. package/dist/chart/components/cross_tool/types/none.drawer.d.ts +9 -0
  66. package/dist/chart/components/cross_tool/types/none.drawer.js +6 -0
  67. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.d.ts +27 -0
  68. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +6 -0
  69. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.d.ts +23 -0
  70. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +6 -0
  71. package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.d.ts +46 -0
  72. package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +6 -0
  73. package/dist/chart/components/events/events-hit-test.drawer.d.ts +34 -0
  74. package/dist/chart/components/events/events-hit-test.drawer.js +6 -0
  75. package/dist/chart/components/events/events.component.d.ts +45 -0
  76. package/dist/chart/components/events/events.component.js +6 -0
  77. package/dist/chart/components/events/events.drawer.d.ts +87 -0
  78. package/dist/chart/components/events/events.drawer.js +6 -0
  79. package/dist/chart/components/events/events.model.d.ts +64 -0
  80. package/dist/chart/components/events/events.model.js +6 -0
  81. package/dist/chart/components/grid/grid.component.d.ts +34 -0
  82. package/dist/chart/components/grid/grid.component.js +6 -0
  83. package/dist/chart/components/grid/grid.drawer.d.ts +55 -0
  84. package/dist/chart/components/grid/grid.drawer.js +6 -0
  85. package/dist/chart/components/high_low/high-low.component.d.ts +17 -0
  86. package/dist/chart/components/high_low/high-low.component.js +6 -0
  87. package/dist/chart/components/high_low/high-low.drawer.d.ts +69 -0
  88. package/dist/chart/components/high_low/high-low.drawer.js +6 -0
  89. package/dist/chart/components/highlights/highlights.component.d.ts +42 -0
  90. package/dist/chart/components/highlights/highlights.component.js +6 -0
  91. package/dist/chart/components/highlights/highlights.drawer.d.ts +56 -0
  92. package/dist/chart/components/highlights/highlights.drawer.js +6 -0
  93. package/dist/chart/components/highlights/highlights.model.d.ts +66 -0
  94. package/dist/chart/components/highlights/highlights.model.js +6 -0
  95. package/dist/chart/components/labels_generator/numeric-axis-labels.generator.d.ts +63 -0
  96. package/dist/chart/components/labels_generator/numeric-axis-labels.generator.js +6 -0
  97. package/dist/chart/components/navigation_map/navigation-map-move.handler.d.ts +36 -0
  98. package/dist/chart/components/navigation_map/navigation-map-move.handler.js +6 -0
  99. package/dist/chart/components/navigation_map/navigation-map.component.d.ts +52 -0
  100. package/dist/chart/components/navigation_map/navigation-map.component.js +6 -0
  101. package/dist/chart/components/navigation_map/navigation-map.drawer.d.ts +96 -0
  102. package/dist/chart/components/navigation_map/navigation-map.drawer.js +6 -0
  103. package/dist/chart/components/navigation_map/navigation-map.model.d.ts +25 -0
  104. package/dist/chart/components/navigation_map/navigation-map.model.js +7 -0
  105. package/dist/chart/components/pan/chart-pan.component.d.ts +52 -0
  106. package/dist/chart/components/pan/chart-pan.component.js +6 -0
  107. package/dist/chart/components/pane/extent/y-extent-component.d.ts +91 -0
  108. package/dist/chart/components/pane/extent/y-extent-component.js +6 -0
  109. package/dist/chart/components/pane/pane-hit-test.controller.d.ts +39 -0
  110. package/dist/chart/components/pane/pane-hit-test.controller.js +6 -0
  111. package/dist/chart/components/pane/pane-manager.component.d.ts +87 -0
  112. package/dist/chart/components/pane/pane-manager.component.js +6 -0
  113. package/dist/chart/components/pane/pane.component.d.ts +193 -0
  114. package/dist/chart/components/pane/pane.component.js +6 -0
  115. package/dist/chart/components/resizer/bar-resizer.component.d.ts +72 -0
  116. package/dist/chart/components/resizer/bar-resizer.component.js +6 -0
  117. package/dist/chart/components/resizer/bar-resizer.drawer.d.ts +34 -0
  118. package/dist/chart/components/resizer/bar-resizer.drawer.js +6 -0
  119. package/dist/chart/components/snapshot/snapshot.component.d.ts +31 -0
  120. package/dist/chart/components/snapshot/snapshot.component.js +6 -0
  121. package/dist/chart/components/volumes/separate-volumes.component.d.ts +45 -0
  122. package/dist/chart/components/volumes/separate-volumes.component.js +6 -0
  123. package/dist/chart/components/volumes/volume-color-resolvers.functions.d.ts +11 -0
  124. package/dist/chart/components/volumes/volume-color-resolvers.functions.js +6 -0
  125. package/dist/chart/components/volumes/volumes.component.d.ts +59 -0
  126. package/dist/chart/components/volumes/volumes.component.js +6 -0
  127. package/dist/chart/components/volumes/volumes.drawer.d.ts +71 -0
  128. package/dist/chart/components/volumes/volumes.drawer.js +6 -0
  129. package/dist/chart/components/volumes/volumes.formatter.d.ts +6 -0
  130. package/dist/chart/components/volumes/volumes.formatter.js +6 -0
  131. package/dist/chart/components/volumes/volumes.model.d.ts +32 -0
  132. package/dist/chart/components/volumes/volumes.model.js +6 -0
  133. package/dist/chart/components/watermark/water-mark.component.d.ts +75 -0
  134. package/dist/chart/components/watermark/water-mark.component.js +6 -0
  135. package/dist/chart/components/watermark/water-mark.drawer.d.ts +68 -0
  136. package/dist/chart/components/watermark/water-mark.drawer.js +6 -0
  137. package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.d.ts +25 -0
  138. package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.js +6 -0
  139. package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.d.ts +55 -0
  140. package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.js +6 -0
  141. package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.d.ts +23 -0
  142. package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.js +6 -0
  143. package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.d.ts +28 -0
  144. package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.js +6 -0
  145. package/dist/chart/components/x_axis/time/parser/time-formats.model.d.ts +33 -0
  146. package/dist/chart/components/x_axis/time/parser/time-formats.model.js +6 -0
  147. package/dist/chart/components/x_axis/time/x-axis-weights.functions.d.ts +62 -0
  148. package/dist/chart/components/x_axis/time/x-axis-weights.functions.js +6 -0
  149. package/dist/chart/components/x_axis/time/x-axis-weights.generator.d.ts +33 -0
  150. package/dist/chart/components/x_axis/time/x-axis-weights.generator.js +6 -0
  151. package/dist/chart/components/x_axis/x-axis-draw.functions.d.ts +17 -0
  152. package/dist/chart/components/x_axis/x-axis-draw.functions.js +6 -0
  153. package/dist/chart/components/x_axis/x-axis-labels.drawer.d.ts +42 -0
  154. package/dist/chart/components/x_axis/x-axis-labels.drawer.js +6 -0
  155. package/dist/chart/components/x_axis/x-axis-labels.generator.d.ts +141 -0
  156. package/dist/chart/components/x_axis/x-axis-labels.generator.js +6 -0
  157. package/dist/chart/components/x_axis/x-axis-labels.model.d.ts +39 -0
  158. package/dist/chart/components/x_axis/x-axis-labels.model.js +6 -0
  159. package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +38 -0
  160. package/dist/chart/components/x_axis/x-axis-scale.handler.js +6 -0
  161. package/dist/chart/components/x_axis/x-axis-time-labels.drawer.d.ts +54 -0
  162. package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +6 -0
  163. package/dist/chart/components/x_axis/x-axis.component.d.ts +73 -0
  164. package/dist/chart/components/x_axis/x-axis.component.js +6 -0
  165. package/dist/chart/components/y_axis/label-color.functions.d.ts +18 -0
  166. package/dist/chart/components/y_axis/label-color.functions.js +6 -0
  167. package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.d.ts +22 -0
  168. package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.js +6 -0
  169. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +33 -0
  170. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +6 -0
  171. package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.d.ts +27 -0
  172. package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +6 -0
  173. package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.d.ts +35 -0
  174. package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +6 -0
  175. package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +23 -0
  176. package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +6 -0
  177. package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +159 -0
  178. package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +6 -0
  179. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +23 -0
  180. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +6 -0
  181. package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +31 -0
  182. package/dist/chart/components/y_axis/y-axis-base-labels.model.js +6 -0
  183. package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +70 -0
  184. package/dist/chart/components/y_axis/y-axis-labels.drawer.js +6 -0
  185. package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +32 -0
  186. package/dist/chart/components/y_axis/y-axis-scale.handler.js +6 -0
  187. package/dist/chart/components/y_axis/y-axis.component.d.ts +158 -0
  188. package/dist/chart/components/y_axis/y-axis.component.js +6 -0
  189. package/dist/chart/components/y_axis/y-axis.drawer.d.ts +72 -0
  190. package/dist/chart/components/y_axis/y-axis.drawer.js +6 -0
  191. package/dist/chart/components/y_axis/y-axis.model.d.ts +33 -0
  192. package/dist/chart/components/y_axis/y-axis.model.js +6 -0
  193. package/dist/chart/drawers/chart-background.drawer.d.ts +19 -0
  194. package/dist/chart/drawers/chart-background.drawer.js +6 -0
  195. package/dist/chart/drawers/chart-type-drawers/area.drawer.d.ts +13 -0
  196. package/dist/chart/drawers/chart-type-drawers/area.drawer.js +6 -0
  197. package/dist/chart/drawers/chart-type-drawers/bar.drawer.d.ts +14 -0
  198. package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +6 -0
  199. package/dist/chart/drawers/chart-type-drawers/baseline.drawer.d.ts +15 -0
  200. package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +6 -0
  201. package/dist/chart/drawers/chart-type-drawers/candle.drawer.d.ts +25 -0
  202. package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +6 -0
  203. package/dist/chart/drawers/chart-type-drawers/histogram.drawer.d.ts +13 -0
  204. package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +6 -0
  205. package/dist/chart/drawers/chart-type-drawers/line.drawer.d.ts +13 -0
  206. package/dist/chart/drawers/chart-type-drawers/line.drawer.js +6 -0
  207. package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.d.ts +13 -0
  208. package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +6 -0
  209. package/dist/chart/drawers/clear-canvas.drawer.d.ts +16 -0
  210. package/dist/chart/drawers/clear-canvas.drawer.js +6 -0
  211. package/dist/chart/drawers/composite.drawer.d.ts +25 -0
  212. package/dist/chart/drawers/composite.drawer.js +6 -0
  213. package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.d.ts +23 -0
  214. package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +6 -0
  215. package/dist/chart/drawers/data-series-drawers/color-candle.drawer.d.ts +17 -0
  216. package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +6 -0
  217. package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.d.ts +8 -0
  218. package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.js +6 -0
  219. package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.d.ts +21 -0
  220. package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +6 -0
  221. package/dist/chart/drawers/data-series-drawers/histogram.drawer.d.ts +11 -0
  222. package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +6 -0
  223. package/dist/chart/drawers/data-series-drawers/linear.drawer.d.ts +12 -0
  224. package/dist/chart/drawers/data-series-drawers/linear.drawer.js +6 -0
  225. package/dist/chart/drawers/data-series-drawers/points.drawer.d.ts +11 -0
  226. package/dist/chart/drawers/data-series-drawers/points.drawer.js +6 -0
  227. package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.d.ts +9 -0
  228. package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.js +6 -0
  229. package/dist/chart/drawers/data-series-drawers/text.drawer.d.ts +13 -0
  230. package/dist/chart/drawers/data-series-drawers/text.drawer.js +6 -0
  231. package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.d.ts +12 -0
  232. package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +6 -0
  233. package/dist/chart/drawers/data-series-drawers/triangle.drawer.d.ts +12 -0
  234. package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +6 -0
  235. package/dist/chart/drawers/data-series.drawer.d.ts +39 -0
  236. package/dist/chart/drawers/data-series.drawer.js +6 -0
  237. package/dist/chart/drawers/drawing-manager.d.ts +61 -0
  238. package/dist/chart/drawers/drawing-manager.js +6 -0
  239. package/dist/chart/drawers/ht-data-series.drawer.d.ts +22 -0
  240. package/dist/chart/drawers/ht-data-series.drawer.js +6 -0
  241. package/dist/chart/events/event-bus.d.ts +48 -0
  242. package/dist/chart/events/event-bus.js +6 -0
  243. package/dist/chart/events/events.d.ts +8 -0
  244. package/dist/chart/events/events.js +6 -0
  245. package/dist/chart/inputhandlers/candle-tap.handler.d.ts +27 -0
  246. package/dist/chart/inputhandlers/candle-tap.handler.js +6 -0
  247. package/dist/chart/inputhandlers/chart-resize.handler.d.ts +67 -0
  248. package/dist/chart/inputhandlers/chart-resize.handler.js +6 -0
  249. package/dist/chart/inputhandlers/cross-event-producer.component.d.ts +44 -0
  250. package/dist/chart/inputhandlers/cross-event-producer.component.js +6 -0
  251. package/dist/chart/inputhandlers/hover-producer.component.d.ts +140 -0
  252. package/dist/chart/inputhandlers/hover-producer.component.js +6 -0
  253. package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +54 -0
  254. package/dist/chart/inputhandlers/main-canvas-touch.handler.js +6 -0
  255. package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +311 -0
  256. package/dist/chart/inputlisteners/canvas-input-listener.component.js +6 -0
  257. package/dist/chart/model/baseline.model.d.ts +54 -0
  258. package/dist/chart/model/baseline.model.js +6 -0
  259. package/dist/chart/model/bounds.model.d.ts +16 -0
  260. package/dist/chart/model/bounds.model.js +6 -0
  261. package/dist/chart/model/candle-hover.d.ts +35 -0
  262. package/dist/chart/model/candle-hover.js +6 -0
  263. package/dist/chart/model/candle-series-high-low.provider.d.ts +20 -0
  264. package/dist/chart/model/candle-series-high-low.provider.js +6 -0
  265. package/dist/chart/model/candle-series.model.d.ts +150 -0
  266. package/dist/chart/model/candle-series.model.js +6 -0
  267. package/dist/chart/model/candle.model.d.ts +46 -0
  268. package/dist/chart/model/candle.model.js +6 -0
  269. package/dist/chart/model/canvas.model.d.ts +131 -0
  270. package/dist/chart/model/canvas.model.js +6 -0
  271. package/dist/chart/model/chart-base-element.d.ts +103 -0
  272. package/dist/chart/model/chart-base-element.js +6 -0
  273. package/dist/chart/model/compare-series-hover.d.ts +22 -0
  274. package/dist/chart/model/compare-series-hover.js +6 -0
  275. package/dist/chart/model/data-series-view.d.ts +58 -0
  276. package/dist/chart/model/data-series-view.js +6 -0
  277. package/dist/chart/model/data-series.config.d.ts +31 -0
  278. package/dist/chart/model/data-series.config.js +6 -0
  279. package/dist/chart/model/data-series.model.d.ts +172 -0
  280. package/dist/chart/model/data-series.model.js +6 -0
  281. package/dist/chart/model/date-time.formatter.d.ts +23 -0
  282. package/dist/chart/model/date-time.formatter.js +6 -0
  283. package/dist/chart/model/hit-test-canvas.model.d.ts +128 -0
  284. package/dist/chart/model/hit-test-canvas.model.js +6 -0
  285. package/dist/chart/model/main-candle-series.model.d.ts +27 -0
  286. package/dist/chart/model/main-candle-series.model.js +6 -0
  287. package/dist/chart/model/scale.model.d.ts +180 -0
  288. package/dist/chart/model/scale.model.js +6 -0
  289. package/dist/chart/model/scaling/auto-scale.model.d.ts +79 -0
  290. package/dist/chart/model/scaling/auto-scale.model.js +6 -0
  291. package/dist/chart/model/scaling/constrait.functions.d.ts +43 -0
  292. package/dist/chart/model/scaling/constrait.functions.js +6 -0
  293. package/dist/chart/model/scaling/lock-ratio.model.d.ts +16 -0
  294. package/dist/chart/model/scaling/lock-ratio.model.js +6 -0
  295. package/dist/chart/model/scaling/move-chart.functions.d.ts +20 -0
  296. package/dist/chart/model/scaling/move-chart.functions.js +6 -0
  297. package/dist/chart/model/scaling/viewport.model.d.ts +223 -0
  298. package/dist/chart/model/scaling/viewport.model.js +6 -0
  299. package/dist/chart/model/scaling/x-zooming.functions.d.ts +26 -0
  300. package/dist/chart/model/scaling/x-zooming.functions.js +6 -0
  301. package/dist/chart/model/time-zone.model.d.ts +65 -0
  302. package/dist/chart/model/time-zone.model.js +6 -0
  303. package/dist/chart/model/visual-candle.d.ts +106 -0
  304. package/dist/chart/model/visual-candle.js +6 -0
  305. package/dist/chart/utils/__tests__/array.utils.test.d.ts +6 -0
  306. package/dist/chart/utils/__tests__/array.utils.test.js +6 -0
  307. package/dist/chart/utils/__tests__/object.utils.test.d.ts +6 -0
  308. package/dist/chart/utils/__tests__/object.utils.test.js +6 -0
  309. package/dist/chart/utils/__tests__/priceIncrementsUtils.test.d.ts +6 -0
  310. package/dist/chart/utils/__tests__/priceIncrementsUtils.test.js +6 -0
  311. package/dist/chart/utils/array.utils.d.ts +101 -0
  312. package/dist/chart/utils/array.utils.js +6 -0
  313. package/dist/chart/utils/auto-period-detector.utils.d.ts +16 -0
  314. package/dist/chart/utils/auto-period-detector.utils.js +6 -0
  315. package/dist/chart/utils/candles-generator-ts.utils.d.ts +41 -0
  316. package/dist/chart/utils/candles-generator-ts.utils.js +6 -0
  317. package/dist/chart/utils/candles-generator.utils.d.ts +13 -0
  318. package/dist/chart/utils/candles-generator.utils.js +6 -0
  319. package/dist/chart/utils/candles.utils.d.ts +8 -0
  320. package/dist/chart/utils/candles.utils.js +6 -0
  321. package/dist/chart/utils/canvas/canvas-drawing-functions.utils.d.ts +68 -0
  322. package/dist/chart/utils/canvas/canvas-drawing-functions.utils.js +6 -0
  323. package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.d.ts +20 -0
  324. package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.js +6 -0
  325. package/dist/chart/utils/canvas/canvas-text-functions.utils.d.ts +76 -0
  326. package/dist/chart/utils/canvas/canvas-text-functions.utils.js +6 -0
  327. package/dist/chart/utils/color.utils.d.ts +6 -0
  328. package/dist/chart/utils/color.utils.js +6 -0
  329. package/dist/chart/utils/device/browser.utils.d.ts +9 -0
  330. package/dist/chart/utils/device/browser.utils.js +6 -0
  331. package/dist/chart/utils/device/device-detector.utils.d.ts +12 -0
  332. package/dist/chart/utils/device/device-detector.utils.js +6 -0
  333. package/dist/chart/utils/device/device-pixel-ratio.utils.d.ts +16 -0
  334. package/dist/chart/utils/device/device-pixel-ratio.utils.js +6 -0
  335. package/dist/chart/utils/device/touchpad.utils.d.ts +30 -0
  336. package/dist/chart/utils/device/touchpad.utils.js +6 -0
  337. package/dist/chart/utils/dom.utils.d.ts +13 -0
  338. package/dist/chart/utils/dom.utils.js +6 -0
  339. package/dist/chart/utils/function.utils.d.ts +13 -0
  340. package/dist/chart/utils/function.utils.js +6 -0
  341. package/dist/chart/utils/math.utils.d.ts +40 -0
  342. package/dist/chart/utils/math.utils.js +6 -0
  343. package/dist/chart/utils/merge.utils.d.ts +27 -0
  344. package/dist/chart/utils/merge.utils.js +6 -0
  345. package/dist/chart/utils/object.utils.d.ts +46 -0
  346. package/dist/chart/utils/object.utils.js +6 -0
  347. package/dist/chart/utils/perfomance/animation-frame-cache.utils.d.ts +53 -0
  348. package/dist/chart/utils/perfomance/animation-frame-cache.utils.js +6 -0
  349. package/dist/chart/utils/perfomance/debounce.utils.d.ts +6 -0
  350. package/dist/chart/utils/perfomance/debounce.utils.js +6 -0
  351. package/dist/chart/utils/perfomance/memoize.utils.d.ts +21 -0
  352. package/dist/chart/utils/perfomance/memoize.utils.js +6 -0
  353. package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.d.ts +15 -0
  354. package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.js +6 -0
  355. package/dist/chart/utils/perfomance/throttle.utils.d.ts +15 -0
  356. package/dist/chart/utils/perfomance/throttle.utils.js +6 -0
  357. package/dist/chart/utils/price-increments.utils.d.ts +44 -0
  358. package/dist/chart/utils/price-increments.utils.js +6 -0
  359. package/dist/chart/utils/uuid.utils.d.ts +6 -0
  360. package/dist/chart/utils/uuid.utils.js +6 -0
  361. package/dist/dxchart.min.js +26 -0
  362. package/dist/index.d.ts +9 -0
  363. package/dist/index.js +6 -0
  364. package/package.json +103 -0
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
7
+ import { FullChartConfig } from '../../chart.config';
8
+ import { DrawingManager } from '../../drawers/drawing-manager';
9
+ import { CrossEventProducerComponent } from '../../inputhandlers/cross-event-producer.component';
10
+ import { HoverProducerComponent } from '../../inputhandlers/hover-producer.component';
11
+ import { CanvasModel } from '../../model/canvas.model';
12
+ import { ChartBaseElement } from '../../model/chart-base-element';
13
+ import { PaneManager } from '../pane/pane-manager.component';
14
+ import { CrossToolTypeDrawer } from './cross-tool.drawer';
15
+ import { CrossToolModel, CrossToolType } from './cross-tool.model';
16
+ export type MagnetTarget = 'O' | 'H' | 'L' | 'C' | 'OHLC' | 'none';
17
+ /**
18
+ * Default bundled chart cross tool.
19
+ */
20
+ export declare class CrossToolComponent extends ChartBaseElement {
21
+ private config;
22
+ private crossToolCanvasModel;
23
+ private canvasBoundsContainer;
24
+ private drawingManager;
25
+ private paneManager;
26
+ readonly model: CrossToolModel;
27
+ private readonly crossToolTypeDrawers;
28
+ constructor(config: FullChartConfig, crossToolCanvasModel: CanvasModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, paneManager: PaneManager, crossEventProducer: CrossEventProducerComponent, hoverProducer: HoverProducerComponent);
29
+ /**
30
+ * Registers default drawer types for the chart.
31
+ * @private
32
+ * @function
33
+ * @name registerDefaultDrawerTypes
34
+ *
35
+ * @returns {void}
36
+ */
37
+ private registerDefaultDrawerTypes;
38
+ /**
39
+ * Sets the cross tool visibility.
40
+ * @param visible
41
+ */
42
+ setVisible(visible: boolean): void;
43
+ /**
44
+ * Sets the crosstool type.
45
+ * - cross-and-labels - both the crosshair and X/Y labels
46
+ * - only-labels - only the X/Y label
47
+ * - none
48
+ * @param type
49
+ */
50
+ setType(type: CrossToolType): void;
51
+ /**
52
+ * Returns an Observable that emits the current hover subject.
53
+ */
54
+ observeCrossToolChanged(): import("rxjs").BehaviorSubject<import("./cross-tool.model").CrossToolHover | null>;
55
+ /**
56
+ * Sets magnet target for cross tool.
57
+ * Supported only for 'cross-and-labels' type.
58
+ * Default magnet target is none.
59
+ * @param target
60
+ */
61
+ setMagnetTarget(target: MagnetTarget): void;
62
+ /**
63
+ * Adds a new drawer type for cross tool, so you can add your own implementation of cross tool
64
+ * (or override existing)
65
+ * @param drawerName - an unique drawer type name
66
+ * @param drawerImpl - CrossToolTypeDrawer object
67
+ */
68
+ registerCrossToolTypeDrawer(drawerName: CrossToolType, drawerImpl: CrossToolTypeDrawer): void;
69
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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{ClearCanvasDrawer as p}from"../../drawers/clear-canvas.drawer";import{CompositeDrawer as c}from"../../drawers/composite.drawer";import{ChartBaseElement as d}from"../../model/chart-base-element";import{CrossToolDrawer as w}from"./cross-tool.drawer";import{CrossToolModel as C}from"./cross-tool.model";import{CrossAndLabelsDrawerType as o}from"./types/cross-and-labels.drawer";import{NoneDrawerType as m}from"./types/none.drawer";export class CrossToolComponent extends d{constructor(s,e,t,a,n,i,l){super(),this.config=s,this.crossToolCanvasModel=e,this.canvasBoundsContainer=t,this.drawingManager=a,this.paneManager=n,this.crossToolTypeDrawers={},this.model=new C(s.components.crossTool,this.crossToolCanvasModel,i,l),this.addChildEntity(this.model);const T=new p(this.crossToolCanvasModel);this.registerDefaultDrawerTypes();const h=new w(this.model,this.crossToolCanvasModel,this.crossToolTypeDrawers),r=new c;r.addDrawer(T,"CLEAR_CANVAS"),r.addDrawer(h,"CROSS_TOOL_DRAWER"),this.drawingManager.addDrawer(r,"CROSS_TOOL")}registerDefaultDrawerTypes(){this.registerCrossToolTypeDrawer("cross-and-labels",new o(this.config,this.canvasBoundsContainer,this.paneManager,()=>!0)),this.registerCrossToolTypeDrawer("just-labels",new o(this.config,this.canvasBoundsContainer,this.paneManager,()=>!0,!0)),this.registerCrossToolTypeDrawer("none",new m)}setVisible(s){this.model.setType(s?"cross-and-labels":"none")}setType(s){this.model.setType(s)}observeCrossToolChanged(){return this.model.currentHoverSubject}setMagnetTarget(s){this.config.components.crossTool.magnetTarget=s}registerCrossToolTypeDrawer(s,e){this.crossToolTypeDrawers[s]=e}}
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { CanvasModel } from '../../model/canvas.model';
7
+ import { Drawer } from '../../drawers/drawing-manager';
8
+ import { CrossToolHover, CrossToolModel, CrossToolType } from './cross-tool.model';
9
+ export interface CrossToolTypeDrawer {
10
+ draw: (ctx: CanvasRenderingContext2D, hover: CrossToolHover) => void;
11
+ }
12
+ export declare class CrossToolDrawer implements Drawer {
13
+ private model;
14
+ private crossToolCanvasModel;
15
+ private readonly crossToolTypeDrawers;
16
+ constructor(model: CrossToolModel, crossToolCanvasModel: CanvasModel, crossToolTypeDrawers: Record<CrossToolType, CrossToolTypeDrawer>);
17
+ /**
18
+ * Draws the cross tool on the canvas.
19
+ * @function
20
+ * @name draw
21
+ * @memberof CrossToolCanvasView
22
+ * @instance
23
+ * @returns {void}
24
+ */
25
+ draw(): void;
26
+ /**
27
+ * Returns an array of string containing the canvas ID of the crossToolCanvasModel.
28
+ *
29
+ * @returns {Array<string>} An array of string containing the canvas ID of the crossToolCanvasModel.
30
+ */
31
+ getCanvasIds(): Array<string>;
32
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 CrossToolDrawer{constructor(o,s,r){this.model=o,this.crossToolCanvasModel=s,this.crossToolTypeDrawers=r}draw(){const o=this.crossToolTypeDrawers[this.model.type];o?this.model.currentHover&&o.draw(this.crossToolCanvasModel.ctx,this.model.currentHover):console.error(`No cross tool drawer type registered for drawer type ${this.model.type}`)}getCanvasIds(){return[this.crossToolCanvasModel.canvasId]}}
@@ -0,0 +1,63 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { ChartConfigComponentsCrossTool } from '../../chart.config';
8
+ import { CrossEventProducerComponent } from '../../inputhandlers/cross-event-producer.component';
9
+ import { Hover, HoverProducerComponent } from '../../inputhandlers/hover-producer.component';
10
+ import { CanvasModel } from '../../model/canvas.model';
11
+ import { ChartBaseElement } from '../../model/chart-base-element';
12
+ export type CrossToolType = 'cross-and-labels' | 'only-labels' | 'none' | string;
13
+ export interface CrossToolHover {
14
+ x: number;
15
+ y: number;
16
+ time: string;
17
+ paneId: string;
18
+ }
19
+ export declare class CrossToolModel extends ChartBaseElement {
20
+ private config;
21
+ private crossToolCanvasModel;
22
+ private crossEventProducer;
23
+ private hoverProducer;
24
+ currentHoverSubject: BehaviorSubject<CrossToolHover | null>;
25
+ get currentHover(): CrossToolHover | null;
26
+ set currentHover(value: CrossToolHover | null);
27
+ type: CrossToolType;
28
+ constructor(config: Required<ChartConfigComponentsCrossTool>, crossToolCanvasModel: CanvasModel, crossEventProducer: CrossEventProducerComponent, hoverProducer: HoverProducerComponent);
29
+ /**
30
+ * Sets the type of the CrossTool object.
31
+ *
32
+ * @param {CrossToolType} type - The type of the CrossTool object.
33
+ * @returns {void}
34
+ */
35
+ setType(type: CrossToolType): void;
36
+ /**
37
+ * Method to activate the cross tool.
38
+ * It subscribes to the canvasInputListener's mouse move event and fires the draw event.
39
+ * It also subscribes to the eventBus's hover and close hover events and updates the hover and fires the draw event accordingly.
40
+ * It also subscribes to the chartModel's candlesSetSubject and timeZoneModel's observeTimeZoneChanged events and recalculates the cross tool X formatter.
41
+ */
42
+ protected doActivate(): void;
43
+ /**
44
+ * This method is used to fire the draw event of the crossToolCanvasModel if the type is not 'none'.
45
+ * @private
46
+ */
47
+ private fireDraw;
48
+ /**
49
+ * Updates the current hover position with the provided hover object.
50
+ * @param {Object} hover - The hover object containing the x and y coordinates and time formatted.
51
+ * @param {number} hover.x - The x coordinate of the hover.
52
+ * @param {number} hover.y - The y coordinate of the hover.
53
+ * @param {string} hover.timeFormatted - The formatted time of the hover.
54
+ * @param {Object} hover.candleHover - The candle hover object containing the open, close, high, low and closestOHLCY coordinates.
55
+ * @param {number} hover.candleHover.openY - The y coordinate of the open price of the candle.
56
+ * @param {number} hover.candleHover.closeY - The y coordinate of the close price of the candle.
57
+ * @param {number} hover.candleHover.highY - The y coordinate of the high price of the candle.
58
+ * @param {number} hover.candleHover.lowY - The y coordinate of the low price of the candle.
59
+ * @param {number} hover.candleHover.closestOHLCY - The y coordinate of the closest OHLC price of the candle.
60
+ * @returns {void}
61
+ */
62
+ updateHover(hover: Hover, magnetTarget?: import("./cross-tool.component").MagnetTarget): void;
63
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 as c}from"rxjs";import{ChartBaseElement as o}from"../../model/chart-base-element";import{CHART_UUID as i}from"../../canvas/canvas-bounds-container";export class CrossToolModel extends o{get currentHover(){return this.currentHoverSubject.getValue()}set currentHover(e){this.currentHoverSubject.next(e)}constructor(e,r,t,s){super(),this.config=e,this.crossToolCanvasModel=r,this.crossEventProducer=t,this.hoverProducer=s,this.currentHoverSubject=new c(null),this.type="cross-and-labels",this.type=e.type}setType(e){this.type=e}doActivate(){super.doActivate(),this.addRxSubscription(this.hoverProducer.hoverSubject.subscribe(e=>{this.crossEventProducer.crossSubject.getValue()!==null&&e!==null?this.updateHover(e):this.currentHover=null,this.fireDraw()}))}fireDraw(){this.type!=="none"&&this.crossToolCanvasModel.fireDraw()}updateHover(e,r=this.config.magnetTarget){if(this.currentHover===null?this.currentHover={x:e.x,y:0,time:e.timeFormatted,paneId:e.paneId}:(this.currentHover.x=e.x,this.currentHover.time=e.timeFormatted),e.candleHover&&e.paneId===i)switch(r){case"O":this.currentHover.y=e.candleHover.openY;break;case"C":this.currentHover.y=e.candleHover.closeY;break;case"H":this.currentHover.y=e.candleHover.highY;break;case"L":this.currentHover.y=e.candleHover.lowY;break;case"OHLC":this.currentHover.y=e.candleHover.closestOHLCY;break;case"none":this.currentHover.y=e.y;break}else this.currentHover.y=e.y;this.currentHoverSubject.next(this.currentHover)}}
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { CanvasBoundsContainer } from '../../../canvas/canvas-bounds-container';
7
+ import { FullChartConfig } from '../../../chart.config';
8
+ import { PaneManager } from '../../pane/pane-manager.component';
9
+ import { CrossToolTypeDrawer } from '../cross-tool.drawer';
10
+ import { CrossToolHover } from '../cross-tool.model';
11
+ export declare class CrossAndLabelsDrawerType implements CrossToolTypeDrawer {
12
+ private config;
13
+ private canvasBoundsContainer;
14
+ private paneManager;
15
+ private crossDrawPredicate;
16
+ private noLines?;
17
+ constructor(config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer, paneManager: PaneManager, crossDrawPredicate?: () => boolean, noLines?: boolean | undefined);
18
+ /**
19
+ * Draws a cross tool on a canvas context and its labels if the crossDrawPredicate is true.
20
+ * @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
21
+ * @param {CrossToolHover} hover - The hover object containing information about the cross tool's position.
22
+ */
23
+ draw(ctx: CanvasRenderingContext2D, hover: CrossToolHover): void;
24
+ /**
25
+ * This is a protected method called `drawCrossTool` that takes two parameters: `ctx` of type `CanvasRenderingContext2D` and `hover` of type `CrossToolHover`.
26
+ * The method draws a cross tool on the canvas using the provided context. It first gets the bounds of all panes and the hit test bounds of all panes. It then gets the top padding of the x-axis from the configuration and the left padding of the y-axis from the configuration based on the type of y-label.
27
+ * If the hit test bounds of all panes contain the hover coordinates, it draws a horizontal line and a vertical line using the provided coordinates and the bounds of all panes. It sets the stroke style to the line color from the configuration and sets the line dash to the line dash from the configuration. It then begins a new path, moves to the start of the horizontal line, draws a line to the end of the horizontal line, moves to the start of the vertical line, and draws a line to the end of the vertical line. Finally, it strokes the path.
28
+ */
29
+ protected drawCrossTool(ctx: CanvasRenderingContext2D, hover: CrossToolHover): void;
30
+ /**
31
+ * Draws the X axis label for the cross tool on the canvas.
32
+ * @param {CanvasRenderingContext2D} ctx - The 2D rendering context for the canvas.
33
+ * @param {CrossToolHover} hover - The hover object containing the x and y coordinates of the cross tool.
34
+ * @returns {void}
35
+ */
36
+ protected drawXLabel(ctx: CanvasRenderingContext2D, hover: CrossToolHover): void;
37
+ /**
38
+ * Draws the Y-axis label on the canvas context at the given point.
39
+ * @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
40
+ * @param {Point} point - The point where the label should be drawn.
41
+ * @returns {void}
42
+ */
43
+ protected drawYLabel(ctx: CanvasRenderingContext2D, point: CrossToolHover): void;
44
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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{CanvasElement as v}from"../../../canvas/canvas-bounds-container";import{avoidAntialiasing as w,drawRoundedRect as B}from"../../../utils/canvas/canvas-drawing-functions.utils";import{priceLabelDrawersMap as S}from"../../y_axis/price_labels/price-label.drawer";export class CrossAndLabelsDrawerType{constructor(o,s,t,e=()=>!0,i){this.config=o,this.canvasBoundsContainer=s,this.paneManager=t,this.crossDrawPredicate=e,this.noLines=i}draw(o,s){this.crossDrawPredicate()&&w(o,()=>this.drawCrossTool(o,s))}drawCrossTool(o,s){var t,e,i,a,l;const n=this.canvasBoundsContainer.getBounds(v.ALL_PANES),d=this.canvasBoundsContainer.getBoundsHitTest(v.ALL_PANES,{extensionY:1e-4}),g=(t=this.config.components.xAxis.padding.top)!==null&&t!==void 0?t:0,r=(i=this.config.components.yAxis.typeConfig[(e=this.config.components.crossTool.yLabel.type)!==null&&e!==void 0?e:"badge"])===null||i===void 0?void 0:i.paddings,p=(a=r==null?void 0:r.start)!==null&&a!==void 0?a:0,c=(l=this.paneManager.paneComponents[s.paneId])===null||l===void 0?void 0:l.ht;if(d(s.x,n.y)){const x={start:[n.x,s.y],end:[n.x+n.width+p,s.y]},f={start:[s.x,n.y],end:[s.x,n.y+n.height+g]},u=c==null?void 0:c(s.x,s.y);this.noLines||(o.strokeStyle=this.config.colors.crossTool.lineColor,o.setLineDash(this.config.components.crossTool.lineDash),o.beginPath(),u&&(o.moveTo(...x.start),o.lineTo(...x.end)),o.moveTo(...f.start),o.lineTo(...f.end),o.stroke()),u&&this.drawYLabel(o,s),this.drawXLabel(o,s)}}drawXLabel(o,s){var t,e,i,a,l;const n=this.config.components.crossTool.xLabel.padding,d=this.config.components.crossTool.xLabel.margin,g=this.config.colors.crossTool;if(this.config.components.xAxis.visible){o.font=this.config.components.xAxis.fontSize+"px "+this.config.components.xAxis.fontFamily;const r=s.x,p=s.time,c=o.measureText(p).width,x=this.config.components.xAxis.fontSize,f=this.canvasBoundsContainer.getBounds(v.X_AXIS);o.save(),o.fillStyle=g.labelBoxColor;const u=(t=n==null?void 0:n.left)!==null&&t!==void 0?t:0,T=(e=n==null?void 0:n.right)!==null&&e!==void 0?e:0,h=(i=n==null?void 0:n.top)!==null&&i!==void 0?i:0,y=(a=n==null?void 0:n.bottom)!==null&&a!==void 0?a:0,b=(l=d==null?void 0:d.top)!==null&&l!==void 0?l:0,m=c+u+T,L=x+h+y,C=Math.max(r-m/2,0),A=f.y+b;B(o,C,A,m,L),o.fillStyle=g.labelTextColor;const P=Math.max(r-c/2,u),_=f.y+b+x+h-1;o.fillText(p,P,_),o.restore()}}drawYLabel(o,s){var t,e;const i=this.config.components.crossTool.yLabel.padding,a=this.config.colors.crossTool;if(this.config.components.yAxis.visible){const l=this.paneManager.paneComponents[s.paneId],n=s.y;if(!l)return;for(const d of l.yExtentComponents){const g=d.regularValueFromY(n),r=d.valueFormatter(g),p=this.canvasBoundsContainer.getBounds(v.PANE_UUID_Y_AXIS(l.uuid,d.idx)),c=S[this.config.components.crossTool.yLabel.type];c(o,p,r,n,{textColor:a.labelTextColor,bgColor:a.labelBoxColor,paddingBottom:i==null?void 0:i.bottom,paddingEnd:i==null?void 0:i.end,paddingTop:i==null?void 0:i.top},(e=(t=d.yAxisComponent)===null||t===void 0?void 0:t.state)!==null&&e!==void 0?e:this.config.components.yAxis,this.config.colors.yAxis,!0)}}}}
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { CrossToolTypeDrawer } from '../cross-tool.drawer';
7
+ export declare class NoneDrawerType implements CrossToolTypeDrawer {
8
+ draw(): void;
9
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 NoneDrawerType{draw(){}}
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { HitBoundsTest } from '../../canvas/canvas-bounds-container';
7
+ import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
8
+ import { ChartPanComponent } from '../pan/chart-pan.component';
9
+ import { DragComponentOptions, DragNDropComponent, DragNDropComponentCallbacks } from './drag-n-drop.component';
10
+ export declare class DragNDropXComponent extends DragNDropComponent {
11
+ constructor(hitTest: HitBoundsTest, dragCallbacks: DragNDropComponentCallbacks, canvasInputListener: CanvasInputListenerComponent, chartPanComponent: ChartPanComponent, dragComponentOptions?: DragComponentOptions);
12
+ /**
13
+ * This method is used to activate the component and add the necessary subscriptions to the canvasInputListener.
14
+ * It calls the super method doActivate() and then adds the following subscriptions:
15
+ * - observeXDragStart() subscription with hitTest() as parameter and onDragStart() as callback function
16
+ * - observeXDrag() subscription with onDragTick() as callback function
17
+ * - observeXDragEnd() subscription with onDragEnd() as callback function
18
+ * @returns {void}
19
+ */
20
+ protected doActivate(): void;
21
+ /**
22
+ * This method overrides the doDeactivate method of the parent class and calls it using the super keyword.
23
+ * It is used to deactivate the current object and perform any necessary cleanup operations.
24
+ * @protected
25
+ */
26
+ protected doDeactivate(): void;
27
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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{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()}}
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { HitBoundsTest } from '../../canvas/canvas-bounds-container';
7
+ import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
8
+ import { ChartPanComponent } from '../pan/chart-pan.component';
9
+ import { DragComponentOptions, DragNDropComponent, DragNDropComponentCallbacks } from './drag-n-drop.component';
10
+ export declare class DragNDropYComponent extends DragNDropComponent {
11
+ constructor(hitTest: HitBoundsTest, dragCallbacks: DragNDropComponentCallbacks, canvasInputListener: CanvasInputListenerComponent, chartPanComponent: ChartPanComponent, dragComponentOptions?: DragComponentOptions);
12
+ /**
13
+ * This method activates the component and adds subscriptions to the canvasInputListener.
14
+ * @protected
15
+ * @returns {void}
16
+ */
17
+ protected doActivate(): void;
18
+ /**
19
+ * This method overrides the doDeactivate method of the parent class and calls the parent method before executing its own code.
20
+ * It is a protected method, which means it can only be accessed within the class and its subclasses.
21
+ */
22
+ protected doDeactivate(): void;
23
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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{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()}}
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { HitBoundsTest } from '../../canvas/canvas-bounds-container';
7
+ import { ChartBaseElement } from '../../model/chart-base-element';
8
+ import { CanvasInputListenerComponent, Point } from '../../inputlisteners/canvas-input-listener.component';
9
+ import { ChartPanComponent } from '../pan/chart-pan.component';
10
+ export interface DragInfo {
11
+ delta: number;
12
+ draggedPixels: number;
13
+ }
14
+ export interface DragComponentOptions {
15
+ disableChartPanning: boolean;
16
+ }
17
+ export interface DragNDropComponentCallbacks {
18
+ onDragStart?: (point: Point) => void;
19
+ onDragTick: (dragInfo: DragInfo) => void;
20
+ onDragEnd?: (draggedPixels: number) => void;
21
+ }
22
+ export declare const defaultDragComponentOptions: DragComponentOptions;
23
+ export declare class DragNDropComponent extends ChartBaseElement {
24
+ protected hitTest: HitBoundsTest;
25
+ protected dragCallbacks: DragNDropComponentCallbacks;
26
+ protected canvasInputListener: CanvasInputListenerComponent;
27
+ protected chartPanComponent: ChartPanComponent;
28
+ private dragComponentOptions;
29
+ dragging: boolean;
30
+ draggedPixels: number;
31
+ constructor(hitTest: HitBoundsTest, dragCallbacks: DragNDropComponentCallbacks, canvasInputListener: CanvasInputListenerComponent, chartPanComponent: ChartPanComponent, dragComponentOptions: DragComponentOptions);
32
+ /**
33
+ * Calls the parent class's doActivate method and performs any additional activation logic.
34
+ * This method is protected and can only be accessed by the class itself and its subclasses.
35
+ */
36
+ protected doActivate(): void;
37
+ /**
38
+ * This method overrides the doDeactivate method of the parent class and calls it using the super keyword.
39
+ * It is a protected method that can only be accessed within the class and its subclasses.
40
+ * This method is responsible for deactivating the current object.
41
+ */
42
+ protected doDeactivate(): void;
43
+ protected onDragStart: (point: Point) => void;
44
+ protected onDragTick: (yDelta: number) => void;
45
+ protected onDragEnd: () => void;
46
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 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()}}
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
8
+ import { ChartModel } from '../chart/chart.model';
9
+ import { FullChartConfig } from '../../chart.config';
10
+ import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
11
+ import { EventsModel } from './events.model';
12
+ export declare class EventsHitTestDrawer implements Drawer {
13
+ private hitTestCanvasModel;
14
+ private chartModel;
15
+ private config;
16
+ private canvasBoundsContainer;
17
+ private model;
18
+ constructor(hitTestCanvasModel: HitTestCanvasModel, chartModel: ChartModel, config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer, model: EventsModel);
19
+ /**
20
+ * Draws events on the hit test canvas.
21
+ * @function
22
+ * @name draw
23
+ * @memberof CanvasElement.EVENTS
24
+ * @instance
25
+ * @returns {void}
26
+
27
+ */
28
+ draw(): void;
29
+ /**
30
+ * Returns an array of string containing the canvas ID of the hitTestCanvasModel.
31
+ * @returns {Array<string>} An array of string containing the canvas ID of the hitTestCanvasModel.
32
+ */
33
+ getCanvasIds(): Array<string>;
34
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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{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]}}
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { Observable } from 'rxjs';
7
+ import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
8
+ import { CursorHandler } from '../../canvas/cursor.handler';
9
+ import { ChartBaseElement } from '../../model/chart-base-element';
10
+ import { FullChartConfig } from '../../chart.config';
11
+ import { CanvasModel } from '../../model/canvas.model';
12
+ import { DrawingManager } from '../../drawers/drawing-manager';
13
+ import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
14
+ import { DateTimeFormatterFactory } from '../../model/date-time.formatter';
15
+ import { ChartModel } from '../chart/chart.model';
16
+ import { EconomicEvent, EventType, EventWithId, EventsModel } from './events.model';
17
+ export declare class EventsComponent extends ChartBaseElement {
18
+ private config;
19
+ private canvasModel;
20
+ private canvasBoundsContainer;
21
+ private drawingManager;
22
+ private formatterFactory;
23
+ eventsModel: EventsModel;
24
+ private eventsXAxisLabelFormatterProvider;
25
+ constructor(config: FullChartConfig, canvasModel: CanvasModel, hitTestCanvasModel: HitTestCanvasModel, chartModel: ChartModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, formatterFactory: DateTimeFormatterFactory, cursorHandler: CursorHandler, backgroundCanvasModel: CanvasModel);
26
+ /**
27
+ * Sets the new event list.
28
+ * @param events
29
+ */
30
+ setEvents(events: EconomicEvent[]): void;
31
+ /**
32
+ * Changes the component visibility.
33
+ * @param visible
34
+ */
35
+ setVisible(visible: boolean): void;
36
+ /**
37
+ * Changes visibility for the specific event type.
38
+ * For example, to turn off dividends visibility you can call this method with { dividends: false } argument
39
+ */
40
+ setEventTypeVisible(eventsVisibility: Partial<Record<EventType, boolean>>): void;
41
+ /**
42
+ * Observes hovered event when mouse moves in, and provides null when mouse moves out.
43
+ */
44
+ observeEventHovered(): Observable<EventWithId | null>;
45
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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{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()}}
@@ -0,0 +1,87 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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 { Bounds } from '../../model/bounds.model';
7
+ import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
8
+ import { CustomIcon, FullChartConfig } from '../../chart.config';
9
+ import { CanvasModel } from '../../model/canvas.model';
10
+ import { Drawer } from '../../drawers/drawing-manager';
11
+ import { DateTimeFormatter } from '../../model/date-time.formatter';
12
+ import { ChartModel } from '../chart/chart.model';
13
+ import { EconomicEvent, EventsModel, EventType, EventWithId } from './events.model';
14
+ export declare class EventsDrawer implements Drawer {
15
+ private backgroundCanvas;
16
+ private canvasModel;
17
+ private chartModel;
18
+ private config;
19
+ private canvasBoundsContainer;
20
+ private model;
21
+ private formatterProvider;
22
+ private customIcons;
23
+ constructor(backgroundCanvas: CanvasModel, canvasModel: CanvasModel, chartModel: ChartModel, config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer, model: EventsModel, formatterProvider: () => DateTimeFormatter);
24
+ /**
25
+ * Creates a custom icon for a given event type.
26
+ * @param {EventType} type - The type of the event.
27
+ * @param {CustomIcon} [icon] - The custom icon object containing the normal and hover images.
28
+ * @returns {void}
29
+ */
30
+ createCustomIcon(type: EventType, icon?: CustomIcon): void;
31
+ /**
32
+ * Creates an icon image from a string containing SVG data.
33
+ * @param {string} iconString - The string containing SVG data.
34
+ * @returns {Object} An object containing an Image object and the height of the SVG element.
35
+ */
36
+ createIconImage(iconString: string): {
37
+ img: HTMLImageElement;
38
+ svgHeight: number;
39
+ };
40
+ /**
41
+ * Draws events on the chart canvas if they are visible according to the configuration.
42
+ * The events are filtered by type and then iterated over to draw them on the chart.
43
+ * If a custom icon is available in the cache, it is used to draw the event, otherwise a default event is drawn.
44
+ * If the event is currently being hovered over, a vertical line is drawn and a label is added to the x-axis.
45
+ * @returns {void}
46
+ */
47
+ draw(): void;
48
+ /**
49
+ * Draws a custom SVG event on a canvas context.
50
+ * @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
51
+ * @param {number} x - The x coordinate of the event.
52
+ * @param {Bounds} bounds - The bounds of the event.
53
+ * @param {EventWithId} event - The event to draw.
54
+ * @returns {void}
55
+ */
56
+ drawCustomSvgEvent(ctx: CanvasRenderingContext2D, x: number, bounds: Bounds, event: EventWithId): void;
57
+ /**
58
+ * Draws a default event on a canvas context.
59
+ * @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
60
+ * @param {number} x - The x coordinate of the event.
61
+ * @param {Bounds} bounds - The bounds of the event.
62
+ * @param {EventWithId} event - The event to draw.
63
+ * @param {string} color - The color of the event.
64
+ * @returns {void}
65
+ */
66
+ drawDefaultEvent(ctx: CanvasRenderingContext2D, x: number, bounds: Bounds, event: EventWithId, color: string): void;
67
+ /**
68
+ * This function is responsible for drawing a label on the canvas at a given x coordinate. The label contains a formatted timestamp of a given event. The function takes two parameters: x, which is the x coordinate where the label will be drawn, and event, which is an object containing information about the event, including its timestamp and type.
69
+ * The function first gets the canvas context and the bounds of the x-axis. It then retrieves the font family, font height, and top padding from the configuration object. The y coordinate of the label is calculated based on the font height, top padding, and the y coordinate of the x-axis bounds. The font is set using the retrieved font family and font height.
70
+ * The timestamp of the event is formatted using a formatter provider function. The width of the label is calculated using the canvas context's measureText() method. The function then calls another function, redrawBackgroundArea(), to hide the regular x-axis label that may overlap with the event label.
71
+ * Finally, the function sets the fill style of the canvas context to the color associated with the event type in the configuration object. The label text is then drawn on the canvas context at the calculated x and y coordinates.
72
+ */
73
+ drawLabel(x: number, event: EventWithId): void;
74
+ /**
75
+ * Returns an array of canvas IDs.
76
+ *
77
+ * @returns {Array<string>} An array containing the ID of the canvas model.
78
+ */
79
+ getCanvasIds(): Array<string>;
80
+ }
81
+ /**
82
+ * Returns the size of an event based on its style
83
+ * @param {EconomicEvent} event - The event to get the size of
84
+ * @returns {number} - The size of the event
85
+
86
+ */
87
+ export declare function getEventSize(event: EconomicEvent): number;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
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{CanvasElement as g}from"../../canvas/canvas-bounds-container";import{redrawBackgroundArea as v}from"../../drawers/chart-background.drawer";const f={"rhombus-small":4,rhombus:6,"rhombus-large":8},c=(h,t)=>`${h}_${t}`;export class EventsDrawer{constructor(t,e,o,s,n,i,a){this.backgroundCanvas=t,this.canvasModel=e,this.chartModel=o,this.config=s,this.canvasBoundsContainer=n,this.model=i,this.formatterProvider=a,this.customIcons={};const r=this.config.components.events.icons;r&&(this.createCustomIcon("earnings",r.earnings),this.createCustomIcon("dividends",r.dividends),this.createCustomIcon("splits",r.splits),this.createCustomIcon("conference-calls",r.conferenceCalls))}createCustomIcon(t,e){if(e){const o=this.createIconImage(e.normal),s=this.createIconImage(e.hover);this.customIcons[c(t,"normal")]=o,this.customIcons[c(t,"hover")]=s}}createIconImage(t){var e;const s=new DOMParser().parseFromString(t,"text/html").querySelector("svg");let n=0;s&&(n=parseInt((e=s.getAttribute("height"))!==null&&e!==void 0?e:"",10));const r="data:image/svg+xml;base64,"+btoa(t),l=new Image;return l.src=r,{img:l,svgHeight:n}}draw(){if(!this.config.components.events.visible)return;const t=this.canvasBoundsContainer.getBounds(g.EVENTS),e=this.canvasBoundsContainer.getBounds(g.ALL_PANES),o=this.canvasModel.ctx;o.save(),this.model.events.filter(s=>this.config.components.events.eventsVisibility[s.type]).forEach(s=>{const n=this.chartModel.candleFromTimestamp(s.timestamp).xCenter(this.chartModel.scaleModel);if(n>e.x&&n<e.x+e.width){const i=this.config.colors.events[s.type].color;o.strokeStyle=i,this.customIcons[c(s.type,"hover")]!==void 0?this.drawCustomSvgEvent(o,n,t,s):this.drawDefaultEvent(o,n,t,s,i),this.model.hoveredEvent.getValue()===s&&(o.beginPath(),o.moveTo(n,e.y),o.lineTo(n,t.y+t.height/2),o.stroke(),o.closePath(),this.config.components.xAxis.visible&&this.drawLabel(n,s))}}),o.restore()}drawCustomSvgEvent(t,e,o,s){const n=o.y+o.height/2,i=this.customIcons[c(s.type,"normal")],a=this.customIcons[c(s.type,"hover")];this.model.hoveredEvent.getValue()===s?t.drawImage(a.img,e-a.svgHeight/2,n-a.svgHeight/2):t.drawImage(i.img,e-i.svgHeight/2,n-i.svgHeight/2)}drawDefaultEvent(t,e,o,s,n){const i=o.y+o.height/2;t.fillStyle=n,t.lineWidth=1.5;const a=getEventSize(s);t.beginPath(),t.moveTo(e-a,i),t.lineTo(e,i-a),t.lineTo(e+a,i),t.lineTo(e,i+a),t.closePath(),this.model.hoveredEvent.getValue()===s?t.fill():t.stroke()}drawLabel(t,e){var o;const s=this.canvasModel.ctx,n=this.canvasBoundsContainer.getBounds(g.X_AXIS),i=this.config.components.xAxis.fontFamily,a=this.config.components.xAxis.fontSize,r=(o=this.config.components.xAxis.padding.top)!==null&&o!==void 0?o:0,l=n.y+a-1+r;s.font=`${a}px ${i}`;const d=this.formatterProvider()(e.timestamp),m=s.measureText(d).width;v(this.backgroundCanvas.ctx,s,t-m/2,n.y+1,m,n.height-1),s.fillStyle=this.config.colors.events[e.type].color,s.fillText(d,t-m/2,l)}getCanvasIds(){return[this.canvasModel.canvasId]}}export function getEventSize(h){return f[h.style]}