@devexperts/dxcharts-lite 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/chart/animation/canvas-animation.d.ts +1 -1
- package/dist/chart/animation/canvas-animation.js +135 -2
- package/dist/chart/animation/types/animation.d.ts +1 -1
- package/dist/chart/animation/types/animation.js +44 -2
- package/dist/chart/animation/types/color-alpha-animation.d.ts +2 -2
- package/dist/chart/animation/types/color-alpha-animation.js +61 -2
- package/dist/chart/animation/types/color-transition-animation.d.ts +2 -2
- package/dist/chart/animation/types/color-transition-animation.js +87 -2
- package/dist/chart/animation/types/viewport-movement-animation.d.ts +1 -1
- package/dist/chart/animation/types/viewport-movement-animation.js +64 -2
- package/dist/chart/animation/viewport-model-animation.d.ts +1 -1
- package/dist/chart/animation/viewport-model-animation.js +21 -2
- package/dist/chart/bootstrap.d.ts +52 -49
- package/dist/chart/bootstrap.js +450 -2
- package/dist/chart/canvas/canvas-bounds-container.d.ts +1 -6
- package/dist/chart/canvas/canvas-bounds-container.js +816 -2
- package/dist/chart/canvas/canvas-chart-html.d.ts +1 -1
- package/dist/chart/canvas/canvas-chart-html.js +17 -19
- package/dist/chart/canvas/chart-elements.d.ts +2 -5
- package/dist/chart/canvas/chart-elements.js +23 -2
- package/dist/chart/canvas/cursor.handler.d.ts +1 -1
- package/dist/chart/canvas/cursor.handler.js +123 -2
- package/dist/chart/canvas/layout-creator.d.ts +1 -1
- package/dist/chart/canvas/layout-creator.js +35 -2
- package/dist/chart/canvas/y-axis-bounds.container.d.ts +3 -3
- package/dist/chart/canvas/y-axis-bounds.container.js +68 -2
- package/dist/chart/chart-container.d.ts +1 -1
- package/dist/chart/chart-container.js +2 -2
- package/dist/chart/chart.config.d.ts +5 -6
- package/dist/chart/chart.config.js +646 -2
- package/dist/chart/chart.d.ts +62 -0
- package/dist/chart/chart.js +106 -0
- package/dist/chart/components/chart/basic-scale.d.ts +3 -3
- package/dist/chart/components/chart/basic-scale.js +32 -2
- package/dist/chart/components/chart/candle-transformer.functions.d.ts +1 -1
- package/dist/chart/components/chart/candle-transformer.functions.js +16 -2
- package/dist/chart/components/chart/candle-width-calculator.functions.d.ts +1 -1
- package/dist/chart/components/chart/candle-width-calculator.functions.js +3 -2
- package/dist/chart/components/chart/candle.functions.d.ts +1 -1
- package/dist/chart/components/chart/candle.functions.js +45 -2
- package/dist/chart/components/chart/chart-area-pan.handler.d.ts +4 -4
- package/dist/chart/components/chart/chart-area-pan.handler.js +198 -2
- package/dist/chart/components/chart/chart-base.model.d.ts +1 -1
- package/dist/chart/components/chart/chart-base.model.js +67 -2
- package/dist/chart/components/chart/chart.component.d.ts +8 -4
- package/dist/chart/components/chart/chart.component.js +409 -2
- package/dist/chart/components/chart/chart.model.d.ts +5 -12
- package/dist/chart/components/chart/chart.model.js +955 -2
- package/dist/chart/components/chart/data-series.high-low-provider.d.ts +1 -1
- package/dist/chart/components/chart/data-series.high-low-provider.js +35 -2
- package/dist/chart/components/chart/fake-candles.d.ts +1 -1
- package/dist/chart/components/chart/fake-candles.js +98 -2
- package/dist/chart/components/chart/price.formatter.d.ts +1 -1
- package/dist/chart/components/chart/price.formatter.js +36 -2
- package/dist/chart/components/chart/secondary-chart-colors-pool.d.ts +1 -1
- package/dist/chart/components/chart/secondary-chart-colors-pool.js +69 -2
- package/dist/chart/components/cross_tool/cross-tool.component.d.ts +1 -1
- package/dist/chart/components/cross_tool/cross-tool.component.js +86 -2
- package/dist/chart/components/cross_tool/cross-tool.drawer.d.ts +1 -1
- package/dist/chart/components/cross_tool/cross-tool.drawer.js +33 -2
- package/dist/chart/components/cross_tool/cross-tool.model.d.ts +1 -1
- package/dist/chart/components/cross_tool/cross-tool.model.js +108 -2
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.d.ts +1 -1
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +138 -2
- package/dist/chart/components/cross_tool/types/none.drawer.d.ts +1 -1
- package/dist/chart/components/cross_tool/types/none.drawer.js +4 -2
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.d.ts +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +29 -2
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.d.ts +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +25 -2
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.d.ts +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +54 -2
- package/dist/chart/components/dynamic-objects/dynamic-objects.component.d.ts +13 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.component.js +20 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.d.ts +18 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.js +23 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.model.d.ts +63 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.model.js +136 -0
- package/dist/chart/components/events/events-hit-test.drawer.d.ts +1 -1
- package/dist/chart/components/events/events-hit-test.drawer.js +64 -2
- package/dist/chart/components/events/events.component.d.ts +1 -1
- package/dist/chart/components/events/events.component.js +62 -2
- package/dist/chart/components/events/events.drawer.d.ts +1 -1
- package/dist/chart/components/events/events.drawer.js +196 -2
- package/dist/chart/components/events/events.model.d.ts +1 -1
- package/dist/chart/components/events/events.model.js +70 -2
- package/dist/chart/components/grid/grid.component.d.ts +3 -3
- package/dist/chart/components/grid/grid.component.js +32 -2
- package/dist/chart/components/grid/grid.drawer.d.ts +5 -4
- package/dist/chart/components/grid/grid.drawer.js +107 -2
- package/dist/chart/components/high_low/high-low.component.d.ts +1 -1
- package/dist/chart/components/high_low/high-low.component.js +13 -2
- package/dist/chart/components/high_low/high-low.drawer.d.ts +1 -1
- package/dist/chart/components/high_low/high-low.drawer.js +127 -2
- package/dist/chart/components/highlights/highlights.component.d.ts +1 -1
- package/dist/chart/components/highlights/highlights.component.js +47 -2
- package/dist/chart/components/highlights/highlights.drawer.d.ts +1 -1
- package/dist/chart/components/highlights/highlights.drawer.js +155 -2
- package/dist/chart/components/highlights/highlights.model.d.ts +1 -1
- package/dist/chart/components/highlights/highlights.model.js +76 -2
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.d.ts +2 -2
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.js +200 -2
- package/dist/chart/components/navigation_map/navigation-map-move.handler.d.ts +3 -3
- package/dist/chart/components/navigation_map/navigation-map-move.handler.js +109 -2
- package/dist/chart/components/navigation_map/navigation-map.component.d.ts +1 -1
- package/dist/chart/components/navigation_map/navigation-map.component.js +113 -2
- package/dist/chart/components/navigation_map/navigation-map.drawer.d.ts +1 -1
- package/dist/chart/components/navigation_map/navigation-map.drawer.js +245 -2
- package/dist/chart/components/navigation_map/navigation-map.model.d.ts +1 -1
- package/dist/chart/components/navigation_map/navigation-map.model.js +34 -3
- package/dist/chart/components/pan/chart-pan.component.d.ts +3 -3
- package/dist/chart/components/pan/chart-pan.component.js +52 -2
- package/dist/chart/components/pane/extent/y-extent-component.d.ts +13 -19
- package/dist/chart/components/pane/extent/y-extent-component.js +121 -2
- package/dist/chart/components/pane/pane-hit-test.controller.d.ts +1 -1
- package/dist/chart/components/pane/pane-hit-test.controller.js +56 -2
- package/dist/chart/components/pane/pane-manager.component.d.ts +11 -6
- package/dist/chart/components/pane/pane-manager.component.js +149 -2
- package/dist/chart/components/pane/pane.component.d.ts +18 -34
- package/dist/chart/components/pane/pane.component.js +279 -2
- package/dist/chart/components/resizer/bar-resizer.component.d.ts +1 -1
- package/dist/chart/components/resizer/bar-resizer.component.js +140 -2
- package/dist/chart/components/resizer/bar-resizer.drawer.d.ts +1 -1
- package/dist/chart/components/resizer/bar-resizer.drawer.js +47 -2
- package/dist/chart/components/snapshot/snapshot.component.d.ts +1 -1
- package/dist/chart/components/snapshot/snapshot.component.js +49 -2
- package/dist/chart/components/volumes/separate-volumes.component.d.ts +7 -11
- package/dist/chart/components/volumes/separate-volumes.component.js +64 -2
- package/dist/chart/components/volumes/volume-color-resolvers.functions.d.ts +1 -1
- package/dist/chart/components/volumes/volume-color-resolvers.functions.js +19 -2
- package/dist/chart/components/volumes/volumes.component.d.ts +9 -9
- package/dist/chart/components/volumes/volumes.component.js +95 -2
- package/dist/chart/components/volumes/volumes.drawer.d.ts +6 -13
- package/dist/chart/components/volumes/volumes.drawer.js +141 -2
- package/dist/chart/components/volumes/volumes.formatter.d.ts +1 -1
- package/dist/chart/components/volumes/volumes.formatter.js +32 -2
- package/dist/chart/components/volumes/volumes.model.d.ts +3 -3
- package/dist/chart/components/volumes/volumes.model.js +44 -2
- package/dist/chart/components/watermark/water-mark.component.d.ts +1 -1
- package/dist/chart/components/watermark/water-mark.component.js +104 -2
- package/dist/chart/components/watermark/water-mark.drawer.d.ts +1 -1
- package/dist/chart/components/watermark/water-mark.drawer.js +188 -2
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.d.ts +1 -1
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.js +28 -2
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.js +188 -2
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.js +77 -2
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.js +80 -2
- package/dist/chart/components/x_axis/time/parser/time-formats.model.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats.model.js +15 -2
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.d.ts +2 -2
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.js +144 -2
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.d.ts +1 -1
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.js +74 -2
- package/dist/chart/components/x_axis/x-axis-draw.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-draw.functions.js +50 -2
- package/dist/chart/components/x_axis/x-axis-labels.drawer.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-labels.drawer.js +71 -2
- package/dist/chart/components/x_axis/x-axis-labels.generator.d.ts +3 -3
- package/dist/chart/components/x_axis/x-axis-labels.generator.js +333 -2
- package/dist/chart/components/x_axis/x-axis-labels.model.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-labels.model.js +36 -2
- package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +3 -3
- package/dist/chart/components/x_axis/x-axis-scale.handler.js +61 -2
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +83 -2
- package/dist/chart/components/x_axis/x-axis.component.d.ts +3 -3
- package/dist/chart/components/x_axis/x-axis.component.js +120 -2
- package/dist/chart/components/y_axis/label-color.functions.d.ts +1 -1
- package/dist/chart/components/y_axis/label-color.functions.js +54 -2
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.d.ts +5 -5
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.js +34 -2
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +4 -4
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +68 -2
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.d.ts +1 -1
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +57 -2
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.d.ts +1 -1
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +96 -2
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +3 -3
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +120 -2
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +10 -9
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +202 -2
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +7 -8
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +59 -2
- package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +7 -5
- package/dist/chart/components/y_axis/y-axis-base-labels.model.js +48 -2
- package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +5 -5
- package/dist/chart/components/y_axis/y-axis-labels.drawer.js +162 -2
- package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +3 -3
- package/dist/chart/components/y_axis/y-axis-scale.handler.js +73 -2
- package/dist/chart/components/y_axis/y-axis.component.d.ts +33 -42
- package/dist/chart/components/y_axis/y-axis.component.js +221 -2
- package/dist/chart/components/y_axis/y-axis.drawer.d.ts +10 -13
- package/dist/chart/components/y_axis/y-axis.drawer.js +97 -2
- package/dist/chart/components/y_axis/y-axis.model.d.ts +10 -18
- package/dist/chart/components/y_axis/y-axis.model.js +34 -2
- package/dist/chart/drawers/chart-background.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-background.drawer.js +70 -2
- package/dist/chart/drawers/chart-type-drawers/area.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/area.drawer.js +70 -2
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +58 -2
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +85 -2
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +163 -2
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +58 -2
- package/dist/chart/drawers/chart-type-drawers/line.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/line.drawer.js +39 -2
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +20 -2
- package/dist/chart/drawers/clear-canvas.drawer.d.ts +1 -1
- package/dist/chart/drawers/clear-canvas.drawer.js +15 -2
- package/dist/chart/drawers/composite.drawer.d.ts +1 -1
- package/dist/chart/drawers/composite.drawer.js +68 -2
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +51 -2
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +36 -2
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.js +17 -2
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +107 -2
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +24 -2
- package/dist/chart/drawers/data-series-drawers/linear.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/linear.drawer.js +20 -2
- package/dist/chart/drawers/data-series-drawers/points.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/points.drawer.js +20 -2
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.js +8 -2
- package/dist/chart/drawers/data-series-drawers/text.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/text.drawer.js +26 -2
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +36 -2
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +23 -2
- package/dist/chart/drawers/data-series.drawer.d.ts +6 -8
- package/dist/chart/drawers/data-series.drawer.js +57 -2
- package/dist/chart/drawers/drawing-manager.d.ts +2 -2
- package/dist/chart/drawers/drawing-manager.js +178 -2
- package/dist/chart/drawers/ht-data-series.drawer.d.ts +1 -1
- package/dist/chart/drawers/ht-data-series.drawer.js +38 -2
- package/dist/chart/events/event-bus.d.ts +1 -1
- package/dist/chart/events/event-bus.js +74 -2
- package/dist/chart/events/events.d.ts +1 -1
- package/dist/chart/events/events.js +4 -2
- package/dist/chart/inputhandlers/candle-tap.handler.d.ts +1 -1
- package/dist/chart/inputhandlers/candle-tap.handler.js +47 -2
- package/dist/chart/inputhandlers/chart-resize.handler.d.ts +1 -1
- package/dist/chart/inputhandlers/chart-resize.handler.js +99 -2
- package/dist/chart/inputhandlers/cross-event-producer.component.d.ts +1 -1
- package/dist/chart/inputhandlers/cross-event-producer.component.js +68 -2
- package/dist/chart/inputhandlers/hover-producer.component.d.ts +3 -3
- package/dist/chart/inputhandlers/hover-producer.component.js +229 -2
- package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +3 -3
- package/dist/chart/inputhandlers/main-canvas-touch.handler.js +81 -2
- package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +1 -1
- package/dist/chart/inputlisteners/canvas-input-listener.component.js +630 -2
- package/dist/chart/model/baseline.model.d.ts +1 -1
- package/dist/chart/model/baseline.model.js +89 -2
- package/dist/chart/model/bounds.model.d.ts +1 -1
- package/dist/chart/model/bounds.model.js +2 -2
- package/dist/chart/model/candle-hover.d.ts +1 -1
- package/dist/chart/model/candle-hover.js +71 -2
- package/dist/chart/model/candle-series-high-low.provider.d.ts +1 -1
- package/dist/chart/model/candle-series-high-low.provider.js +46 -2
- package/dist/chart/model/candle-series.model.d.ts +4 -4
- package/dist/chart/model/candle-series.model.js +246 -2
- package/dist/chart/model/candle.model.d.ts +1 -1
- package/dist/chart/model/candle.model.js +70 -2
- package/dist/chart/model/canvas.model.d.ts +1 -1
- package/dist/chart/model/canvas.model.js +229 -2
- package/dist/chart/model/chart-base-element.d.ts +1 -1
- package/dist/chart/model/chart-base-element.js +130 -2
- package/dist/chart/model/compare-series-hover.d.ts +1 -1
- package/dist/chart/model/compare-series-hover.js +26 -2
- package/dist/chart/model/data-series-view.d.ts +6 -6
- package/dist/chart/model/data-series-view.js +112 -2
- package/dist/chart/model/data-series.config.d.ts +1 -1
- package/dist/chart/model/data-series.config.js +15 -2
- package/dist/chart/model/data-series.model.d.ts +5 -5
- package/dist/chart/model/data-series.model.js +282 -2
- package/dist/chart/model/date-time.formatter.d.ts +1 -1
- package/dist/chart/model/date-time.formatter.js +152 -2
- package/dist/chart/model/hit-test-canvas.model.d.ts +2 -2
- package/dist/chart/model/hit-test-canvas.model.js +257 -2
- package/dist/chart/model/main-candle-series.model.d.ts +2 -2
- package/dist/chart/model/main-candle-series.model.js +30 -2
- package/dist/chart/model/scale.model.d.ts +3 -2
- package/dist/chart/model/scale.model.js +317 -2
- package/dist/chart/model/scaling/auto-scale.model.d.ts +1 -1
- package/dist/chart/model/scaling/auto-scale.model.js +98 -2
- package/dist/chart/model/scaling/constrait.functions.d.ts +1 -1
- package/dist/chart/model/scaling/constrait.functions.js +62 -2
- package/dist/chart/model/scaling/lock-ratio.model.d.ts +1 -1
- package/dist/chart/model/scaling/lock-ratio.model.js +18 -2
- package/dist/chart/model/scaling/move-chart.functions.d.ts +1 -1
- package/dist/chart/model/scaling/move-chart.functions.js +23 -2
- package/dist/chart/model/scaling/viewport.model.d.ts +3 -3
- package/dist/chart/model/scaling/viewport.model.js +280 -2
- package/dist/chart/model/scaling/x-zooming.functions.d.ts +1 -1
- package/dist/chart/model/scaling/x-zooming.functions.js +36 -2
- package/dist/chart/model/time-zone.model.d.ts +1 -1
- package/dist/chart/model/time-zone.model.js +110 -2
- package/dist/chart/model/visual-candle.d.ts +1 -1
- package/dist/chart/model/visual-candle.js +135 -2
- package/dist/chart/utils/__tests__/array.utils.test.d.ts +1 -1
- package/dist/chart/utils/__tests__/array.utils.test.js +136 -2
- package/dist/chart/utils/{perfomance/debounce.utils.js → __tests__/math.utils.test.d.ts} +2 -2
- package/dist/chart/utils/__tests__/math.utils.test.js +19 -0
- package/dist/chart/utils/__tests__/object.utils.test.d.ts +1 -1
- package/dist/chart/utils/__tests__/object.utils.test.js +12 -2
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.d.ts +1 -1
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.js +30 -2
- package/dist/chart/utils/array.utils.d.ts +2 -2
- package/dist/chart/utils/array.utils.js +270 -2
- package/dist/chart/utils/auto-period-detector.utils.d.ts +1 -1
- package/dist/chart/utils/auto-period-detector.utils.js +40 -2
- package/dist/chart/utils/candles-generator-ts.utils.d.ts +1 -1
- package/dist/chart/utils/candles-generator-ts.utils.js +21 -2
- package/dist/chart/utils/candles-generator.utils.d.ts +1 -1
- package/dist/chart/utils/candles-generator.utils.js +162 -2
- package/dist/chart/utils/candles.utils.d.ts +1 -1
- package/dist/chart/utils/candles.utils.js +43 -2
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.d.ts +1 -1
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.js +145 -2
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.d.ts +1 -1
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.js +52 -2
- package/dist/chart/utils/canvas/canvas-text-functions.utils.d.ts +1 -1
- package/dist/chart/utils/canvas/canvas-text-functions.utils.js +157 -2
- package/dist/chart/utils/color.utils.d.ts +1 -1
- package/dist/chart/utils/color.utils.js +32 -2
- package/dist/chart/utils/device/browser.utils.d.ts +1 -1
- package/dist/chart/utils/device/browser.utils.js +11 -2
- package/dist/chart/utils/device/device-detector.utils.d.ts +1 -1
- package/dist/chart/utils/device/device-detector.utils.js +25 -2
- package/dist/chart/utils/device/device-pixel-ratio.utils.d.ts +1 -1
- package/dist/chart/utils/device/device-pixel-ratio.utils.js +22 -2
- package/dist/chart/utils/device/touchpad.utils.d.ts +1 -1
- package/dist/chart/utils/device/touchpad.utils.js +92 -2
- package/dist/chart/utils/dom.utils.d.ts +1 -1
- package/dist/chart/utils/dom.utils.js +16 -2
- package/dist/chart/utils/function.utils.d.ts +1 -1
- package/dist/chart/utils/function.utils.js +17 -2
- package/dist/chart/utils/linkedList.utils.d.ts +28 -0
- package/dist/chart/utils/linkedList.utils.js +138 -0
- package/dist/chart/utils/math.utils.d.ts +1 -1
- package/dist/chart/utils/math.utils.js +116 -2
- package/dist/chart/utils/merge.utils.d.ts +1 -1
- package/dist/chart/utils/merge.utils.js +57 -2
- package/dist/chart/utils/object.utils.d.ts +1 -1
- package/dist/chart/utils/object.utils.js +44 -2
- package/dist/chart/utils/{perfomance → performance}/animation-frame-cache.utils.d.ts +1 -1
- package/dist/chart/utils/performance/animation-frame-cache.utils.js +77 -0
- package/dist/chart/utils/{perfomance → performance}/debounce.utils.d.ts +1 -1
- package/dist/chart/utils/performance/debounce.utils.js +12 -0
- package/dist/chart/utils/{perfomance → performance}/memoize.utils.d.ts +1 -1
- package/dist/chart/utils/performance/memoize.utils.js +74 -0
- package/dist/chart/utils/{perfomance → performance}/request-animation-frame-throttle.utils.d.ts +1 -1
- package/dist/chart/utils/performance/request-animation-frame-throttle.utils.js +43 -0
- package/dist/chart/utils/{perfomance → performance}/throttle.utils.d.ts +1 -1
- package/dist/chart/utils/performance/throttle.utils.js +26 -0
- package/dist/chart/utils/price-increments.utils.d.ts +2 -1
- package/dist/chart/utils/price-increments.utils.js +128 -2
- package/dist/chart/utils/uuid.utils.d.ts +1 -1
- package/dist/chart/utils/uuid.utils.js +5 -2
- package/dist/dxchart.min.js +10 -13
- package/dist/index.d.ts +4 -4
- package/dist/index.js +21 -2
- package/package.json +4 -4
- package/dist/chart/utils/perfomance/animation-frame-cache.utils.js +0 -6
- package/dist/chart/utils/perfomance/memoize.utils.js +0 -6
- package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.js +0 -6
- package/dist/chart/utils/perfomance/throttle.utils.js +0 -6
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Merges 2 js objects recursively with all properties.
|
|
8
|
+
* - does not modify base object
|
|
9
|
+
* - can override or only add missing ones
|
|
10
|
+
*
|
|
11
|
+
* @param base - base object to merge data into
|
|
12
|
+
* @param override - object with new data which should be merged
|
|
13
|
+
* @param options - merge options
|
|
14
|
+
* @doc-tags tricky,utility
|
|
15
|
+
*/
|
|
16
|
+
export function merge(base, override, options = DEFAULT_MERGE_OPTIONS) {
|
|
17
|
+
function doMerge(base, override) {
|
|
18
|
+
for (const k in override) {
|
|
19
|
+
if (k in base) {
|
|
20
|
+
if (typeof base[k] === 'object' && base[k] !== null && !Array.isArray(base[k])) {
|
|
21
|
+
doMerge(base[k], override[k]);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// do not merge arrays or functions
|
|
25
|
+
if (options === null || options === void 0 ? void 0 : options.overrideExisting) {
|
|
26
|
+
base[k] = override[k];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
if (options === null || options === void 0 ? void 0 : options.addIfMissing) {
|
|
32
|
+
base[k] = override[k];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return base;
|
|
37
|
+
}
|
|
38
|
+
return doMerge(base, override);
|
|
39
|
+
}
|
|
40
|
+
export function mergeArray(base, override, hashFn, mergeObjects = false) {
|
|
41
|
+
if (!base || !override || override.length === 0) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
override.forEach(o => {
|
|
45
|
+
const hash = hashFn(o);
|
|
46
|
+
const existingIndex = base.findIndex(b => hashFn(b) === hash);
|
|
47
|
+
if (existingIndex === -1) {
|
|
48
|
+
base.push(o);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
if (mergeObjects) {
|
|
52
|
+
// try merging objects in array
|
|
53
|
+
merge(base[existingIndex], o, { overrideExisting: true, addIfMissing: true });
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
base.splice(existingIndex, 1, o);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export const DEFAULT_MERGE_OPTIONS = { overrideExisting: false, addIfMissing: true };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
-
export const cloneUnsafe=
|
|
6
|
+
export const cloneUnsafe = (value) => JSON.parse(JSON.stringify(value));
|
|
7
|
+
export function typedEntries_UNSAFE(obj) {
|
|
8
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
9
|
+
return Object.entries(obj);
|
|
10
|
+
}
|
|
11
|
+
export const findKeyFromValue = (map, mapValue) => {
|
|
12
|
+
for (const [key, value] of Array.from(map.entries())) {
|
|
13
|
+
if (value === mapValue) {
|
|
14
|
+
return key;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export function keys(r) {
|
|
19
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
20
|
+
return Object.keys(r);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Deeply compares two objects
|
|
24
|
+
* @param {*} objA
|
|
25
|
+
* @param {*} objB
|
|
26
|
+
* @returns {Boolean}
|
|
27
|
+
*/
|
|
28
|
+
export function deepEqual(objA, objB) {
|
|
29
|
+
if (Object.is(objA, objB)) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const keysA = Object.keys(objA);
|
|
36
|
+
const keysB = Object.keys(objB);
|
|
37
|
+
if (keysA.length !== keysB.length) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
// Test for A's keys different from B.
|
|
41
|
+
for (let i = 0, len = keysA.length; i < len; i++) {
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
if (!hasOwnProperty.call(objB, keysA[i]) || !deepEqual(objA[keysA[i]], objB[keysA[i]])) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
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 { animationFrameThrottled } from './request-animation-frame-throttle.utils';
|
|
7
|
+
import { uuid } from '../uuid.utils';
|
|
8
|
+
/**
|
|
9
|
+
* Use this as a wrapper to cache calculation results during single animation frame cycle.
|
|
10
|
+
* It is useful if
|
|
11
|
+
* - you have multiple invocations of same code in same animation frame
|
|
12
|
+
* - you're sure that result will always be the same
|
|
13
|
+
*/
|
|
14
|
+
export class AnimationFrameCache {
|
|
15
|
+
constructor(dataProvider, dataUpdatedPredicate = () => true) {
|
|
16
|
+
this.dataProvider = dataProvider;
|
|
17
|
+
this.dataUpdatedPredicate = dataUpdatedPredicate;
|
|
18
|
+
this.calculatedInThisFrame = false;
|
|
19
|
+
this.animFrameId = `anim_cache_${uuid()}`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Calculates or retrieves a cached value.
|
|
23
|
+
* If the value has not been calculated in the current frame, it calculates it by calling the dataProvider function.
|
|
24
|
+
* If the data has been updated, it sets the calculatedInThisFrame flag to true.
|
|
25
|
+
* It also sets a throttled animation frame to reset the calculatedInThisFrame flag to false.
|
|
26
|
+
* If the cache is not null, it returns the cached value, otherwise it calls the dataProvider function and returns its result.
|
|
27
|
+
* @returns {T} The cached or calculated value.
|
|
28
|
+
*/
|
|
29
|
+
calculateOrGet() {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!this.calculatedInThisFrame) {
|
|
32
|
+
this.cache = this.dataProvider();
|
|
33
|
+
if (this.dataUpdatedPredicate()) {
|
|
34
|
+
this.calculatedInThisFrame = true;
|
|
35
|
+
}
|
|
36
|
+
animationFrameThrottled(this.animFrameId, () => {
|
|
37
|
+
this.calculatedInThisFrame = false;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return (_a = this.cache) !== null && _a !== void 0 ? _a : this.dataProvider();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Invalidates the current state and returns the result of the calculateOrGet() method.
|
|
44
|
+
* @returns {T} The result of the calculateOrGet() method.
|
|
45
|
+
*/
|
|
46
|
+
forceCalculateOrGet() {
|
|
47
|
+
this.invalidate();
|
|
48
|
+
return this.calculateOrGet();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Returns the last cached value or undefined if there is no cached value.
|
|
52
|
+
* @returns {T | undefined} The last cached value or undefined.
|
|
53
|
+
*/
|
|
54
|
+
getLastCachedValue() {
|
|
55
|
+
return this.cache;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Updates the cache value with the provided value.
|
|
59
|
+
* @param {T} value - The new value to be set in the cache.
|
|
60
|
+
* @returns {void}
|
|
61
|
+
*/
|
|
62
|
+
updateCacheValue(value) {
|
|
63
|
+
this.cache = value;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Invalidates the cache and sets the calculatedInThisFrame flag to false.
|
|
67
|
+
* @function
|
|
68
|
+
* @name invalidate
|
|
69
|
+
* @memberof ClassName
|
|
70
|
+
* @instance
|
|
71
|
+
* @returns {void}
|
|
72
|
+
*/
|
|
73
|
+
invalidate() {
|
|
74
|
+
this.cache = undefined;
|
|
75
|
+
this.calculatedInThisFrame = false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
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 debounce = (callback, waitFor) => {
|
|
7
|
+
let timeout = 0;
|
|
8
|
+
return (...args) => {
|
|
9
|
+
clearTimeout(timeout);
|
|
10
|
+
timeout = +setTimeout(() => callback(...args), waitFor);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
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
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
7
|
+
export const MEMOIZE_CLEAR_FUNCTION = Symbol('MEMOIZE_CLEAR_FUNCTION');
|
|
8
|
+
/**
|
|
9
|
+
* Memoizes function for passed arguments
|
|
10
|
+
* @doc-tags utility
|
|
11
|
+
*/
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
13
|
+
export function memoize(fn) {
|
|
14
|
+
const storage = {};
|
|
15
|
+
const result = function () {
|
|
16
|
+
const args = Array.prototype.slice.call(arguments);
|
|
17
|
+
const key = serialize(args);
|
|
18
|
+
if (typeof storage[key] === 'undefined') {
|
|
19
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
20
|
+
storage[key] = fn.apply(this, args);
|
|
21
|
+
}
|
|
22
|
+
return storage[key];
|
|
23
|
+
}.bind(this);
|
|
24
|
+
// inject clearer
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
result[MEMOIZE_CLEAR_FUNCTION] = function () {
|
|
27
|
+
const args = Array.prototype.slice.call(arguments);
|
|
28
|
+
const key = serialize(args);
|
|
29
|
+
delete storage[key];
|
|
30
|
+
};
|
|
31
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
export const memoOnce = (E) => (f) => {
|
|
35
|
+
let hasValue = false;
|
|
36
|
+
let cachedR;
|
|
37
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
38
|
+
let cachedArgs = [];
|
|
39
|
+
const update = (args) => {
|
|
40
|
+
cachedR = f(...args);
|
|
41
|
+
hasValue = true;
|
|
42
|
+
cachedArgs = args;
|
|
43
|
+
};
|
|
44
|
+
return (...args) => {
|
|
45
|
+
const length = args.length;
|
|
46
|
+
if (hasValue && length === 0) {
|
|
47
|
+
return cachedR;
|
|
48
|
+
}
|
|
49
|
+
if (!hasValue || cachedArgs.length !== length) {
|
|
50
|
+
update(args);
|
|
51
|
+
return cachedR;
|
|
52
|
+
}
|
|
53
|
+
for (let i = 0; i < length; i++) {
|
|
54
|
+
if (!E.equals(cachedArgs[i], args[i])) {
|
|
55
|
+
update(args);
|
|
56
|
+
return cachedR;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return cachedR;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* @param {Array.<*>} args
|
|
64
|
+
* @returns {String}
|
|
65
|
+
*/
|
|
66
|
+
export function serialize(args) {
|
|
67
|
+
const argsAreValid = args.every(arg => {
|
|
68
|
+
return typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'boolean';
|
|
69
|
+
});
|
|
70
|
+
if (!argsAreValid) {
|
|
71
|
+
throw Error('Arguments to memoized function can only be strings or numbers');
|
|
72
|
+
}
|
|
73
|
+
return JSON.stringify(args);
|
|
74
|
+
}
|
package/dist/chart/utils/{perfomance → performance}/request-animation-frame-throttle.utils.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
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
|
+
let fired = false;
|
|
7
|
+
export let animationFrameId = 0;
|
|
8
|
+
// map is faster than record
|
|
9
|
+
const actions = new Map();
|
|
10
|
+
const priorActions = new Map();
|
|
11
|
+
const animFrame = () => {
|
|
12
|
+
if (!fired) {
|
|
13
|
+
fired = true;
|
|
14
|
+
animationFrameId = requestAnimationFrame(() => {
|
|
15
|
+
priorActions.forEach((action, key) => {
|
|
16
|
+
action();
|
|
17
|
+
priorActions.delete(key);
|
|
18
|
+
});
|
|
19
|
+
actions.forEach((action, key) => {
|
|
20
|
+
action();
|
|
21
|
+
actions.delete(key);
|
|
22
|
+
});
|
|
23
|
+
fired = false;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export const animationFrameThrottled = (name, action) => {
|
|
28
|
+
actions.set(name, action);
|
|
29
|
+
animFrame();
|
|
30
|
+
};
|
|
31
|
+
export const cancelThrottledAnimationFrame = (name) => {
|
|
32
|
+
actions.delete(name);
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Prior actions will be called before regular actions
|
|
36
|
+
* An example of regular action - draw event
|
|
37
|
+
* @param name
|
|
38
|
+
* @param action
|
|
39
|
+
*/
|
|
40
|
+
export const animationFrameThrottledPrior = (name, action) => {
|
|
41
|
+
priorActions.set(name, action);
|
|
42
|
+
animFrame();
|
|
43
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
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 { uuid } from '../uuid.utils';
|
|
7
|
+
import { animationFrameThrottled } from './request-animation-frame-throttle.utils';
|
|
8
|
+
export function throttle(shouldPreventDefault, listener, isSuppressed) {
|
|
9
|
+
let last;
|
|
10
|
+
const animFrameId = uuid();
|
|
11
|
+
function fireLastEvent() {
|
|
12
|
+
const event = last;
|
|
13
|
+
last = void 0;
|
|
14
|
+
if (event) {
|
|
15
|
+
listener(event);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return function (event) {
|
|
19
|
+
const hasEvent = last;
|
|
20
|
+
last = event;
|
|
21
|
+
shouldPreventDefault && event.preventDefault();
|
|
22
|
+
if (!hasEvent && !(typeof isSuppressed === 'function' && isSuppressed())) {
|
|
23
|
+
animationFrameThrottled(animFrameId, fireLastEvent);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
@@ -42,3 +42,4 @@ export declare class PriceIncrementsUtils {
|
|
|
42
42
|
*/
|
|
43
43
|
static validatePriceIncrementsOrPrecisions(data: number[]): boolean;
|
|
44
44
|
}
|
|
45
|
+
export declare const precisionsToIncrement: (price: number, precisions: number[]) => number;
|
|
@@ -1,6 +1,132 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
-
import{
|
|
6
|
+
import { lastOf } from './array.utils';
|
|
7
|
+
import { floor, MathUtils } from './math.utils';
|
|
8
|
+
class PriceIncrementsUtils {
|
|
9
|
+
/**
|
|
10
|
+
* Automatically detects increment of provided value range.
|
|
11
|
+
* Naive algorithm takes 1st mantissa number's :
|
|
12
|
+
* range=124.14 => increment=1
|
|
13
|
+
* range=6300.02931 => increment=10
|
|
14
|
+
* range=0.0018 => increment=0.00001
|
|
15
|
+
*
|
|
16
|
+
* @param valueRange
|
|
17
|
+
* @doc-tags tricky,y-axis
|
|
18
|
+
*/
|
|
19
|
+
static autoDetectIncrementOfValueRange(valueRange) {
|
|
20
|
+
const extent = this.getDigitsInNumber(valueRange);
|
|
21
|
+
if (valueRange === 0) {
|
|
22
|
+
return 0.01;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return Math.pow(10, extent - 3);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets number of digits in number.
|
|
30
|
+
* 20 => 2
|
|
31
|
+
* 100 => 3
|
|
32
|
+
* 7 => 1
|
|
33
|
+
* 1.123 => 1
|
|
34
|
+
* -200 => 3
|
|
35
|
+
* -1234567.00031 => 7
|
|
36
|
+
* 0.0001 = > -4
|
|
37
|
+
* @param x - any number
|
|
38
|
+
*/
|
|
39
|
+
static getDigitsInNumber(x) {
|
|
40
|
+
// eslint-disable-next-line no-bitwise
|
|
41
|
+
const getDigits = (val) => floor(Math.log10((val ^ (val >> 31)) - (val >> 31))) + 1;
|
|
42
|
+
let numberDigitsIntegerPart = getDigits(x);
|
|
43
|
+
if (numberDigitsIntegerPart === 1 && x < 1) {
|
|
44
|
+
numberDigitsIntegerPart = getDigits(x * 10e8) - 9;
|
|
45
|
+
}
|
|
46
|
+
return numberDigitsIntegerPart;
|
|
47
|
+
}
|
|
48
|
+
// Price increment represent array of increment-price couples and trailing increment
|
|
49
|
+
// e.g. [(priceIncrement, price,)* incrementForOtherPrices]
|
|
50
|
+
// [0.01, 1, 0.1, 10, 1] means
|
|
51
|
+
// there are three increments (0.01 for price < 1 ), (0.1 for price < 10), (1 for any other price)
|
|
52
|
+
static getPriceIncrement(price, increments = []) {
|
|
53
|
+
if (!this.validatePriceIncrementsOrPrecisions(increments)) {
|
|
54
|
+
return this.DEFAULT_INCREMENT;
|
|
55
|
+
}
|
|
56
|
+
if (isNaN(price)) {
|
|
57
|
+
return Math.round(increments[0]);
|
|
58
|
+
}
|
|
59
|
+
price = Math.abs(price);
|
|
60
|
+
let i = 1;
|
|
61
|
+
const RELATIVE_EPS = 1e-6;
|
|
62
|
+
while (i < increments.length &&
|
|
63
|
+
price > increments[i] + Math.min(increments[i - 1], increments[i + 1]) * RELATIVE_EPS) {
|
|
64
|
+
i += 2;
|
|
65
|
+
}
|
|
66
|
+
if (i >= increments.length ||
|
|
67
|
+
price < increments[i] - Math.min(increments[i - 1], increments[i + 1]) * RELATIVE_EPS) {
|
|
68
|
+
return increments[i - 1];
|
|
69
|
+
}
|
|
70
|
+
return Math.min(increments[i - 1], increments[i + 1]);
|
|
71
|
+
}
|
|
72
|
+
static getPricePrecision(price, precisions) {
|
|
73
|
+
if (!this.validatePriceIncrementsOrPrecisions(precisions)) {
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
if (isNaN(price)) {
|
|
77
|
+
return Math.round(precisions[0]);
|
|
78
|
+
}
|
|
79
|
+
price = Math.abs(price);
|
|
80
|
+
let i = 1;
|
|
81
|
+
while (i < precisions.length && price > precisions[i]) {
|
|
82
|
+
i += 2;
|
|
83
|
+
}
|
|
84
|
+
return Math.round(precisions[i - 1]);
|
|
85
|
+
}
|
|
86
|
+
static roundPriceToIncrement(price, increments, incrementReferencePrice) {
|
|
87
|
+
const increment = PriceIncrementsUtils.getPriceIncrement(incrementReferencePrice ? incrementReferencePrice : price, increments);
|
|
88
|
+
return MathUtils.roundToNearest(price, increment);
|
|
89
|
+
}
|
|
90
|
+
static computePrecisions(increments) {
|
|
91
|
+
const precisions = [...increments];
|
|
92
|
+
for (let i = 0; i < increments.length; i += 2) {
|
|
93
|
+
precisions[i] = PriceIncrementsUtils.calculatePrecision(increments[i]);
|
|
94
|
+
}
|
|
95
|
+
for (let i = 1; i < increments.length; i += 2) {
|
|
96
|
+
precisions[i] =
|
|
97
|
+
increments[i] + Math.min(increments[i - 1], increments[i + 1]) * PriceIncrementsUtils.RELATIVE_EPS;
|
|
98
|
+
}
|
|
99
|
+
return precisions;
|
|
100
|
+
}
|
|
101
|
+
static calculatePrecision(value) {
|
|
102
|
+
// in case value is a huge number we need to perform normalization so that relative epsilon still works
|
|
103
|
+
let val = value > 1 ? Math.abs(Math.floor(value) - value) : value;
|
|
104
|
+
for (let i = 0; i < PriceIncrementsUtils.MAXIMUM_PRECISION; i++) {
|
|
105
|
+
const round = Math.floor(val + 0.5);
|
|
106
|
+
const eps = Math.abs(val * PriceIncrementsUtils.RELATIVE_EPS);
|
|
107
|
+
if (round >= val - eps && round <= val + eps) {
|
|
108
|
+
return i;
|
|
109
|
+
}
|
|
110
|
+
val *= 10;
|
|
111
|
+
}
|
|
112
|
+
return PriceIncrementsUtils.MAXIMUM_PRECISION;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* checks if the received from feed increments/precisions data is valid to display
|
|
116
|
+
* examples of wrong data: [], [0], not an array
|
|
117
|
+
*/
|
|
118
|
+
static validatePriceIncrementsOrPrecisions(data) {
|
|
119
|
+
return !(data.length === 0 || !Array.isArray(data) || data.findIndex((i) => i !== 0) === -1);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
PriceIncrementsUtils.DEFAULT_INCREMENT = 0.01;
|
|
123
|
+
PriceIncrementsUtils.DEFAULT_PRECISION = 2;
|
|
124
|
+
PriceIncrementsUtils.RELATIVE_EPS = 1e-8;
|
|
125
|
+
PriceIncrementsUtils.MAXIMUM_PRECISION = 10;
|
|
126
|
+
export { PriceIncrementsUtils };
|
|
127
|
+
// TODO review dxFeed precision format
|
|
128
|
+
export const precisionsToIncrement = (price, precisions) => {
|
|
129
|
+
var _a;
|
|
130
|
+
const precision = (_a = lastOf(precisions)) !== null && _a !== void 0 ? _a : 1;
|
|
131
|
+
return Math.pow(10, -precision);
|
|
132
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
-
export function uuid()
|
|
6
|
+
export function uuid() {
|
|
7
|
+
const chr4 = () => Math.random().toString(16).slice(-4);
|
|
8
|
+
return `${chr4() + chr4()}-${chr4()}-${chr4()}-${chr4()}-${chr4() + chr4() + chr4()}`;
|
|
9
|
+
}
|