@devexperts/dxcharts-lite 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/README.md +4 -4
  2. package/dist/chart/animation/canvas-animation.d.ts +1 -1
  3. package/dist/chart/animation/canvas-animation.js +135 -2
  4. package/dist/chart/animation/types/animation.d.ts +1 -1
  5. package/dist/chart/animation/types/animation.js +44 -2
  6. package/dist/chart/animation/types/color-alpha-animation.d.ts +2 -2
  7. package/dist/chart/animation/types/color-alpha-animation.js +61 -2
  8. package/dist/chart/animation/types/color-transition-animation.d.ts +2 -2
  9. package/dist/chart/animation/types/color-transition-animation.js +87 -2
  10. package/dist/chart/animation/types/viewport-movement-animation.d.ts +1 -1
  11. package/dist/chart/animation/types/viewport-movement-animation.js +64 -2
  12. package/dist/chart/animation/viewport-model-animation.d.ts +1 -1
  13. package/dist/chart/animation/viewport-model-animation.js +21 -2
  14. package/dist/chart/bootstrap.d.ts +52 -49
  15. package/dist/chart/bootstrap.js +450 -2
  16. package/dist/chart/canvas/canvas-bounds-container.d.ts +1 -6
  17. package/dist/chart/canvas/canvas-bounds-container.js +816 -2
  18. package/dist/chart/canvas/canvas-chart-html.d.ts +1 -1
  19. package/dist/chart/canvas/canvas-chart-html.js +17 -19
  20. package/dist/chart/canvas/chart-elements.d.ts +2 -5
  21. package/dist/chart/canvas/chart-elements.js +23 -2
  22. package/dist/chart/canvas/cursor.handler.d.ts +1 -1
  23. package/dist/chart/canvas/cursor.handler.js +123 -2
  24. package/dist/chart/canvas/layout-creator.d.ts +1 -1
  25. package/dist/chart/canvas/layout-creator.js +35 -2
  26. package/dist/chart/canvas/y-axis-bounds.container.d.ts +3 -3
  27. package/dist/chart/canvas/y-axis-bounds.container.js +68 -2
  28. package/dist/chart/chart-container.d.ts +1 -1
  29. package/dist/chart/chart-container.js +2 -2
  30. package/dist/chart/chart.config.d.ts +5 -6
  31. package/dist/chart/chart.config.js +646 -2
  32. package/dist/chart/chart.d.ts +62 -0
  33. package/dist/chart/chart.js +106 -0
  34. package/dist/chart/components/chart/basic-scale.d.ts +3 -3
  35. package/dist/chart/components/chart/basic-scale.js +32 -2
  36. package/dist/chart/components/chart/candle-transformer.functions.d.ts +1 -1
  37. package/dist/chart/components/chart/candle-transformer.functions.js +16 -2
  38. package/dist/chart/components/chart/candle-width-calculator.functions.d.ts +1 -1
  39. package/dist/chart/components/chart/candle-width-calculator.functions.js +3 -2
  40. package/dist/chart/components/chart/candle.functions.d.ts +1 -1
  41. package/dist/chart/components/chart/candle.functions.js +45 -2
  42. package/dist/chart/components/chart/chart-area-pan.handler.d.ts +4 -4
  43. package/dist/chart/components/chart/chart-area-pan.handler.js +198 -2
  44. package/dist/chart/components/chart/chart-base.model.d.ts +1 -1
  45. package/dist/chart/components/chart/chart-base.model.js +67 -2
  46. package/dist/chart/components/chart/chart.component.d.ts +8 -4
  47. package/dist/chart/components/chart/chart.component.js +409 -2
  48. package/dist/chart/components/chart/chart.model.d.ts +5 -12
  49. package/dist/chart/components/chart/chart.model.js +955 -2
  50. package/dist/chart/components/chart/data-series.high-low-provider.d.ts +1 -1
  51. package/dist/chart/components/chart/data-series.high-low-provider.js +35 -2
  52. package/dist/chart/components/chart/fake-candles.d.ts +1 -1
  53. package/dist/chart/components/chart/fake-candles.js +98 -2
  54. package/dist/chart/components/chart/price.formatter.d.ts +1 -1
  55. package/dist/chart/components/chart/price.formatter.js +36 -2
  56. package/dist/chart/components/chart/secondary-chart-colors-pool.d.ts +1 -1
  57. package/dist/chart/components/chart/secondary-chart-colors-pool.js +69 -2
  58. package/dist/chart/components/cross_tool/cross-tool.component.d.ts +1 -1
  59. package/dist/chart/components/cross_tool/cross-tool.component.js +86 -2
  60. package/dist/chart/components/cross_tool/cross-tool.drawer.d.ts +1 -1
  61. package/dist/chart/components/cross_tool/cross-tool.drawer.js +33 -2
  62. package/dist/chart/components/cross_tool/cross-tool.model.d.ts +1 -1
  63. package/dist/chart/components/cross_tool/cross-tool.model.js +108 -2
  64. package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.d.ts +1 -1
  65. package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +138 -2
  66. package/dist/chart/components/cross_tool/types/none.drawer.d.ts +1 -1
  67. package/dist/chart/components/cross_tool/types/none.drawer.js +4 -2
  68. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.d.ts +1 -1
  69. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +29 -2
  70. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.d.ts +1 -1
  71. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +25 -2
  72. package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.d.ts +1 -1
  73. package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +54 -2
  74. package/dist/chart/components/dynamic-objects/dynamic-objects.component.d.ts +13 -0
  75. package/dist/chart/components/dynamic-objects/dynamic-objects.component.js +20 -0
  76. package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.d.ts +18 -0
  77. package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.js +23 -0
  78. package/dist/chart/components/dynamic-objects/dynamic-objects.model.d.ts +63 -0
  79. package/dist/chart/components/dynamic-objects/dynamic-objects.model.js +136 -0
  80. package/dist/chart/components/events/events-hit-test.drawer.d.ts +1 -1
  81. package/dist/chart/components/events/events-hit-test.drawer.js +64 -2
  82. package/dist/chart/components/events/events.component.d.ts +1 -1
  83. package/dist/chart/components/events/events.component.js +62 -2
  84. package/dist/chart/components/events/events.drawer.d.ts +1 -1
  85. package/dist/chart/components/events/events.drawer.js +196 -2
  86. package/dist/chart/components/events/events.model.d.ts +1 -1
  87. package/dist/chart/components/events/events.model.js +70 -2
  88. package/dist/chart/components/grid/grid.component.d.ts +3 -3
  89. package/dist/chart/components/grid/grid.component.js +32 -2
  90. package/dist/chart/components/grid/grid.drawer.d.ts +5 -4
  91. package/dist/chart/components/grid/grid.drawer.js +107 -2
  92. package/dist/chart/components/high_low/high-low.component.d.ts +1 -1
  93. package/dist/chart/components/high_low/high-low.component.js +13 -2
  94. package/dist/chart/components/high_low/high-low.drawer.d.ts +1 -1
  95. package/dist/chart/components/high_low/high-low.drawer.js +127 -2
  96. package/dist/chart/components/highlights/highlights.component.d.ts +1 -1
  97. package/dist/chart/components/highlights/highlights.component.js +47 -2
  98. package/dist/chart/components/highlights/highlights.drawer.d.ts +1 -1
  99. package/dist/chart/components/highlights/highlights.drawer.js +155 -2
  100. package/dist/chart/components/highlights/highlights.model.d.ts +1 -1
  101. package/dist/chart/components/highlights/highlights.model.js +76 -2
  102. package/dist/chart/components/labels_generator/numeric-axis-labels.generator.d.ts +2 -2
  103. package/dist/chart/components/labels_generator/numeric-axis-labels.generator.js +200 -2
  104. package/dist/chart/components/navigation_map/navigation-map-move.handler.d.ts +3 -3
  105. package/dist/chart/components/navigation_map/navigation-map-move.handler.js +109 -2
  106. package/dist/chart/components/navigation_map/navigation-map.component.d.ts +1 -1
  107. package/dist/chart/components/navigation_map/navigation-map.component.js +113 -2
  108. package/dist/chart/components/navigation_map/navigation-map.drawer.d.ts +1 -1
  109. package/dist/chart/components/navigation_map/navigation-map.drawer.js +245 -2
  110. package/dist/chart/components/navigation_map/navigation-map.model.d.ts +1 -1
  111. package/dist/chart/components/navigation_map/navigation-map.model.js +34 -3
  112. package/dist/chart/components/pan/chart-pan.component.d.ts +3 -3
  113. package/dist/chart/components/pan/chart-pan.component.js +52 -2
  114. package/dist/chart/components/pane/extent/y-extent-component.d.ts +13 -19
  115. package/dist/chart/components/pane/extent/y-extent-component.js +121 -2
  116. package/dist/chart/components/pane/pane-hit-test.controller.d.ts +1 -1
  117. package/dist/chart/components/pane/pane-hit-test.controller.js +56 -2
  118. package/dist/chart/components/pane/pane-manager.component.d.ts +11 -6
  119. package/dist/chart/components/pane/pane-manager.component.js +149 -2
  120. package/dist/chart/components/pane/pane.component.d.ts +18 -34
  121. package/dist/chart/components/pane/pane.component.js +279 -2
  122. package/dist/chart/components/resizer/bar-resizer.component.d.ts +1 -1
  123. package/dist/chart/components/resizer/bar-resizer.component.js +140 -2
  124. package/dist/chart/components/resizer/bar-resizer.drawer.d.ts +1 -1
  125. package/dist/chart/components/resizer/bar-resizer.drawer.js +47 -2
  126. package/dist/chart/components/snapshot/snapshot.component.d.ts +1 -1
  127. package/dist/chart/components/snapshot/snapshot.component.js +49 -2
  128. package/dist/chart/components/volumes/separate-volumes.component.d.ts +7 -11
  129. package/dist/chart/components/volumes/separate-volumes.component.js +64 -2
  130. package/dist/chart/components/volumes/volume-color-resolvers.functions.d.ts +1 -1
  131. package/dist/chart/components/volumes/volume-color-resolvers.functions.js +19 -2
  132. package/dist/chart/components/volumes/volumes.component.d.ts +9 -9
  133. package/dist/chart/components/volumes/volumes.component.js +95 -2
  134. package/dist/chart/components/volumes/volumes.drawer.d.ts +6 -13
  135. package/dist/chart/components/volumes/volumes.drawer.js +141 -2
  136. package/dist/chart/components/volumes/volumes.formatter.d.ts +1 -1
  137. package/dist/chart/components/volumes/volumes.formatter.js +32 -2
  138. package/dist/chart/components/volumes/volumes.model.d.ts +3 -3
  139. package/dist/chart/components/volumes/volumes.model.js +44 -2
  140. package/dist/chart/components/watermark/water-mark.component.d.ts +1 -1
  141. package/dist/chart/components/watermark/water-mark.component.js +104 -2
  142. package/dist/chart/components/watermark/water-mark.drawer.d.ts +1 -1
  143. package/dist/chart/components/watermark/water-mark.drawer.js +188 -2
  144. package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.d.ts +1 -1
  145. package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.js +28 -2
  146. package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.d.ts +1 -1
  147. package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.js +188 -2
  148. package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.d.ts +1 -1
  149. package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.js +77 -2
  150. package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.d.ts +1 -1
  151. package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.js +80 -2
  152. package/dist/chart/components/x_axis/time/parser/time-formats.model.d.ts +1 -1
  153. package/dist/chart/components/x_axis/time/parser/time-formats.model.js +15 -2
  154. package/dist/chart/components/x_axis/time/x-axis-weights.functions.d.ts +2 -2
  155. package/dist/chart/components/x_axis/time/x-axis-weights.functions.js +144 -2
  156. package/dist/chart/components/x_axis/time/x-axis-weights.generator.d.ts +1 -1
  157. package/dist/chart/components/x_axis/time/x-axis-weights.generator.js +74 -2
  158. package/dist/chart/components/x_axis/x-axis-draw.functions.d.ts +1 -1
  159. package/dist/chart/components/x_axis/x-axis-draw.functions.js +50 -2
  160. package/dist/chart/components/x_axis/x-axis-labels.drawer.d.ts +1 -1
  161. package/dist/chart/components/x_axis/x-axis-labels.drawer.js +71 -2
  162. package/dist/chart/components/x_axis/x-axis-labels.generator.d.ts +3 -3
  163. package/dist/chart/components/x_axis/x-axis-labels.generator.js +333 -2
  164. package/dist/chart/components/x_axis/x-axis-labels.model.d.ts +1 -1
  165. package/dist/chart/components/x_axis/x-axis-labels.model.js +36 -2
  166. package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +3 -3
  167. package/dist/chart/components/x_axis/x-axis-scale.handler.js +61 -2
  168. package/dist/chart/components/x_axis/x-axis-time-labels.drawer.d.ts +1 -1
  169. package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +83 -2
  170. package/dist/chart/components/x_axis/x-axis.component.d.ts +3 -3
  171. package/dist/chart/components/x_axis/x-axis.component.js +120 -2
  172. package/dist/chart/components/y_axis/label-color.functions.d.ts +1 -1
  173. package/dist/chart/components/y_axis/label-color.functions.js +54 -2
  174. package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.d.ts +5 -5
  175. package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.js +34 -2
  176. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +4 -4
  177. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +68 -2
  178. package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.d.ts +1 -1
  179. package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +57 -2
  180. package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.d.ts +1 -1
  181. package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +96 -2
  182. package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +3 -3
  183. package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +120 -2
  184. package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +10 -9
  185. package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +202 -2
  186. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +7 -8
  187. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +59 -2
  188. package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +7 -5
  189. package/dist/chart/components/y_axis/y-axis-base-labels.model.js +48 -2
  190. package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +5 -5
  191. package/dist/chart/components/y_axis/y-axis-labels.drawer.js +162 -2
  192. package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +3 -3
  193. package/dist/chart/components/y_axis/y-axis-scale.handler.js +73 -2
  194. package/dist/chart/components/y_axis/y-axis.component.d.ts +33 -42
  195. package/dist/chart/components/y_axis/y-axis.component.js +221 -2
  196. package/dist/chart/components/y_axis/y-axis.drawer.d.ts +10 -13
  197. package/dist/chart/components/y_axis/y-axis.drawer.js +97 -2
  198. package/dist/chart/components/y_axis/y-axis.model.d.ts +10 -18
  199. package/dist/chart/components/y_axis/y-axis.model.js +34 -2
  200. package/dist/chart/drawers/chart-background.drawer.d.ts +1 -1
  201. package/dist/chart/drawers/chart-background.drawer.js +70 -2
  202. package/dist/chart/drawers/chart-type-drawers/area.drawer.d.ts +1 -1
  203. package/dist/chart/drawers/chart-type-drawers/area.drawer.js +70 -2
  204. package/dist/chart/drawers/chart-type-drawers/bar.drawer.d.ts +1 -1
  205. package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +58 -2
  206. package/dist/chart/drawers/chart-type-drawers/baseline.drawer.d.ts +1 -1
  207. package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +85 -2
  208. package/dist/chart/drawers/chart-type-drawers/candle.drawer.d.ts +1 -1
  209. package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +163 -2
  210. package/dist/chart/drawers/chart-type-drawers/histogram.drawer.d.ts +1 -1
  211. package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +58 -2
  212. package/dist/chart/drawers/chart-type-drawers/line.drawer.d.ts +1 -1
  213. package/dist/chart/drawers/chart-type-drawers/line.drawer.js +39 -2
  214. package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.d.ts +1 -1
  215. package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +20 -2
  216. package/dist/chart/drawers/clear-canvas.drawer.d.ts +1 -1
  217. package/dist/chart/drawers/clear-canvas.drawer.js +15 -2
  218. package/dist/chart/drawers/composite.drawer.d.ts +1 -1
  219. package/dist/chart/drawers/composite.drawer.js +68 -2
  220. package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.d.ts +1 -1
  221. package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +51 -2
  222. package/dist/chart/drawers/data-series-drawers/color-candle.drawer.d.ts +1 -1
  223. package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +36 -2
  224. package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.d.ts +1 -1
  225. package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.js +17 -2
  226. package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.d.ts +1 -1
  227. package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +107 -2
  228. package/dist/chart/drawers/data-series-drawers/histogram.drawer.d.ts +1 -1
  229. package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +24 -2
  230. package/dist/chart/drawers/data-series-drawers/linear.drawer.d.ts +1 -1
  231. package/dist/chart/drawers/data-series-drawers/linear.drawer.js +20 -2
  232. package/dist/chart/drawers/data-series-drawers/points.drawer.d.ts +1 -1
  233. package/dist/chart/drawers/data-series-drawers/points.drawer.js +20 -2
  234. package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.d.ts +1 -1
  235. package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.js +8 -2
  236. package/dist/chart/drawers/data-series-drawers/text.drawer.d.ts +1 -1
  237. package/dist/chart/drawers/data-series-drawers/text.drawer.js +26 -2
  238. package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.d.ts +1 -1
  239. package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +36 -2
  240. package/dist/chart/drawers/data-series-drawers/triangle.drawer.d.ts +1 -1
  241. package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +23 -2
  242. package/dist/chart/drawers/data-series.drawer.d.ts +6 -8
  243. package/dist/chart/drawers/data-series.drawer.js +57 -2
  244. package/dist/chart/drawers/drawing-manager.d.ts +2 -2
  245. package/dist/chart/drawers/drawing-manager.js +178 -2
  246. package/dist/chart/drawers/ht-data-series.drawer.d.ts +1 -1
  247. package/dist/chart/drawers/ht-data-series.drawer.js +38 -2
  248. package/dist/chart/events/event-bus.d.ts +1 -1
  249. package/dist/chart/events/event-bus.js +74 -2
  250. package/dist/chart/events/events.d.ts +1 -1
  251. package/dist/chart/events/events.js +4 -2
  252. package/dist/chart/inputhandlers/candle-tap.handler.d.ts +1 -1
  253. package/dist/chart/inputhandlers/candle-tap.handler.js +47 -2
  254. package/dist/chart/inputhandlers/chart-resize.handler.d.ts +1 -1
  255. package/dist/chart/inputhandlers/chart-resize.handler.js +99 -2
  256. package/dist/chart/inputhandlers/cross-event-producer.component.d.ts +1 -1
  257. package/dist/chart/inputhandlers/cross-event-producer.component.js +68 -2
  258. package/dist/chart/inputhandlers/hover-producer.component.d.ts +3 -3
  259. package/dist/chart/inputhandlers/hover-producer.component.js +229 -2
  260. package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +3 -3
  261. package/dist/chart/inputhandlers/main-canvas-touch.handler.js +81 -2
  262. package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +1 -1
  263. package/dist/chart/inputlisteners/canvas-input-listener.component.js +630 -2
  264. package/dist/chart/model/baseline.model.d.ts +1 -1
  265. package/dist/chart/model/baseline.model.js +89 -2
  266. package/dist/chart/model/bounds.model.d.ts +1 -1
  267. package/dist/chart/model/bounds.model.js +2 -2
  268. package/dist/chart/model/candle-hover.d.ts +1 -1
  269. package/dist/chart/model/candle-hover.js +71 -2
  270. package/dist/chart/model/candle-series-high-low.provider.d.ts +1 -1
  271. package/dist/chart/model/candle-series-high-low.provider.js +46 -2
  272. package/dist/chart/model/candle-series.model.d.ts +4 -4
  273. package/dist/chart/model/candle-series.model.js +246 -2
  274. package/dist/chart/model/candle.model.d.ts +1 -1
  275. package/dist/chart/model/candle.model.js +70 -2
  276. package/dist/chart/model/canvas.model.d.ts +1 -1
  277. package/dist/chart/model/canvas.model.js +229 -2
  278. package/dist/chart/model/chart-base-element.d.ts +1 -1
  279. package/dist/chart/model/chart-base-element.js +130 -2
  280. package/dist/chart/model/compare-series-hover.d.ts +1 -1
  281. package/dist/chart/model/compare-series-hover.js +26 -2
  282. package/dist/chart/model/data-series-view.d.ts +6 -6
  283. package/dist/chart/model/data-series-view.js +112 -2
  284. package/dist/chart/model/data-series.config.d.ts +1 -1
  285. package/dist/chart/model/data-series.config.js +15 -2
  286. package/dist/chart/model/data-series.model.d.ts +5 -5
  287. package/dist/chart/model/data-series.model.js +282 -2
  288. package/dist/chart/model/date-time.formatter.d.ts +1 -1
  289. package/dist/chart/model/date-time.formatter.js +152 -2
  290. package/dist/chart/model/hit-test-canvas.model.d.ts +2 -2
  291. package/dist/chart/model/hit-test-canvas.model.js +257 -2
  292. package/dist/chart/model/main-candle-series.model.d.ts +2 -2
  293. package/dist/chart/model/main-candle-series.model.js +30 -2
  294. package/dist/chart/model/scale.model.d.ts +3 -2
  295. package/dist/chart/model/scale.model.js +317 -2
  296. package/dist/chart/model/scaling/auto-scale.model.d.ts +1 -1
  297. package/dist/chart/model/scaling/auto-scale.model.js +98 -2
  298. package/dist/chart/model/scaling/constrait.functions.d.ts +1 -1
  299. package/dist/chart/model/scaling/constrait.functions.js +62 -2
  300. package/dist/chart/model/scaling/lock-ratio.model.d.ts +1 -1
  301. package/dist/chart/model/scaling/lock-ratio.model.js +18 -2
  302. package/dist/chart/model/scaling/move-chart.functions.d.ts +1 -1
  303. package/dist/chart/model/scaling/move-chart.functions.js +23 -2
  304. package/dist/chart/model/scaling/viewport.model.d.ts +3 -3
  305. package/dist/chart/model/scaling/viewport.model.js +280 -2
  306. package/dist/chart/model/scaling/x-zooming.functions.d.ts +1 -1
  307. package/dist/chart/model/scaling/x-zooming.functions.js +36 -2
  308. package/dist/chart/model/time-zone.model.d.ts +1 -1
  309. package/dist/chart/model/time-zone.model.js +110 -2
  310. package/dist/chart/model/visual-candle.d.ts +1 -1
  311. package/dist/chart/model/visual-candle.js +135 -2
  312. package/dist/chart/utils/__tests__/array.utils.test.d.ts +1 -1
  313. package/dist/chart/utils/__tests__/array.utils.test.js +136 -2
  314. package/dist/chart/utils/{perfomance/debounce.utils.js → __tests__/math.utils.test.d.ts} +2 -2
  315. package/dist/chart/utils/__tests__/math.utils.test.js +19 -0
  316. package/dist/chart/utils/__tests__/object.utils.test.d.ts +1 -1
  317. package/dist/chart/utils/__tests__/object.utils.test.js +12 -2
  318. package/dist/chart/utils/__tests__/priceIncrementsUtils.test.d.ts +1 -1
  319. package/dist/chart/utils/__tests__/priceIncrementsUtils.test.js +30 -2
  320. package/dist/chart/utils/array.utils.d.ts +2 -2
  321. package/dist/chart/utils/array.utils.js +270 -2
  322. package/dist/chart/utils/auto-period-detector.utils.d.ts +1 -1
  323. package/dist/chart/utils/auto-period-detector.utils.js +40 -2
  324. package/dist/chart/utils/candles-generator-ts.utils.d.ts +1 -1
  325. package/dist/chart/utils/candles-generator-ts.utils.js +21 -2
  326. package/dist/chart/utils/candles-generator.utils.d.ts +1 -1
  327. package/dist/chart/utils/candles-generator.utils.js +162 -2
  328. package/dist/chart/utils/candles.utils.d.ts +1 -1
  329. package/dist/chart/utils/candles.utils.js +43 -2
  330. package/dist/chart/utils/canvas/canvas-drawing-functions.utils.d.ts +1 -1
  331. package/dist/chart/utils/canvas/canvas-drawing-functions.utils.js +145 -2
  332. package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.d.ts +1 -1
  333. package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.js +52 -2
  334. package/dist/chart/utils/canvas/canvas-text-functions.utils.d.ts +1 -1
  335. package/dist/chart/utils/canvas/canvas-text-functions.utils.js +157 -2
  336. package/dist/chart/utils/color.utils.d.ts +1 -1
  337. package/dist/chart/utils/color.utils.js +32 -2
  338. package/dist/chart/utils/device/browser.utils.d.ts +1 -1
  339. package/dist/chart/utils/device/browser.utils.js +11 -2
  340. package/dist/chart/utils/device/device-detector.utils.d.ts +1 -1
  341. package/dist/chart/utils/device/device-detector.utils.js +25 -2
  342. package/dist/chart/utils/device/device-pixel-ratio.utils.d.ts +1 -1
  343. package/dist/chart/utils/device/device-pixel-ratio.utils.js +22 -2
  344. package/dist/chart/utils/device/touchpad.utils.d.ts +1 -1
  345. package/dist/chart/utils/device/touchpad.utils.js +92 -2
  346. package/dist/chart/utils/dom.utils.d.ts +1 -1
  347. package/dist/chart/utils/dom.utils.js +16 -2
  348. package/dist/chart/utils/function.utils.d.ts +1 -1
  349. package/dist/chart/utils/function.utils.js +17 -2
  350. package/dist/chart/utils/linkedList.utils.d.ts +28 -0
  351. package/dist/chart/utils/linkedList.utils.js +138 -0
  352. package/dist/chart/utils/math.utils.d.ts +1 -1
  353. package/dist/chart/utils/math.utils.js +116 -2
  354. package/dist/chart/utils/merge.utils.d.ts +1 -1
  355. package/dist/chart/utils/merge.utils.js +57 -2
  356. package/dist/chart/utils/object.utils.d.ts +1 -1
  357. package/dist/chart/utils/object.utils.js +44 -2
  358. package/dist/chart/utils/{perfomance → performance}/animation-frame-cache.utils.d.ts +1 -1
  359. package/dist/chart/utils/performance/animation-frame-cache.utils.js +77 -0
  360. package/dist/chart/utils/{perfomance → performance}/debounce.utils.d.ts +1 -1
  361. package/dist/chart/utils/performance/debounce.utils.js +12 -0
  362. package/dist/chart/utils/{perfomance → performance}/memoize.utils.d.ts +1 -1
  363. package/dist/chart/utils/performance/memoize.utils.js +74 -0
  364. package/dist/chart/utils/{perfomance → performance}/request-animation-frame-throttle.utils.d.ts +1 -1
  365. package/dist/chart/utils/performance/request-animation-frame-throttle.utils.js +43 -0
  366. package/dist/chart/utils/{perfomance → performance}/throttle.utils.d.ts +1 -1
  367. package/dist/chart/utils/performance/throttle.utils.js +26 -0
  368. package/dist/chart/utils/price-increments.utils.d.ts +2 -1
  369. package/dist/chart/utils/price-increments.utils.js +128 -2
  370. package/dist/chart/utils/uuid.utils.d.ts +1 -1
  371. package/dist/chart/utils/uuid.utils.js +5 -2
  372. package/dist/dxchart.min.js +10 -13
  373. package/dist/index.d.ts +4 -4
  374. package/dist/index.js +21 -2
  375. package/package.json +4 -4
  376. package/dist/chart/utils/perfomance/animation-frame-cache.utils.js +0 -6
  377. package/dist/chart/utils/perfomance/memoize.utils.js +0 -6
  378. package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.js +0 -6
  379. package/dist/chart/utils/perfomance/throttle.utils.js +0 -6
