@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,79 @@
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 { Index, Unit, ViewportModel, ViewportModelState } from './viewport.model';
7
+ /**
8
+ * Provides the high and low values. Used for series in auto-scale calculation.
9
+ */
10
+ export interface HighLowProvider {
11
+ isHighLowActive: () => boolean;
12
+ /**
13
+ * Calculates the Y high and low.
14
+ * @param state - (optional) used to calculate over some state in future
15
+ */
16
+ calculateHighLow: (state?: ViewportModelState) => HighLow;
17
+ }
18
+ export interface HighLow {
19
+ high: Unit;
20
+ low: Unit;
21
+ highIdx?: Index;
22
+ lowIdx?: Index;
23
+ }
24
+ type HighLowPostProcessor = (highLow: HighLow) => HighLow;
25
+ /**
26
+ * Auxiliary sub-model to apply X,Y auto-scaling feature.
27
+ * Transforms the original ViewportModel.
28
+ * @doc-tags auto-scale,viewport,scaling
29
+ */
30
+ export declare class AutoScaleViewportSubModel {
31
+ private delegate;
32
+ auto: boolean;
33
+ highLowProviders: Record<string, HighLowProvider>;
34
+ highLowPostPorcessor: Record<string, HighLowPostProcessor>;
35
+ constructor(delegate: ViewportModel, highLowProviders?: Record<string, HighLowProvider>);
36
+ /**
37
+ * Sets a HighLowProvider for a given name.
38
+ * @param {string} name - The name of the HighLowProvider.
39
+ * @param {HighLowProvider} provider - The HighLowProvider to be set.
40
+ */
41
+ setHighLowProvider(name: string, provider: HighLowProvider): void;
42
+ /**
43
+ * Deletes a high-low provider from the list of high-low providers.
44
+ * @param {string} name - The name of the high-low provider to be deleted.
45
+ */
46
+ deleteHighLowProvider(name: string): void;
47
+ /**
48
+ * Sets a HighLowPostProcessor for a given name.
49
+ *
50
+ * @param {string} name - The name of the HighLowPostProcessor.
51
+ * @param {HighLowPostProcessor} processor - The HighLowPostProcessor to be set.
52
+ * @returns {void}
53
+ */
54
+ setHighLowPostProcessor(name: string, processor: HighLowPostProcessor): void;
55
+ /**
56
+ * Sets the auto and recalculates the state of the viewport model.
57
+ * @param {ViewportModelState} state - The state of the viewport model.
58
+ * @param {boolean} auto - The auto value to set.
59
+ * @returns {void}
60
+ */
61
+ setAutoAndRecalculateState(state: ViewportModelState, auto: boolean): void;
62
+ }
63
+ /**
64
+ * Y auto-scale viewport transformer. Calculates highLow for all chart visuals and recalculates the Y scale.
65
+ * @param vm
66
+ * @param state
67
+ * @param highLowProviders
68
+ * @param highLowPostProcessors
69
+ */
70
+ export declare const autoScaleYViewportTransformer: (vm: ViewportModel, state: ViewportModelState, highLowProviders: HighLowProvider[], highLowPostProcessors: HighLowPostProcessor[]) => void;
71
+ /**
72
+ * Merges an array of HighLow objects into a single HighLow object.
73
+ * @param {HighLow[]} input - The array of HighLow objects to be merged.
74
+ * @returns {HighLow} - The merged HighLow object.
75
+
76
+ */
77
+ export declare function mergeHighLow(input: HighLow[]): HighLow;
78
+ export declare const getDefaultHighLow: () => HighLow;
79
+ export {};
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ export class AutoScaleViewportSubModel{constructor(o,e){this.delegate=o,this.auto=!0,this.highLowPostPorcessor={},this.highLowProviders=e!=null?e:{}}setHighLowProvider(o,e){this.highLowProviders[o]=e}deleteHighLowProvider(o){delete this.highLowProviders[o]}setHighLowPostProcessor(o,e){this.highLowPostPorcessor[o]=e}setAutoAndRecalculateState(o,e){this.auto=e,e&&autoScaleYViewportTransformer(this.delegate,o,Object.values(this.highLowProviders),Object.values(this.highLowPostPorcessor))}}export const autoScaleYViewportTransformer=(i,o,e,t)=>{const h=e.filter(r=>r.isHighLowActive()).map(r=>r.calculateHighLow(o)),l=mergeHighLow(h),s=t.reduce((r,c)=>c(r),l);o.yStart=s.low,o.yEnd=s.high,o.zoomY=i.calculateZoomY(o.yStart,o.yEnd)};export function mergeHighLow(i){if(i.length===0)return getDefaultHighLow();let o=i[0].high,e=i[0].low;return i.forEach(t=>{isFinite(t.high)&&t.high>=o&&(o=t.high),isFinite(t.low)&&t.low<=e&&(e=t.low)}),{low:e,high:o}}export const getDefaultHighLow=()=>({high:Number.MIN_SAFE_INTEGER,low:Number.MAX_SAFE_INTEGER});
@@ -0,0 +1,43 @@
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 { ChartConfigComponentsChart } from '../../chart.config';
7
+ import { Bounds, BoundsProvider } from '../bounds.model';
8
+ import VisualCandle from '../visual-candle';
9
+ import { ViewportModelState } from './viewport.model';
10
+ /**
11
+ * Return constraited state that handled zooming and moving chart near first/last candles
12
+ * this and other constraits that works with state should mutate and return state
13
+ * @param initialState
14
+ * @param state
15
+ * @param visualCandlesCoordinates
16
+ * @param candleLimit
17
+ * @param bounds
18
+ * @returns
19
+ * @doc-tags viewport,zoom,scaling
20
+ */
21
+ export declare const candleEdgesConstrait: (state: ViewportModelState, visualCandlesCoordinates: VisualCandle[], candleLimit: number, bounds: Bounds) => {
22
+ xStart: number;
23
+ xEnd: number;
24
+ yStart: number;
25
+ yEnd: number;
26
+ zoomX: number;
27
+ zoomY: number;
28
+ inverseY: boolean;
29
+ };
30
+ /**
31
+ * This function limits minimum and maximum chart viewport dependening on visible x-units
32
+ * @returns
33
+ * @doc-tags viewport,zoom,scaling
34
+ */
35
+ export declare const zoomConstraint: (initialState: ViewportModelState, state: ViewportModelState, chartConfig: ChartConfigComponentsChart, boundsProvider: BoundsProvider) => {
36
+ xStart: number;
37
+ xEnd: number;
38
+ yStart: number;
39
+ yEnd: number;
40
+ zoomX: number;
41
+ zoomY: number;
42
+ inverseY: boolean;
43
+ };
@@ -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{at as S}from"../../utils/array.utils";import{calculateZoom as E,pixelsToUnits as w}from"./viewport.model";export const candleEdgesConstrait=(d,s,r,l)=>{var t,o,i,a;const n=Object.assign({},d),e=(o=(t=s[r])===null||t===void 0?void 0:t.startUnit)!==null&&o!==void 0?o:0,c=(a=(i=S(-r,s))===null||i===void 0?void 0:i.startUnit)!==null&&a!==void 0?a:0;let m=d.xStart,x=d.xEnd;return n.xStart>=c&&(m=c,x=x-(n.xStart-c)),n.xEnd<e&&(m=e-w(l.width,n.zoomX),x=e),n.xStart=m,n.xEnd=x,n},zoomConstraint=(d,s,r,l)=>{const t=Object.assign({},s),o=l(),i=t.xEnd-t.xStart,a=i<r.minCandles,n=o.width/r.minWidth,e=i>n;if(o.width>0){if(e)return t.xStart=t.xEnd-n,t.zoomX=E(t.xEnd-t.xStart,o.width),t;if(a)return t.xEnd=d.xEnd,t.xStart=t.xEnd-r.minCandles,t.zoomX=E(t.xEnd-t.xStart,o.width),t}return t};
@@ -0,0 +1,16 @@
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 { ViewportModelState, Zoom } from './viewport.model';
7
+ export type ZoomXToZoomYRatio = number;
8
+ export declare const ratioFromZoomXY: (zoomX: Zoom, zoomY: Zoom) => ZoomXToZoomYRatio;
9
+ export declare const zoomXToZoomY: (zoomX: Zoom, ratio: ZoomXToZoomYRatio) => Zoom;
10
+ export declare const zoomYToZoomX: (zoomY: Zoom, ratio: ZoomXToZoomYRatio) => Zoom;
11
+ /**
12
+ * Locks the zoomY with zoomX and moves yEnd according to ratio changes.
13
+ * @param state
14
+ * @param zoomXYRatio
15
+ */
16
+ export declare const lockedYEndViewportCalculator: (state: ViewportModelState, zoomXYRatio: ZoomXToZoomYRatio) => void;
@@ -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 ratioFromZoomXY=(o,n)=>o/n,zoomXToZoomY=(o,n)=>o/n,zoomYToZoomX=(o,n)=>o*n,lockedYEndViewportCalculator=(o,n)=>{const Y=o.zoomY;o.zoomY=zoomXToZoomY(o.zoomX,n);const c=o.zoomY/Y,m=o.yEnd-o.yStart,r=m*c-m;o.yEnd=o.yEnd+r};
@@ -0,0 +1,20 @@
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 { Unit, ViewportModelState } from './viewport.model';
7
+ /**
8
+ * Moves both xStart and xEnd without changing the viewport width (zoomX).
9
+ * @param state
10
+ * @param xStart - left starting point in units
11
+ * @doc-tags scaling,viewport
12
+ */
13
+ export declare const moveXStart: (state: ViewportModelState, xStart: Unit) => void;
14
+ /**
15
+ * Moves both yStart and yEnd without changing the viewport height (zoomY).
16
+ * @param state
17
+ * @param yStart - starting point in units
18
+ * @doc-tags scaling,viewport
19
+ */
20
+ export declare const moveYStart: (state: ViewportModelState, yStart: Unit) => void;
@@ -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 moveXStart=(n,o)=>{const r=n.xStart;n.xStart=o,n.xEnd=n.xEnd+(o-r)},moveYStart=(n,o)=>{const r=n.yStart;n.yStart=o,n.yEnd=n.yEnd+(o-r)};
@@ -0,0 +1,223 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ import { Subject } from 'rxjs';
7
+ import { ChartBaseElement } from '../chart-base-element';
8
+ import { ViewportMovementAnimation } from '../../animation/types/viewport-movement-animation';
9
+ import { Bounds } from '../bounds.model';
10
+ export type Unit = number;
11
+ export type Price = number;
12
+ export type Pixel = number;
13
+ export type Zoom = number;
14
+ export declare const calculateZoom: (viewportUnits: Unit, viewportPixels: Pixel) => Zoom;
15
+ export declare const unitToPixels: (units: Unit, zoom: Zoom) => Pixel;
16
+ export declare const pixelsToUnits: (px: Pixel, zoom: Zoom) => Unit;
17
+ export type Index = Unit;
18
+ export type Timestamp = Unit;
19
+ export type Percent = Unit;
20
+ export type LogValue = Unit;
21
+ export type YUnit = Price | Percent | LogValue;
22
+ export declare const unitToPercent: (value: Unit, baseLine: Unit) => Percent;
23
+ export declare const percentToUnit: (percent: Percent, baseLine: Unit) => Unit;
24
+ export declare const calcLogValue: (value: Price) => LogValue;
25
+ export declare const logValueToUnit: (logValue: LogValue) => number;
26
+ /**
27
+ * This interface describes chart entity which transforms some units to pixel values.
28
+ * We need to separate this interface and viewport-model.
29
+ * Viewport model describes piece of chart viewport:
30
+ * - main chart pane
31
+ * - underlay study pane
32
+ *
33
+ * But sometimes in viewport we have units which are not the price (price is default unit for y-axis).
34
+ * In this case we need special logic to convert price to viewport units and this logic might vary for different chart entities.
35
+ * A good example is chart candle series:
36
+ * let's assume we use percents for as y-axis units, then each candle series will use their own logic to get percent unit from the price.
37
+ * Thus, we need to segregate interface of ViewportModel and Viewable interface.
38
+ * You can think of ViewportModel as a screen and Viewable as a figure which should be drawn on the screen.
39
+ */
40
+ export interface Viewable {
41
+ toX(unit: Unit): Pixel;
42
+ toY(unit: Unit): Pixel;
43
+ xPixels(unit: Unit): Pixel;
44
+ yPixels(unit: Unit): Pixel;
45
+ }
46
+ /**
47
+ * Represents state of ViewportModel.
48
+ * When the model is calculated step-by-step, this state acts like an intermediate result.
49
+ * Only when all calculations are complete - we {@link ViewportModel#apply} result.
50
+ */
51
+ export interface ViewportModelState {
52
+ xStart: Unit;
53
+ xEnd: Unit;
54
+ yStart: Unit;
55
+ yEnd: Unit;
56
+ zoomX: Zoom;
57
+ zoomY: Zoom;
58
+ inverseY: boolean;
59
+ }
60
+ /**
61
+ * Abstract viewport model.
62
+ * Viewport has 4 coordinates: xStart, xEnd, yStart and yEnd - all stored in {@link Unit}.
63
+ * Main methods:
64
+ * - {@link toX} - converts xUnits to xPixels
65
+ * - {@link toY} - converts yUnits to yPixels
66
+ * - {@link fromX} - converts xPixels to xUnits
67
+ * - {@link fromY} - converts yPixels to yUnits
68
+ *
69
+ * To convert unit-pixels and vice versa uses {@link getBounds} method.
70
+ * zoomX and zoomY are proportions between units and pixels.
71
+ */
72
+ export declare abstract class ViewportModel extends ChartBaseElement implements Viewable {
73
+ currentAnimation?: ViewportMovementAnimation;
74
+ private _xStart;
75
+ private _xEnd;
76
+ private _yStart;
77
+ private _yEnd;
78
+ private _zoomX;
79
+ private _zoomY;
80
+ private _inverseY;
81
+ /**
82
+ * An abstract method that returns the bounds of a chart, volumes, studies, etc.
83
+ * @returns {Bounds} The bounds of the specified element.
84
+ */
85
+ abstract getBounds(): Bounds;
86
+ changed: Subject<void>;
87
+ xChanged: import("rxjs").Observable<{
88
+ start: number;
89
+ end: number;
90
+ }>;
91
+ yChanged: import("rxjs").Observable<{
92
+ start: number;
93
+ end: number;
94
+ }>;
95
+ /**
96
+ * Converts a unit value to pixels based on the current zoom level and xStart value.
97
+ * @param {Unit} unit - The unit value to be converted to pixels.
98
+ * @returns {Pixel} - The converted pixel value.
99
+ */
100
+ toX(unit: Unit): Pixel;
101
+ /**
102
+ * Converts a unit value to pixels based on the current zoom level in the x-axis.
103
+ * @param {Unit} unit - The unit value to be converted to pixels.
104
+ * @returns {Pixel} - The converted value in pixels.
105
+ */
106
+ xPixels(unit: Unit): Pixel;
107
+ /**
108
+ * Converts a given unit value to pixel value in the Y-axis.
109
+ * @param {Unit} unit - The unit value to be converted to pixel value.
110
+ * @returns {Pixel} - The pixel value of the given unit value in the Y-axis.
111
+ */
112
+ toY(unit: Unit): Pixel;
113
+ /**
114
+ * Converts a unit value to pixels based on the current zoom level in the Y axis.
115
+ * @param {Unit} unit - The unit value to be converted to pixels.
116
+ * @returns {Pixel} - The converted value in pixels.
117
+ */
118
+ yPixels(unit: Unit): Pixel;
119
+ /**
120
+ * Converts a pixel value to a unit value based on the current zoom level and xStart value.
121
+ * @param {Pixel} px - The pixel value to convert to unit value.
122
+ * @returns {Unit} - The converted unit value.
123
+ */
124
+ fromX(px: Pixel): Unit;
125
+ /**
126
+ * Converts a pixel value to a unit value along the y-axis.
127
+ * @param {Pixel} px - The pixel value to be converted.
128
+ * @returns {void}
129
+ */
130
+ fromY(px: Pixel): Unit;
131
+ /**
132
+ * Recalculates the zoom factor for the x-axis based on the start and end values of the x-axis.
133
+ * @function
134
+ * @name recalculateZoomX
135
+ * @memberof ClassName
136
+ * @instance
137
+ * @returns {void}
138
+ */
139
+ recalculateZoomX(): void;
140
+ /**
141
+ * Recalculates the zoomY property of the object.
142
+ * The zoomY property is calculated using the yStart and yEnd properties of the object.
143
+ * @function
144
+ * @name recalculateZoomY
145
+ * @memberof Object
146
+ * @instance
147
+ * @returns {void}
148
+ */
149
+ recalculateZoomY(): void;
150
+ /**
151
+ * Calculates the zoom factor for the x-axis based on the start and end units.
152
+ * @param {Unit} start - The start unit.
153
+ * @param {Unit} end - The end unit.
154
+ * @returns {Zoom} The zoom factor for the x-axis.
155
+ */
156
+ calculateZoomX(start: Unit, end: Unit): Zoom;
157
+ /**
158
+ * Calculates the zoom factor for the Y axis based on the start and end units.
159
+ * @param {Unit} start - The start unit.
160
+ * @param {Unit} end - The end unit.
161
+ * @returns {Zoom} The zoom factor for the Y axis.
162
+ */
163
+ calculateZoomY(start: Unit, end: Unit): Zoom;
164
+ /**
165
+ * Should be called when x/y start/end changes.
166
+ */
167
+ recalculateZoom(fireChanged?: boolean): void;
168
+ /**
169
+ * Moves the viewport to exactly xStart..xEnd place.
170
+ * (you need to fire DRAW event after this)
171
+ * @param xStart - viewport start in units
172
+ * @param xEnd - viewport end in units
173
+ * @param fireChanged - fire changed event
174
+ */
175
+ setXScale(xStart: Unit, xEnd: Unit, fireChanged?: boolean): void;
176
+ /**
177
+ * Moves the viewport to exactly yStart..yEnd place.
178
+ * (you need to fire DRAW event after this)
179
+ * @param yStart - viewport start in units
180
+ * @param yEnd - viewport end in units
181
+ * @param fireChanged - fire changed event
182
+ */
183
+ setYScale(yStart: Unit, yEnd: Unit, fireChanged?: boolean): void;
184
+ /**
185
+ * Exports current state of VM.
186
+ */
187
+ export(): ViewportModelState;
188
+ /**
189
+ * Applies the state to current VM.
190
+ * @param state
191
+ */
192
+ apply(state: ViewportModelState): void;
193
+ /**
194
+ * Emits a notification that the object has changed.
195
+ * @function
196
+ * @name fireChanged
197
+ * @memberof ClassName
198
+ * @instance
199
+ * @returns {void}
200
+ */
201
+ fireChanged(): void;
202
+ get xStart(): Unit;
203
+ set xStart(value: Unit);
204
+ get xEnd(): Unit;
205
+ set xEnd(value: Unit);
206
+ get yStart(): Unit;
207
+ set yStart(value: Unit);
208
+ get yEnd(): Unit;
209
+ set yEnd(value: Unit);
210
+ get zoomX(): Zoom;
211
+ set zoomX(value: Zoom);
212
+ get zoomY(): Zoom;
213
+ set zoomY(value: Zoom);
214
+ get inverseY(): boolean;
215
+ set inverseY(value: boolean);
216
+ /**
217
+ * Checks if the viewport is valid.
218
+ *
219
+ * @returns {boolean} - Returns true if the viewport is valid, false otherwise.
220
+ */
221
+ isViewportValid(): boolean;
222
+ }
223
+ export declare const compareStates: (a: ViewportModelState, b: ViewportModelState) => boolean;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2002 - 2023 Devexperts LLC
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
+ * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ import{Subject as n}from"rxjs";import{distinctUntilChanged as o,map as r,share as h}from"rxjs/operators";import{ChartBaseElement as a}from"../chart-base-element";import{keys as d}from"../../utils/object.utils";export const calculateZoom=(e,t)=>e/t,unitToPixels=(e,t)=>e/t,pixelsToUnits=(e,t)=>e*t,unitToPercent=(e,t)=>(e-t)*100/t,percentToUnit=(e,t)=>e*t/100+t,calcLogValue=e=>Math.log2(e),logValueToUnit=e=>Math.pow(2,e);export class ViewportModel extends a{constructor(){super(...arguments),this._xStart=0,this._xEnd=0,this._yStart=0,this._yEnd=0,this._zoomX=1,this._zoomY=1,this._inverseY=!1,this.changed=new n,this.xChanged=this.changed.pipe(r(()=>({start:this.xStart,end:this.xEnd})),o((t,s)=>t.start===s.start&&t.end===s.end),h()),this.yChanged=this.changed.pipe(r(()=>({start:this.yStart,end:this.yEnd})),o((t,s)=>t.start===s.start&&t.end===s.end),h())}toX(t){return this.getBounds().x+unitToPixels(t-this.xStart,this.zoomX)}xPixels(t){return unitToPixels(t,this.zoomX)}toY(t){return this.inverseY?this.getBounds().y+unitToPixels(t-this.yStart,this.zoomY):this.getBounds().y+this.getBounds().height-unitToPixels(t-this.yStart,this.zoomY)}yPixels(t){return unitToPixels(t,this.zoomY)}fromX(t){const s=t-this.getBounds().x;return pixelsToUnits(s+unitToPixels(this.xStart,this.zoomX),this.zoomX)}fromY(t){const s=t-this.getBounds().y;return this.inverseY?pixelsToUnits(s+unitToPixels(this.yStart,this.zoomY),this.zoomY):pixelsToUnits(this.getBounds().height-s+unitToPixels(this.yStart,this.zoomY),this.zoomY)}recalculateZoomX(){this.zoomX=this.calculateZoomX(this.xStart,this.xEnd)}recalculateZoomY(){this.zoomY=this.calculateZoomY(this.yStart,this.yEnd)}calculateZoomX(t,s){return calculateZoom(s-t,this.getBounds().width)}calculateZoomY(t,s){return calculateZoom(s-t,this.getBounds().height)}recalculateZoom(t=!0){this.recalculateZoomX(),this.recalculateZoomY(),t&&this.fireChanged()}setXScale(t,s,i=!0){this.xStart=t,this.xEnd=s,this.recalculateZoomX(),i&&this.fireChanged()}setYScale(t,s,i=!0){this.yStart=t,this.yEnd=s,this.recalculateZoomY(),i&&this.fireChanged()}export(){return{xStart:this.xStart,xEnd:this.xEnd,yStart:this.yStart,yEnd:this.yEnd,zoomX:this.zoomX,zoomY:this.zoomY,inverseY:this.inverseY}}apply(t){this.xStart=t.xStart,this.xEnd=t.xEnd,this.yStart=t.yStart,this.yEnd=t.yEnd,this.zoomX=t.zoomX,this.zoomY=t.zoomY,this.inverseY=t.inverseY,this.fireChanged()}fireChanged(){this.changed.next()}get xStart(){return this._xStart}set xStart(t){this._xStart=t}get xEnd(){return this._xEnd}set xEnd(t){this._xEnd=t}get yStart(){return this._yStart}set yStart(t){this._yStart=t}get yEnd(){return this._yEnd}set yEnd(t){this._yEnd=t}get zoomX(){return this._zoomX}set zoomX(t){this._zoomX=t}get zoomY(){return this._zoomY}set zoomY(t){this._zoomY=t}get inverseY(){return this._inverseY}set inverseY(t){this._inverseY=t}isViewportValid(){return this.xStart!==this.xEnd&&this.yStart!==this.yEnd&&isFinite(this.yStart)&&isFinite(this.yEnd)}}export const compareStates=(e,t)=>!d(e).some(s=>e[s]!==t[s]);
@@ -0,0 +1,26 @@
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 { ViewportModel, ViewportModelState } from './viewport.model';
7
+ import { ViewportPercent } from '../scale.model';
8
+ /**
9
+ * Zooms to percentage of viewport proportionally.
10
+ * @param vm
11
+ * @param state
12
+ * @param viewportPercent
13
+ * @param zoomStrength - 0..1 number, 1=max strength
14
+ * @param zoomIn
15
+ * @doc-tags viewport,zoom,scaling
16
+ */
17
+ export declare const zoomXToPercentViewportCalculator: (vm: ViewportModel, state: ViewportModelState, viewportPercent: ViewportPercent, zoomStrength: number, zoomIn: boolean) => ViewportModelState;
18
+ /**
19
+ * Zooms to viewports end.
20
+ * @param vm
21
+ * @param state
22
+ * @param zoomStrength - 0..1 number, 1=max strength
23
+ * @param zoomIn
24
+ * @doc-tags viewport,zoom,scaling
25
+ */
26
+ export declare const zoomXToEndViewportCalculator: (vm: ViewportModel, state: ViewportModelState, zoomStrength: number, zoomIn: boolean) => ViewportModelState;
@@ -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 zoomXToPercentViewportCalculator=(n,o,r,x,E)=>{const d=(o.xEnd-o.xStart)*x,l=d*r,c=d*(1-r);return E?(o.xStart=o.xStart+l,o.xEnd=o.xEnd-c):(o.xStart=o.xStart-l,o.xEnd=o.xEnd+c),o.zoomX=n.calculateZoomX(o.xStart,o.xEnd),o},zoomXToEndViewportCalculator=(n,o,r,x)=>zoomXToPercentViewportCalculator(n,o,1,r,x);
@@ -0,0 +1,65 @@
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 { getTimezoneOffset as getTimezoneOffsetDateFnsTz } from 'date-fns-tz';
7
+ import { Observable } from 'rxjs';
8
+ import { DateFormatter, FullChartConfig } from '../chart.config';
9
+ import { DateTimeFormatter, DateTimeFormatterFactory } from './date-time.formatter';
10
+ import { Timestamp } from './scaling/viewport.model';
11
+ export interface TimeZone {
12
+ readonly timeZone: string;
13
+ readonly name: string;
14
+ readonly utcOffset: string;
15
+ }
16
+ export declare const memoizedTZOffset: typeof getTimezoneOffsetDateFnsTz;
17
+ export declare const getTimezoneOffset: (timezone: string, time: Timestamp) => number;
18
+ export declare class TimeZoneModel {
19
+ private config;
20
+ private timeZoneChangedSubject;
21
+ private dateTimeFormatterFactory;
22
+ currentTzOffset: (time: Timestamp) => number;
23
+ constructor(config: FullChartConfig);
24
+ /**
25
+ * Sets the timezone for the configuration and updates the current timezone offset.
26
+ * @param {string} timeZone - The timezone to set.
27
+ * @returns {void}
28
+ */
29
+ setTimeZone(timeZone: string): void;
30
+ /**
31
+ * Returns an Observable that emits a string value when the time zone is changed.
32
+ * The Observable is created from the timeZoneChangedSubject Subject.
33
+ * @returns {Observable<string>} An Observable that emits a string value when the time zone is changed.
34
+ */
35
+ observeTimeZoneChanged(): Observable<string>;
36
+ /**
37
+ * Initializes a DateTimeFormatterFactory object.
38
+ * @param {DateFormatter} [dateFormatter] - Optional DateFormatter object.
39
+ * @returns {DateTimeFormatterFactory} - Returns a DateTimeFormatterFactory object.
40
+ * If a plain function is provided as the dateFormatter parameter, it will be used as a date formatter without applying UTC datetime override for candles more than 1d period.
41
+ * If a custom date formatter exists, it will be used for datetime formatting applying optionally UTC datetime override for candles more than 1d period.
42
+ * If no dateFormatter is provided, a default DateTimeFormatterFactory object will be returned.
43
+ */
44
+ initFormatterFactory(dateFormatter?: DateFormatter): DateTimeFormatterFactory;
45
+ /**
46
+ * Returns the DateTimeFormatterFactory instance used by this class.
47
+ *
48
+ * @returns {DateTimeFormatterFactory} The DateTimeFormatterFactory instance used by this class.
49
+ */
50
+ getFormatterFactory(): DateTimeFormatterFactory;
51
+ private formatterCache;
52
+ getDateTimeFormatter(format: string): DateTimeFormatter;
53
+ /**
54
+ * Calculates the offset of a given timezone from the local timezone.
55
+ * @private
56
+ * @param {string} timezone - The timezone to calculate the offset for.
57
+ */
58
+ private getOffset;
59
+ /**
60
+ * Gets the timezone offset value in milliseconds
61
+ * @param {string} timezone name
62
+ * @returns {function(time:Number):Date}
63
+ */
64
+ tzOffset(timezone: string): (time: number) => Date;
65
+ }
@@ -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{getTimezoneOffset as n}from"date-fns-tz";import{ReplaySubject as s}from"rxjs";import{memoize as f}from"../utils/perfomance/memoize.utils";import{dateTimeFormatterFactory as c}from"./date-time.formatter";export const memoizedTZOffset=f(n),getTimezoneOffset=(r,e)=>new Date(e).getTimezoneOffset()*60*1e3+memoizedTZOffset(r,e);export class TimeZoneModel{constructor(e){this.config=e,this.timeZoneChangedSubject=new s,this.currentTzOffset=t=>this.getOffset(this.config.timezone,t),this.formatterCache={},this.getOffset=(t,i)=>getTimezoneOffset(t,i),this.dateTimeFormatterFactory=this.initFormatterFactory(this.config.dateFormatter)}setTimeZone(e){this.config.timezone=e,this.formatterCache={},this.timeZoneChangedSubject.next(e)}observeTimeZoneChanged(){return this.timeZoneChangedSubject.asObservable()}initFormatterFactory(e){let t;if(e&&typeof e=="function")t=e;else if(e&&e.createFormatterFunction&&typeof e.createFormatterFunction=="function"){const i=e.createFormatterFunction;t=o=>i(o).bind(e)}else t=c(this.config,this.tzOffset);return t}getFormatterFactory(){return this.dateTimeFormatterFactory}getDateTimeFormatter(e){return this.formatterCache[e]===void 0&&(this.formatterCache[e]=this.dateTimeFormatterFactory(e)),this.formatterCache[e]}tzOffset(e){const t=o=>-new Date(o).getTimezoneOffset()*a;let i;return e?i=o=>memoizedTZOffset(e,o):i=t,o=>new Date(+o+i(o)-t(o))}}const a=60*1e3;
@@ -0,0 +1,106 @@
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 { Candle } from './candle.model';
7
+ import { Pixel, Unit, Viewable } from './scaling/viewport.model';
8
+ import { PriceMovement } from './candle-series.model';
9
+ import { VisualSeriesPoint } from './data-series.model';
10
+ /**
11
+ * Candle's visual representation. Candle's coordinates are adjusted by .5 unit to prevent anti-aliasing effect for
12
+ * lines with 1px width
13
+ *
14
+ * @param x wick location on X-axis
15
+ * @param width candle's width
16
+ * @param op open price location on Y axis
17
+ * @param cl close price location on Y axis
18
+ * @param lineStart wick's top location on Y axis
19
+ * @param lineEnd wick's bottom location on Y axis
20
+ * @param name candle's direction: up | down | none
21
+ * @param candle original candle
22
+ * @param hasBorder flag denoting if border should be drawn
23
+ * @constructor
24
+ */
25
+ export default class VisualCandle extends VisualSeriesPoint {
26
+ width: Unit;
27
+ high: Unit;
28
+ low: Unit;
29
+ open: Unit;
30
+ name: PriceMovement;
31
+ candle: Candle;
32
+ startUnit: Unit;
33
+ hasBorder: boolean;
34
+ isActive: boolean;
35
+ isHollow: boolean;
36
+ constructor(x: number, width: number, open: number, close: number, high: number, low: number, name: PriceMovement, candle: Candle, hasBorder?: boolean, isActive?: boolean, isHollow?: boolean);
37
+ /**
38
+ * Calculates the height of the body of a viewable element.
39
+ * @param {Viewable} viewable - The viewable element.
40
+ * @returns {Pixel} - The height of the body in pixels.
41
+ */
42
+ bodyHeight(viewable: Viewable): Pixel;
43
+ /**
44
+ * Calculates the height of a candle in pixels based on the high and low values of the candle and the viewable area.
45
+ *
46
+ * @param {Viewable} viewable - The viewable area object.
47
+ * @returns {Pixel} - The height of the candle in pixels.
48
+ */
49
+ candleHeight(viewable: Viewable): Pixel;
50
+ /**
51
+ * Returns coordinates of vertical line used to draw candle's body in case of small candle width
52
+ * @returns {[x,y,x2,y2]}
53
+ */
54
+ bodyAsVLine(viewable: Viewable): [number, number, number, number] | undefined;
55
+ /**
56
+ * Returns rectangle used to draw candles' body
57
+ * @returns {[x,y,width,height]}
58
+ */
59
+ bodyRect(viewable: Viewable): [number, number, number, number];
60
+ /**
61
+ * Returns the current candle object.
62
+ *
63
+ * @returns {Candle} The current candle object.
64
+ */
65
+ getCandle(): Candle;
66
+ /**
67
+ * Returns candle Y points in ascending order
68
+ */
69
+ yBodyKeyPoints(viewable: Viewable): [Pixel, Pixel, Pixel, Pixel];
70
+ /**
71
+ * Calculates the y-coordinate of the end of a line segment that is within the viewable area.
72
+ * @param {Viewable} viewable - The viewable area object.
73
+ * @returns {Pixel} - The y-coordinate of the end of the line segment in pixels.
74
+ */
75
+ yLineEnd(viewable: Viewable): Pixel;
76
+ /**
77
+ * Returns the pixel value of the starting point of the y-axis line on the given viewable area.
78
+ * @param {Viewable} viewable - The viewable area to calculate the pixel value on.
79
+ * @returns {Pixel} - The pixel value of the starting point of the y-axis line.
80
+ */
81
+ yLineStart(viewable: Viewable): Pixel;
82
+ /**
83
+ * Calculates the starting y-coordinate of the body of a viewable object.
84
+ * @param {Viewable} viewable - The viewable object for which the starting y-coordinate of the body is to be calculated.
85
+ * @returns {Pixel} - The starting y-coordinate of the body of the viewable object.
86
+ */
87
+ yBodyStart(viewable: Viewable): Pixel;
88
+ /**
89
+ * Calculates the maximum pixel value of the y-coordinate of the viewable object's end point and the open and close values of the current object.
90
+ * @param {Viewable} viewable - The viewable object whose end point is to be compared with the open and close values of the current object.
91
+ * @returns {Pixel} - The maximum pixel value of the y-coordinate of the viewable object's end point and the open and close values of the current object.
92
+ */
93
+ yBodyEnd(viewable: Viewable): Pixel;
94
+ /**
95
+ * Calculates the x-coordinate of the center of a viewable object in pixels.
96
+ * @param {Viewable} viewable - The viewable object whose center is to be calculated.
97
+ * @returns {Pixel} - The x-coordinate of the center of the viewable object in pixels.
98
+ */
99
+ xCenter(viewable: Viewable): Pixel;
100
+ /**
101
+ * Returns the starting pixel position of a viewable object
102
+ * @param {Viewable} viewable - The viewable object to get the starting pixel position from
103
+ * @returns {Pixel} - The starting pixel position of the viewable object
104
+ */
105
+ xStart(viewable: Viewable): Pixel;
106
+ }
@@ -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{floorToDPR as s,roundToDPR as l}from"../utils/device/device-pixel-ratio.utils";import{VisualSeriesPoint as u}from"./data-series.model";export default class y extends u{constructor(t,o,h,i,n,r,e,d,a=!1,c=!1,Y=!1){super(t,i),this.startUnit=t-o/2,this.width=o,this.open=h,this.high=n,this.low=r,this.name=e,this.candle=d,this.hasBorder=a,this.isActive=c,this.isHollow=Y}bodyHeight(t){return s(Math.abs(t.toY(this.open)-t.toY(this.close)))}candleHeight(t){return s(Math.abs(t.toY(this.high)-t.toY(this.low)))}bodyAsVLine(t){if(this.width<2)return[this.centerUnit,this.yLineStart(t),this.width,this.candleHeight(t)]}bodyRect(t){return[this.startUnit,this.yBodyStart(t),this.width,this.bodyHeight(t)]}getCandle(){return this.candle}yBodyKeyPoints(t){const o=s(t.toY(this.high)),h=s(t.toY(this.low)),i=s(t.toY(this.open)),n=s(t.toY(this.close)),[r,e]=i>n?[n,i]:[i,n],[d,a]=o>h?[h,o]:[o,h];return[d,r,e,a]}yLineEnd(t){return s(Math.max(t.toY(this.high),t.toY(this.low)))}yLineStart(t){return s(Math.min(t.toY(this.high),t.toY(this.low)))}yBodyStart(t){return s(Math.min(t.toY(this.open),t.toY(this.close)))}yBodyEnd(t){return s(Math.max(t.toY(this.open),t.toY(this.close)))}xCenter(t){return this.x(t)}xStart(t){return l(t.toX(this.startUnit))}}