@devexperts/dxcharts-lite 1.0.2 → 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 (255) hide show
  1. package/README.md +2 -2
  2. package/dist/chart/animation/canvas-animation.js +134 -1
  3. package/dist/chart/animation/types/animation.js +43 -1
  4. package/dist/chart/animation/types/color-alpha-animation.d.ts +1 -1
  5. package/dist/chart/animation/types/color-alpha-animation.js +60 -1
  6. package/dist/chart/animation/types/color-transition-animation.d.ts +1 -1
  7. package/dist/chart/animation/types/color-transition-animation.js +86 -1
  8. package/dist/chart/animation/types/viewport-movement-animation.js +63 -1
  9. package/dist/chart/animation/viewport-model-animation.js +20 -1
  10. package/dist/chart/bootstrap.d.ts +51 -48
  11. package/dist/chart/bootstrap.js +449 -1
  12. package/dist/chart/canvas/canvas-bounds-container.d.ts +0 -5
  13. package/dist/chart/canvas/canvas-bounds-container.js +815 -1
  14. package/dist/chart/canvas/canvas-chart-html.js +16 -18
  15. package/dist/chart/canvas/chart-elements.d.ts +1 -4
  16. package/dist/chart/canvas/chart-elements.js +22 -1
  17. package/dist/chart/canvas/cursor.handler.js +122 -1
  18. package/dist/chart/canvas/layout-creator.js +34 -1
  19. package/dist/chart/canvas/y-axis-bounds.container.d.ts +2 -2
  20. package/dist/chart/canvas/y-axis-bounds.container.js +67 -1
  21. package/dist/chart/chart-container.js +1 -1
  22. package/dist/chart/chart.config.d.ts +4 -5
  23. package/dist/chart/chart.config.js +645 -1
  24. package/dist/chart/chart.d.ts +62 -0
  25. package/dist/chart/chart.js +106 -0
  26. package/dist/chart/components/chart/basic-scale.d.ts +2 -2
  27. package/dist/chart/components/chart/basic-scale.js +31 -1
  28. package/dist/chart/components/chart/candle-transformer.functions.js +15 -1
  29. package/dist/chart/components/chart/candle-width-calculator.functions.js +2 -1
  30. package/dist/chart/components/chart/candle.functions.js +44 -1
  31. package/dist/chart/components/chart/chart-area-pan.handler.d.ts +3 -3
  32. package/dist/chart/components/chart/chart-area-pan.handler.js +197 -1
  33. package/dist/chart/components/chart/chart-base.model.js +66 -1
  34. package/dist/chart/components/chart/chart.component.d.ts +7 -3
  35. package/dist/chart/components/chart/chart.component.js +408 -1
  36. package/dist/chart/components/chart/chart.model.d.ts +4 -11
  37. package/dist/chart/components/chart/chart.model.js +954 -1
  38. package/dist/chart/components/chart/data-series.high-low-provider.js +34 -1
  39. package/dist/chart/components/chart/fake-candles.js +97 -1
  40. package/dist/chart/components/chart/price.formatter.js +35 -1
  41. package/dist/chart/components/chart/secondary-chart-colors-pool.js +68 -1
  42. package/dist/chart/components/cross_tool/cross-tool.component.js +85 -1
  43. package/dist/chart/components/cross_tool/cross-tool.drawer.js +32 -1
  44. package/dist/chart/components/cross_tool/cross-tool.model.js +107 -1
  45. package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +137 -1
  46. package/dist/chart/components/cross_tool/types/none.drawer.js +3 -1
  47. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +28 -1
  48. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +24 -1
  49. package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +53 -1
  50. package/dist/chart/components/dynamic-objects/dynamic-objects.component.d.ts +13 -0
  51. package/dist/chart/components/dynamic-objects/dynamic-objects.component.js +20 -0
  52. package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.d.ts +18 -0
  53. package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.js +23 -0
  54. package/dist/chart/components/dynamic-objects/dynamic-objects.model.d.ts +63 -0
  55. package/dist/chart/components/dynamic-objects/dynamic-objects.model.js +136 -0
  56. package/dist/chart/components/events/events-hit-test.drawer.js +63 -1
  57. package/dist/chart/components/events/events.component.js +61 -1
  58. package/dist/chart/components/events/events.drawer.js +195 -1
  59. package/dist/chart/components/events/events.model.js +69 -1
  60. package/dist/chart/components/grid/grid.component.d.ts +2 -2
  61. package/dist/chart/components/grid/grid.component.js +31 -1
  62. package/dist/chart/components/grid/grid.drawer.d.ts +4 -3
  63. package/dist/chart/components/grid/grid.drawer.js +106 -1
  64. package/dist/chart/components/high_low/high-low.component.js +12 -1
  65. package/dist/chart/components/high_low/high-low.drawer.js +126 -1
  66. package/dist/chart/components/highlights/highlights.component.js +46 -1
  67. package/dist/chart/components/highlights/highlights.drawer.js +154 -1
  68. package/dist/chart/components/highlights/highlights.model.js +75 -1
  69. package/dist/chart/components/labels_generator/numeric-axis-labels.generator.d.ts +1 -1
  70. package/dist/chart/components/labels_generator/numeric-axis-labels.generator.js +199 -1
  71. package/dist/chart/components/navigation_map/navigation-map-move.handler.d.ts +2 -2
  72. package/dist/chart/components/navigation_map/navigation-map-move.handler.js +108 -1
  73. package/dist/chart/components/navigation_map/navigation-map.component.js +112 -1
  74. package/dist/chart/components/navigation_map/navigation-map.drawer.js +244 -1
  75. package/dist/chart/components/navigation_map/navigation-map.model.js +33 -2
  76. package/dist/chart/components/pan/chart-pan.component.d.ts +2 -2
  77. package/dist/chart/components/pan/chart-pan.component.js +51 -1
  78. package/dist/chart/components/pane/extent/y-extent-component.d.ts +12 -18
  79. package/dist/chart/components/pane/extent/y-extent-component.js +120 -1
  80. package/dist/chart/components/pane/pane-hit-test.controller.js +55 -1
  81. package/dist/chart/components/pane/pane-manager.component.d.ts +10 -5
  82. package/dist/chart/components/pane/pane-manager.component.js +148 -1
  83. package/dist/chart/components/pane/pane.component.d.ts +16 -32
  84. package/dist/chart/components/pane/pane.component.js +278 -1
  85. package/dist/chart/components/resizer/bar-resizer.component.js +139 -1
  86. package/dist/chart/components/resizer/bar-resizer.drawer.js +46 -1
  87. package/dist/chart/components/snapshot/snapshot.component.js +48 -1
  88. package/dist/chart/components/volumes/separate-volumes.component.d.ts +6 -10
  89. package/dist/chart/components/volumes/separate-volumes.component.js +63 -1
  90. package/dist/chart/components/volumes/volume-color-resolvers.functions.js +18 -1
  91. package/dist/chart/components/volumes/volumes.component.d.ts +6 -7
  92. package/dist/chart/components/volumes/volumes.component.js +94 -1
  93. package/dist/chart/components/volumes/volumes.drawer.d.ts +5 -12
  94. package/dist/chart/components/volumes/volumes.drawer.js +140 -1
  95. package/dist/chart/components/volumes/volumes.formatter.js +31 -1
  96. package/dist/chart/components/volumes/volumes.model.d.ts +2 -2
  97. package/dist/chart/components/volumes/volumes.model.js +43 -1
  98. package/dist/chart/components/watermark/water-mark.component.js +103 -1
  99. package/dist/chart/components/watermark/water-mark.drawer.js +187 -1
  100. package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.js +27 -1
  101. package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.js +187 -1
  102. package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.js +76 -1
  103. package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.js +79 -1
  104. package/dist/chart/components/x_axis/time/parser/time-formats.model.js +14 -1
  105. package/dist/chart/components/x_axis/time/x-axis-weights.functions.d.ts +1 -1
  106. package/dist/chart/components/x_axis/time/x-axis-weights.functions.js +143 -1
  107. package/dist/chart/components/x_axis/time/x-axis-weights.generator.js +73 -1
  108. package/dist/chart/components/x_axis/x-axis-draw.functions.js +49 -1
  109. package/dist/chart/components/x_axis/x-axis-labels.drawer.js +70 -1
  110. package/dist/chart/components/x_axis/x-axis-labels.generator.d.ts +2 -2
  111. package/dist/chart/components/x_axis/x-axis-labels.generator.js +332 -1
  112. package/dist/chart/components/x_axis/x-axis-labels.model.js +35 -1
  113. package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +2 -2
  114. package/dist/chart/components/x_axis/x-axis-scale.handler.js +60 -1
  115. package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +82 -1
  116. package/dist/chart/components/x_axis/x-axis.component.d.ts +2 -2
  117. package/dist/chart/components/x_axis/x-axis.component.js +119 -1
  118. package/dist/chart/components/y_axis/label-color.functions.js +53 -1
  119. package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.d.ts +4 -4
  120. package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.js +33 -1
  121. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +3 -3
  122. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +67 -1
  123. package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +56 -1
  124. package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +95 -1
  125. package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +2 -2
  126. package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +119 -1
  127. package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +9 -8
  128. package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +201 -1
  129. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +6 -7
  130. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +58 -1
  131. package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +6 -4
  132. package/dist/chart/components/y_axis/y-axis-base-labels.model.js +47 -1
  133. package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +4 -4
  134. package/dist/chart/components/y_axis/y-axis-labels.drawer.js +161 -1
  135. package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +2 -2
  136. package/dist/chart/components/y_axis/y-axis-scale.handler.js +72 -1
  137. package/dist/chart/components/y_axis/y-axis.component.d.ts +32 -41
  138. package/dist/chart/components/y_axis/y-axis.component.js +220 -1
  139. package/dist/chart/components/y_axis/y-axis.drawer.d.ts +9 -12
  140. package/dist/chart/components/y_axis/y-axis.drawer.js +96 -1
  141. package/dist/chart/components/y_axis/y-axis.model.d.ts +9 -17
  142. package/dist/chart/components/y_axis/y-axis.model.js +33 -1
  143. package/dist/chart/drawers/chart-background.drawer.js +69 -1
  144. package/dist/chart/drawers/chart-type-drawers/area.drawer.js +69 -1
  145. package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +57 -1
  146. package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +84 -1
  147. package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +162 -1
  148. package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +57 -1
  149. package/dist/chart/drawers/chart-type-drawers/line.drawer.js +38 -1
  150. package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +19 -1
  151. package/dist/chart/drawers/clear-canvas.drawer.js +14 -1
  152. package/dist/chart/drawers/composite.drawer.js +67 -1
  153. package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +50 -1
  154. package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +35 -1
  155. package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.js +16 -1
  156. package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +106 -1
  157. package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +23 -1
  158. package/dist/chart/drawers/data-series-drawers/linear.drawer.js +19 -1
  159. package/dist/chart/drawers/data-series-drawers/points.drawer.js +19 -1
  160. package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.js +7 -1
  161. package/dist/chart/drawers/data-series-drawers/text.drawer.js +25 -1
  162. package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +35 -1
  163. package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +22 -1
  164. package/dist/chart/drawers/data-series.drawer.d.ts +5 -7
  165. package/dist/chart/drawers/data-series.drawer.js +56 -1
  166. package/dist/chart/drawers/drawing-manager.d.ts +1 -1
  167. package/dist/chart/drawers/drawing-manager.js +177 -1
  168. package/dist/chart/drawers/ht-data-series.drawer.js +37 -1
  169. package/dist/chart/events/event-bus.js +73 -1
  170. package/dist/chart/events/events.js +3 -1
  171. package/dist/chart/inputhandlers/candle-tap.handler.js +46 -1
  172. package/dist/chart/inputhandlers/chart-resize.handler.js +98 -1
  173. package/dist/chart/inputhandlers/cross-event-producer.component.js +67 -1
  174. package/dist/chart/inputhandlers/hover-producer.component.d.ts +2 -2
  175. package/dist/chart/inputhandlers/hover-producer.component.js +228 -1
  176. package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +2 -2
  177. package/dist/chart/inputhandlers/main-canvas-touch.handler.js +80 -1
  178. package/dist/chart/inputlisteners/canvas-input-listener.component.js +629 -1
  179. package/dist/chart/model/baseline.model.js +88 -1
  180. package/dist/chart/model/bounds.model.js +1 -1
  181. package/dist/chart/model/candle-hover.js +70 -1
  182. package/dist/chart/model/candle-series-high-low.provider.js +45 -1
  183. package/dist/chart/model/candle-series.model.d.ts +3 -3
  184. package/dist/chart/model/candle-series.model.js +245 -1
  185. package/dist/chart/model/candle.model.js +69 -1
  186. package/dist/chart/model/canvas.model.js +228 -1
  187. package/dist/chart/model/chart-base-element.js +129 -1
  188. package/dist/chart/model/compare-series-hover.js +25 -1
  189. package/dist/chart/model/data-series-view.d.ts +5 -5
  190. package/dist/chart/model/data-series-view.js +111 -1
  191. package/dist/chart/model/data-series.config.js +14 -1
  192. package/dist/chart/model/data-series.model.d.ts +4 -4
  193. package/dist/chart/model/data-series.model.js +281 -1
  194. package/dist/chart/model/date-time.formatter.js +151 -1
  195. package/dist/chart/model/hit-test-canvas.model.d.ts +1 -1
  196. package/dist/chart/model/hit-test-canvas.model.js +256 -1
  197. package/dist/chart/model/main-candle-series.model.d.ts +1 -1
  198. package/dist/chart/model/main-candle-series.model.js +29 -1
  199. package/dist/chart/model/scale.model.d.ts +2 -1
  200. package/dist/chart/model/scale.model.js +316 -1
  201. package/dist/chart/model/scaling/auto-scale.model.js +97 -1
  202. package/dist/chart/model/scaling/constrait.functions.js +61 -1
  203. package/dist/chart/model/scaling/lock-ratio.model.js +17 -1
  204. package/dist/chart/model/scaling/move-chart.functions.js +22 -1
  205. package/dist/chart/model/scaling/viewport.model.d.ts +2 -2
  206. package/dist/chart/model/scaling/viewport.model.js +279 -1
  207. package/dist/chart/model/scaling/x-zooming.functions.js +35 -1
  208. package/dist/chart/model/time-zone.model.js +109 -1
  209. package/dist/chart/model/visual-candle.js +134 -1
  210. package/dist/chart/utils/__tests__/array.utils.test.js +135 -1
  211. package/dist/chart/utils/__tests__/math.utils.test.js +14 -1
  212. package/dist/chart/utils/__tests__/object.utils.test.js +11 -1
  213. package/dist/chart/utils/__tests__/priceIncrementsUtils.test.js +29 -1
  214. package/dist/chart/utils/array.utils.d.ts +1 -1
  215. package/dist/chart/utils/array.utils.js +269 -1
  216. package/dist/chart/utils/auto-period-detector.utils.js +39 -1
  217. package/dist/chart/utils/candles-generator-ts.utils.js +20 -1
  218. package/dist/chart/utils/candles-generator.utils.js +161 -1
  219. package/dist/chart/utils/candles.utils.js +42 -1
  220. package/dist/chart/utils/canvas/canvas-drawing-functions.utils.js +144 -1
  221. package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.js +51 -1
  222. package/dist/chart/utils/canvas/canvas-text-functions.utils.js +156 -1
  223. package/dist/chart/utils/color.utils.js +31 -1
  224. package/dist/chart/utils/device/browser.utils.js +10 -1
  225. package/dist/chart/utils/device/device-detector.utils.js +24 -1
  226. package/dist/chart/utils/device/device-pixel-ratio.utils.js +21 -1
  227. package/dist/chart/utils/device/touchpad.utils.js +91 -1
  228. package/dist/chart/utils/dom.utils.js +15 -1
  229. package/dist/chart/utils/function.utils.js +16 -1
  230. package/dist/chart/utils/linkedList.utils.d.ts +28 -0
  231. package/dist/chart/utils/linkedList.utils.js +138 -0
  232. package/dist/chart/utils/math.utils.js +115 -1
  233. package/dist/chart/utils/merge.utils.js +56 -1
  234. package/dist/chart/utils/object.utils.js +43 -1
  235. package/dist/chart/utils/performance/animation-frame-cache.utils.js +77 -0
  236. package/dist/chart/utils/{perfomance → performance}/debounce.utils.js +7 -1
  237. package/dist/chart/utils/performance/memoize.utils.js +74 -0
  238. package/dist/chart/utils/performance/request-animation-frame-throttle.utils.js +43 -0
  239. package/dist/chart/utils/performance/throttle.utils.js +26 -0
  240. package/dist/chart/utils/price-increments.utils.d.ts +1 -0
  241. package/dist/chart/utils/price-increments.utils.js +127 -1
  242. package/dist/chart/utils/uuid.utils.js +4 -1
  243. package/dist/dxchart.min.js +9 -12
  244. package/dist/index.d.ts +3 -3
  245. package/dist/index.js +20 -1
  246. package/package.json +4 -4
  247. package/dist/chart/utils/perfomance/animation-frame-cache.utils.js +0 -6
  248. package/dist/chart/utils/perfomance/memoize.utils.js +0 -6
  249. package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.js +0 -6
  250. package/dist/chart/utils/perfomance/throttle.utils.js +0 -6
  251. /package/dist/chart/utils/{perfomance → performance}/animation-frame-cache.utils.d.ts +0 -0
  252. /package/dist/chart/utils/{perfomance → performance}/debounce.utils.d.ts +0 -0
  253. /package/dist/chart/utils/{perfomance → performance}/memoize.utils.d.ts +0 -0
  254. /package/dist/chart/utils/{perfomance → performance}/request-animation-frame-throttle.utils.d.ts +0 -0
  255. /package/dist/chart/utils/{perfomance → performance}/throttle.utils.d.ts +0 -0