@@ -1,6 +1,68 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- import{ChartBaseElement as n}from"../../model/chart-base-element";import{createCandlesOffsetProvider as d}from"../chart/data-series.high-low-provider";import{VolumesDrawer as h}from"./volumes.drawer";import{volumeFormatter as u}from"./volumes.formatter";class a extends n{constructor(o,e,t,s,r,i,l){super(),this.canvasModel=o,this.chartComponent=e,this.drawingManager=t,this.config=s,this.volumesModel=r,this.volumesColorByChartTypeMap=i,this.paneManager=l,s.components.volumes.showSeparately&&this.activateSeparateVolumes()}doActivate(){super.doActivate(),this.addRxSubscription(this.chartComponent.chartModel.candlesUpdatedSubject.subscribe(()=>{var o,e;return!(!((o=this.scaleModel)===null||o===void 0)&&o.isViewportValid())&&((e=this.scaleModel)===null||e===void 0?void 0:e.doAutoScale(!0))})),this.addRxSubscription(this.volumesModel.volumeMax.subscribe(()=>{var o;return(o=this.scaleModel)===null||o===void 0?void 0:o.doAutoScale()}))}activateSeparateVolumes(){if(this.paneManager.paneComponents[a.UUID]===void 0){const o=this.paneManager.createPane(a.UUID,{paneFormatters:{regular:u},useDefaultHighLow:!1,increment:1}),{scaleModel:e}=o,t=d(()=>({top:10,bottom:0,left:0,right:0,visible:!0}),this.volumesModel.highLowProvider);e.autoScaleModel.setHighLowProvider("volumes",t),e.doAutoScale(!0),this.scaleModel=e;const s=new h(this.canvasModel,this.config,this.volumesModel,this.chartComponent.chartModel,e,this.volumesColorByChartTypeMap,()=>this.config.components.volumes.showSeparately);this.drawingManager.addDrawer(s,"UNDERLAY_VOLUMES_AREA")}}deactiveSeparateVolumes(){this.paneManager.removePane(a.UUID),delete this.scaleModel,this.drawingManager.removeDrawerByName("UNDERLAY_VOLUMES_AREA")}fromY(o){var e,t;return(t=(e=this.scaleModel)===null||e===void 0?void 0:e.fromY(o))!==null&&t!==void 0?t:0}}a.UUID="volumes";export{a as SeparateVolumesComponent};
6
+ import { ChartBaseElement } from '../../model/chart-base-element';
7
+ import { createCandlesOffsetProvider } from '../chart/data-series.high-low-provider';
8
+ import { volumeFormatter } from './volumes.formatter';
9
+ class SeparateVolumesComponent extends ChartBaseElement {
10
+ constructor(chartComponent, drawingManager, config, volumesModel, paneManager) {
11
+ super();
12
+ this.chartComponent = chartComponent;
13
+ this.drawingManager = drawingManager;
14
+ this.config = config;
15
+ this.volumesModel = volumesModel;
16
+ this.paneManager = paneManager;
17
+ if (config.components.volumes.showSeparately) {
18
+ this.activateSeparateVolumes();
19
+ }
20
+ }
21
+ doActivate() {
22
+ super.doActivate();
23
+ this.addRxSubscription(this.chartComponent.chartModel.candlesUpdatedSubject.subscribe(() => { var _a, _b; return !((_a = this.pane) === null || _a === void 0 ? void 0 : _a.scale.isViewportValid()) && ((_b = this.pane) === null || _b === void 0 ? void 0 : _b.scale.doAutoScale(true)); }));
24
+ this.addRxSubscription(this.volumesModel.volumeMax.subscribe(() => { var _a; return (_a = this.pane) === null || _a === void 0 ? void 0 : _a.scale.doAutoScale(); }));
25
+ }
26
+ /**
27
+ * Activates the separate volumes feature.
28
+ * If the pane component for separate volumes does not exist, it creates a new pane with the specified UUID and options.
29
+ * It then sets the high-low provider for the volumes scale model and does an auto scale.
30
+ * A new VolumesDrawer is created and added to the drawing manager with the specified parameters.
31
+ */
32
+ activateSeparateVolumes() {
33
+ if (this.paneManager.panes[SeparateVolumesComponent.UUID] === undefined) {
34
+ const volumePane = this.paneManager.createPane(SeparateVolumesComponent.UUID, {
35
+ paneFormatters: {
36
+ regular: volumeFormatter,
37
+ },
38
+ useDefaultHighLow: false,
39
+ increment: 1,
40
+ });
41
+ this.pane = volumePane;
42
+ volumePane.mainExtent.yAxis.setAxisType('regular');
43
+ const { scale: scaleModel } = volumePane;
44
+ const volumesHighLowProvider = createCandlesOffsetProvider(() => ({ top: 10, bottom: 0, left: 0, right: 0, visible: true }), this.volumesModel.highLowProvider);
45
+ scaleModel.autoScaleModel.setHighLowProvider('volumes', volumesHighLowProvider);
46
+ scaleModel.doAutoScale(true);
47
+ }
48
+ }
49
+ /**
50
+ * Deactivates the separate volumes feature by removing the separate volumes pane, deleting the scale model, and removing the underlay volumes area drawer.
51
+ */
52
+ deactiveSeparateVolumes() {
53
+ this.paneManager.removePane(SeparateVolumesComponent.UUID);
54
+ delete this.pane;
55
+ this.drawingManager.removeDrawerByName('UNDERLAY_VOLUMES_AREA');
56
+ }
57
+ /**
58
+ * Converts a pixel value from the Y-axis of the scale model to the corresponding data value.
59
+ * @param {Pixel} y - The pixel value to convert.
60
+ * @returns {Unit} - The corresponding data value.
61
+ */
62
+ fromY(y) {
63
+ var _a, _b;
64
+ return (_b = (_a = this.pane) === null || _a === void 0 ? void 0 : _a.scale.fromY(y)) !== null && _b !== void 0 ? _b : 0;
65
+ }
66
+ }
67
+ SeparateVolumesComponent.UUID = 'volumes';
68
+ export { SeparateVolumesComponent };
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
@@ -1,6 +1,23 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- import t from"color";export const VOLUMES_COLOR_OPACITY=.3,resolveColorForBar=(o,r)=>{const e=r.barTheme[`${o}Color`];return t(e).alpha(VOLUMES_COLOR_OPACITY).toString()},resolveColorUsingConfig=(o,r)=>{const e=r.volume[`${o}BarColor`];return t(e).alpha(VOLUMES_COLOR_OPACITY).toString()},resolveColorForLine=(o,r)=>{const e=r.lineTheme[`${o}Color`];return t(e).alpha(VOLUMES_COLOR_OPACITY).toString()},resolveColorForCandle=(o,r)=>{const e=r.candleTheme[`${o}Color`];return t(e).alpha(VOLUMES_COLOR_OPACITY).toString()};
6
+ import Color from 'color';
7
+ export const VOLUMES_COLOR_OPACITY = 0.3;
8
+ export const resolveColorForBar = (priceMovement, colors) => {
9
+ const color = colors.barTheme[`${priceMovement}Color`];
10
+ return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString();
11
+ };
12
+ export const resolveColorUsingConfig = (priceMovement, colors) => {
13
+ const color = colors.volume[`${priceMovement}BarColor`];
14
+ return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString();
15
+ };
16
+ export const resolveColorForLine = (priceMovement, colors) => {
17
+ const color = colors.lineTheme[`${priceMovement}Color`];
18
+ return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString();
19
+ };
20
+ export const resolveColorForCandle = (priceMovement, colors) => {
21
+ const color = colors.candleTheme[`${priceMovement}Color`];
22
+ return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString();
23
+ };
@@ -1,32 +1,32 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
+ import { BehaviorSubject } from 'rxjs';
6
7
  import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
