@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,141 @@
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 { FullChartConfig } from '../../chart.config';
7
+ import EventBus from '../../events/event-bus';
8
+ import { CanvasModel } from '../../model/canvas.model';
9
+ import { ScaleModel } from '../../model/scale.model';
10
+ import { Timestamp } from '../../model/scaling/viewport.model';
11
+ import { TimeZoneModel } from '../../model/time-zone.model';
12
+ import VisualCandle from '../../model/visual-candle';
13
+ import { ChartModel } from '../chart/chart.model';
14
+ import { NumericAxisLabel } from '../labels_generator/numeric-axis-labels.generator';
15
+ import { TimeFormatWithDuration } from './time/parser/time-formats.model';
16
+ export interface XAxisLabelsGenerator {
17
+ /**
18
+ * Generates x-axis labels from scratch. Heavy operation.
19
+ */
20
+ generateLabels(): void;
21
+ /**
22
+ * Updates current labels state (x-position). Lightweight operation.
23
+ */
24
+ recalculateLabels(): void;
25
+ labels: NumericAxisLabel[];
26
+ /**
27
+ * Updates new appeared candle's label
28
+ */
29
+ updateLastLabel?(candle: VisualCandle): void;
30
+ /**
31
+ * Updates history candle's labels
32
+ */
33
+ updateHistoryLabels?(candles: VisualCandle[]): void;
34
+ }
35
+ /**
36
+ * Model for base labels on X axis.
37
+ * Generates and stored the time labels.
38
+ */
39
+ export interface XAxisLabelWeighted extends NumericAxisLabel {
40
+ time: Timestamp;
41
+ weight: number;
42
+ idx: number;
43
+ }
44
+ export declare class XAxisTimeLabelsGenerator implements XAxisLabelsGenerator {
45
+ private eventBus;
46
+ private config;
47
+ private chartModel;
48
+ private scaleModel;
49
+ private timeZoneModel;
50
+ private canvasModel;
51
+ private labelsGroupedByWeight;
52
+ private weightedCache?;
53
+ private levelsCache;
54
+ get labels(): XAxisLabelWeighted[];
55
+ private formatsByWeightMap;
56
+ private weightToTimeFormatMatcherArray;
57
+ private weightToTimeFormatsDict;
58
+ private extendedLabelsFilterConfig;
59
+ constructor(eventBus: EventBus, config: FullChartConfig, chartModel: ChartModel, scaleModel: ScaleModel, timeZoneModel: TimeZoneModel, canvasModel: CanvasModel);
60
+ private getLabelsFromChartType;
61
+ /**
62
+ * Make a prediction(750) about how many candles we need to fake to fill all X axis by labels
63
+ */
64
+ private getAllCandlesWithFake;
65
+ /**
66
+ * Maps an array of weighted points to an array of XAxisLabelWeighted objects.
67
+ * @param {WeightedPoint[]} weightedPoints - An array of weighted points to be mapped.
68
+ * @param {VisualCandle[]} allCandlesWithFake - An array of visual candles to be used for formatting the labels.
69
+ * @returns {XAxisLabelWeighted[]} An array of XAxisLabelWeighted objects.
70
+ */
71
+ private mapWeightedPointsToLabels;
72
+ /**
73
+ * Sets the formats for labels configuration.
74
+ * @param {Record<TimeFormatWithDuration, string>} newFormatsByWeightMap - The new formats by weight map.
75
+ * @returns {void}
76
+ */
77
+ setFormatsForLabelsConfig(newFormatsByWeightMap: Record<TimeFormatWithDuration, string>): void;
78
+ /**
79
+ * Generates weighted labels based on allCandlesWithFake, weightToTimeFormatMatcherDict and timeZoneModel.
80
+ * @private
81
+ * @function
82
+ * @returns {void}
83
+ */
84
+ private generateWeightedLabels;
85
+ /**
86
+ * Retrieves the labels from the cache for a given coverUpLevel.
87
+ * @param {number} coverUpLevel - The coverUpLevel to retrieve the labels from the cache.
88
+ * @returns {Array<string>|undefined} - The labels for the given coverUpLevel if they exist in the cache, otherwise undefined.
89
+ */
90
+ private getLabelsFromCache;
91
+ /**
92
+ * Updates label of new appeared candle
93
+ * @param {VisualCandle} candle - new updated candle
94
+ * @returns {void}
95
+ */
96
+ updateLastLabel(candle: VisualCandle): void;
97
+ /**
98
+ * Creates labels for history candles and merge it with existing
99
+ * @param {VisualCandle} candle - new history candles
100
+ * @returns {void}
101
+ */
102
+ updateHistoryLabels(candles: VisualCandle[]): void;
103
+ /**
104
+ * Calls the method generateWeightedLabels to generate labels.
105
+ * @returns {void}
106
+ */
107
+ generateLabels(): void;
108
+ /**
109
+ * Recalculates the labels by calling the method recalculateCachedLabels.
110
+ * @returns {void}
111
+ */
112
+ recalculateLabels(): void;
113
+ /**
114
+ * Recalculates cached labels based on the current configuration and zoom level.
115
+ * If there are no grouped labels, the cache is not set.
116
+ * Calculates the maximum label width based on the font size and the maximum format length.
117
+ * Calculates the cover up level based on the maximum label width and the mean candle width.
118
+ * If the cover up level is negative, the cache is not updated.
119
+ * If the cover up level has not changed, the cached labels are returned.
120
+ * Otherwise, the labels are filtered by extended rules and grouped by cover up level.
121
+ * The filtered labels are then cached and returned.
122
+ */
123
+ private recalculateCachedLabels;
124
+ /**
125
+ * Post filtering for equivolume case
126
+ * {@link overlappingPredicate} is used
127
+ * @param {XAxisLabelWeighted[]} labels - array of labels filtered by weights algorithm
128
+ * @returns {XAxisLabelWeighted[]} - array of filtered labels by overlaping predicate
129
+ */
130
+ private postProcessing;
131
+ /**
132
+ * Filters the labels by extended rules.
133
+ * @private
134
+ *
135
+ * @param {Record<number, XAxisLabelWeighted[]>} labelsGroupedByWeight - Object containing the labels grouped by weight.
136
+ * @param {number} coverUpLevel - The cover up level.
137
+ *
138
+ * @returns {Record<number, XAxisLabelWeighted[]>} - Object containing the filtered labels grouped by weight.
139
+ */
140
+ private filterLabelsByExtendedRules;
141
+ }
@@ -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{unitToPixels as L}from"../../model/scaling/viewport.model";import{cloneUnsafe as F,typedEntries_UNSAFE as p}from"../../utils/object.utils";import{fakeVisualCandle as T}from"../chart/fake-candles";import{parseTimeFormatsFromKey as v}from"./time/parser/time-formats-parser.functions";import{filterMapGroupedLabelsByCoverUpLevel as w,getWeightFromTimeFormat as y,groupLabelsByWeight as b,overlappingPredicate as M}from"./time/x-axis-weights.functions";import{generateWeightsMapForConfig as C,mapCandlesToWeightedPoints as u}from"./time/x-axis-weights.generator";export class XAxisTimeLabelsGenerator{get labels(){return this.getLabelsFromChartType()}constructor(e,a,o,s,t,i){this.eventBus=e,this.config=a,this.chartModel=o,this.scaleModel=s,this.timeZoneModel=t,this.canvasModel=i,this.labelsGroupedByWeight={},this.levelsCache={},this.weightToTimeFormatMatcherArray=[],this.weightToTimeFormatsDict={},this.extendedLabelsFilterConfig={minute_1:r=>r>=2},this.formatsByWeightMap=a.components.xAxis.formatsForLabelsConfig;const{weightToTimeFormatsDict:n,weightToTimeFormatMatcherDict:h}=C(this.formatsByWeightMap);this.weightToTimeFormatMatcherArray=Object.entries(h).map(([r,l])=>[parseInt(r,10),l]).sort(([r],[l])=>l-r),this.weightToTimeFormatsDict=n}getLabelsFromChartType(){var e,a;const o=(a=(e=this.weightedCache)===null||e===void 0?void 0:e.labels)!==null&&a!==void 0?a:[];return this.config.components.chart.type==="equivolume"?this.postProcessing(o):o}getAllCandlesWithFake(){const e=this.chartModel.mainCandleSeries.visualPoints;if(e.length===0)return[];const o=Array.from({length:750}).map((s,t)=>T(this.chartModel.mainCandleSeries.dataPoints,this.chartModel.mainCandleSeries.visualPoints,this.chartModel.mainCandleSeries.meanCandleWidth,e.length+t,this.chartModel.getPeriod()));return[...e,...o]}mapWeightedPointsToLabels(e,a){const o=new Array(e.length);return e.forEach((s,t)=>{var i;const n=a[t],h=this.weightToTimeFormatsDict[s.weight],r=this.timeZoneModel.getDateTimeFormatter(h)(n.candle.timestamp);o[t]={weight:s.weight,idx:(i=n.candle.idx)!==null&&i!==void 0?i:0,value:n.centerUnit,time:n.candle.timestamp,text:r}}),o}setFormatsForLabelsConfig(e){const{weightToTimeFormatsDict:a,weightToTimeFormatMatcherDict:o}=C(e);this.formatsByWeightMap=e,this.weightToTimeFormatMatcherArray=Object.entries(o).map(([s,t])=>[parseInt(s,10),t]).sort(([s],[t])=>t-s),this.weightToTimeFormatsDict=a,this.generateWeightedLabels()}generateWeightedLabels(){const e=this.getAllCandlesWithFake(),a=u(e,this.weightToTimeFormatMatcherArray,this.timeZoneModel.tzOffset(this.config.timezone)),o=this.mapWeightedPointsToLabels(a,e);this.labelsGroupedByWeight=b(o),this.weightedCache=void 0,this.levelsCache={},this.recalculateCachedLabels()}getLabelsFromCache(e){if(this.levelsCache[e])return this.levelsCache[e]}updateLastLabel(e){const a=this.chartModel.mainCandleSeries.visualPoints[this.chartModel.mainCandleSeries.visualPoints.length-2];if(a){const s=u([a,e],this.weightToTimeFormatMatcherArray,this.timeZoneModel.tzOffset(this.config.timezone)),t=this.mapWeightedPointsToLabels([s[1]],[e]),[i]=t;this.labelsGroupedByWeight=Object.entries(this.labelsGroupedByWeight).reduce((n,[h,r])=>{const l=r.findIndex(d=>d.idx===i.idx);let c=r;if(l!==-1&&(c=r.filter(d=>d.idx!==i.idx)),parseInt(h,10)===i.weight){const d=c.findIndex(m=>m.idx>i.idx);d!==-1?c=[...c.slice(0,d),i,...c.slice(d)]:c.push(i)}return n[h]=c,n},{}),this.weightedCache=void 0,this.levelsCache={},this.recalculateCachedLabels()}}updateHistoryLabels(e){const a=e.concat(this.chartModel.mainCandleSeries.visualPoints[e.length]),o=u(a,this.weightToTimeFormatMatcherArray,this.timeZoneModel.tzOffset(this.config.timezone)),s=this.mapWeightedPointsToLabels(o,a),t=b(s),i=F(t);for(const r in this.labelsGroupedByWeight)i[r]===void 0&&(i[r]=this.labelsGroupedByWeight[r]);const n=this.chartModel.mainCandleSeries.visualPoints[e.length-1],h=Object.entries(i).sort(([r],[l])=>parseInt(l,10)-parseInt(r,10)).reduce((r,[l,c])=>{const d=parseInt(l,10),m=this.labelsGroupedByWeight[d];if(d===this.weightToTimeFormatMatcherArray[0][0]&&m.shift(),m){const f=m.map(g=>(g.idx=g.idx+e.length,g.value=n.startUnit+n.width+g.value,g));t[d]?r[l]=c.concat(f):r[l]=f}else r[l]=c;return r},{});this.labelsGroupedByWeight=h,this.weightedCache=void 0,this.levelsCache={},this.recalculateCachedLabels()}generateLabels(){this.generateWeightedLabels()}recalculateLabels(){this.recalculateCachedLabels()}recalculateCachedLabels(){if(Object.getOwnPropertyNames(this.labelsGroupedByWeight).length===0)return;const e=this.config.components.xAxis.fontSize,a=Object.values(this.formatsByWeightMap).reduce((i,n)=>Math.max(n.length,i),1),o=e*a,s=L(this.chartModel.mainCandleSeries.meanCandleWidth,this.scaleModel.zoomX),t=Math.round(o/s);if(!(t<0&&!isFinite(s))&&(this.weightedCache===void 0||t!==this.weightedCache.coverUpLevel)){const i=this.getLabelsFromCache(t);if(i){this.weightedCache={labels:i,coverUpLevel:t};return}const n=w(this.filterLabelsByExtendedRules(this.labelsGroupedByWeight,t),t);this.levelsCache[t]=n,this.weightedCache={labels:n,coverUpLevel:t},this.eventBus.fireDraw()}}postProcessing(e){var a,o;const s=[];let t=0,i=1;for(;i<=e.length-1;){const n=e[t],h=e[i];M(this.canvasModel.ctx,this.config,n,h,this.scaleModel,30)?((a=h.weight)!==null&&a!==void 0?a:0)>((o=n.weight)!==null&&o!==void 0?o:0)&&(t=i):(s.push(n),t=i,i===e.length-1&&s.push(h)),i++}return s}filterLabelsByExtendedRules(e,a){const o=p(this.extendedLabelsFilterConfig).reduce((s,t)=>{if(!t)return s;const[i,n]=t;if(n){const h=v(i);if(h){const r=y(h);s[r]=n}}return s},{});return p(e).reduce((s,[t,i])=>(o[t]&&o[t](a)||(s[t]=i),s),{})}}
@@ -0,0 +1,39 @@
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 } from '../../model/chart-base-element';
7
+ import EventBus from '../../events/event-bus';
8
+ import { LabelAlign } from './x-axis-draw.functions';
9
+ export interface XAxisLabel {
10
+ text: string;
11
+ x: number;
12
+ color: string;
13
+ alignType?: LabelAlign;
14
+ subGroupId?: number;
15
+ }
16
+ /***
17
+ * If you want to define a new Labels Provider for X Axis, you must extend this interface.
18
+ */
19
+ export interface XAxisLabelsProvider {
20
+ readonly getUnorderedLabels: () => XAxisLabel[];
21
+ }
22
+ /**
23
+ * Custom labels on X axis.
24
+ */
25
+ export declare class XAxisLabelsModel extends ChartBaseElement {
26
+ eventBus: EventBus;
27
+ readonly labelProviders: XAxisLabelsProvider[];
28
+ labels: XAxisLabel[];
29
+ constructor(eventBus: EventBus, labelProviders: XAxisLabelsProvider[]);
30
+ /**
31
+ * Initializes the model by recalculating the labels.
32
+ */
33
+ private initModel;
34
+ /**
35
+ * Recalculates the labels by clearing the existing labels and adding new labels from the label providers.
36
+ * @returns {void}
37
+ */
38
+ recalculateLabels(): void;
39
+ }
@@ -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 t}from"../../model/chart-base-element";import{EVENT_DRAW as l}from"../../events/events";export class XAxisLabelsModel extends t{constructor(e,s){super(),this.eventBus=e,this.labelProviders=s,this.labels=[],this.initModel(),this.addSubscription(this.eventBus.on(l,()=>this.recalculateLabels()))}initModel(){this.recalculateLabels()}recalculateLabels(){this.labels=[];for(const e of this.labelProviders)this.labels.push(...e.getUnorderedLabels())}}
@@ -0,0 +1,38 @@
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 } from '../../model/chart-base-element';
7
+ import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
8
+ import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
9
+ import { ScaleModel } from '../../model/scale.model';
10
+ import { Pixel, Unit } from '../../model/scaling/viewport.model';
11
+ import { ChartModel } from '../chart/chart.model';
12
+ import { ChartPanComponent } from '../pan/chart-pan.component';
13
+ /**
14
+ * Handles the mouse drag on X axis - to zoom the viewport horizontally.
15
+ * @doc-tags scaling,zoom,viewport
16
+ */
17
+ export declare class XAxisScaleHandler extends ChartBaseElement {
18
+ private scaleModel;
19
+ private canvasInputListener;
20
+ private canvasBoundsContainer;
21
+ private chartPanComponent;
22
+ private chartModel;
23
+ lastXStart: Unit;
24
+ lastXWidth: Unit;
25
+ lastXPxWidth: Pixel;
26
+ constructor(scaleModel: ScaleModel, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, chartPanComponent: ChartPanComponent, chartModel: ChartModel);
27
+ /**
28
+ * This method is used to activate the canvas input listener and add a subscription to it.
29
+ * It calls the parent class's doActivate method and then subscribes to the canvasInputListener's observeDbClick method.
30
+ * The subscription is added to the RxJS subscription list.
31
+ * When the subscription is triggered, the doBasicScale method is called.
32
+ * @protected
33
+ * @returns {void}
34
+ */
35
+ protected doActivate(): void;
36
+ private onXDragStart;
37
+ private onXDragTick;
38
+ }
@@ -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 u}from"../../model/chart-base-element";import{CanvasElement as a}from"../../canvas/canvas-bounds-container";import{DragNDropXComponent as p}from"../dran-n-drop_helper/drag-n-drop-x.component";export class XAxisScaleHandler extends u{constructor(t,n,e,o,h){super(),this.scaleModel=t,this.canvasInputListener=n,this.canvasBoundsContainer=e,this.chartPanComponent=o,this.chartModel=h,this.lastXStart=0,this.lastXWidth=0,this.lastXPxWidth=0,this.onXDragStart=()=>{this.lastXStart=this.scaleModel.xStart,this.lastXWidth=this.scaleModel.xEnd-this.scaleModel.xStart;const s=this.canvasBoundsContainer.getBounds(a.X_AXIS);this.lastXPxWidth=s.width-this.canvasInputListener.currentPoint.x},this.onXDragTick=s=>{const{delta:d}=s,i=this.lastXPxWidth-d;if(i<0)return;const c=this.lastXPxWidth/i,l=this.lastXWidth*c,X=this.lastXStart+(this.lastXWidth-l);this.scaleModel.setXScale(X,this.scaleModel.xEnd)};const r=new p(this.canvasBoundsContainer.getBoundsHitTest(a.X_AXIS),{onDragStart:this.onXDragStart,onDragTick:this.onXDragTick},this.canvasInputListener,this.chartPanComponent,{disableChartPanning:!1});this.addChildEntity(r)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasInputListener.observeDbClick(this.canvasBoundsContainer.getBoundsHitTest(a.X_AXIS)).subscribe(()=>this.chartModel.doBasicScale())),this.addRxSubscription(this.chartModel.candlesPrependSubject.subscribe(({prependedCandlesWidth:t})=>this.lastXStart+=t))}}
@@ -0,0 +1,54 @@
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 } from '../labels_generator/numeric-axis-labels.generator';
7
+ import { Bounds } from '../../model/bounds.model';
8
+ import { FullChartConfig } from '../../chart.config';
9
+ import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
10
+ import { CanvasModel } from '../../model/canvas.model';
11
+ import { Drawer } from '../../drawers/drawing-manager';
12
+ import { ViewportModel } from '../../model/scaling/viewport.model';
13
+ /**
14
+ * This Drawer draws regular time labels for X Axis.
15
+ */
16
+ export declare class XAxisTimeLabelsDrawer implements Drawer {
17
+ private config;
18
+ private canvasModel;
19
+ private viewportModel;
20
+ private canvasBoundsContainer;
21
+ private labelsProvider;
22
+ private drawPredicate;
23
+ constructor(config: FullChartConfig, canvasModel: CanvasModel, viewportModel: ViewportModel, canvasBoundsContainer: CanvasBoundsContainer, labelsProvider: () => NumericAxisLabel[], drawPredicate?: () => boolean);
24
+ /**
25
+ * Draws the X-axis labels on the canvas.
26
+ * If the drawPredicate is true, it will draw the labels.
27
+ * @returns {void}
28
+ */
29
+ draw(): void;
30
+ /**
31
+ * Draws labels on a canvas context.
32
+ * @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
33
+ * @param {NumericAxisLabel[]} labels - An array of NumericAxisLabel objects containing the value and text of each label.
34
+ * @param {Bounds} bounds - The bounds of the viewport.
35
+ * @param {string} color - The color of the labels.
36
+ * @param {number} fontHeight - The height of the font in pixels.
37
+ * @param {string} fontFamily - The font family to use for the labels.
38
+ * @param {number} offsetTop - The offset from the top of the viewport to draw the labels.
39
+ * @returns {void}
40
+ */
41
+ drawLabels(ctx: CanvasRenderingContext2D, labels: NumericAxisLabel[], bounds: Bounds, color: string, fontHeight: number, fontFamily: string, offsetTop: number): void;
42
+ /**
43
+ * Returns a font string based on the provided FullChartConfig object.
44
+ * @param {FullChartConfig} config - The FullChartConfig object containing the font style, size and family.
45
+ * @returns {string} - The font string in the format of "fontStyle fontSize fontFamily".
46
+ */
47
+ static getFontFromConfig(config: FullChartConfig): string;
48
+ /**
49
+ * Returns an array of canvas IDs.
50
+ *
51
+ * @returns {Array<string>} An array containing the ID of the canvas.
52
+ */
53
+ getCanvasIds(): Array<string>;
54
+ }
@@ -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 d}from"../../canvas/canvas-bounds-container";import{calculateTextWidth as h}from"../../utils/canvas/canvas-font-measure-tool.utils";export class XAxisTimeLabelsDrawer{constructor(t,o,n,e,i,a=()=>!0){this.config=t,this.canvasModel=o,this.viewportModel=n,this.canvasBoundsContainer=e,this.labelsProvider=i,this.drawPredicate=a}draw(){var t;if(this.drawPredicate()){const o=this.canvasModel.ctx,n=this.config.colors.xAxis,e=this.config.components.xAxis.fontFamily,i=XAxisTimeLabelsDrawer.getFontFromConfig(this.config),a=this.config.components.xAxis.fontSize,r=(t=this.config.components.xAxis.padding.top)!==null&&t!==void 0?t:0;o.save(),o.font=i,o.fillStyle=n.backgroundColor;const s=this.canvasBoundsContainer.getBounds(d.X_AXIS);o.fillRect(s.x,s.y,s.width,s.height);const l=this.config.colors.xAxis.labelTextColor,c=this.labelsProvider();this.drawLabels(o,c,s,l,a,e,r),o.restore()}}drawLabels(t,o,n,e,i,a,r){const s=`${i}px ${a}`;t.fillStyle=e;for(const l of o){const c=this.viewportModel.toX(l.value)-h(l.text,t,s)/2;if(c<0||c>n.width)continue;const f=n.y+i-1+r,x=l.text;t.font=s,t.fillText(x,c,f)}}static getFontFromConfig(t){return`${t.components.xAxis.fontStyle} ${t.components.xAxis.fontSize}px ${t.components.xAxis.fontFamily}`}getCanvasIds(){return[this.canvasModel.canvasId]}}
@@ -0,0 +1,73 @@
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 { CursorHandler } from '../../canvas/cursor.handler';
8
+ import { ChartBaseElement } from '../../model/chart-base-element';
9
+ import { FullChartConfig } from '../../chart.config';
10
+ import { CanvasModel } from '../../model/canvas.model';
11
+ import { DrawingManager } from '../../drawers/drawing-manager';
12
+ import EventBus from '../../events/event-bus';
13
+ import { ChartResizeHandler } from '../../inputhandlers/chart-resize.handler';
14
+ import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
15
+ import { ScaleModel } from '../../model/scale.model';
16
+ import { TimeZoneModel } from '../../model/time-zone.model';
17
+ import { ChartComponent } from '../chart/chart.component';
18
+ import { ChartPanComponent } from '../pan/chart-pan.component';
19
+ import { TimeFormatWithDuration } from './time/parser/time-formats.model';
20
+ import { XAxisLabelsDrawer } from './x-axis-labels.drawer';
21
+ import { XAxisLabelsGenerator } from './x-axis-labels.generator';
22
+ import { XAxisLabelsModel, XAxisLabelsProvider } from './x-axis-labels.model';
23
+ import { XAxisScaleHandler } from './x-axis-scale.handler';
24
+ import { XAxisTimeLabelsDrawer } from './x-axis-time-labels.drawer';
25
+ /**
26
+ * X-axis component, contains all x-axis calculation and rendering logic.
27
+ */
28
+ export declare class XAxisComponent extends ChartBaseElement {
29
+ private eventBus;
30
+ private config;
31
+ canvasModel: CanvasModel;
32
+ chartComponent: ChartComponent;
33
+ private scaleModel;
34
+ private chartResizeHandler;
35
+ private timeZoneModel;
36
+ xAxisDrawer: XAxisTimeLabelsDrawer;
37
+ xAxisLabelsDrawer: XAxisLabelsDrawer;
38
+ xAxisLabelsGenerator: XAxisLabelsGenerator;
39
+ readonly xAxisLabelsModel: XAxisLabelsModel;
40
+ xAxisScaleHandler: XAxisScaleHandler;
41
+ constructor(eventBus: EventBus, config: FullChartConfig, canvasModel: CanvasModel, chartComponent: ChartComponent, scaleModel: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, canvasInputListener: CanvasInputListenerComponent, chartResizeHandler: ChartResizeHandler, drawingManager: DrawingManager, timeZoneModel: TimeZoneModel, chartPanComponent: ChartPanComponent, cursorHandler: CursorHandler, backgroundCanvasModel: CanvasModel);
42
+ /**
43
+ * This method is used to activate the chart and update the labels if there is a new data set or equivolume type.
44
+ * It subscribes to the chart type change, candles set subject, candles updated subject, and time zone change to generate new labels.
45
+ * It also subscribes to the x-axis scale change and canvas resize to recalculate the labels.
46
+ * @protected
47
+ * @returns {void}
48
+ */
49
+ protected doActivate(): void;
50
+ /**
51
+ * Returns the xAxisDrawer object.
52
+ *
53
+ * @returns {Object} The xAxisDrawer object.
54
+ */
55
+ getDrawer(): XAxisTimeLabelsDrawer;
56
+ /**
57
+ * You can add a custom labels provider for additional labels on XAxis (like for drawings)
58
+ * @param provider
59
+ */
60
+ registerXAxisLabelsProvider(provider: XAxisLabelsProvider): void;
61
+ /**
62
+ * Controls visibility of the x-axis
63
+ */
64
+ setVisible(isVisible: boolean): void;
65
+ /**
66
+ * Set new config for x labels formatting
67
+ */
68
+ setFormatsForLabelsConfig(newFormatsByWeightMap: Record<TimeFormatWithDuration, string>): void;
69
+ /**
70
+ * If visible, when you can see the x-axis on the chart
71
+ */
72
+ isVisible(): boolean;
73
+ }
@@ -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 n}from"rxjs";import{distinctUntilChanged as v,map as d,throttleTime as f,filter as h}from"rxjs/operators";import{CanvasElement as w}from"../../canvas/canvas-bounds-container";import{ChartBaseElement as C}from"../../model/chart-base-element";import{CompositeDrawer as S}from"../../drawers/composite.drawer";import{XAxisLabelsDrawer as g}from"./x-axis-labels.drawer";import{XAxisTimeLabelsGenerator as x}from"./x-axis-labels.generator";import{XAxisLabelsModel as D}from"./x-axis-labels.model";import{XAxisScaleHandler as G}from"./x-axis-scale.handler";import{XAxisTimeLabelsDrawer as M}from"./x-axis-time-labels.drawer";import{lastOf as X}from"../../utils/array.utils";import{notEmpty as H}from"../../utils/function.utils";import{availableBarTypes as R}from"../../chart.config";export class XAxisComponent extends C{constructor(e,s,i,t,r,a,m,c,b,l,p,A,u){super(),this.eventBus=e,this.config=s,this.canvasModel=i,this.chartComponent=t,this.scaleModel=r,this.chartResizeHandler=c,this.timeZoneModel=l;const L=new x(e,s,t.chartModel,r,l,this.canvasModel);this.xAxisLabelsGenerator=L,this.xAxisLabelsModel=new D(e,[]);const o=new S;b.addDrawer(o,"X_AXIS"),this.xAxisDrawer=new M(s,i,r,a,()=>this.xAxisLabelsGenerator.labels,()=>s.components.xAxis.visible),o.addDrawer(this.xAxisDrawer),this.xAxisLabelsDrawer=new g(u,s,i,a,this.xAxisLabelsModel),o.addDrawer(this.xAxisLabelsDrawer),this.xAxisScaleHandler=new G(r,m,a,p,this.chartComponent.chartModel),this.addChildEntity(this.xAxisScaleHandler),A.setCursorForCanvasEl(w.X_AXIS,s.components.xAxis.cursor)}doActivate(){super.doActivate(),this.addRxSubscription(n(this.chartComponent.chartModel.candlesSetSubject,this.timeZoneModel.observeTimeZoneChanged()).subscribe(()=>{this.xAxisLabelsGenerator.generateLabels()})),this.addRxSubscription(this.chartComponent.chartModel.candlesPrependSubject.pipe(h(({preparedCandles:e})=>e.length!==0),d(({preparedCandles:e})=>this.chartComponent.chartModel.mainCandleSeries.visualPoints.slice(0,e.length))).subscribe(e=>{R.includes(this.config.components.chart.type)&&this.xAxisLabelsGenerator.updateHistoryLabels&&this.xAxisLabelsGenerator.updateHistoryLabels(e)})),this.addRxSubscription(n(this.scaleModel.xChanged,this.chartResizeHandler.canvasResized).pipe(f(50,void 0,{trailing:!0,leading:!0})).subscribe(()=>{this.xAxisLabelsGenerator.recalculateLabels()})),this.addRxSubscription(this.chartComponent.chartModel.candlesUpdatedSubject.pipe(d(()=>X(this.chartComponent.chartModel.mainCandleSeries.visualPoints)),v((e,s)=>{var i,t;return((i=e==null?void 0:e.candle)===null||i===void 0?void 0:i.timestamp)===((t=s==null?void 0:s.candle)===null||t===void 0?void 0:t.timestamp)}),h(H)).subscribe(e=>{this.xAxisLabelsGenerator.updateLastLabel&&this.xAxisLabelsGenerator.updateLastLabel(e)}))}getDrawer(){return this.xAxisDrawer}registerXAxisLabelsProvider(e){this.xAxisLabelsModel.labelProviders.push(e)}setVisible(e){var s;!((s=this.config.components)===null||s===void 0)&&s.xAxis&&(this.config.components.xAxis.visible=e,this.eventBus.fireDraw())}setFormatsForLabelsConfig(e){this.xAxisLabelsGenerator instanceof x?this.xAxisLabelsGenerator.setFormatsForLabelsConfig(e):console.error("Format config for x-axis is not available")}isVisible(){var e,s;return(s=(e=this.config.components)===null||e===void 0?void 0:e.xAxis.visible)!==null&&s!==void 0?s:!1}}
@@ -0,0 +1,18 @@
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 { PriceMovement } from '../../model/candle-series.model';
7
+ import { FullChartColors, YAxisLabelsColors } from '../../chart.config';
8
+ export declare const DEFAULT_LABEL_COLOR = "#FF00FF";
9
+ export declare const getPrimaryLabelTextColor: (lastPriceMovement: PriceMovement, colors: YAxisLabelsColors) => string;
10
+ export declare const resolveColorForBar: (priceMovement: PriceMovement, colors: FullChartColors) => string;
11
+ export declare const resolveColorForLine: (priceMovement: PriceMovement, colors: FullChartColors) => string;
12
+ export declare const resolveColorForCandle: (priceMovement: PriceMovement, colors: FullChartColors) => string;
13
+ export declare const resolveColorForArea: (priceMovement: PriceMovement, colors: FullChartColors) => string;
14
+ export declare const resolveColorForScatterPlot: (priceMovement: PriceMovement, colors: FullChartColors) => string;
15
+ export declare const resolveColorForHistogram: (priceMovement: PriceMovement, colors: FullChartColors) => string;
16
+ export declare const resolveColorForBaseLine: (priceMovement: PriceMovement, colors: FullChartColors) => string;
17
+ export declare const resolveColorForTrendAndHollow: (priceMovement: PriceMovement, colors: FullChartColors) => string;
18
+ export declare const resolveDefaultColorForLabel: () => string;
@@ -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 const DEFAULT_LABEL_COLOR="#FF00FF",getPrimaryLabelTextColor=(r,o)=>r==="down"?o.lastPrice.textNegative:r==="up"?o.lastPrice.textPositive:o.lastPrice.textSelected,resolveColorForBar=(r,o)=>{const e=o.barTheme[`${r}Color`];return e!=null?e:DEFAULT_LABEL_COLOR},resolveColorForLine=(r,o)=>{const e=o.lineTheme[`${r}Color`];return e!=null?e:DEFAULT_LABEL_COLOR},resolveColorForCandle=(r,o)=>{const e=o.candleTheme[`${r}Color`];return e!=null?e:DEFAULT_LABEL_COLOR},resolveColorForArea=(r,o)=>{const e=o.areaTheme.lineColor;return e!=null?e:DEFAULT_LABEL_COLOR},resolveColorForScatterPlot=(r,o)=>{const e=o.scatterPlot.mainColor;return e!=null?e:DEFAULT_LABEL_COLOR},resolveColorForHistogram=(r,o)=>{const e=o.histogram[`${r}Cap`];return e!=null?e:DEFAULT_LABEL_COLOR},resolveColorForBaseLine=(r,o)=>{const e=r==="up"?o.baseLineTheme.upperSectionStrokeColor:o.baseLineTheme.lowerSectionStrokeColor;return e!=null?e:DEFAULT_LABEL_COLOR},resolveColorForTrendAndHollow=(r,o)=>{const e=o.candleTheme[`${r}WickColor`];return e!=null?e:DEFAULT_LABEL_COLOR},resolveDefaultColorForLabel=()=>(console.warn("Fallback for label default color"),DEFAULT_LABEL_COLOR);
@@ -0,0 +1,22 @@
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 { ChartModel } from '../chart/chart.model';
7
+ import { NumericAxisLabelsGenerator, PriceAxisType } from '../labels_generator/numeric-axis-labels.generator';
8
+ import { ViewportModel } from '../../model/scaling/viewport.model';
9
+ /**
10
+ * Y axis labels generator for prices. Respects price increment from instrument.
11
+ */
12
+ export declare class NumericYAxisLabelsGenerator extends NumericAxisLabelsGenerator {
13
+ private chartModel;
14
+ constructor(increment: number | null, chartModel: ChartModel | undefined, viewportModel: ViewportModel, valueFormatter: (value: number) => string, axisTypeProvider?: () => PriceAxisType, baseLineProvider?: () => number, singleLabelHeightPixels?: number);
15
+ getLargestLabel(): string;
16
+ /**
17
+ * Calculates the increment to be used on the chart axis based on the length of the value and the instrument's price increments.
18
+ * @param {number} valueLength - The length of the value.
19
+ * @returns {number} - The calculated increment.
20
+ */
21
+ protected calculateIncrement(valueLength: number): number;
22
+ }
@@ -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{PriceIncrementsUtils as i}from"../../utils/price-increments.utils";import{NumericAxisLabelsGenerator as l}from"../labels_generator/numeric-axis-labels.generator";import{lastOf as o}from"../../utils/array.utils";export class NumericYAxisLabelsGenerator extends l{constructor(r,t,e,n,s=()=>"regular",c=()=>1,a=23){super(r,()=>[e.yStart,e.yEnd],()=>e.getBounds().height,n,!1,s,c,void 0,a),this.chartModel=t}getLargestLabel(){var r;return((r=this.labelsCache.getLastCachedValue())!==null&&r!==void 0?r:[]).reduce((t,e)=>e.text.length>t.length?e.text:t,"")}calculateIncrement(r){var t;const e=(t=this.chartModel)===null||t===void 0?void 0:t.mainCandleSeries.instrument;if(this.chartModel&&e&&Array.isArray(e.priceIncrements)){const n=o(this.chartModel.getCandles()),s=n&&n.close?n.close:0,c=i.getPriceIncrement(s,e.priceIncrements);return this.adjustIncrementOnAxisType(c)}return super.calculateIncrement(r)}}
@@ -0,0 +1,33 @@
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 } from '../../../chart.config';
7
+ import { BoundsProvider } from '../../../model/bounds.model';
8
+ import { DataSeriesConfig } from '../../../model/data-series.config';
9
+ import { DataSeriesModel } from '../../../model/data-series.model';
10
+ import { LabelGroup, YAxisLabelsProvider } from './y-axis-labels.model';
11
+ export declare class DataSeriesYAxisLabelsProvider implements YAxisLabelsProvider {
12
+ private series;
13
+ private config;
14
+ yAxisBoundsProvider: BoundsProvider;
15
+ axisState?: ChartConfigComponentsYAxis | undefined;
16
+ constructor(series: DataSeriesModel, config: DataSeriesConfig, yAxisBoundsProvider: BoundsProvider, axisState?: ChartConfigComponentsYAxis | undefined);
17
+ /**
18
+ * Returns an array of LabelGroup objects that contain VisualYAxisLabel objects.
19
+ * The labels are unordered and are based on the last data series point or the last visual series point, depending on the configuration.
20
+ * The labels are formatted using the series value formatter.
21
+ * The label appearance type and draw configuration are also based on the configuration.
22
+ * @returns {LabelGroup[]} An array of LabelGroup objects that contain VisualYAxisLabel objects.
23
+ */
24
+ getUnorderedLabels(): LabelGroup[];
25
+ /**
26
+ * Retrieves the `config` object from the `series` object and then retrieves the `paintConfig` object from the `config` object.
27
+ * If `paintConfig` is null or undefined, it uses the `DEFAULT_DATA_SERIES_PAINT_CONFIG`. It then retrieves the `bgColor`
28
+ * from the `paintConfig` object and calculates the `textColor` based on the `bgColor` using the `getLabelTextColorByBackgroundColor` function.
29
+ * Finally, it returns an object with `textColor`, `bgColor`, `paddingBottom`, `paddingEnd`, and `paddingTop` properties.
30
+ * @returns {YAxisLabelDrawConfig}
31
+ */
32
+ private getLabelDrawConfig;
33
+ }
@@ -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{DEFAULT_DATA_SERIES_PAINT_CONFIG as c}from"../../../model/data-series.config";import{getLabelTextColorByBackgroundColor as d}from"../../../utils/canvas/canvas-text-functions.utils";export class DataSeriesYAxisLabelsProvider{constructor(i,e,s,t){this.series=i,this.config=e,this.yAxisBoundsProvider=s,this.axisState=t}getUnorderedLabels(){if(this.config.visible){const e=this.config.labelLastValue==="series"?this.series.getLastDataSeriesPoint:this.series.getLastVisualSeriesPoint,s=this.yAxisBoundsProvider(),t=this.config.labelMode,a=this.config.labelAppearanceType,o=e();if(o!==void 0){const n=this.series.view.toY(o.close);if(isFinite(n)){const r=this.series.valueFormatter(o.close),l=this.getLabelDrawConfig();return[{labels:[Object.assign({y:n,description:this.series.name,mode:t,labelType:a,labelText:r},l)],axisState:this.axisState,bounds:s}]}}}return[]}getLabelDrawConfig(){var i;const e=this.series.config,t=((i=e.paintConfig[0])!==null&&i!==void 0?i:c).color;return{textColor:d(t,"white","black"),bgColor:t,paddingBottom:e.labelPaddingBottom,paddingEnd:e.labelPaddingEnd,paddingTop:e.labelPaddingTop}}}
@@ -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
+ export interface FormattedYCoordinate {
7
+ bottom: number;
8
+ top: number;
9
+ labelWeight: number;
10
+ actualIndex: number;
11
+ }
12
+ export interface PositionAndWeight {
13
+ y: number;
14
+ weight: number;
15
+ }
16
+ export interface BoundsForLabelsCalculator {
17
+ top: number;
18
+ bottom: number;
19
+ }
20
+ /**
21
+ * Calculates the Y coordinates for the labels of a chart based on the provided points and label height.
22
+ * @param {PositionAndWeight[]} points - An array of objects containing the position and weight of each point.
23
+ * @param {number} labelHeight - The height of the label.
24
+ * @returns {number[]} An array of Y coordinates for the labels.
25
+ * @doc-tags tricky
26
+ */
27
+ export declare function calcLabelsYCoordinates(points: PositionAndWeight[], labelHeight: 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{notEmpty as d}from"../../../utils/function.utils";export function calcLabelsYCoordinates(o,a){if(o.filter(t=>t!==null).length<=1)return o.map(t=>t.y);const e=a-2,l=o.map((t,s)=>f(t,s,e)).filter(d).sort(m),i=new Array(l.length);return l.forEach((t,s)=>{if(t===null)return;const n=l[s+1];if(n&&n.top<t.bottom){const b=n.labelWeight-t.labelWeight===1?2:0,r=t.bottom-n.top+b;n.top+=r,n.bottom+=r}i[t.actualIndex]=(t.top+t.bottom)/2}),i}const f=(o,a,e)=>o?{top:o.y-e/2,bottom:o.y+e/2,labelWeight:o.weight,actualIndex:a}:null,m=(o,a)=>{const e=o.top,l=a.top;return e>l?1:e<l||e===l&&o.labelWeight<a.labelWeight?-1:0};
@@ -0,0 +1,35 @@
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 { FullChartConfig } from '../../../chart.config';
7
+ import { DataSeriesType } from '../../../model/data-series.config';
8
+ import { ChartModel, LastCandleLabelHandler } from '../../chart/chart.model';
9
+ import { LabelGroup, YAxisLabelsProvider } from './y-axis-labels.model';
10
+ import { LabelColorResolver } from '../y-axis.component';
11
+ export declare class LastCandleLabelsProvider implements YAxisLabelsProvider {
12
+ private chartModel;
13
+ private config;
14
+ private lastCandleLabelsByChartType;
15
+ private resolveLabelColorFn;
16
+ constructor(chartModel: ChartModel, config: FullChartConfig, lastCandleLabelsByChartType: Partial<Record<DataSeriesType, LastCandleLabelHandler>>, resolveLabelColorFn: (chartType: DataSeriesType) => LabelColorResolver);
17
+ /**
18
+ * Returns an array of LabelGroup objects that contain the labels for the yAxis of the chart.
19
+ * @returns {LabelGroup[]} An array of LabelGroup objects that contain the labels for the yAxis of the chart.
20
+ */
21
+ getUnorderedLabels(): LabelGroup[];
22
+ /**
23
+ * Returns the visual label for the Y axis of a candle series.
24
+ * @param {CandleSeriesModel} series - The candle series model.
25
+ * @returns {Omit<VisualYAxisLabel, 'bgColor'> | null} - The visual label for the Y axis or null if there is no data.
26
+ */
27
+ private getYAxisVisualLabel;
28
+ /**
29
+ * Returns the configuration object for drawing the label of the Y-axis.
30
+ * @param {CandleSeriesModel} series - The series model for which the label configuration is to be returned.
31
+ * @param {boolean} primary - A boolean value indicating whether the label is primary or not.
32
+ * @returns {YAxisLabelDrawConfig} - The configuration object for drawing the label of the Y-axis.
33
+ */
34
+ private getLabelDrawConfig;
35
+ }
@@ -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{getPrimaryLabelTextColor as b}from"../label-color.functions";import{lastOf as d}from"../../../utils/array.utils";import{getLabelTextColorByBackgroundColor as h}from"../../../utils/canvas/canvas-text-functions.utils";export class LastCandleLabelsProvider{constructor(e,o,t,s){this.chartModel=e,this.config=o,this.lastCandleLabelsByChartType=t,this.resolveLabelColorFn=s}getUnorderedLabels(){const e=[];if(this.config.components.yAxis.labels.settings.lastPrice.mode!=="none"){const t=this.getYAxisVisualLabel(this.chartModel.mainCandleSeries),s=t&&Object.assign(Object.assign({},t),this.getLabelDrawConfig(this.chartModel.mainCandleSeries,!0));if(s){const l={labels:[s]},a=this.lastCandleLabelsByChartType[this.config.components.chart.type];a==null||a(l,this.chartModel.mainCandleSeries),e.push(l)}this.chartModel.candleSeries.forEach((l,a)=>{if(a===0)return;const i=this.getYAxisVisualLabel(l),n=i&&Object.assign(Object.assign({},i),this.getLabelDrawConfig(l,!1));if(n){const c={labels:[n]},r=this.lastCandleLabelsByChartType[l.config.type];r==null||r(c,this.chartModel.mainCandleSeries),e.push(c)}})}return e}getYAxisVisualLabel(e){const o=d(e.dataPoints);if(o){const t=e.view.toY(o.close);if(isFinite(t)){const s=this.config.components.yAxis.labels.settings.lastPrice.mode,l=this.config.components.yAxis.labels.settings.lastPrice.type;return{y:t,labelWeight:0,labelText:this.chartModel.pane.valueFormatter(o.close,e),mode:s,labelType:l,description:e.instrument.symbol}}}return null}getLabelDrawConfig(e,o){const t=e.colors.labels,s=this.resolveLabelColorFn(e.config.type),{rectLabelTextColor:l,rectLabelInvertedTextColor:a}=this.chartModel.config.colors.yAxis;let i="#FFFFFF",n="#FFFFFF";return t&&(i=s(e.lastPriceMovement,e.colors),n=o?b(e.lastPriceMovement,t):l),{bgColor:i,textColor:h(i,n,a),rounded:!0}}}
@@ -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, YAxisLabelAppearanceType } from '../../../chart.config';
8
+ import { Bounds } from '../../../model/bounds.model';
9
+ import { drawBadgeLabel, drawPlainLabel, drawRectLabel } from '../y-axis-labels.drawer';
10
+ import { VisualYAxisLabel, YAxisVisualLabelType } from './y-axis-labels.model';
11
+ type LabelDrawer = typeof drawBadgeLabel | typeof drawRectLabel | typeof drawPlainLabel;
12
+ export declare const DEFAULT_LABEL_APPEARANCE_TYPE: YAxisLabelAppearanceType;
13
+ export declare const priceLabelDrawersMap: Record<YAxisVisualLabelType, LabelDrawer>;
14
+ /**
15
+ * Draws label on Y axis with provided parameters.
16
+ * @param ctx - canvas 2D context to draw on
17
+ * @param bounds - bounds of Y axis
18
+ * @param visualLabel
19
+ * @param canvasBoundsContainer
20
+ * @param config
21
+ */
22
+ export declare function drawLabel(ctx: CanvasRenderingContext2D, backgroundCtx: CanvasRenderingContext2D, bounds: Bounds, paneBounds: Bounds, visualLabel: VisualYAxisLabel, canvasBoundsContainer: CanvasBoundsContainer, config: ChartConfigComponentsYAxis, colors: FullChartColors['yAxis']): void;
23
+ export {};