@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,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,CHART_UUID as q}from"../../../canvas/canvas-bounds-container";import{getFontFromConfig as I}from"../../../chart.config";import{redrawBackgroundArea as z}from"../../../drawers/chart-background.drawer";import{avoidAntialiasing as J,drawLine as K}from"../../../utils/canvas/canvas-drawing-functions.utils";import{calculateSymbolHeight as N,calculateTextWidth as R}from"../../../utils/canvas/canvas-font-measure-tool.utils";import{floor as O}from"../../../utils/math.utils";import{drawBadgeLabel as Q,drawPlainLabel as Z,drawRectLabel as $}from"../y-axis-labels.drawer";export const DEFAULT_LABEL_APPEARANCE_TYPE="badge";const X=4;export const priceLabelDrawersMap={badge:Q,rectangle:$,plain:Z};export function drawLabel(o,n,e,m,t,B,l,_){var s,d,c,r,a;const p=t.y,f=t.labelText,T=(s=t.mode)!==null&&s!==void 0?s:"label",x=(d=t.labelType)!==null&&d!==void 0?d:DEFAULT_LABEL_APPEARANCE_TYPE,g=t.description,A=(c=t.textFont)!==null&&c!==void 0?c:I(l),w=t.bgColor,b=(r=t.lineColor)!==null&&r!==void 0?r:w,h=R(g!=null?g:"",o,A)+8,D=O(t.y),y=N(A,o),E=p-y/2,j=p+y/2-E;o.save(),o.fillStyle=w,o.strokeStyle=b;const i=B.getBounds(V.PANE_UUID(q)),G=priceLabelDrawersMap[x],C=l.labels.descriptions,M=v(e,D,j),Y=()=>C&&L(n,o,e,m,t,l.align,l);let F,P;const U=2;l.align==="right"?(F=i.x,P=C?i.x+i.width-h:i.x+i.width+U):(F=C?i.x+h:i.x-U,P=i.x+i.width);const k=(a=t.lineY)!==null&&a!==void 0?a:t.y,H=()=>M&&J(o,()=>K(o,F,k,P,k,1)),W=()=>G(o,e,f,p,t,l,_,!1,n);switch(T){case"line":H(),Y();break;case"line-label":H(),Y(),W();break;case"label":Y(),W();break;case"none":break}o.restore()}const v=(o,n,e)=>n>o.y+e/2&&n<o.y+o.height-e/2;function L(o,n,e,m,t,B="right",l){var _,s,d;const c=t.description;if(!c||c.length===0)return;const r=t.y,a=I(l),p=R(c,n,a),f=N(a,n),T=(_=t.paddingTop)!==null&&_!==void 0?_:X,x=(s=t.paddingBottom)!==null&&s!==void 0?s:X,g=r-f/2-T,w=r+f/2+x-g;if(r<e.y+w/2||r>e.y+e.height-w/2)return;n.save();const b=p+5,h=4,D=p+h*2,y=m.x+m.width,E=B==="right"?y-D:m.x+h;z(o,n,E,g,b,w,.8),n.fillStyle=(d=t.descColor)!==null&&d!==void 0?d:t.bgColor,n.font=a;const S=B==="right"?y-p-h*2:m.x+h*2;n.fillText(c,S,r+f/2-1),n.restore()}
@@ -0,0 +1,159 @@
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 { ChartConfigComponentsYAxis, FullChartConfig, YAxisLabelMode } from '../../../chart.config';
9
+ import EventBus from '../../../events/event-bus';
10
+ import { Bounds } from '../../../model/bounds.model';
11
+ import { CanvasModel } from '../../../model/canvas.model';
12
+ import { ChartBaseElement } from '../../../model/chart-base-element';
13
+ import { Unit } from '../../../model/scaling/viewport.model';
14
+ import { ChartModel } from '../../chart/chart.model';
15
+ import { YAxisLabelDrawConfig } from '../y-axis-labels.drawer';
16
+ export type YAxisVisualLabelType = 'badge' | 'rectangle' | 'plain';
17
+ export interface VisualYAxisLabel extends YAxisLabelDrawConfig {
18
+ y: Unit;
19
+ labelText: string;
20
+ mode?: YAxisLabelMode;
21
+ labelType?: YAxisVisualLabelType;
22
+ lineY?: number;
23
+ labelWeight?: number;
24
+ description?: string;
25
+ subGroupId?: number;
26
+ }
27
+ export interface LabelGroup {
28
+ labels: VisualYAxisLabel[];
29
+ bounds?: Bounds;
30
+ axisState?: ChartConfigComponentsYAxis;
31
+ }
32
+ export type ProviderGroups = Record<string, YAxisLabelsProvider[]>;
33
+ export declare const LabelsGroups: {
34
+ readonly MAIN: "MAIN";
35
+ };
36
+ /**
37
+ * Different labels on Y axis:
38
+ * - last candle price
39
+ * - bid/ask
40
+ * - countdown
41
+ * - prev.day price
42
+ * - high low in viewport
43
+ * - drawings
44
+ * - studies
45
+ * - ...
46
+ * Anything but the base labels which are generated in other component {@link YAxisBaseLabelsModel}
47
+ */
48
+ export declare class YAxisLabelsModel extends ChartBaseElement {
49
+ eventBus: EventBus;
50
+ private chartModel;
51
+ private canvasBoundsContainer;
52
+ private config;
53
+ private canvasModel;
54
+ private updateYAxisWidth;
55
+ orderedLabels: LabelGroup[];
56
+ /**
57
+ * an easier way to manage custom y-axis labels, than y-axis labels providers, but doesn't support overlapping avoidance
58
+ */
59
+ readonly customLabels: Record<string, VisualYAxisLabel>;
60
+ private labelsProviders;
61
+ private labelsPositionRecalculatedSubject;
62
+ private animFrameId;
63
+ constructor(eventBus: EventBus, chartModel: ChartModel, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig, canvasModel: CanvasModel, updateYAxisWidth: () => void);
64
+ /**
65
+ * This method is used to activate the chart and subscribe to the observables that will trigger the update of the labels.
66
+ * It calls the parent method doActivate() and adds a new Rx subscription to the merge of the following observables:
67
+ * - chartModel.observeCandlesChanged()
68
+ * - canvasBoundsContainer.observeBoundsChanged(CanvasElement.CHART)
69
+ * - chartModel.nextCandleTimeStampSubject
70
+ * - canvasBoundsContainer.barResizerChangedSubject
71
+ * - chartModel.scaleModel.changed
72
+ * When any of these observables emit a new value, the updateLabels() method is called.
73
+ * @protected
74
+ */
75
+ protected doActivate(): void;
76
+ /**
77
+ * Initializes the model by calling the methods to initialize the label groups and recalculate the labels.
78
+ * Then, it fires the draw event on the canvas model.
79
+ * @private
80
+ */
81
+ private initModel;
82
+ /**
83
+ * Initializes the labels groups.
84
+ * If there are labels providers, it creates a group for each one and adds the providers to their respective groups.
85
+ * @returns {void}
86
+ */
87
+ private initLabelsGroups;
88
+ /**
89
+ * Updates YAxis ordered labels.
90
+ * @param adjustYAxisWidth - provide "true", if you need to adjust width after new labels will be calculated.
91
+ */
92
+ updateLabels(adjustYAxisWidth?: boolean): void;
93
+ /**
94
+ * Recalculates the labels based on the current configuration and label providers.
95
+ * It generates label groups and calculates their coordinates based on their weight and the label height.
96
+ * The coordinates are generated in the order they were passed to the generator.
97
+ * The ordered labels are then updated with the new coordinates and reversed.
98
+ * @returns {void}
99
+ */
100
+ recalculateLabels(): void;
101
+ /**
102
+ * Creates a new group with the given name if it doesn't exist yet.
103
+ * @param {string} groupName - The name of the group to be created.
104
+ * @returns {void}
105
+ */
106
+ private createGroup;
107
+ /**
108
+ * Adds a YAxisLabelsProvider component to a group.
109
+ *
110
+ * @param {YAxisLabelsProvider} component - The component to add to the group.
111
+ * @param {string} groupName - The name of the group to add the component to.
112
+ * @param {string} id - The id of the component to add to the group.
113
+ * @returns {void}
114
+ */
115
+ private addToGroup;
116
+ /**
117
+ * Updates the coordinates of the labels in a LabelGroup object based on an array of points.
118
+ * @param {LabelGroup} labels - The LabelGroup object containing the labels to be updated.
119
+ * @param {number[]} points - An array of points to be used to update the y-coordinate of each label.
120
+ * @returns {LabelGroup} - A new LabelGroup object with updated label coordinates.
121
+ */
122
+ private updateLabelsCoordinates;
123
+ /**
124
+ * Returns an Observable that emits a void value whenever the labels position is recalculated.
125
+ * The Observable is created from the labelsPositionRecalculatedSubject Subject.
126
+ * @returns {Observable<void>} An Observable that emits a void value whenever the labels position is recalculated.
127
+ */
128
+ observeLabelsPositionsRecalculated(): Observable<void>;
129
+ /**
130
+ * Registers a Y axis labels provider for a given group name and ID.
131
+ *
132
+ * @param {string} groupName - The name of the group to which the provider belongs.
133
+ * @param {YAxisLabelsProvider} provider - The provider to be registered.
134
+ * @param {string} id - The ID of the provider to be registered.
135
+ * @returns {void}
136
+ */
137
+ registerYAxisLabelsProvider(groupName: string, provider: YAxisLabelsProvider, id: string): void;
138
+ /**
139
+ * Unregisters a Y axis labels provider.
140
+ *
141
+ * @param {string} groupName - The name of the group to which the provider belongs.
142
+ * @param {string} id - The ID of the provider to unregister.
143
+ *
144
+ * @returns {void}
145
+ */
146
+ unregisterYAxisLabelsProvider(groupName: string, id: string): void;
147
+ }
148
+ /**
149
+ * YAxisLabelsProvider interface used to write price labels providers
150
+ * for YAxisLabelsModel.
151
+ * Under the hood, YAxisLabelsModel calls Provider.getUnorderedLabels method
152
+ * on each provider, and generates Y coordinates for each label
153
+ * according to non-overlapping condition
154
+ * Then, with the info which was got from the Providers and Y coordinates
155
+ * follows the draw cycle of labels
156
+ */
157
+ export interface YAxisLabelsProvider {
158
+ readonly getUnorderedLabels: () => LabelGroup[];
159
+ }
@@ -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{merge as h,Subject as b}from"rxjs";import{CanvasElement as c,CHART_UUID as v}from"../../../canvas/canvas-bounds-container";import{ChartBaseElement as u}from"../../../model/chart-base-element";import{animationFrameThrottledPrior as p}from"../../../utils/perfomance/request-animation-frame-throttle.utils";import{uuid as m}from"../../../utils/uuid.utils";import{calcLabelsYCoordinates as f}from"./labels-positions-calculator";import{flat as d}from"../../../utils/array.utils";export const LabelsGroups={MAIN:"MAIN"};export class YAxisLabelsModel extends u{constructor(e,s,t,i,r,l){super(),this.eventBus=e,this.chartModel=s,this.canvasBoundsContainer=t,this.config=i,this.canvasModel=r,this.updateYAxisWidth=l,this.orderedLabels=[],this.customLabels={},this.labelsProviders={},this.labelsPositionRecalculatedSubject=new b,this.animFrameId=`anim_cache_${m()}`,this.initModel()}doActivate(){super.doActivate(),this.addRxSubscription(h(this.chartModel.observeCandlesChanged(),this.canvasBoundsContainer.observeBoundsChanged(c.PANE_UUID(v)),this.chartModel.nextCandleTimeStampSubject,this.canvasBoundsContainer.barResizerChangedSubject,this.chartModel.scaleModel.changed).subscribe(()=>{this.updateLabels()}))}initModel(){this.initLabelsGroups(),this.recalculateLabels(),this.canvasModel.fireDraw()}initLabelsGroups(){if(Object.keys(this.labelsProviders).length!==0)for(const e of Object.keys(this.labelsProviders))this.createGroup(e),Object.entries(this.labelsProviders[e]).forEach(([s,t])=>{this.addToGroup(t,e,s)})}updateLabels(e=!1){this.recalculateLabels(),p(this.animFrameId,()=>{e&&this.updateYAxisWidth(),this.canvasModel.fireDraw()})}recalculateLabels(){var e,s;this.orderedLabels=[];const t=this.config.components.yAxis.fontSize+((e=this.config.components.yAxis.labelBoxMargin.top)!==null&&e!==void 0?e:0)+((s=this.config.components.yAxis.labelBoxMargin.bottom)!==null&&s!==void 0?s:0);for(const i of Object.values(this.labelsProviders)){const r=d(Object.values(i).map(a=>a.getUnorderedLabels())),l=d(r.map(a=>a.labels)).map(a=>{var o;return{y:a.y,weight:(o=a.labelWeight)!==null&&o!==void 0?o:Number.POSITIVE_INFINITY}}),n=f(l,t);r.forEach(a=>{const o=n.splice(0,a.labels.length);this.orderedLabels.push(this.updateLabelsCoordinates(a,o))})}this.orderedLabels=this.orderedLabels.reverse()}createGroup(e){!this.labelsProviders[e]&&(this.labelsProviders[e]={})}addToGroup(e,s,t){this.labelsProviders[s]&&(Object.values(this.labelsProviders[s]).includes(e)||(this.labelsProviders[s][t]=e))}updateLabelsCoordinates(e,s){return Object.assign(Object.assign({},e),{labels:e.labels.map((t,i)=>Object.assign(Object.assign({},t),{lineY:t.y,y:s[i]}))})}observeLabelsPositionsRecalculated(){return this.labelsPositionRecalculatedSubject.asObservable()}registerYAxisLabelsProvider(e,s,t){var i;const r=(i=this.labelsProviders[e])!==null&&i!==void 0?i:{};r[t]=s,this.labelsProviders[e]=r,this.initModel()}unregisterYAxisLabelsProvider(e,s){var t;const i=(t=this.labelsProviders[e])!==null&&t!==void 0?t:{};delete i[s],this.labelsProviders[e]&&Object.keys(this.labelsProviders[e]).length===0&&delete this.labelsProviders[e],this.initModel()}}
@@ -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 { CanvasBoundsContainer } from '../../../canvas/canvas-bounds-container';
7
+ import { ChartConfigComponentsYAxis, FullChartColors } from '../../../chart.config';
8
+ import { Drawer } from '../../../drawers/drawing-manager';
9
+ import { CanvasModel } from '../../../model/canvas.model';
10
+ import { LabelGroup, VisualYAxisLabel } from './y-axis-labels.model';
11
+ export declare class YAxisPriceLabelsDrawer implements Drawer {
12
+ private labelsProvider;
13
+ private yAxisLabelsCanvasModel;
14
+ private backgroundCanvasModel;
15
+ private yAxisState;
16
+ private canvasBoundsContainer;
17
+ private yAxisColors;
18
+ private readonly customLabels;
19
+ constructor(labelsProvider: () => LabelGroup[], yAxisLabelsCanvasModel: CanvasModel, backgroundCanvasModel: CanvasModel, yAxisState: ChartConfigComponentsYAxis, canvasBoundsContainer: CanvasBoundsContainer, yAxisColors: FullChartColors['yAxis'], customLabels: Record<string, VisualYAxisLabel>);
20
+ draw(): void;
21
+ drawHighlightedBackgroundBetweenLabels(): void;
22
+ getCanvasIds(): Array<string>;
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{CanvasElement as c,CHART_UUID as h,limitYToBounds as u}from"../../../canvas/canvas-bounds-container";import{fillRect as C}from"../../../utils/canvas/canvas-drawing-functions.utils";import{drawLabel as b}from"./price-label.drawer";export class YAxisPriceLabelsDrawer{constructor(t,d,e,i,r,o,a){this.labelsProvider=t,this.yAxisLabelsCanvasModel=d,this.backgroundCanvasModel=e,this.yAxisState=i,this.canvasBoundsContainer=r,this.yAxisColors=o,this.customLabels=a}draw(){const t=this.yAxisLabelsCanvasModel.ctx,d=this.backgroundCanvasModel.ctx,e=this.canvasBoundsContainer.getBounds(c.PANE_UUID_Y_AXIS(h)),i=this.canvasBoundsContainer.getBounds(c.ALL_PANES);this.drawHighlightedBackgroundBetweenLabels(),this.labelsProvider().forEach(o=>{var a;const l=(a=o.bounds)!==null&&a!==void 0?a:e;o.labels.forEach(s=>{var n;return b(t,d,l,i,s,this.canvasBoundsContainer,(n=o.axisState)!==null&&n!==void 0?n:this.yAxisState,this.yAxisColors)})}),Object.values(this.customLabels).forEach(o=>b(t,d,e,i,o,this.canvasBoundsContainer,this.yAxisState,this.yAxisColors))}drawHighlightedBackgroundBetweenLabels(){const t=this.yAxisLabelsCanvasModel.ctx,d=this.labelsProvider(),e={};d.forEach(i=>{i.labels.forEach(r=>{var o,a,l;if(r.subGroupId){const s=(o=e[r.subGroupId])!==null&&o!==void 0?o:[];if(e[r.subGroupId]=s,s.push(r),s.length===2){const n=(a=i.bounds)!==null&&a!==void 0?a:this.canvasBoundsContainer.getBounds(c.PANE_UUID_Y_AXIS(h));t.save(),t.fillStyle=(l=s[0].highlightColor)!==null&&l!==void 0?l:s[0].bgColor;const[v,x]=s[0].y>s[1].y?[s[1].y,s[0].y]:[s[0].y,s[1].y];C(t,{x:n.x,y:u(v,n)},{x:n.x+n.width-6,y:u(x,n)}),t.restore()}}})})}getCanvasIds(){return[this.yAxisLabelsCanvasModel.canvasId]}}
@@ -0,0 +1,31 @@
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 { NumericAxisLabel, NumericAxisLabelsGenerator } from '../labels_generator/numeric-axis-labels.generator';
7
+ import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
8
+ import { ChartBaseElement } from '../../model/chart-base-element';
9
+ import { ScaleModel } from '../../model/scale.model';
10
+ export declare class YAxisBaseLabelsModel extends ChartBaseElement {
11
+ private scaleModel;
12
+ private yAxisLabelsGenerator;
13
+ private canvasBoundsContainer;
14
+ labels: Array<NumericAxisLabel>;
15
+ private prevYAxisHeight;
16
+ private animFrameId;
17
+ constructor(scaleModel: ScaleModel, yAxisLabelsGenerator: NumericAxisLabelsGenerator, canvasBoundsContainer: CanvasBoundsContainer);
18
+ /**
19
+ * This method is used to activate the component. It calls the parent's doActivate method and subscribes to the merge of two observables:
20
+ * - this.scaleModel.yChanged
21
+ * - this.canvasBoundsContainer.observeBoundsChanged
22
+ * The merge of these two observables is used to update the labels of the component when either the y-axis scale model changes or the canvas bounds change.
23
+ * If the height of the canvas bounds changes by more than 1.5 times the previous height, the labels cache is invalidated and the previous y-axis height is updated.
24
+ */
25
+ protected doActivate(): void;
26
+ /**
27
+ * Updates the labels of the chart's y-axis by generating new numeric labels using the yAxisLabelsGenerator object.
28
+ * Then, it calls the updateYAxisWidth method to update the width of the y-axis.
29
+ */
30
+ updateLabels(): void;
31
+ }
@@ -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{merge as t}from"rxjs";import{filter as a,map as r,tap as o}from"rxjs/operators";import{CanvasElement as n}from"../../canvas/canvas-bounds-container";import{ChartBaseElement as h}from"../../model/chart-base-element";import{uuid as m}from"../../utils/uuid.utils";import{animationFrameThrottledPrior as l}from"../../utils/perfomance/request-animation-frame-throttle.utils";import{isDiffersBy as d}from"../../utils/math.utils";export class YAxisBaseLabelsModel extends h{constructor(e,s,i){super(),this.scaleModel=e,this.yAxisLabelsGenerator=s,this.canvasBoundsContainer=i,this.labels=[],this.prevYAxisHeight=0,this.animFrameId=`anim_cache_${m()}`}doActivate(){super.doActivate(),this.addRxSubscription(t(this.scaleModel.yChanged,this.canvasBoundsContainer.observeBoundsChanged(n.Y_AXIS).pipe(r(e=>e.height),a(e=>d(e,this.prevYAxisHeight,1.5)),o(e=>{this.yAxisLabelsGenerator.labelsCache.invalidate(),this.prevYAxisHeight=e}))).subscribe(()=>this.updateLabels()))}updateLabels(){this.labels=this.yAxisLabelsGenerator.generateNumericLabels(),l(this.animFrameId,()=>this.canvasBoundsContainer.updateYAxisWidths())}}
@@ -0,0 +1,70 @@
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 { ChartConfigComponentsYAxis, FullChartColors } from '../../chart.config';
7
+ import { Bounds } from '../../model/bounds.model';
8
+ export interface YAxisLabelDrawProps {
9
+ ctx: CanvasRenderingContext2D;
10
+ bounds: Bounds;
11
+ text: string;
12
+ centralY: number;
13
+ config: YAxisLabelDrawConfig;
14
+ subGroupId?: number;
15
+ }
16
+ export interface YAxisLabelDrawConfig {
17
+ textFont?: string;
18
+ textColor?: string;
19
+ bgColor: string;
20
+ highlightColor?: string;
21
+ descColor?: string;
22
+ lineColor?: string;
23
+ paddingTop?: number;
24
+ paddingBottom?: number;
25
+ paddingEnd?: number;
26
+ paddingStart?: number;
27
+ rounded?: boolean;
28
+ }
29
+ export declare const DEFAULT_PRICE_LABEL_PADDING = 4;
30
+ /**
31
+ * Draws badge label on Y axis with provided parameters.
32
+ * @param ctx - canvas 2D context to draw on
33
+ * @param bounds - bounds of Y axis
34
+ * @param text - text to draw
35
+ * @param centralY - y
36
+ * @param config - label styles config
37
+ * @param align
38
+ * @param yAxisState
39
+ */
40
+ export declare function drawBadgeLabel(ctx: CanvasRenderingContext2D, bounds: Bounds, text: string, centralY: number, config: YAxisLabelDrawConfig, yAxisState: ChartConfigComponentsYAxis, yAxisColors: FullChartColors['yAxis'], drawOutside?: boolean): void;
41
+ /**
42
+ * Draws rectangle label on Y axis with provided parameters.
43
+ * @param ctx - canvas 2D context to draw on
44
+ * @param bounds - bounds of Y axis
45
+ * @param text - text to draw
46
+ * @param centralY - y
47
+ * @param config - label styles config
48
+ * @param align
49
+ * @param yAxisState
50
+ */
51
+ export declare function drawRectLabel(ctx: CanvasRenderingContext2D, bounds: Bounds, text: string, centralY: number, config: YAxisLabelDrawConfig, yAxisState: ChartConfigComponentsYAxis, yAxisColors: FullChartColors['yAxis'], drawOutside?: boolean): void;
52
+ /**
53
+ * Draws rectangle label on Y axis with provided parameters but with transparent background.
54
+ * @param ctx - canvas 2D context to draw on
55
+ * @param bounds - bounds of Y axis
56
+ * @param text - text to draw
57
+ * @param centralY - y
58
+ * @param config - label styles config
59
+ * @param align
60
+ * @param yAxisState
61
+ */
62
+ export declare function drawPlainLabel(ctx: CanvasRenderingContext2D, bounds: Bounds, text: string, centralY: number, config: YAxisLabelDrawConfig, yAxisState: ChartConfigComponentsYAxis, yAxisColors: FullChartColors['yAxis'], drawOutside?: boolean, backgroundCtx?: CanvasRenderingContext2D): void;
63
+ /**
64
+ * Offset from the center of label to the top/bottom.
65
+ *
66
+ * @param font Label font
67
+ * @param ctx Drawing context
68
+ * @param paddingTop - extra padding from top
69
+ */
70
+ export declare function getLabelYOffset(font: string, ctx: CanvasRenderingContext2D, paddingTop?: number): 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{getFontFromConfig as M}from"../../chart.config";import{redrawBackgroundArea as q}from"../../drawers/chart-background.drawer";import{drawPriceLabel as z,drawRoundedRect as J}from"../../utils/canvas/canvas-drawing-functions.utils";import{calculateSymbolHeight as D,calculateTextWidth as X}from"../../utils/canvas/canvas-font-measure-tool.utils";import{getLabelTextColorByBackgroundColor as j}from"../../utils/canvas/canvas-text-functions.utils";import{round as G}from"../../utils/math.utils";export const DEFAULT_PRICE_LABEL_PADDING=4;export function drawBadgeLabel(o,t,m,n,l,d,b,R=!1){var _,a,g,p,v,h,s;const r=d.align,f=(_=l.textFont)!==null&&_!==void 0?_:M(d),B=l.bgColor,E=(a=l.textColor)!==null&&a!==void 0?a:j(B,b.labelTextColor,b.labelInvertedTextColor),F=(g=l.paddingTop)!==null&&g!==void 0?g:DEFAULT_PRICE_LABEL_PADDING,x=(p=l.paddingBottom)!==null&&p!==void 0?p:DEFAULT_PRICE_LABEL_PADDING,L=(v=l.paddingEnd)!==null&&v!==void 0?v:DEFAULT_PRICE_LABEL_PADDING,i=G(D(f,o)/2),e=n-i-F,C=n+i+x-e;if((n<t.y+C/2||n>t.y+t.height-C/2)&&!R)return;o.save(),o.fillStyle=B,o.strokeStyle=B;const c=G(t.width/6),u=r==="right"?t.x:t.x+t.width,w=r==="right"?u+c:u-c,H=d.labelBoxMargin.end,k=H-L,T=t.width-c-k;z(o,w,e,u,e+G(C/2),w,e+C,T,(s=(h=d.typeConfig.badge)===null||h===void 0?void 0:h.rounded)!==null&&s!==void 0?s:!1,r),o.fillStyle=E,o.font=f;const I=r==="right"?t.x+t.width-X(m,o,f)-H:t.x+H;o.fillText(m,I,n+i-1),o.restore()}export function drawRectLabel(o,t,m,n,l,d,b,R=!1){var _,a,g,p,v,h,s,r,f,B,E;const F=d.align,x=(_=l.textFont)!==null&&_!==void 0?_:M(d),L=l.bgColor,i=(a=l.textColor)!==null&&a!==void 0?a:j(L,b.labelTextColor,b.labelInvertedTextColor),e=(g=d.typeConfig.rectangle)===null||g===void 0?void 0:g.paddings,W=(v=(p=l.paddingTop)!==null&&p!==void 0?p:e==null?void 0:e.top)!==null&&v!==void 0?v:DEFAULT_PRICE_LABEL_PADDING,C=(s=(h=l.paddingBottom)!==null&&h!==void 0?h:e==null?void 0:e.bottom)!==null&&s!==void 0?s:DEFAULT_PRICE_LABEL_PADDING,c=(f=(r=l.paddingEnd)!==null&&r!==void 0?r:e==null?void 0:e.end)!==null&&f!==void 0?f:DEFAULT_PRICE_LABEL_PADDING,u=l.paddingStart,w=D(x,o),H=n-w/2-W,T=n+w/2+C-H,I=(B=l.rounded)!==null&&B!==void 0?B:(E=d.typeConfig.rectangle)===null||E===void 0?void 0:E.rounded;if((n<t.y+T/2||n>t.y+t.height-T/2)&&!R)return;o.save(),o.fillStyle=L,o.strokeStyle=L;const y=d.labelBoxMargin.end;o.font=x;const O=X(m,o,x),P=y-c,S=u!==void 0?O+u+c:t.width-P,N=F==="right"?t.x+t.width-P-S:t.x+P,U=F==="right"?t.x+t.width-O-y:y;I?J(o,N,H,S,T,4,!0):o.fillRect(N,H,S,T),o.fillStyle=i,o.fillText(m,U,n+w/2-1),o.restore()}export function drawPlainLabel(o,t,m,n,l,d,b,R=!1,_){var a,g,p,v,h,s,r,f,B;const E=d.align,F=(a=l.textFont)!==null&&a!==void 0?a:M(d),x=l.bgColor,L=(g=l.textColor)!==null&&g!==void 0?g:j(x,b.labelTextColor,b.labelInvertedTextColor),i=(p=d.typeConfig.rectangle)===null||p===void 0?void 0:p.paddings,e=(h=(v=l.paddingTop)!==null&&v!==void 0?v:i==null?void 0:i.top)!==null&&h!==void 0?h:DEFAULT_PRICE_LABEL_PADDING,W=(r=(s=l.paddingBottom)!==null&&s!==void 0?s:i==null?void 0:i.bottom)!==null&&r!==void 0?r:DEFAULT_PRICE_LABEL_PADDING,C=(B=(f=l.paddingEnd)!==null&&f!==void 0?f:i==null?void 0:i.end)!==null&&B!==void 0?B:DEFAULT_PRICE_LABEL_PADDING,c=l.paddingStart,u=D(F,o),w=n-u/2-e,k=n+u/2+W-w;if((n<t.y+k/2||n>t.y+t.height-k/2)&&!R)return;o.save(),o.fillStyle=x,o.strokeStyle=x;const T=d.labelBoxMargin.end;o.font=F;const I=X(m,o,F),y=T-C,O=c!==void 0?I+c+C:t.width-y,P=E==="right"?t.x+t.width-y-O:t.x+y,S=E==="right"?t.x+t.width-I-T:T;_&&q(_,o,P,w,O,k),o.fillStyle=L,o.fillText(m,S,n+u/2-1),o.restore()}export function getLabelYOffset(o,t,m=DEFAULT_PRICE_LABEL_PADDING){return D(o,t)/2+m}
@@ -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 { Subject } from 'rxjs';
7
+ import { CanvasBoundsContainer, HitBoundsTest } from '../../canvas/canvas-bounds-container';
8
+ import { ChartConfigComponentsYAxis } from '../../chart.config';
9
+ import EventBus from '../../events/event-bus';
10
+ import { ChartBaseElement } from '../../model/chart-base-element';
11
+ import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
12
+ import { Pixel, Unit, ViewportModel } from '../../model/scaling/viewport.model';
13
+ import { ChartPanComponent } from '../pan/chart-pan.component';
14
+ /**
15
+ * Handles the mouse drag on Y axis - to zoom the viewport vertically.
16
+ * @doc-tags scaling,zoom,viewport
17
+ */
18
+ export declare class YAxisScaleHandler extends ChartBaseElement {
19
+ private bus;
20
+ private viewportModel;
21
+ private canvasBoundsContainer;
22
+ private autoScaleCallback;
23
+ yAxisDragEndSubject: Subject<void>;
24
+ lastYStart: Unit;
25
+ lastYEnd: Unit;
26
+ lastYHeight: Unit;
27
+ lastYPxHeight: Pixel;
28
+ constructor(bus: EventBus, config: ChartConfigComponentsYAxis, chartPanComponent: ChartPanComponent, viewportModel: ViewportModel, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, hitTest: HitBoundsTest, autoScaleCallback: (auto: boolean) => void);
29
+ private onYDragStart;
30
+ private onYDragTick;
31
+ private onYDragEnd;
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
+ import{Subject as p}from"rxjs";import{CanvasElement as m}from"../../canvas/canvas-bounds-container";import{ChartBaseElement as E}from"../../model/chart-base-element";import{DragNDropYComponent as b}from"../dran-n-drop_helper/drag-n-drop-y.component";const d=10;export class YAxisScaleHandler extends E{constructor(i,t,Y,g,n,D,h,l){if(super(),this.bus=i,this.viewportModel=g,this.canvasBoundsContainer=D,this.autoScaleCallback=l,this.yAxisDragEndSubject=new p,this.lastYStart=0,this.lastYEnd=0,this.lastYHeight=0,this.lastYPxHeight=0,this.onYDragStart=()=>{this.lastYStart=this.viewportModel.yStart,this.lastYEnd=this.viewportModel.yEnd,this.lastYHeight=this.viewportModel.yEnd-this.viewportModel.yStart,this.lastYPxHeight=this.canvasBoundsContainer.getBounds(m.Y_AXIS).height},this.onYDragTick=s=>{const{delta:e}=s;let a;e<0?a=1/(1+-e/this.lastYPxHeight*(d-1)):a=1+e/this.lastYPxHeight*(d-1);const c=(this.lastYHeight*a-this.lastYHeight)/2,u=this.lastYStart-c,S=this.lastYEnd+c;this.autoScaleCallback(!1),this.viewportModel.setYScale(u,S),this.bus.fireDraw()},this.onYDragEnd=()=>{this.yAxisDragEndSubject.next()},t.customScale){const s=()=>t.type!=="percent",e=new b(h,{onDragTick:r(this.onYDragTick,s),onDragStart:r(this.onYDragStart,s),onDragEnd:r(this.onYDragEnd,s)},n,Y,{disableChartPanning:!1});this.addChildEntity(e),t.customScaleDblClick&&n.observeDbClick(h).subscribe(()=>{l(!0),this.bus.fireDraw()})}}}const r=(o,i)=>(...t)=>i()&&o(...t);
@@ -0,0 +1,158 @@
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 { Subject } from 'rxjs';
7
+ import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
8
+ import { CursorHandler } from '../../canvas/cursor.handler';
9
+ import { BarType, ChartConfigComponentsYAxis, FullChartColors, FullChartConfig, YAxisAlign, YAxisLabelAppearanceType, YAxisLabelMode, YAxisLabelType } from '../../chart.config';
10
+ import { CompositeDrawer } from '../../drawers/composite.drawer';
11
+ import { DrawingManager } from '../../drawers/drawing-manager';
12
+ import EventBus from '../../events/event-bus';
13
+ import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
14
+ import { PriceMovement } from '../../model/candle-series.model';
15
+ import { CanvasModel } from '../../model/canvas.model';
16
+ import { ChartBaseElement } from '../../model/chart-base-element';
17
+ import { DataSeriesType } from '../../model/data-series.config';
18
+ import { ScaleModel } from '../../model/scale.model';
19
+ import { ChartModel } from '../chart/chart.model';
20
+ import { PriceAxisType } from '../labels_generator/numeric-axis-labels.generator';
21
+ import { ChartPanComponent } from '../pan/chart-pan.component';
22
+ import { PaneManager } from '../pane/pane-manager.component';
23
+ import { VisualYAxisLabel, YAxisLabelsProvider } from './price_labels/y-axis-labels.model';
24
+ import { YAxisScaleHandler } from './y-axis-scale.handler';
25
+ import { YAxisModel } from './y-axis.model';
26
+ import { YAxisWidthContributor } from '../../canvas/y-axis-bounds.container';
27
+ export type LabelColorResolver = (priceMovement: PriceMovement, colors: FullChartColors) => string;
28
+ /**
29
+ * Y axis component. Contains all Y axis related logic.
30
+ */
31
+ export declare class YAxisComponent extends ChartBaseElement {
32
+ private eventBus;
33
+ private config;
34
+ private canvasModel;
35
+ private yAxisLabelsCanvasModel;
36
+ private backgroundCanvasModel;
37
+ private chartModel;
38
+ private scaleModel;
39
+ private canvasBoundsContainer;
40
+ private cursorHandler;
41
+ yAxisScaleHandler: YAxisScaleHandler;
42
+ yAxisModel: YAxisModel;
43
+ axisTypeSetSubject: Subject<PriceAxisType>;
44
+ readonly state: ChartConfigComponentsYAxis;
45
+ private labelsColorByChartTypeMap;
46
+ drawer: CompositeDrawer;
47
+ constructor(eventBus: EventBus, config: FullChartConfig, canvasModel: CanvasModel, yAxisLabelsCanvasModel: CanvasModel, backgroundCanvasModel: CanvasModel, chartModel: ChartModel, scaleModel: ScaleModel, canvasInputListeners: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, chartPanComponent: ChartPanComponent, paneManager: PaneManager, cursorHandler: CursorHandler);
48
+ private updateCursor;
49
+ /**
50
+ * Updates labels visual appearance on canvas
51
+ */
52
+ updateOrderedLabels(adjustYAxisWidth?: boolean): void;
53
+ /**
54
+ * Calls the parent class's doActivate method
55
+ * @protected
56
+ * @returns {void}
57
+ */
58
+ protected doActivate(): void;
59
+ /**
60
+ * Registers default label color resolvers for different chart types.
61
+ * @private
62
+ * @function
63
+ * @name registerDefaultLabelColorResolver
64
+ * @returns {void}
65
+ */
66
+ private registerDefaultLabelColorResolver;
67
+ /**
68
+ * You can add a custom labels provider for additional labels on YAxis (like for drawings, symbol last price, studies, etc..)
69
+ * @param groupName - a group in which labels position recalculation algorithm will be applied, usually it's subchart name
70
+ * @param provider
71
+ * @param id
72
+ */
73
+ registerYAxisLabelsProvider(provider: YAxisLabelsProvider, groupName?: string, id?: string): string;
74
+ /**
75
+ * An easier way to manage custom y-axis labels, than y-axis labels providers.
76
+ * However, overlapping avoidance is not supported
77
+ * @param name
78
+ * @param label
79
+ */
80
+ addSimpleYAxisLabel(name: string, label: VisualYAxisLabel): void;
81
+ /**
82
+ * @param name
83
+ */
84
+ deleteSimpleYAxisLabel(name: string): void;
85
+ /**
86
+ * Unregister a Y axis labels provider from the specified group.
87
+ * @param {string} groupName - The name of the group from which to unregister the provider. Defaults to LabelsGroups.MAIN.
88
+ * @param {string} id - The ID of the provider to unregister.
89
+ * @returns {string} - The ID of the unregistered provider.
90
+ */
91
+ unregisterYAxisLabelsProvider(groupName: string | undefined, id: string): string;
92
+ /**
93
+ * If custom pane has y-axis it has to register width contributor to correctly calculate overall y-axis width.
94
+ * @param contributor
95
+ */
96
+ registerYAxisWidthContributor(contributor: YAxisWidthContributor): void;
97
+ /**
98
+ * Sets the type of axis: percent, regular or logarithmic.
99
+ * @param type - the type of axis
100
+ */
101
+ setAxisType(type: PriceAxisType): void;
102
+ /**
103
+ * Change YAxis position to left or to right
104
+ * @param align
105
+ */
106
+ setYAxisAlign(align: YAxisAlign): void;
107
+ /**
108
+ * Controls visibility of the y-axis
109
+ */
110
+ setVisible(isVisible: boolean): void;
111
+ /**
112
+ * If visible, when you can see the y-axis on the chart
113
+ */
114
+ isVisible(): boolean;
115
+ /**
116
+ * Controls lockPriceToBarRatio of the y-axis
117
+ */
118
+ setLockPriceToBarRatio(value?: boolean): void;
119
+ /**
120
+ * Changes the visual type of particular label.
121
+ * @param type - label type
122
+ * @param mode - visual mode
123
+ */
124
+ changeLabelMode(type: YAxisLabelType, mode: YAxisLabelMode): void;
125
+ /**
126
+ * Changes the visual type of particular label.
127
+ * @param type - label type
128
+ * @param mode - visual mode
129
+ */
130
+ changeLabelAppearance(type: YAxisLabelType, mode: YAxisLabelAppearanceType): void;
131
+ /**
132
+ * Sets the inverse price scale mode. Inverts Y axis vertically.
133
+ * Inversion also works for candles, drawings and overlay studies.
134
+ * @param inverse - true or false
135
+ */
136
+ togglePriceScaleInverse(inverse: boolean): void;
137
+ /**
138
+ * Changes the visibility of the labels' descriptions.
139
+ * @param {boolean} descVisibility - A boolean value indicating whether the descriptions should be visible or not.
140
+ * @returns {void}
141
+ */
142
+ changeLabelsDescriptionVisibility(descVisibility: boolean): void;
143
+ /**
144
+ * Registers a label color resolver for a specific chart type.
145
+ *
146
+ * @param {BarType} chartType - The type of chart for which the label color resolver is being registered.
147
+ * @param {LabelColorResolver} resolver - The function that will be used to resolve the color of the labels for the specified chart type.
148
+ * @returns {void}
149
+ */
150
+ registerLabelColorResolver(chartType: BarType, resolver: LabelColorResolver): void;
151
+ /**
152
+ * Returns a function that resolves the color for a label based on the type of data series.
153
+ * @param {DataSeriesType} candlesType - The type of data series.
154
+ * @returns {Function} - A function that resolves the color for a label.
155
+ * If there is no color mapping for the given data series type, it returns the default color resolver function.
156
+ */
157
+ getLabelsColorResolver(candlesType: DataSeriesType): LabelColorResolver;
158
+ }
@@ -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{Subject as g}from"rxjs";import{CanvasElement as d,CHART_UUID as r}from"../../canvas/canvas-bounds-container";import{ClearCanvasDrawer as f}from"../../drawers/clear-canvas.drawer";import{CompositeDrawer as w}from"../../drawers/composite.drawer";import{ChartBaseElement as Y}from"../../model/chart-base-element";import{uuid as D}from"../../utils/uuid.utils";import{resolveColorForArea as S,resolveColorForBar as R,resolveColorForBaseLine as P,resolveColorForCandle as I,resolveColorForHistogram as B,resolveColorForLine as _,resolveColorForScatterPlot as T,resolveColorForTrendAndHollow as b,resolveDefaultColorForLabel as E}from"./label-color.functions";import{LastCandleLabelsProvider as F}from"./price_labels/last-candle-labels.provider";import{LabelsGroups as h}from"./price_labels/y-axis-labels.model";import{YAxisPriceLabelsDrawer as H}from"./price_labels/y-axis-price-labels.drawer";import{YAxisScaleHandler as U}from"./y-axis-scale.handler";import{YAxisDrawer as N}from"./y-axis.drawer";import{YAxisModel as X}from"./y-axis.model";export class YAxisComponent extends Y{constructor(e,s,t,A,x,l,a,C,i,c,L,n,p){super(),this.eventBus=e,this.config=s,this.canvasModel=t,this.yAxisLabelsCanvasModel=A,this.backgroundCanvasModel=x,this.chartModel=l,this.scaleModel=a,this.canvasBoundsContainer=i,this.cursorHandler=p,this.axisTypeSetSubject=new g,this.labelsColorByChartTypeMap={},this.state=s.components.yAxis;const o=new w;this.drawer=o;const y=new f(this.yAxisLabelsCanvasModel);o.addDrawer(y,"YAXIS_CLEAR"),this.registerDefaultLabelColorResolver(),c.addDrawer(o,"Y_AXIS"),this.yAxisScaleHandler=new U(e,this.state,L,a,C,i,i.getBoundsHitTest(d.PANE_UUID_Y_AXIS(r)),M=>a.autoScale(M)),this.addChildEntity(this.yAxisScaleHandler),this.yAxisModel=new X(n.paneComponents[r],e,this.config,i,t,l,a),this.addChildEntity(this.yAxisModel),n.paneComponents[r].yAxisLabelsGenerator=this.yAxisModel.yAxisLabelsGenerator;const u=new N(s,this.state,t,()=>this.yAxisModel.yAxisBaseLabelsModel.labels,()=>i.getBounds(d.Y_AXIS),()=>this.state.visible,l.pane.scaleModel.toY.bind(l.pane.scaleModel));o.addDrawer(u);const v=new H(()=>this.yAxisModel.yAxisLabelsModel.orderedLabels,this.yAxisLabelsCanvasModel,this.backgroundCanvasModel,this.state,this.canvasBoundsContainer,this.config.colors.yAxis,this.yAxisModel.yAxisLabelsModel.customLabels);o.addDrawer(v);const m=new F(this.chartModel,this.config,this.chartModel.lastCandleLabelsByChartType,this.getLabelsColorResolver.bind(this));this.registerYAxisLabelsProvider(m,h.MAIN),n.paneComponents[r].mainYExtentComponent.getAxisType=()=>this.state.type,this.updateCursor()}updateCursor(){this.state.type==="percent"?this.cursorHandler.setCursorForCanvasEl(d.PANE_UUID_Y_AXIS(r),this.config.components.yAxis.resizeDisabledCursor):this.cursorHandler.setCursorForCanvasEl(d.PANE_UUID_Y_AXIS(r),this.config.components.yAxis.cursor)}updateOrderedLabels(e=!1){this.yAxisModel.yAxisLabelsModel.updateLabels(e)}doActivate(){super.doActivate()}registerDefaultLabelColorResolver(){this.registerLabelColorResolver("candle",I),this.registerLabelColorResolver("bar",R),this.registerLabelColorResolver("line",_),this.registerLabelColorResolver("area",S),this.registerLabelColorResolver("scatterPlot",T),this.registerLabelColorResolver("histogram",B),this.registerLabelColorResolver("baseline",P),this.registerLabelColorResolver("trend",b),this.registerLabelColorResolver("hollow",b)}registerYAxisLabelsProvider(e,s=h.MAIN,t=D()){return this.yAxisModel.yAxisLabelsModel.registerYAxisLabelsProvider(s,e,t),t}addSimpleYAxisLabel(e,s){this.yAxisModel.yAxisLabelsModel.customLabels[e]=s,this.canvasModel.fireDraw()}deleteSimpleYAxisLabel(e){delete this.yAxisModel.yAxisLabelsModel.customLabels[e],this.canvasModel.fireDraw()}unregisterYAxisLabelsProvider(e=h.MAIN,s){return this.yAxisModel.yAxisLabelsModel.unregisterYAxisLabelsProvider(e,s),s}registerYAxisWidthContributor(e){this.canvasBoundsContainer.yAxisBoundsContainer.registerYAxisWidthContributor(e)}setAxisType(e){e!==this.state.type&&(this.state.type=e,this.axisTypeSetSubject.next(e),this.scaleModel.autoScale(!0),this.yAxisModel.yAxisLabelsModel.updateLabels(!0),this.updateCursor())}setYAxisAlign(e){this.state.align=e,this.canvasBoundsContainer.updateYAxisWidths(),this.eventBus.fireDraw()}setVisible(e){this.state.visible=e,this.eventBus.fireDraw()}isVisible(){return this.state.visible}setLockPriceToBarRatio(e=!1){this.scaleModel.setLockPriceToBarRatio(e)}changeLabelMode(e,s){this.state.labels.settings[e].mode=s,this.yAxisModel.yAxisLabelsModel.updateLabels()}changeLabelAppearance(e,s){this.state.labels.settings[e].type=s,this.yAxisModel.yAxisLabelsModel.updateLabels()}togglePriceScaleInverse(e){this.scaleModel.state.inverse=e,this.scaleModel.inverseY=e,this.scaleModel.scaleInversedSubject.next(e)}changeLabelsDescriptionVisibility(e){this.state.labels.descriptions=e,this.canvasModel.fireDraw()}registerLabelColorResolver(e,s){this.labelsColorByChartTypeMap[e]=s}getLabelsColorResolver(e){var s;return(s=this.labelsColorByChartTypeMap[e])!==null&&s!==void 0?s:E}}
@@ -0,0 +1,72 @@
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 { ChartConfigComponentsYAxis, FullChartConfig } from '../../chart.config';
7
+ import { CanvasModel } from '../../model/canvas.model';
8
+ import { NumericAxisLabel } from '../labels_generator/numeric-axis-labels.generator';
9
+ import { Drawer } from '../../drawers/drawing-manager';
10
+ import { Unit, ViewportModel } from '../../model/scaling/viewport.model';
11
+ import { Bounds, BoundsProvider } from '../../model/bounds.model';
12
+ export interface YAxisLabel {
13
+ readonly text: string;
14
+ readonly value: Unit;
15
+ }
16
+ export interface YAxisAnimationParameters {
17
+ readonly removed: YAxisLabel[];
18
+ readonly added: YAxisLabel[];
19
+ readonly stay: YAxisLabel[];
20
+ }
21
+ /**
22
+ * Draws the Y_AXIS rectangle + it's base labels.
23
+ */
24
+ export declare class YAxisDrawer implements Drawer {
25
+ private fullConfig;
26
+ private yAxisState;
27
+ private canvasModel;
28
+ private labelsProvider;
29
+ private axisBounds;
30
+ private drawPredicate;
31
+ private toY;
32
+ constructor(fullConfig: FullChartConfig, yAxisState: ChartConfigComponentsYAxis, canvasModel: CanvasModel, labelsProvider: () => Array<NumericAxisLabel>, axisBounds: BoundsProvider, drawPredicate: () => boolean, toY: ViewportModel['toY']);
33
+ /**
34
+ * Draws the axis on the canvas if the drawPredicate is true.
35
+ * It gets the labels from the labelsProvider and the bounds from the axisBounds.
36
+ * It sets the background color of the axis and fills the background rectangle.
37
+ * It gets the font from the yAxisState and calculates the font height.
38
+ * It saves the context, clips it to the bounds and draws the labels with the given font and text color.
39
+ * @function
40
+ */
41
+ draw(): void;
42
+ /**
43
+ * Draws labels on the Y-axis of a canvas chart.
44
+ * @param {CanvasRenderingContext2D} ctx - The 2D rendering context of the canvas.
45
+ * @param {YAxisLabel[]} labels - An array of objects containing the value and text of each label.
46
+ * @param {Bounds} axisBounds - An object containing the x, y, width, and height of the Y-axis.
47
+ * @param {number} fontHeight - The height of the font used for the labels.
48
+ * @param {string} font - The font used for the labels.
49
+ * @param {string} labelTextColor - The color of the label text.
50
+ */
51
+ drawLabels(ctx: CanvasRenderingContext2D, labels: YAxisLabel[], axisBounds: Bounds, fontHeight: number, font: string, labelTextColor: string): void;
52
+ /**
53
+ * Returns an array of canvas IDs.
54
+ *
55
+ * @returns {Array<string>} An array containing the canvas ID.
56
+ */
57
+ getCanvasIds(): Array<string>;
58
+ /**
59
+ * Returns the background color of the Y-axis.
60
+ *
61
+ * @protected
62
+ * @returns {string} The background color of the Y-axis.
63
+ */
64
+ protected getBackgroundColor(): string;
65
+ /**
66
+ * Returns the color of the label text for the chart area axis.
67
+ *
68
+ * @protected
69
+ * @returns {string} The color of the label text.
70
+ */
71
+ protected getLabelTextColor(): string;
72
+ }