7
- import { ChartBaseElement } from '../../model/chart-base-element';
8
8
  import { BarType, FullChartColors, FullChartConfig } from '../../chart.config';
9
- import { CanvasModel } from '../../model/canvas.model';
10
9
  import { DrawingManager } from '../../drawers/drawing-manager';
11
10
  import { PriceMovement } from '../../model/candle-series.model';
11
+ import { CanvasModel } from '../../model/canvas.model';
12
+ import { ChartBaseElement } from '../../model/chart-base-element';
12
13
  import { ScaleModel } from '../../model/scale.model';
13
14
  import { ChartComponent } from '../chart/chart.component';
15
+ import { DynamicObjectsComponent } from '../dynamic-objects/dynamic-objects.component';
14
16
  import { PaneManager } from '../pane/pane-manager.component';
15
17
  import { SeparateVolumesComponent } from './separate-volumes.component';
16
18
  import { VolumesModel } from './volumes.model';
17
- import { YAxisComponent } from '../y_axis/y-axis.component';
18
- import { BehaviorSubject } from 'rxjs';
19
19
  export type VolumeColorResolver = (priceMovement: PriceMovement, colors: FullChartColors) => string;
20
20
  export declare class VolumesComponent extends ChartBaseElement {
21
21
  private canvasModel;
22
22
  private canvasBoundsContainer;
23
23
  private config;
24
24
  separateVolumes: SeparateVolumesComponent;
25
- private volumesColorByChartTypeMap;
25
+ volumesColorByChartTypeMap: Partial<Record<BarType, VolumeColorResolver>>;
26
26
  volumesModel: VolumesModel;
27
- yAxisComponent: YAxisComponent;
28
- volumeSettingChangedSubject: BehaviorSubject<boolean>;
29
- constructor(canvasModel: CanvasModel, chartComponent: ChartComponent, scaleModel: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, config: FullChartConfig, paneManager: PaneManager, yAxisComponent: YAxisComponent);
27
+ volumeVisibilityChangedSubject: BehaviorSubject<boolean>;
28
+ volumeIsSeparateModeChangedSubject: BehaviorSubject<boolean>;
29
+ constructor(canvasModel: CanvasModel, chartComponent: ChartComponent, scale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, config: FullChartConfig, paneManager: PaneManager, dynamicObjectsComponent: DynamicObjectsComponent);
30
30
  /**
31
31
  * Registers default volume color resolvers for candle, line and bar charts
32
32
  * @private
@@ -1,6 +1,99 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- import{ChartBaseElement as n}from"../../model/chart-base-element";import{SeparateVolumesComponent as p}from"./separate-volumes.component";import{resolveColorForBar as v,resolveColorForCandle as r,resolveColorForLine as C}from"./volume-color-resolvers.functions";import{VolumesDrawer as V}from"./volumes.drawer";import{VolumesModel as c}from"./volumes.model";import{BehaviorSubject as d}from"rxjs";export class VolumesComponent extends n{constructor(e,o,l,a,i,s,m,u){super(),this.canvasModel=e,this.canvasBoundsContainer=a,this.config=s,this.volumesColorByChartTypeMap={},this.volumeSettingChangedSubject=new d(!1);const t=new c(o,l);this.volumesModel=t,this.yAxisComponent=u,this.addChildEntity(t),this.separateVolumes=new p(e,o,i,s,t,this.volumesColorByChartTypeMap,m),this.addChildEntity(this.separateVolumes);const h=new V(e,s,t,o.chartModel,l,this.volumesColorByChartTypeMap,()=>!s.components.volumes.showSeparately);i.addDrawer(h,"VOLUMES"),this.registerDefaultVolumeColorResolvers(),this.volumeSettingChangedSubject.next(s.components.volumes.visible)}registerDefaultVolumeColorResolvers(){this.registerVolumeColorResolver("candle",r),this.registerVolumeColorResolver("trend",r),this.registerVolumeColorResolver("hollow",r),this.registerVolumeColorResolver("line",C),this.registerVolumeColorResolver("bar",v)}setShowVolumesSeparatly(e){this.config.components.volumes.showSeparately!==e&&(this.config.components.volumes.showSeparately=e,e?this.separateVolumes.activateSeparateVolumes():this.separateVolumes.deactiveSeparateVolumes())}doDeactivate(){super.doDeactivate(),this.setVisible(!1)}registerVolumeColorResolver(e,o){this.volumesColorByChartTypeMap[e]=o}setVisible(e=!0){this.config.components.volumes.visible=e,this.volumeSettingChangedSubject.next(e),this.config.components.volumes.showSeparately===!0&&(e?this.separateVolumes.activateSeparateVolumes():this.separateVolumes.deactiveSeparateVolumes()),this.canvasBoundsContainer.recalculatePanesHeightRatios(),this.canvasModel.fireDraw()}}
6
+ import { BehaviorSubject } from 'rxjs';
7
+ import { CHART_UUID } from '../../canvas/canvas-bounds-container';
8
+ import { ChartBaseElement } from '../../model/chart-base-element';
9
+ import { SeparateVolumesComponent } from './separate-volumes.component';
10
+ import { resolveColorForBar, resolveColorForCandle, resolveColorForLine } from './volume-color-resolvers.functions';
11
+ import { VolumesDrawer } from './volumes.drawer';
12
+ import { VolumesModel } from './volumes.model';
13
+ export class VolumesComponent extends ChartBaseElement {
14
+ constructor(canvasModel, chartComponent, scale, canvasBoundsContainer, drawingManager, config, paneManager, dynamicObjectsComponent) {
15
+ super();
16
+ this.canvasModel = canvasModel;
17
+ this.canvasBoundsContainer = canvasBoundsContainer;
18
+ this.config = config;
19
+ this.volumesColorByChartTypeMap = {};
20
+ this.volumeVisibilityChangedSubject = new BehaviorSubject(false);
21
+ this.volumeIsSeparateModeChangedSubject = new BehaviorSubject(false);
22
+ const volumesModel = new VolumesModel(chartComponent, scale);
23
+ this.volumesModel = volumesModel;
24
+ this.addChildEntity(volumesModel);
25
+ this.separateVolumes = new SeparateVolumesComponent(chartComponent, drawingManager, config, volumesModel, paneManager);
26
+ const volumesDrawer = new VolumesDrawer(config, this.volumesModel, chartComponent.chartModel, () => { var _a, _b; return (this.config.components.volumes.showSeparately ? (_b = (_a = this.separateVolumes.pane) === null || _a === void 0 ? void 0 : _a.scale) !== null && _b !== void 0 ? _b : scale : scale); }, this.volumesColorByChartTypeMap, () => true);
27
+ dynamicObjectsComponent.model.addObject({ drawer: volumesDrawer, model: volumesModel }, CHART_UUID);
28
+ this.addChildEntity(this.separateVolumes);
29
+ this.registerDefaultVolumeColorResolvers();
30
+ this.volumeVisibilityChangedSubject.next(config.components.volumes.visible);
31
+ this.volumeIsSeparateModeChangedSubject.next(config.components.volumes.showSeparately);
32
+ }
33
+ /**
34
+ * Registers default volume color resolvers for candle, line and bar charts
35
+ * @private
36
+ */
37
+ registerDefaultVolumeColorResolvers() {
38
+ this.registerVolumeColorResolver('candle', resolveColorForCandle);
39
+ this.registerVolumeColorResolver('trend', resolveColorForCandle);
40
+ this.registerVolumeColorResolver('hollow', resolveColorForCandle);
41
+ this.registerVolumeColorResolver('line', resolveColorForLine);
42
+ this.registerVolumeColorResolver('bar', resolveColorForBar);
43
+ }
44
+ /**
45
+ * Sets whether the volumes should be shown separately or not.
46
+ *
47
+ * @param {boolean} separate - A boolean value indicating whether the volumes should be shown separately or not.
48
+ * @returns {void}
49
+ */
50
+ setShowVolumesSeparatly(separate) {
51
+ if (this.config.components.volumes.showSeparately !== separate) {
52
+ this.config.components.volumes.showSeparately = separate;
53
+ if (separate) {
54
+ this.separateVolumes.activateSeparateVolumes();
55
+ }
56
+ else {
57
+ this.separateVolumes.deactiveSeparateVolumes();
58
+ }
59
+ this.volumeIsSeparateModeChangedSubject.next(separate);
60
+ }
61
+ }
62
+ /**
63
+ * This method deactivates the current component by calling the superclass doDeactivate method and setting the visibility of the component to false.
64
+ * @returns {void}
65
+ */
66
+ doDeactivate() {
67
+ super.doDeactivate();
68
+ this.setVisible(false);
69
+ }
70
+ /**
71
+ * You can use this method to determine volumes' color for specified chart type.
72
+ * @param chartType
73
+ * @param resolver
74
+ */
75
+ registerVolumeColorResolver(chartType, resolver) {
76
+ this.volumesColorByChartTypeMap[chartType] = resolver;
77
+ }
78
+ /**
79
+ * Sets the visibility of the volumes component and updates the canvas accordingly.
80
+ * @param {boolean} visible - Whether the volumes component should be visible or not. Default is true.
81
+ * @returns {void}
82
+ */
83
+ setVisible(visible = true) {
84
+ this.config.components.volumes.visible = visible;
85
+ this.volumeVisibilityChangedSubject.next(visible);
86
+ if (this.config.components.volumes.showSeparately === true) {
87
+ if (visible) {
88
+ this.separateVolumes.activateSeparateVolumes();
89
+ this.volumeIsSeparateModeChangedSubject.next(true);
90
+ }
91
+ else {
92
+ this.separateVolumes.deactiveSeparateVolumes();
93
+ this.volumeIsSeparateModeChangedSubject.next(false);
94
+ }
95
+ }
96
+ this.canvasBoundsContainer.recalculatePanesHeightRatios();
97
+ this.canvasModel.fireDraw();
98
+ }
99
+ }
@@ -1,25 +1,24 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
6
  import { BarType, FullChartConfig } from '../../chart.config';