@@ -3,4 +3,284 @@
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{DataSeriesYAxisLabelsProvider as x}from"../components/y_axis/price_labels/data-series-y-axis-labels.provider";import{binarySearch as l,create2DArray as h,lastOf as P,slice2DArray as v}from"../utils/array.utils";import{floorToDPR as d}from"../utils/device/device-pixel-ratio.utils";import{MathUtils as g}from"../utils/math.utils";import{merge as p}from"../utils/merge.utils";import{cloneUnsafe as m}from"../utils/object.utils";import{ChartBaseElement as I}from"./chart-base-element";import{DataSeriesView as c}from"./data-series-view";import{DEFAULT_DATA_SERIES_CONFIG as u}from"./data-series.config";export class VisualSeriesPoint{constructor(t,i){this.centerUnit=t,this.close=i}y(t){return d(t.toY(this.close))}x(t){return d(t.toX(this.centerUnit))}clone(){return new VisualSeriesPoint(this.centerUnit,this.close)}}export class DataSeriesModel extends I{get dataPoints2D(){return this._dataPoints}get dataPoints(){return this._dataPointsFlat}set dataPoints(t){this._dataPoints=h(t),this._dataPointsFlat=this._dataPoints.flat(),this.visualPoints=this._toVisualPoints(this._dataPoints)}get visualPoints(){return this._visualPointsFlat}get visualPoints2D(){return this._visualPoints}set visualPoints(t){this._visualPoints=h(t),this._visualPointsFlat=this._visualPoints.flat()}constructor(t,i,e=m(u)){var a;super(),this.extentComponent=t,this.id=i,this.name="",this.hovered=!1,this._dataPoints=[],this.pricePrecisions=[2],this.linkedDataSeriesModels=[],this._dataPointsFlat=[],this._visualPoints=[],this._visualPointsFlat=[],this.dataIdxStart=0,this.dataIdxEnd=0,this.getPaintConfig=s=>{var n;return(n=this.config.paintConfig[s])!==null&&n!==void 0?n:this.config.paintConfig[0]},this.getBaseLine=(s=this.dataIdxStart)=>{var n,r;return(r=(n=this.visualPoints[s])===null||n===void 0?void 0:n.close)!==null&&r!==void 0?r:1},this.getTextForPoint=s=>`${s.close}`,this.getLastVisualSeriesPoint=()=>{const s=this.visualPoints,n=l(s,this.scaleModel.xEnd,r=>r.centerUnit).index;return s[n]},this.getLastDataSeriesPoint=()=>{const s=this.visualPoints;return P(s)},this.config=p(e,u),this.scaleModel=t.scaleModel,this.view=new c(this,this.scaleModel,()=>this.extentComponent.getAxisType(),this.getBaseLine),this.yAxisLabelProvider=new x(this,this.config,t.getYAxisBounds,(a=t.yAxisComponent)===null||a===void 0?void 0:a.state),this.highLowProvider=f(this),t.addDataSeries(this),this.activate()}doActivate(){this.addRxSubscription(this.scaleModel.xChanged.subscribe(()=>this.recalculateDataViewportIndexes())),this.addRxSubscription(this.scaleModel.scaleInversedSubject.subscribe(()=>this.recalculateVisualPoints()))}setDataPoints(t){this.dataPoints=t,this.extentComponent.paneComponent.updateView()}_toVisualPoints(t){return t.map(i=>this.toVisualPoints(i))}moveToExtent(t){var i;this.extentComponent.removeDataSeries(this),this.extentComponent=t,this.scaleModel=t.scaleModel,this.view=new c(this,this.scaleModel,()=>this.extentComponent.getAxisType(),this.getBaseLine),this.yAxisLabelProvider.yAxisBoundsProvider=t.getYAxisBounds,this.yAxisLabelProvider.axisState=(i=t.yAxisComponent)===null||i===void 0?void 0:i.state,this.deactivate(),this.activate(),t.addDataSeries(this)}toVisualPoints(t){return t.map((i,e)=>({centerUnit:e,close:i.close}))}setType(t){this.config.type=t,this.extentComponent.dataSeriesCanvasModel.fireDraw()}recalculateVisualPoints(){this.visualPoints=this._toVisualPoints(this.dataPoints2D)}recalculateDataViewportIndexes(t=this.scaleModel.xStart,i=this.scaleModel.xEnd){const{dataIdxStart:e,dataIdxEnd:a}=this.calculateDataViewportIndexes(t,i);this.dataIdxStart=e,this.dataIdxEnd=a}calculateDataViewportIndexes(t,i){const e=l(this.visualPoints,t,s=>s.centerUnit).index,a=l(this.visualPoints,i,s=>s.centerUnit).index;return{dataIdxStart:e,dataIdxEnd:a}}valueFormatter(t){return defaultValueFormatter(t)}getSeriesInViewport(t,i){let e=this.dataIdxStart,a=this.dataIdxEnd;if(i!==void 0&&t!==void 0){const s=this.calculateDataViewportIndexes(t,i);e=s.dataIdxStart,a=s.dataIdxEnd}return v(this.visualPoints2D,e,a)}}export const calculateDataSeriesHighLow=o=>{const t={high:Number.MIN_SAFE_INTEGER,low:Number.MAX_SAFE_INTEGER,highIdx:0,lowIdx:0};for(let i=0;i<o.length;i++){const e=o[i];e.close>t.high&&(t.high=e.close,t.highIdx=i),e.close<t.low&&(t.low=e.close,t.lowIdx=i)}return t};const f=o=>({isHighLowActive:()=>o.config.highLowActive,calculateHighLow:t=>{const i=calculateDataSeriesHighLow(o.getSeriesInViewport(t==null?void 0:t.xStart,t==null?void 0:t.xEnd).flat());return Object.assign(Object.assign({},i),{high:o.view.toAxisUnits(i.high),low:o.view.toAxisUnits(i.low)})}});export const defaultValueFormatter=o=>{const i=s=>Math.ceil(Math.log(Math.abs(s))*Math.LOG10E),a=((s,n=5)=>Math.max(0,n-Math.max(0,i(s))))(o);return g.makeDecimal(o,a)};
6
+ import { DataSeriesYAxisLabelsProvider } from '../components/y_axis/price_labels/data-series-y-axis-labels.provider';
7
+ import { binarySearch, create2DArray, lastOf, slice2DArray } from '../utils/array.utils';
8
+ import { floorToDPR } from '../utils/device/device-pixel-ratio.utils';
9
+ import { MathUtils } from '../utils/math.utils';
10
+ import { merge } from '../utils/merge.utils';
11
+ import { cloneUnsafe } from '../utils/object.utils';
12
+ import { ChartBaseElement } from './chart-base-element';
13
+ import { DataSeriesView } from './data-series-view';
14
+ import { DEFAULT_DATA_SERIES_CONFIG, } from './data-series.config';
15
+ /**
16
+ * Properties are named in order to match VisualCandle interface
17
+ */
18
+ export class VisualSeriesPoint {
19
+ constructor(centerUnit, close) {
20
+ this.centerUnit = centerUnit;
21
+ this.close = close;
22
+ }
23
+ /**
24
+ * returns y coordinate in pixels
25
+ */
26
+ y(viewable) {
27
+ return floorToDPR(viewable.toY(this.close));
28
+ }
29
+ /**
30
+ * returns x coordinate in pixels
31
+ */
32
+ x(viewable) {
33
+ return floorToDPR(viewable.toX(this.centerUnit));
34
+ }
35
+ clone() {
36
+ return new VisualSeriesPoint(this.centerUnit, this.close);
37
+ }
38
+ }
39
+ /**
40
+ * DataSeriesModel represents single time series chart.
41
+ * Usually data source is presented as a one-dimension array, but here it can be presented as two-dimension array
42
+ * If the data is presented as two-dim array when every data array will be drawn as a separate time-series
43
+ * For example, linear chart type will be drawn with gaps on the chart
44
+ */
45
+ export class DataSeriesModel extends ChartBaseElement {
46
+ get dataPoints2D() {
47
+ return this._dataPoints;
48
+ }
49
+ get dataPoints() {
50
+ return this._dataPointsFlat;
51
+ }
52
+ set dataPoints(points) {
53
+ // createTwoDimArray here and below is needed to support two-dimension arrays
54
+ this._dataPoints = create2DArray(points);
55
+ this._dataPointsFlat = this._dataPoints.flat();
56
+ this.visualPoints = this._toVisualPoints(this._dataPoints);
57
+ }
58
+ get visualPoints() {
59
+ return this._visualPointsFlat;
60
+ }
61
+ get visualPoints2D() {
62
+ return this._visualPoints;
63
+ }
64
+ set visualPoints(points) {
65
+ this._visualPoints = create2DArray(points);
66
+ this._visualPointsFlat = this._visualPoints.flat();
67
+ }
68
+ constructor(extentComponent, id, _config = cloneUnsafe(DEFAULT_DATA_SERIES_CONFIG)) {
69
+ var _a;
70
+ super();
71
+ this.extentComponent = extentComponent;
72
+ this.id = id;
73
+ this.name = '';
74
+ this.hovered = false;
75
+ this._dataPoints = [];
76
+ this.pricePrecisions = [2];
77
+ /**
78
+ * Should be used for paint tools like rectangular drawing or diff cloud
79
+ */
80
+ this.linkedDataSeriesModels = [];
81
+ this._dataPointsFlat = [];
82
+ this._visualPoints = [];
83
+ this._visualPointsFlat = [];
84
+ // start/end data index in viewport
85
+ this.dataIdxStart = 0;
86
+ this.dataIdxEnd = 0;
87
+ /**
88
+ * Returns the paint configuration object for a specific series part, or the default paint configuration object
89
+ * if the specified series part is not defined in the current DataSeriesView configuration.
90
+ *
91
+ * @param {number} seriesPart - The index of the series part to get the paint configuration for.
92
+ * @returns {DataSeriesPaintConfig} The paint configuration object for the specified series part, or the default paint configuration object.
93
+ */
94
+ this.getPaintConfig = (seriesPart) => {
95
+ var _a;
96
+ return (_a = this.config.paintConfig[seriesPart]) !== null && _a !== void 0 ? _a : this.config.paintConfig[0];
97
+ };
98
+ /**
99
+ * Returns the close value of the visual point at the given index, or 1 if the visual point is not defined.
100
+ * The index defaults to the data index start of the DataSeriesView.
101
+ *
102
+ * @param {number} [idx=this.dataIdxStart] - The index of the visual point to retrieve the close value for.
103
+ * @returns {Unit} The close value of the visual point at the given index, or 1 if the visual point is not defined.
104
+ */
105
+ this.getBaseline = (idx = this.dataIdxStart) => { var _a, _b; return (_b = (_a = this.visualPoints[idx]) === null || _a === void 0 ? void 0 : _a.close) !== null && _b !== void 0 ? _b : 1; };
106
+ /**
107
+ * Returns the string representation of the close value of the given visual point.
108
+ *
109
+ * @param {VisualSeriesPoint} point - The visual point to get the string representation of the close value for.
110
+ * @returns {string} The string representation of the close value of the given visual point.
111
+ */
112
+ this.getTextForPoint = (point) => `${point.close}`;
113
+ /**
114
+ * Returns last visible on the screen data series value
115
+ * @param seriesIndex
116
+ */
117
+ this.getLastVisualSeriesPoint = () => {
118
+ const points = this.visualPoints;
119
+ const endIdx = binarySearch(points, this.scale.xEnd, i => i.centerUnit).index;
120
+ return points[endIdx];
121
+ };
122
+ /**
123
+ * Return last overall data series value (even if not visible)
124
+ * @param seriesIndex
125
+ */
126
+ this.getLastDataSeriesPoint = () => {
127
+ const points = this.visualPoints;
128
+ return lastOf(points);
129
+ };
130
+ this.config = merge(_config, DEFAULT_DATA_SERIES_CONFIG);
131
+ this.scale = extentComponent.scale;
132
+ this.view = new DataSeriesView(this, this.scale, () => this.extentComponent.yAxis.getAxisType(), this.getBaseline);
133
+ this.yAxisLabelProvider = new DataSeriesYAxisLabelsProvider(this, this.config, extentComponent.getYAxisBounds, (_a = extentComponent.yAxis) === null || _a === void 0 ? void 0 : _a.state);
134
+ this.highLowProvider = createDataSeriesModelHighLowProvider(this);
135
+ extentComponent.addDataSeries(this);
136
+ this.activate();
137
+ }
138
+ doActivate() {
139
+ this.addRxSubscription(this.scale.xChanged.subscribe(() => this.recalculateDataViewportIndexes()));
140
+ this.addRxSubscription(this.scale.scaleInversedSubject.subscribe(() => this.recalculateVisualPoints()));
141
+ }
142
+ /**
143
+ * Sets the data points and recalculates internal state
144
+ * @param {DataSeriesPoint[][] | DataSeriesPoint[]} points - The data points to set for the model. Can be an array of arrays or a single array.
145
+ * @returns {void}
146
+ */
147
+ setDataPoints(points) {
148
+ this.dataPoints = points;
149
+ this.extentComponent.paneComponent.updateView();
150
+ }
151
+ _toVisualPoints(data) {
152
+ return data.map(d => this.toVisualPoints(d));
153
+ }
154
+ /**
155
+ * Moves the DataSeriesModel to the given extent.
156
+ * @param extent
157
+ */
158
+ moveToExtent(extent) {
159
+ var _a;
160
+ this.extentComponent.removeDataSeries(this);
161
+ this.extentComponent = extent;
162
+ this.scale = extent.scale;
163
+ this.view = new DataSeriesView(this, this.scale, () => this.extentComponent.yAxis.getAxisType(), this.getBaseline);
164
+ this.yAxisLabelProvider.yAxisBoundsProvider = extent.getYAxisBounds;
165
+ this.yAxisLabelProvider.axisState = (_a = extent.yAxis) === null || _a === void 0 ? void 0 : _a.state;
166
+ // shut down old subscriptions
167
+ this.deactivate();
168
+ // and apply new ones (with updated scaleModel)
169
+ this.activate();
170
+ extent.addDataSeries(this);
171
+ }
172
+ /**
173
+ * Transforms the given array of data points of type D into an array of visual points of type V.
174
+ * Each visual point object contains a centerUnit property with the index of the point in the input array,
175
+ * and a close property with the close value of the point.
176
+ *
177
+ * @param {D[]} data - The array of data points to transform into visual points.
178
+ * @returns {V[]} An array of visual points, each with a centerUnit and close property.
179
+ */
180
+ toVisualPoints(data) {
181
+ // @ts-ignore
182
+ return data.map((point, idx) => ({ centerUnit: idx, close: point.close }));
183
+ }
184
+ setType(type) {
185
+ this.config.type = type;
186
+ this.extentComponent.dynamicObjectsCanvasModel.fireDraw();
187
+ }
188
+ /**
189
+ * Recalculates the visual points of the DataSeriesView based on the current data points.
190
+ * The visual points are stored in the visualPoints property of the DataSeriesView.
191
+ * Should be called 1 time when data are set / updated to chart.
192
+ */
193
+ recalculateVisualPoints() {
194
+ this.visualPoints = this._toVisualPoints(this.dataPoints2D);
195
+ }
196
+ /**
197
+ * Recalculates the indexes of the start and end points of the data viewport,
198
+ * based on the current xStart and xEnd values of the scale model, or on the given xStart and xEnd parameters.
199
+ *
200
+ * @param {number} [xStart=this.scale.xStart] - The start value of the viewport on the x-axis. Defaults to the current xStart value of the scale model.
201
+ * @param {number} [xEnd=this.scale.xEnd] - The end value of the viewport on the x-axis. Defaults to the current xEnd value of the scale model.
202
+ */
203
+ recalculateDataViewportIndexes(xStart = this.scale.xStart, xEnd = this.scale.xEnd) {
204
+ const { dataIdxStart, dataIdxEnd } = this.calculateDataViewportIndexes(xStart, xEnd);
205
+ this.dataIdxStart = dataIdxStart;
206
+ this.dataIdxEnd = dataIdxEnd;
207
+ }
208
+ /**
209
+ * Calculates and returns the indexes of the start and end points of the data viewport,
210
+ * based on the given start and end units on the x-axis.
211
+ *
212
+ * @param {Unit} xStart - The start value of the viewport on the x-axis.
213
+ * @param {Unit} xEnd - The end value of the viewport on the x-axis.
214
+ * @returns {DataSeriesViewportIndexes} An object containing the calculated start and end indexes of the data viewport.
215
+ */
216
+ calculateDataViewportIndexes(xStart, xEnd) {
217
+ const dataIdxStart = binarySearch(this.visualPoints, xStart, i => i.centerUnit).index;
218
+ const dataIdxEnd = binarySearch(this.visualPoints, xEnd, i => i.centerUnit).index;
219
+ return {
220
+ dataIdxStart,
221
+ dataIdxEnd,
222
+ };
223
+ }
224
+ /**
225
+ * Formats the given numerical value using the default value formatter.
226
+ *
227
+ * @param {number} value - The numerical value to be formatted.
228
+ * @returns {string} The formatted value as a string.
229
+ */
230
+ valueFormatter(value) {
231
+ return defaultValueFormatter(value);
232
+ }
233
+ /**
234
+ * Returns a two-dimensional array of the visual points in the viewport of the DataSeriesView.
235
+ * The viewport range can be customized by providing start and end units on the x-axis.
236
+ * If start or end units are not provided, the current viewport range of the DataSeriesView is used.
237
+ *
238
+ * @param {number} [xStart] - The start value of the viewport range on the x-axis.
239
+ * @param {number} [xEnd] - The end value of the viewport range on the x-axis.
240
+ * @returns {V[][]} A two-dimensional array of the visual points in the viewport of the DataSeriesView.
241
+ */
242
+ getSeriesInViewport(xStart, xEnd) {
243
+ let dataIdxStart = this.dataIdxStart;
244
+ let dataIdxEnd = this.dataIdxEnd;
245
+ if (xEnd !== undefined && xStart !== undefined) {
246
+ const res = this.calculateDataViewportIndexes(xStart, xEnd);
247
+ dataIdxStart = res.dataIdxStart;
248
+ dataIdxEnd = res.dataIdxEnd;
249
+ }
250
+ return slice2DArray(this.visualPoints2D, dataIdxStart, dataIdxEnd);
251
+ }
252
+ }
253
+ export const calculateDataSeriesHighLow = (visualCandles) => {
254
+ const result = {
255
+ high: Number.MIN_SAFE_INTEGER,
256
+ low: Number.MAX_SAFE_INTEGER,
257
+ highIdx: 0,
258
+ lowIdx: 0,
259
+ };
260
+ for (let i = 0; i < visualCandles.length; i++) {
261
+ const candle = visualCandles[i];
262
+ if (candle.close > result.high) {
263
+ result.high = candle.close;
264
+ result.highIdx = i;
265
+ }
266
+ if (candle.close < result.low) {
267
+ result.low = candle.close;
268
+ result.lowIdx = i;
269
+ }
270
+ }
271
+ return result;
272
+ };
273
+ const createDataSeriesModelHighLowProvider = (dataSeries) => ({
274
+ isHighLowActive: () => dataSeries.config.highLowActive,
275
+ calculateHighLow: state => {
276
+ const highLow = calculateDataSeriesHighLow(dataSeries.getSeriesInViewport(state === null || state === void 0 ? void 0 : state.xStart, state === null || state === void 0 ? void 0 : state.xEnd).flat());
277
+ return Object.assign(Object.assign({}, highLow), { high: dataSeries.view.toAxisUnits(highLow.high), low: dataSeries.view.toAxisUnits(highLow.low) });
278
+ },
279
+ });
280
+ export const defaultValueFormatter = (value) => {
281
+ const DEFAULT_PRECISION = 5;
282
+ const calcFraction = (val) => Math.ceil(Math.log(Math.abs(val)) * Math.LOG10E);
283
+ const calcPrecision = (val, maxPrecision = DEFAULT_PRECISION) => Math.max(0, maxPrecision - Math.max(0, calcFraction(val)));
284
+ const resPrecision = calcPrecision(value);
285
+ return MathUtils.makeDecimal(value, resPrecision);
286
+ };
@@ -3,4 +3,154 @@
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
- export const defaultDateTimeFormatter=()=>e=>e.toString(),dateTimeFormatterFactory=(e,n)=>{var a;const d="date.get"+(n((a=e.timezone)!==null&&a!==void 0?a:"")?"":"UTC"),r={YYYY:t("FullYear"),YY:t("FullYear")+" % 100",MMM:s("shortMonths","Month"),MMMM:l(s("shortMonths","Month")),M:"1+"+t("Month"),d:t("Date"),H:t("Hours"),m:t("Minutes"),s:t("Seconds"),sss:t("Milliseconds"),EEE:s("shortDays","Day"),SSS:"this.addTwoZeros("+t("Milliseconds")+")",T:"date.getTime()"};["s","m","H","d","M"].forEach(function(o){r[o+o]="this.addZero("+r[o]+")"});const i=new RegExp(Object.keys(r).sort().reverse().join("|"),"g");function t(o){return d+o+"()"}function s(o,h){return"this."+o+"["+t(h)+"]"}function l(o){return o+".toUpperCase()"}function c(o){return"' + ("+r[o]+") + '"}return function(o){var h;const M={shortDays:p(e),shortMonths:f(e),addZero(u){return u<10?"0"+u:u},addTwoZeros(u){return(u<100?"0":"")+(u<10?"0":"")+u},tzDate:n((h=e.timezone)!==null&&h!==void 0?h:"")||function(u){return u instanceof Date?u:new Date(+u)}};return new Function("date","date=this.tzDate(date); return '"+o.replace(i,c)+"'").bind(M)}};function p(e){var n;return(n=e.shortDays)!==null&&n!==void 0?n:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}function f(e){var n;return(n=e.shortMonths)!==null&&n!==void 0?n:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}export const recalculateXFormatter=(e,n,a)=>{if(e){if(typeof e=="string")return a(e);if(Array.isArray(e)){const d=e.filter(r=>{if(r.showWhen){const i=[];return r.showWhen.periodLessThen&&i.push(()=>{var t,s;return n<((s=(t=r.showWhen)===null||t===void 0?void 0:t.periodLessThen)!==null&&s!==void 0?s:0)}),r.showWhen.periodMoreThen&&i.push(()=>{var t,s;return n>=((s=(t=r.showWhen)===null||t===void 0?void 0:t.periodMoreThen)!==null&&s!==void 0?s:0)}),i.every(t=>t())}else return!0});if(d.length>0){const r=d[0];if(r.format)return a(r.format);if(r.customFormatter)return r.customFormatter}}}return defaultDateTimeFormatter()};
6
+ export const defaultDateTimeFormatter = () => (date) => date.toString();
7
+ /**
8
+ * Default chart-core time formatter.
9
+ * @param config
10
+ * @param offsetFunction
11
+ * @doc-tags chart-core,default-config,date-formatter
12
+ */
13
+ export const dateTimeFormatterFactory = (config, offsetFunction) => {
14
+ var _a;
15
+ const getPrefix = 'date.get' + (offsetFunction((_a = config.timezone) !== null && _a !== void 0 ? _a : '') ? '' : 'UTC');
16
+ const patterns = {
17
+ YYYY: apply('FullYear'),
18
+ YY: apply('FullYear') + ' % 100',
19
+ MMM: from('shortMonths', 'Month'),
20
+ MMMM: upperCase(from('shortMonths', 'Month')),
21
+ M: '1+' + apply('Month'),
22
+ d: apply('Date'),
23
+ H: apply('Hours'),
24
+ m: apply('Minutes'),
25
+ s: apply('Seconds'),
26
+ sss: apply('Milliseconds'),
27
+ EEE: from('shortDays', 'Day'),
28
+ SSS: 'this.' + 'addTwoZeros' + '(' + apply('Milliseconds') + ')',
29
+ T: 'date.getTime()',
30
+ };
31
+ ['s', 'm', 'H', 'd', 'M'].forEach(function (k) {
32
+ patterns[k + k] = 'this.' + 'addZero' + '(' + patterns[k] + ')';
33
+ });
34
+ const re = new RegExp(Object.keys(patterns).sort().reverse().join('|'), 'g');
35
+ /**
36
+ * Returns a string that concatenates the result of the function getPrefix with the input string fn and the string '()'.
37
+ * @param {string} fn - The input string to concatenate.
38
+ * @returns {string} - The resulting string.
39
+ */
40
+ function apply(fn) {
41
+ return getPrefix + fn + '()';
42
+ }
43
+ /**
44
+ * Returns a string that represents an element of an array by applying a function to its index.
45
+ *
46
+ * @param {string} array - The name of the array.
47
+ * @param {string} fn - The name of the function to apply to the index.
48
+ * @returns {string} - A string that represents an element of the array.
49
+ */
50
+ function from(array, fn) {
51
+ return 'this.' + array + '[' + apply(fn) + ']';
52
+ }
53
+ /**
54
+ * Returns a string with the function name and the '.toUpperCase()' method appended to it.
55
+ * @param {string} fn - The name of the function to be converted to uppercase.
56
+ * @returns {string} - The resulting string with the function name in uppercase.
57
+ */
58
+ function upperCase(fn) {
59
+ return fn + '.toUpperCase()';
60
+ }
61
+ /**
62
+ * Returns a string that concatenates a pattern from an object with a string
63
+ * @param {string} pattern - The key of the pattern to be concatenated
64
+ * @returns {string} - A string that concatenates a pattern from an object with a string
65
+ */
66
+ function applyPattern(pattern) {
67
+ return "' + (" + patterns[pattern] + ") + '";
68
+ }
69
+ return function (pattern) {
70
+ var _a;
71
+ const context = {
72
+ shortDays: getShortDays(config),
73
+ shortMonths: getShortMonths(config),
74
+ /**
75
+ * Adds a leading zero to a number if it is less than 10
76
+ * @param {number} x - The number to add a leading zero to
77
+ * @returns {string|number} - The number with a leading zero if it is less than 10, otherwise the original number
78
+ */
79
+ addZero(x) {
80
+ return x < 10 ? '0' + x : x;
81
+ },
82
+ /**
83
+ * Adds two zeros to a number if it is less than 10 or 100
84
+ * @param {number} x - The number to add zeros to
85
+ * @returns {string} - The number with two zeros added if necessary
86
+ */
87
+ addTwoZeros(x) {
88
+ return (x < 100 ? '0' : '') + (x < 10 ? '0' : '') + x;
89
+ },
90
+ tzDate: offsetFunction((_a = config.timezone) !== null && _a !== void 0 ? _a : '') ||
91
+ function (date) {
92
+ return date instanceof Date ? date : new Date(+date);
93
+ },
94
+ };
95
+ // eslint-disable-next-line no-new-func
96
+ return new Function('date', 'date=this.' + 'tzDate' + "(date); return '" + pattern.replace(re, applyPattern) + "'").bind(context);
97
+ };
98
+ };
99
+ /**
100
+ * Returns an array of short day names based on the provided configuration object.
101
+ * If the configuration object does not contain shortDays property, it returns an array of default short day names.
102
+ *
103
+ * @param {TimeFormatterConfig} config - The configuration object containing shortDays property.
104
+ * @returns {string[]} - An array of short day names.
105
+ */
106
+ function getShortDays(config) {
107
+ var _a;
108
+ return (_a = config.shortDays) !== null && _a !== void 0 ? _a : ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
109
+ }
110
+ /**
111
+ * Returns an array of short month names based on the provided configuration object.
112
+ * If the configuration object does not have a 'shortMonths' property, it returns the default array of short month names.
113
+ *
114
+ * @param {TimeFormatterConfig} config - The configuration object that contains the shortMonths property.
115
+ * @returns {string[]} - An array of short month names.
116
+ */
117
+ function getShortMonths(config) {
118
+ var _a;
119
+ return (_a = config.shortMonths) !== null && _a !== void 0 ? _a : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
120
+ }
121
+ export const recalculateXFormatter = (xAxisLabelFormat, period, formatterFactory) => {
122
+ if (xAxisLabelFormat) {
123
+ if (typeof xAxisLabelFormat === 'string') {
124
+ // always same format
125
+ return formatterFactory(xAxisLabelFormat);
126
+ }
127
+ else if (Array.isArray(xAxisLabelFormat)) {
128
+ // conditional format
129
+ const matchingFormats = xAxisLabelFormat.filter(config => {
130
+ if (config.showWhen) {
131
+ const predicates = [];
132
+ if (config.showWhen.periodLessThen) {
133
+ predicates.push(() => { var _a, _b; return period < ((_b = (_a = config.showWhen) === null || _a === void 0 ? void 0 : _a.periodLessThen) !== null && _b !== void 0 ? _b : 0); });
134
+ }
135
+ if (config.showWhen.periodMoreThen) {
136
+ predicates.push(() => { var _a, _b; return period >= ((_b = (_a = config.showWhen) === null || _a === void 0 ? void 0 : _a.periodMoreThen) !== null && _b !== void 0 ? _b : 0); });
137
+ }
138
+ return predicates.every(p => p());
139
+ }
140
+ else {
141
+ return true;
142
+ }
143
+ });
144
+ if (matchingFormats.length > 0) {
145
+ const formatConfig = matchingFormats[0];
146
+ if (formatConfig.format) {
147
+ return formatterFactory(formatConfig.format);
148
+ }
149
+ else if (formatConfig.customFormatter) {
150
+ return formatConfig.customFormatter;
151
+ }
152
+ }
153
+ }
154
+ }
155
+ return defaultDateTimeFormatter();
156
+ };
@@ -11,7 +11,7 @@ import { DrawingManager } from '../drawers/drawing-manager';
11
11
  import EventBus from '../events/event-bus';
12
12
  import { CanvasInputListenerComponent, Point } from '../inputlisteners/canvas-input-listener.component';
13
13
  export type HitTestEvents = 'mousedown' | 'hover' | 'touchstart' | 'dblclick' | 'contextmenu' | 'zoom' | 'mouseup';
14
- type HitTestType = 'DRAWINGS' | 'DATA_SERIES' | 'EVENTS' | 'NEWS';
14
+ type HitTestType = 'DRAWINGS' | 'DATA_SERIES' | 'EVENTS' | 'NEWS' | 'EXECUTED_ORDERS';
15
15
  export declare const HIT_TEST_ID_RANGE: Record<HitTestType, [number, number]>;
16
16
  /** HitTestCanvasModel
17
17
  * Canvas layer for testing mouse events over the models such as Charts, Drawings, Volumes and etc.