7
7
  import { CanvasModel } from '../../model/canvas.model';
8
- import { Drawer } from '../../drawers/drawing-manager';
9
8
  import { ViewportModel } from '../../model/scaling/viewport.model';
10
9
  import { ChartModel } from '../chart/chart.model';
10
+ import { DynamicModelDrawer } from '../dynamic-objects/dynamic-objects.drawer';
11
11
  import { VolumeColorResolver } from './volumes.component';
12
12
  import { VolumesModel } from './volumes.model';
13
- export declare class VolumesDrawer implements Drawer {
14
- private canvasModel;
13
+ export declare class VolumesDrawer implements DynamicModelDrawer<VolumesModel> {
15
14
  private config;
16
15
  private volumesModel;
17
16
  private chartModel;
18
- private viewportModel;
17
+ getViewportModel: () => ViewportModel;
19
18
  private volumesColorByChartTypeMap;
20
19
  private drawPredicate;
21
20
  private readonly volumeBarColors;
22
- constructor(canvasModel: CanvasModel, config: FullChartConfig, volumesModel: VolumesModel, chartModel: ChartModel, viewportModel: ViewportModel, volumesColorByChartTypeMap: Partial<Record<BarType, VolumeColorResolver>>, drawPredicate: () => boolean);
21
+ constructor(config: FullChartConfig, volumesModel: VolumesModel, chartModel: ChartModel, getViewportModel: () => ViewportModel, volumesColorByChartTypeMap: Partial<Record<BarType, VolumeColorResolver>>, drawPredicate: () => boolean);
23
22
  /**
24
23
  * This function is used to calculate the colors for each volume bar. It is an optimization to avoid calculating the color for each volume, which can be expensive.
25
24
  * @param {BarType} barType - The type of bar to calculate the color for.
@@ -33,7 +32,7 @@ export declare class VolumesDrawer implements Drawer {
33
32
  * Restores the canvas context.
34
33
  * @returns {void}
35
34
  */
36
- draw(): void;
35
+ draw(canvasModel: CanvasModel): void;
37
36
  /**
38
37
  * Draws the last bar of the chart if the volumes component is visible.
39
38
  * TODO: Rework the function.
@@ -62,10 +61,4 @@ export declare class VolumesDrawer implements Drawer {
62
61
  * @returns {void}
63
62
  */
64
63
  private drawVolume;
65
- /**
66
- * Returns an array of canvas ids.
67
- *
68
- * @returns {Array<string>} An array containing the canvas id.
69
- */
70
- getCanvasIds(): Array<string>;
71
64
  }
@@ -1,6 +1,145 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- import{clipToBounds as f}from"../../drawers/data-series.drawer";import{unitToPixels as m}from"../../model/scaling/viewport.model";import{ceilToDPR as u,floorToDPR as n}from"../../utils/device/device-pixel-ratio.utils";import{resolveColorUsingConfig as p}from"./volume-color-resolvers.functions";import{flat as M}from"../../utils/array.utils";const w=3;export class VolumesDrawer{constructor(e,t,o,i,l,s,r){this.canvasModel=e,this.config=t,this.volumesModel=o,this.chartModel=i,this.viewportModel=l,this.volumesColorByChartTypeMap=s,this.drawPredicate=r,this.volumeBarColors={down:"#FF00FF",up:"#FF00FF",none:"#FF00FF"}}calculateColors(e){var t;const o=(t=this.volumesColorByChartTypeMap[e])!==null&&t!==void 0?t:p;this.volumeBarColors.down=o("down",this.config.colors),this.volumeBarColors.up=o("up",this.config.colors),this.volumeBarColors.none=o("none",this.config.colors)}draw(){if(this.config.components.volumes.visible&&this.drawPredicate()){this.calculateColors(this.config.components.chart.type);const e=this.canvasModel.ctx;e.save();const t=this.viewportModel.getBounds();f(e,t),this.drawVolumes(),e.restore()}}drawLastBar(){this.config.components.volumes.visible}drawVolumes(){const e=this.volumesModel.volumeMax.getValue();if(e===0)return;const t=M(this.chartModel.mainCandleSeries.getSeriesInViewport(this.chartModel.scaleModel.xStart-1,this.chartModel.scaleModel.xEnd+1));t.forEach((o,i)=>{if(o.candle.volume){const l=this.viewportModel.getBounds(),s=l.height,r=t[i+1]!==void 0?n(this.viewportModel.toX(t[i+1].startUnit)):void 0,c=n(this.viewportModel.toX(o.startUnit)),a=r!==void 0?r-c:n(m(o.width,this.viewportModel.zoomX));if(this.config.components.volumes.showSeparately){const h=n(this.viewportModel.toY(o.candle.volume)),d=n(this.viewportModel.toY(0))-h;this.drawVolume(o,c,h,a,d)}else{const h=e/(s/w),d=Math.max(m(o.candle.volume,h),2),v=n(l.y+s-d);this.drawVolume(o,c,v,a,d)}}})}drawVolume(e,t,o,i,l){const s=this.canvasModel.ctx,r=o,c=o+l,a=e.name;s.fillStyle=this.volumeBarColors[a],s.strokeStyle=this.volumeBarColors[a],i===0?(s.beginPath(),s.moveTo(t,r),s.lineTo(t,u(c)),s.stroke()):s.fillRect(t,o,i,u(l))}getCanvasIds(){return[this.canvasModel.canvasId]}}
6
+ import { clipToBounds } from '../../drawers/data-series.drawer';
7
+ import { unitToPixels } from '../../model/scaling/viewport.model';
8
+ import { flat } from '../../utils/array.utils';
9
+ import { ceilToDPR, floorToDPR } from '../../utils/device/device-pixel-ratio.utils';
10
+ import { resolveColorUsingConfig } from './volume-color-resolvers.functions';
11
+ // ratio of CHART bounds height which is for overlay volumes
12
+ const OVERLAY_VOLUME_TOTAL_HEIGHT_DIVISOR = 3;
13
+ export class VolumesDrawer {
14
+ constructor(config, volumesModel, chartModel, getViewportModel, volumesColorByChartTypeMap, drawPredicate) {
15
+ this.config = config;
16
+ this.volumesModel = volumesModel;
17
+ this.chartModel = chartModel;
18
+ this.getViewportModel = getViewportModel;
19
+ this.volumesColorByChartTypeMap = volumesColorByChartTypeMap;
20
+ this.drawPredicate = drawPredicate;
21
+ this.volumeBarColors = {
22
+ down: '#FF00FF',
23
+ up: '#FF00FF',
24
+ none: '#FF00FF',
25
+ };
26
+ }
27
+ /**
28
+ * This function is used to calculate the colors for each volume bar. It is an optimization to avoid calculating the color for each volume, which can be expensive.
29
+ * @param {BarType} barType - The type of bar to calculate the color for.
30
+ * @returns {void}
31
+ */
32
+ calculateColors(barType) {
33
+ var _a;
34
+ const getVolumeBarColor = (_a = this.volumesColorByChartTypeMap[barType]) !== null && _a !== void 0 ? _a : resolveColorUsingConfig;
35
+ this.volumeBarColors['down'] = getVolumeBarColor('down', this.config.colors);
36
+ this.volumeBarColors['up'] = getVolumeBarColor('up', this.config.colors);
37
+ this.volumeBarColors['none'] = getVolumeBarColor('none', this.config.colors);
38
+ }
39
+ /**
40
+ * Draws the volumes on the chart canvas if the volumes are visible and the drawPredicate is true.
41
+ * Calculates the colors based on the chart type and saves the canvas context.
42
+ * Clips the canvas to the viewport bounds and draws the volumes.
43
+ * Restores the canvas context.
44
+ * @returns {void}
45
+ */
46
+ draw(canvasModel) {
47
+ if (this.config.components.volumes.visible && this.drawPredicate()) {
48
+ this.calculateColors(this.config.components.chart.type);
49
+ const ctx = canvasModel.ctx;
50
+ ctx.save();
51
+ const bounds = this.getViewportModel().getBounds();
52
+ clipToBounds(ctx, bounds);
53
+ this.drawVolumes(canvasModel);
54
+ ctx.restore();
55
+ }
56
+ }
57
+ /**
58
+ * Draws the last bar of the chart if the volumes component is visible.
59
+ * TODO: Rework the function.
60
+ *
61
+ * @returns {void}
62
+ */
63
+ drawLastBar() {
64
+ if (this.config.components.volumes.visible) {
65
+ // TODO rework
66
+ // this.calculateColors(this.config.components.chart.type);
67
+ // const ctx = this.canvasModel.ctx;
68
+ // const lastVolume = lastOf(this.volumes.data);
69
+ // if (lastVolume) {
70
+ // ctx.fillStyle = this.volumeBarColors[lastVolume.direction];
71
+ // const { width, height, x, y } = lastVolume;
72
+ // ctx.fillRect(x, y, width, height);
73
+ // }
74
+ }
75
+ }
76
+ /**
77
+ * Draws volumes on the chart based on the data provided by the volumesModel and chartModel.
78
+ * If the volumeMax is 0, the function will return without drawing anything.
79
+ * The function loops through all the candles in the viewport and calculates the x, y, width and height of each volume bar.
80
+ * If the config.components.volumes.showSeparately is true, the function will draw each volume bar separately.
81
+ * Otherwise, it will calculate the zoomY based on the volumeMax and the fullVHeight, and draw all the volume bars together.
82
+ * @private
83
+ */
84
+ drawVolumes(canvasModel) {
85
+ const volumeMax = this.volumesModel.volumeMax.getValue();
86
+ if (volumeMax === 0) {
87
+ return;
88
+ }
89
+ const candles = flat(this.chartModel.mainCandleSeries
90
+ // TODO volumes drawer should be a part of data series drawer
91
+ .getSeriesInViewport(this.chartModel.scale.xStart - 1, this.chartModel.scale.xEnd + 1));
92
+ const viewportModel = this.getViewportModel();
93
+ candles.forEach((vCandle, idx) => {
94
+ if (vCandle.candle.volume) {
95
+ const bounds = viewportModel.getBounds();
96
+ const fullVHeight = bounds.height;
97
+ const nextX = candles[idx + 1] !== undefined
98
+ ? floorToDPR(viewportModel.toX(candles[idx + 1].startUnit))
99
+ : undefined;
100
+ const x = floorToDPR(viewportModel.toX(vCandle.startUnit));
101
+ const width = nextX !== undefined ? nextX - x : floorToDPR(unitToPixels(vCandle.width, viewportModel.zoomX));
102
+ if (this.config.components.volumes.showSeparately) {
103
+ const y = floorToDPR(viewportModel.toY(vCandle.candle.volume));
104
+ const height = floorToDPR(viewportModel.toY(0)) - y;
105
+ this.drawVolume(canvasModel, vCandle, x, y, width, height);
106
+ }
107
+ else {
108
+ const zoomY = volumeMax / (fullVHeight / OVERLAY_VOLUME_TOTAL_HEIGHT_DIVISOR);
109
+ const height = Math.max(unitToPixels(vCandle.candle.volume, zoomY), 2);
110
+ const y = floorToDPR(bounds.y + fullVHeight - height);
111
+ this.drawVolume(canvasModel, vCandle, x, y, width, height);
112
+ }
113
+ }
114
+ });
115
+ }
116
+ /**
117
+ * Draws a volume bar on the canvas.
118
+ *
119
+ * @private
120
+ * @param {VisualCandle} vCandle - The visual candle object.
121
+ * @param {Pixel} x - The x coordinate of the top-left corner of the volume bar.
122
+ * @param {Pixel} y - The y coordinate of the top-left corner of the volume bar.
123
+ * @param {Pixel} width - The width of the volume bar.
124
+ * @param {Pixel} height - The height of the volume bar.
125
+ * @returns {void}
126
+ */
127
+ drawVolume(canvasModel, vCandle, x, y, width, height) {
128
+ const ctx = canvasModel.ctx;
129
+ const yStart = y;
130
+ const yEnd = y + height;
131
+ const direction = vCandle.name;
132
+ ctx.fillStyle = this.volumeBarColors[direction];
133
+ ctx.strokeStyle = this.volumeBarColors[direction];
134
+ if (width === 0) {
135
+ // just draw a vertical line
136
+ ctx.beginPath();
137
+ ctx.moveTo(x, yStart);
138
+ ctx.lineTo(x, ceilToDPR(yEnd));
139
+ ctx.stroke();
140
+ }
141
+ else {
142
+ ctx.fillRect(x, y, width, ceilToDPR(height));
143
+ }
144
+ }
145
+ }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
@@ -1,6 +1,36 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- const c=5,_=1e-10,s=/\.?0+$/,E=/(\.[1-9]*)0+$/;export const volumeFormatter=t=>{const r=(I,e)=>{const o=Math.pow(10,5),n=Math.round(I*o)/o;return n<1&&n>=1e-10?n.toFixed(5).replace(s,"").replace(E,""):(n+"").replace(E,"")+(e||"")};return Math.abs(t)>999999999?(t=Math.round(t/1e6)*1e6,r(t/1e9,"B")):Math.abs(t)>999999?(t=1e3*Math.round(t/1e3),r(t/1e6,"M")):Math.abs(t)>9999?r(t/1e3,"K"):r(t)};
6
+ const DEFAULT_PRECISION = 5;
7
+ const MIN_VALUE = 0.0000000001;
8
+ const TRAILLING_ZEROES_REGEXP = /\.?0+$/;
9
+ const TRAILLING_FRACTION_WITH_ZEROES_REGEXP = /(\.[1-9]*)0+$/;
10
+ export const volumeFormatter = (value) => {
11
+ const formatValue = (value, amountToCut) => {
12
+ const rounder = Math.pow(10, DEFAULT_PRECISION);
13
+ const roundedValue = Math.round(value * rounder) / rounder;
14
+ if (roundedValue < 1 && roundedValue >= MIN_VALUE) {
15
+ return roundedValue
16
+ .toFixed(DEFAULT_PRECISION)
17
+ .replace(TRAILLING_ZEROES_REGEXP, '')
18
+ .replace(TRAILLING_FRACTION_WITH_ZEROES_REGEXP, '');
19
+ }
20
+ else {
21
+ return (roundedValue + '').replace(TRAILLING_FRACTION_WITH_ZEROES_REGEXP, '') + (amountToCut || '');
22
+ }
23
+ };
24
+ if (Math.abs(value) > 999999999) {
25
+ value = Math.round(value / 1000000) * 1000000;
26
+ return formatValue(value / 1000000000, 'B');
27
+ }
28
+ if (Math.abs(value) > 999999) {
29
+ value = 1000 * Math.round(value / 1000);
30
+ return formatValue(value / 1000000, 'M');
31
+ }
32
+ if (Math.abs(value) > 9999) {
33
+ return formatValue(value / 1000, 'K');
34
+ }
35
+ return formatValue(value);
36
+ };
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
@@ -10,10 +10,10 @@ import { HighLowProvider } from '../../model/scaling/auto-scale.model';
10
10
  import { ChartComponent } from '../chart/chart.component';
11
11
  export declare class VolumesModel extends ChartBaseElement {
12
12
  private chartComponent;
13
- private scaleModel;
13
+ private scale;
14
14
  volumeMax: BehaviorSubject<number>;
15
15
  highLowProvider: HighLowProvider;
16
- constructor(chartComponent: ChartComponent, scaleModel: ScaleModel);
16
+ constructor(chartComponent: ChartComponent, scale: ScaleModel);
17
17
  protected doActivate(): void;
18
18
  /**
19
19
  * Used for optimization when we have to update only the last candle
@@ -1,6 +1,48 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
- import{BehaviorSubject as o,merge as i}from"rxjs";import{ChartBaseElement as s}from"../../model/chart-base-element";import{firstOf as l,maxMin as r}from"../../utils/array.utils";const h=r(t=>t.candle.volume);export class VolumesModel extends s{constructor(e,a){super(),this.chartComponent=e,this.scaleModel=a,this.volumeMax=new o(0),this.highLowProvider={calculateHighLow:()=>({high:this.volumeMax.getValue(),low:0}),isHighLowActive:()=>!0}}doActivate(){super.doActivate(),this.addRxSubscription(i(this.chartComponent.chartModel.observeCandlesChanged(),this.scaleModel.xChanged).subscribe(()=>this.updateVolumeMax())),this.addRxSubscription(this.chartComponent.chartModel.mainCandleSeries.observeLastVisualCandleChanged().subscribe(()=>this.recalculateLastVisualVolume()))}recalculateLastVisualVolume(){}updateVolumeMax(){var e;this.volumeMax.next((e=l(h(this.chartComponent.chartModel.mainCandleSeries.getSeriesInViewport().flat())))!==null&&e!==void 0?e:0)}}
6
+ import { BehaviorSubject, merge } from 'rxjs';
7
+ import { ChartBaseElement } from '../../model/chart-base-element';
8
+ import { firstOf, maxMin } from '../../utils/array.utils';
9
+ const volumeMaxMinFn = maxMin(candle => candle.candle.volume);
10
+ export class VolumesModel extends ChartBaseElement {
11
+ constructor(chartComponent, scale) {
12
+ super();
13
+ this.chartComponent = chartComponent;
14
+ this.scale = scale;
15
+ // max volume in all data series
16
+ this.volumeMax = new BehaviorSubject(0);
17
+ this.highLowProvider = {
18
+ calculateHighLow: () => ({ high: this.volumeMax.getValue(), low: 0 }),
19
+ isHighLowActive: () => true,
20
+ };
21
+ }
22
+ doActivate() {
23
+ super.doActivate();
24
+ this.addRxSubscription(merge(this.chartComponent.chartModel.observeCandlesChanged(), this.scale.xChanged).subscribe(() => this.updateVolumeMax()));
25
+ this.addRxSubscription(this.chartComponent.chartModel.mainCandleSeries
26
+ .observeLastVisualCandleChanged()
27
+ .subscribe(() => this.recalculateLastVisualVolume()));
28
+ }
29
+ /**
30
+ * Used for optimization when we have to update only the last candle
31
+ * Doesn't work for line chart types
32
+ * @doc-tags tricky
33
+ */
34
+ recalculateLastVisualVolume() {
35
+ // TODO rework, move this logic to drawer
36
+ }
37
+ /**
38
+ * Updates the maximum volume value of the chart.
39
+ * @function
40
+ * @name updateVolumeMax
41
+ * @memberof ChartComponent
42
+ * @returns {void}
43
+ */
44
+ updateVolumeMax() {
45
+ var _a;
46
+ this.volumeMax.next((_a = firstOf(volumeMaxMinFn(this.chartComponent.chartModel.mainCandleSeries.getSeriesInViewport().flat()))) !== null && _a !== void 0 ? _a : 0);
47
+ }
48
+ }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2002 - 2023 Devexperts LLC
2
+ * Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
3
3
  * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */