@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
|
@@ -0,0 +1,62 @@
|
|
|
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 ChartBootstrap from './bootstrap';
|
|
7
|
+
import { BarType, PartialChartConfig } from './chart.config';
|
|
8
|
+
import { CandleSeries } from './components/chart/chart.component';
|
|
9
|
+
import { PaneComponent, YExtentFormatters } from './components/pane/pane.component';
|
|
10
|
+
/**
|
|
11
|
+
* New shiny chart wrapper
|
|
12
|
+
*/
|
|
13
|
+
export declare class Chart extends ChartBootstrap {
|
|
14
|
+
yAxis: import("./components/y_axis/y-axis.component").YAxisComponent;
|
|
15
|
+
xAxis: import("./components/x_axis/x-axis.component").XAxisComponent;
|
|
16
|
+
watermark: import("./components/watermark/water-mark.component").WaterMarkComponent;
|
|
17
|
+
highlights: import("./components/highlights/highlights.component").HighlightsComponent;
|
|
18
|
+
events: import("./components/events/events.component").EventsComponent;
|
|
19
|
+
snapshot: import("./components/snapshot/snapshot.component").SnapshotComponent;
|
|
20
|
+
crosshair: import("./components/cross_tool/cross-tool.component").CrossToolComponent;
|
|
21
|
+
navigationMap: import("./components/navigation_map/navigation-map.component").NavigationMapComponent;
|
|
22
|
+
volumes: import("./components/volumes/volumes.component").VolumesComponent;
|
|
23
|
+
cursors: import("./canvas/cursor.handler").CursorHandler;
|
|
24
|
+
data: import("./components/chart/chart.component").ChartComponent;
|
|
25
|
+
scale: import("./model/scale.model").ScaleModel;
|
|
26
|
+
panning: import("./components/pan/chart-pan.component").ChartPanComponent;
|
|
27
|
+
constructor(element: HTMLElement, config?: PartialChartConfig);
|
|
28
|
+
/**
|
|
29
|
+
* Registers number formatters for pane
|
|
30
|
+
* @param uuid - pane's id
|
|
31
|
+
* @param formatters - object, that contains 3 fileds: 'regular', 'percent', 'logarithmic'.
|
|
32
|
+
* Each filed must have it's own formatter.
|
|
33
|
+
* If 'percent' and 'logarithmic' formatters did not provided, 'regular' will be applied.
|
|
34
|
+
*/
|
|
35
|
+
registerPaneFormatters(uuid: string, formatters: YExtentFormatters): void;
|
|
36
|
+
/**
|
|
37
|
+
* Contains tear-down logic for chart
|
|
38
|
+
* Use when you want to unmount the chart from the host app
|
|
39
|
+
*/
|
|
40
|
+
destroy(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the visibility of the volumes separately and updates the yAxis width.
|
|
43
|
+
* @param {boolean} separate - A boolean value indicating whether to show the volumes separately or not. Default value is false.
|
|
44
|
+
*/
|
|
45
|
+
showSeparateVolumes(separate?: boolean): void;
|
|
46
|
+
setData(data: CandleSeries | CandleSeries[]): void;
|
|
47
|
+
updateData(data: CandleSeries | CandleSeries[]): void;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the auto scale property of the scale model.
|
|
50
|
+
* @param {boolean} auto - A boolean value indicating whether the auto scale is enabled or not. Default value is true.
|
|
51
|
+
*/
|
|
52
|
+
setAutoScale(auto?: boolean): void;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the right-to-left (RTL) configuration of the component.
|
|
55
|
+
*
|
|
56
|
+
* @param {boolean} rtl - A boolean value indicating whether the component should be displayed in RTL mode.
|
|
57
|
+
* @returns {void}
|
|
58
|
+
*/
|
|
59
|
+
setRtl(rtl: boolean): void;
|
|
60
|
+
setChartType(type: BarType): void;
|
|
61
|
+
createPane(): PaneComponent;
|
|
62
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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 ChartBootstrap from './bootstrap';
|
|
7
|
+
/**
|
|
8
|
+
* New shiny chart wrapper
|
|
9
|
+
*/
|
|
10
|
+
export class Chart extends ChartBootstrap {
|
|
11
|
+
constructor(element, config = {}) {
|
|
12
|
+
super(element, config);
|
|
13
|
+
this.yAxis = this.yAxisComponent;
|
|
14
|
+
this.xAxis = this.xAxisComponent;
|
|
15
|
+
this.watermark = this.watermarkComponent;
|
|
16
|
+
this.highlights = this.highlightsComponent;
|
|
17
|
+
this.events = this.eventsComponent;
|
|
18
|
+
this.snapshot = this.snapshotComponent;
|
|
19
|
+
this.crosshair = this.crossToolComponent;
|
|
20
|
+
this.navigationMap = this.navigationMapComponent;
|
|
21
|
+
this.volumes = this.volumesComponent;
|
|
22
|
+
this.cursors = this.cursorHandler;
|
|
23
|
+
this.data = this.chartComponent;
|
|
24
|
+
this.scale = this.scaleModel;
|
|
25
|
+
this.panning = this.chartPanComponent;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Registers number formatters for pane
|
|
29
|
+
* @param uuid - pane's id
|
|
30
|
+
* @param formatters - object, that contains 3 fileds: 'regular', 'percent', 'logarithmic'.
|
|
31
|
+
* Each filed must have it's own formatter.
|
|
32
|
+
* If 'percent' and 'logarithmic' formatters did not provided, 'regular' will be applied.
|
|
33
|
+
*/
|
|
34
|
+
registerPaneFormatters(uuid, formatters) {
|
|
35
|
+
var _a;
|
|
36
|
+
(_a = this.paneManager.panes[uuid]) === null || _a === void 0 ? void 0 : _a.setPaneValueFormatters(formatters);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Contains tear-down logic for chart
|
|
40
|
+
* Use when you want to unmount the chart from the host app
|
|
41
|
+
*/
|
|
42
|
+
destroy() {
|
|
43
|
+
this.bus.setMuted(true);
|
|
44
|
+
this.chartComponents.forEach(c => c.disable());
|
|
45
|
+
this.parentElement.childNodes.forEach(n => n.remove());
|
|
46
|
+
this.parentElement.style.width = '';
|
|
47
|
+
this.parentElement.style.height = '';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sets the visibility of the volumes separately and updates the yAxis width.
|
|
51
|
+
* @param {boolean} separate - A boolean value indicating whether to show the volumes separately or not. Default value is false.
|
|
52
|
+
*/
|
|
53
|
+
showSeparateVolumes(separate = false) {
|
|
54
|
+
if (this.volumes) {
|
|
55
|
+
this.volumes.setShowVolumesSeparatly(separate);
|
|
56
|
+
this.canvasBoundsContainer.updateYAxisWidths();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
setData(data) {
|
|
60
|
+
if (Array.isArray(data)) {
|
|
61
|
+
if (data.length === 0) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const [mainSeries, ...restSeries] = data;
|
|
65
|
+
this.chartComponent.setAllSeries(mainSeries, restSeries);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this.chartComponent.setMainSeries(data);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
updateData(data) {
|
|
72
|
+
if (Array.isArray(data)) {
|
|
73
|
+
if (data.length === 0) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const [mainSeries, ...restSeries] = data;
|
|
77
|
+
this.chartComponent.updateAllSeries(mainSeries, restSeries);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
this.chartComponent.updateAllSeries(data);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Sets the auto scale property of the scale model.
|
|
85
|
+
* @param {boolean} auto - A boolean value indicating whether the auto scale is enabled or not. Default value is true.
|
|
86
|
+
*/
|
|
87
|
+
setAutoScale(auto = true) {
|
|
88
|
+
this.scale.autoScale(auto);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Sets the right-to-left (RTL) configuration of the component.
|
|
92
|
+
*
|
|
93
|
+
* @param {boolean} rtl - A boolean value indicating whether the component should be displayed in RTL mode.
|
|
94
|
+
* @returns {void}
|
|
95
|
+
*/
|
|
96
|
+
setRtl(rtl) {
|
|
97
|
+
this.config.rtl = rtl;
|
|
98
|
+
this.bus.fireDraw();
|
|
99
|
+
}
|
|
100
|
+
setChartType(type) {
|
|
101
|
+
this.chartComponent.setChartType(type);
|
|
102
|
+
}
|
|
103
|
+
createPane() {
|
|
104
|
+
return this.paneManager.createPane();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -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
|
*/
|
|
@@ -12,11 +12,11 @@ import { ChartModel } from './chart.model';
|
|
|
12
12
|
* @param scaleModel
|
|
13
13
|
* @doc-tags scaling,viewport
|
|
14
14
|
*/
|
|
15
|
-
export declare const createBasicScaleViewportTransformer: (
|
|
15
|
+
export declare const createBasicScaleViewportTransformer: (scale: ScaleModel) => (visualCandleSource: VisualCandle[]) => void;
|
|
16
16
|
/**
|
|
17
17
|
* Moves the viewport between 2 timestamps.
|
|
18
18
|
* @param scaleModel
|
|
19
19
|
* @param chartModel
|
|
20
20
|
* @param canvasAnimationContainer
|
|
21
21
|
*/
|
|
22
|
-
export declare const createTimeFrameViewportTransformer: (
|
|
22
|
+
export declare const createTimeFrameViewportTransformer: (scale: ScaleModel, chartModel: ChartModel) => (timeframe: [Timestamp, Timestamp], zoomIn?: boolean | null) => void;
|
|
@@ -1,6 +1,36 @@
|
|
|
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
|
+
* Calculates the initial viewport.
|
|
8
|
+
* @param scaleModel
|
|
9
|
+
* @doc-tags scaling,viewport
|
|
10
|
+
*/
|
|
11
|
+
export const createBasicScaleViewportTransformer = (scale) => (visualCandleSource) => {
|
|
12
|
+
if (visualCandleSource.length !== 0) {
|
|
13
|
+
const vCandles = visualCandleSource.slice(Math.max(visualCandleSource.length - scale.state.defaultViewportItems, 0));
|
|
14
|
+
const startCandle = vCandles[0];
|
|
15
|
+
const endCandle = vCandles[vCandles.length - 1];
|
|
16
|
+
scale.setXScale(startCandle.startUnit, endCandle.startUnit + endCandle.width + scale.offsets.right);
|
|
17
|
+
scale.doAutoScale(true);
|
|
18
|
+
scale.recalculateZoomXYRatio();
|
|
19
|
+
scale.fireChanged();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Moves the viewport between 2 timestamps.
|
|
24
|
+
* @param scaleModel
|
|
25
|
+
* @param chartModel
|
|
26
|
+
* @param canvasAnimationContainer
|
|
27
|
+
*/
|
|
28
|
+
export const createTimeFrameViewportTransformer = (scale, chartModel) => (timeframe, zoomIn = null) => {
|
|
29
|
+
const [firstTimestamp, lastTimestamp] = timeframe;
|
|
30
|
+
const xStart = chartModel.candleFromTimestamp(firstTimestamp).startUnit;
|
|
31
|
+
const xEnd = chartModel.candleFromTimestamp(lastTimestamp).startUnit;
|
|
32
|
+
const additionalAnimationWidth = zoomIn === null ? 0 : chartModel.mainCandleSeries.meanCandleWidth * 2;
|
|
33
|
+
const animationEffectXStart = zoomIn ? xStart - additionalAnimationWidth : xStart + additionalAnimationWidth;
|
|
34
|
+
const animationEffectXEnd = zoomIn ? xEnd + additionalAnimationWidth : xEnd - additionalAnimationWidth;
|
|
35
|
+
scale.setXScale(animationEffectXStart, animationEffectXEnd);
|
|
36
|
+
};
|
|
@@ -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,20 @@
|
|
|
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{hollowDirection
|
|
6
|
+
import { hollowDirection, nameDirection } from '../../model/candle.model';
|
|
7
|
+
import VisualCandle from '../../model/visual-candle';
|
|
8
|
+
export const defaultCandleTransformer = (candle, { x, width, activeCandle }) => new VisualCandle(x, width, candle.open, candle.close, candle.hi, candle.lo, nameDirection(candle.open, candle.close), candle, true, getCandleIsActive(candle, activeCandle));
|
|
9
|
+
export const hollowCandleTransformer = (candle, { x, width, activeCandle, prevCandle }) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return new VisualCandle(x, width, candle.open, candle.close, candle.hi, candle.lo, hollowDirection((_a = prevCandle === null || prevCandle === void 0 ? void 0 : prevCandle.close) !== null && _a !== void 0 ? _a : candle.close, candle.close), candle, true, getCandleIsActive(candle, activeCandle), candle.close > candle.open);
|
|
12
|
+
};
|
|
13
|
+
export const trendCandleTransformer = (candle, { x, width, activeCandle, prevCandle }) => {
|
|
14
|
+
var _a;
|
|
15
|
+
return new VisualCandle(x, width, candle.open, candle.close, candle.hi, candle.lo, nameDirection((_a = prevCandle === null || prevCandle === void 0 ? void 0 : prevCandle.close) !== null && _a !== void 0 ? _a : candle.close, candle.close), candle, true, getCandleIsActive(candle, activeCandle), candle.close > candle.open);
|
|
16
|
+
};
|
|
17
|
+
export const getCandleIsActive = (candle, activeCandle) => {
|
|
18
|
+
const isActive = activeCandle && activeCandle.idx === candle.idx;
|
|
19
|
+
return isActive !== null && isActive !== void 0 ? isActive : false;
|
|
20
|
+
};
|
|
@@ -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,7 @@
|
|
|
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{BASIC_CANDLE_WIDTH
|
|
6
|
+
import { BASIC_CANDLE_WIDTH } from '../../model/candle.model';
|
|
7
|
+
export const calculateCandleWidth = () => BASIC_CANDLE_WIDTH;
|
|
@@ -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,49 @@
|
|
|
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{finite
|
|
6
|
+
import { finite } from '../../utils/math.utils';
|
|
7
|
+
/**
|
|
8
|
+
* In the early days of Futures contract there is no much trading,
|
|
9
|
+
* so there is not enough information to build a candle: only Open/Close value available.
|
|
10
|
+
* In this case Daily candle, which we receive, must be completed to full OHLC with equal values.
|
|
11
|
+
*/
|
|
12
|
+
export const prepareCandle = (candle) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const settlementPrice = finite(candle.close, candle.open, candle.hi, candle.lo);
|
|
15
|
+
if (!isFinite(settlementPrice)) {
|
|
16
|
+
throw new Error('Received candle without any price');
|
|
17
|
+
}
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
const preparedCandleHi = finite(candle.hi, Math.max(candle.open, candle.close), settlementPrice);
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
const preparedCandleLo = finite(candle.lo, Math.min(candle.open, candle.close), settlementPrice);
|
|
22
|
+
const preparedCandleOpen = finite(candle.open, candle.lo, settlementPrice);
|
|
23
|
+
const preparedCandleClose = finite(candle.close, candle.hi, settlementPrice);
|
|
24
|
+
return {
|
|
25
|
+
hi: preparedCandleHi,
|
|
26
|
+
lo: preparedCandleLo,
|
|
27
|
+
open: preparedCandleOpen,
|
|
28
|
+
close: preparedCandleClose,
|
|
29
|
+
timestamp: candle.timestamp,
|
|
30
|
+
volume: (_a = candle.volume) !== null && _a !== void 0 ? _a : 0,
|
|
31
|
+
expansion: candle.expansion,
|
|
32
|
+
idx: candle.idx,
|
|
33
|
+
impVolatility: candle.impVolatility,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Adds index to candles according to their array index.
|
|
38
|
+
* @param candles
|
|
39
|
+
*/
|
|
40
|
+
export const reindexCandles = (candles) => {
|
|
41
|
+
for (let i = 0; i < candles.length; ++i) {
|
|
42
|
+
candles[i].idx = i;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export const deleteCandlesIndex = (candles) => {
|
|
46
|
+
candles.forEach(candle => {
|
|
47
|
+
candle.idx = undefined;
|
|
48
|
+
});
|
|
49
|
+
};
|
|
@@ -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
|
*/
|
|
@@ -39,7 +39,7 @@ export interface ChartWheelEvent {
|
|
|
39
39
|
export declare class ChartAreaPanHandler extends ChartBaseElement {
|
|
40
40
|
private bus;
|
|
41
41
|
private config;
|
|
42
|
-
private
|
|
42
|
+
private scale;
|
|
43
43
|
private mainCanvasParent;
|
|
44
44
|
private canvasInputListener;
|
|
45
45
|
private canvasBoundsContainer;
|
|
@@ -50,7 +50,7 @@ export declare class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
50
50
|
xDraggedCandlesDelta: number;
|
|
51
51
|
lastXStart: number;
|
|
52
52
|
wheelTrottleTime: number;
|
|
53
|
-
constructor(bus: EventBus, config: FullChartConfig,
|
|
53
|
+
constructor(bus: EventBus, config: FullChartConfig, scale: ScaleModel, mainCanvasParent: Element, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, canvasAnimation: CanvasAnimation, chartPanComponent: ChartPanComponent);
|
|
54
54
|
/**
|
|
55
55
|
* It observes the wheel event on all panes of the canvas and throttles it to the specified time.
|
|
56
56
|
* It then calculates the zoom sensitivity based on whether the event was triggered by a touchpad or not.
|
|
@@ -74,7 +74,7 @@ export declare class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
74
74
|
* @param {HitBoundsTest} hitTest - The hit test of the pane.
|
|
75
75
|
* @returns {DragNDropYComponent} - The drag and drop component for panning the chart along the Y-axis.
|
|
76
76
|
*/
|
|
77
|
-
registerChartYPanHandler(
|
|
77
|
+
registerChartYPanHandler(scale: ScaleModel, hitTest: HitBoundsTest): DragNDropYComponent;
|
|
78
78
|
private onXDragStart;
|
|
79
79
|
private onXDragTick;
|
|
80
80
|
}
|
|
@@ -1,6 +1,202 @@
|
|
|
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 { merge } from 'rxjs';
|
|
7
|
+
import { throttleTime } from 'rxjs/operators';
|
|
8
|
+
import { VIEWPORT_ANIMATION_ID } from '../../animation/canvas-animation';
|
|
9
|
+
import { CanvasElement } from '../../canvas/canvas-bounds-container';
|
|
10
|
+
import { MainCanvasTouchHandler } from '../../inputhandlers/main-canvas-touch.handler';
|
|
11
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
12
|
+
import { pixelsToUnits } from '../../model/scaling/viewport.model';
|
|
13
|
+
import { deviceDetector } from '../../utils/device/device-detector.utils';
|
|
14
|
+
import { getTouchpadSensitivity, touchpadDetector } from '../../utils/device/touchpad.utils';
|
|
15
|
+
import { DragNDropXComponent } from '../dran-n-drop_helper/drag-n-drop-x.component';
|
|
16
|
+
import { DragNDropYComponent } from '../dran-n-drop_helper/drag-n-drop-y.component';
|
|
17
|
+
/**
|
|
18
|
+
* ChartAreaPanHandler is a class that handles the panning and zooming of the chart area.
|
|
19
|
+
* It extends the ChartBaseElement class and has the following properties:
|
|
20
|
+
* @property {MainCanvasTouchHandler} touchHandler - An instance of the MainCanvasTouchHandler class.
|
|
21
|
+
* @property {Point} currentPoint - An object that represents the current point of the chart area.
|
|
22
|
+
* @property {number} xDraggedCandlesDelta - A number that represents the number of candles delta changed during X dragging.
|
|
23
|
+
* @property {number} lastXStart - A number that represents the last X start position.
|
|
24
|
+
* @property {number} lastYStart - A number that represents the last Y start position.
|
|
25
|
+
* @property {number} wheelTrottleTime - A number that represents the time in ms for the wheel throttle.
|
|
26
|
+
* @constructor
|
|
27
|
+
* @param {EventBus} bus - An instance of the EventBus class.
|
|
28
|
+
* @param {FullChartConfig} config - An instance of the FullChartConfig class.
|
|
29
|
+
* @param {ScaleModel} scaleModel - An instance of the ScaleModel class.
|
|
30
|
+
* @param {Element} mainCanvasParent - The parent element of the main canvas.
|
|
31
|
+
* @param {CanvasInputListenerComponent} canvasInputListener - An instance of the CanvasInputListenerComponent class.
|
|
32
|
+
* @param {CanvasBoundsContainer} canvasBoundsContainer - An instance of the CanvasBoundsContainer class.
|
|
33
|
+
* @param {CanvasAnimation} canvasAnimation - An instance of the CanvasAnimation class.
|
|
34
|
+
* @param {ChartPanComponent} chartPanComponent - An instance of the ChartPanComponent class.
|
|
35
|
+
|
|
36
|
+
*/
|
|
37
|
+
export class ChartAreaPanHandler extends ChartBaseElement {
|
|
38
|
+
constructor(bus, config, scale, mainCanvasParent, canvasInputListener, canvasBoundsContainer, canvasAnimation, chartPanComponent) {
|
|
39
|
+
super();
|
|
40
|
+
this.bus = bus;
|
|
41
|
+
this.config = config;
|
|
42
|
+
this.scale = scale;
|
|
43
|
+
this.mainCanvasParent = mainCanvasParent;
|
|
44
|
+
this.canvasInputListener = canvasInputListener;
|
|
45
|
+
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
46
|
+
this.canvasAnimation = canvasAnimation;
|
|
47
|
+
this.chartPanComponent = chartPanComponent;
|
|
48
|
+
this.currentPoint = { x: 0, y: 0 };
|
|
49
|
+
// number of candles delta changed during X dragging: 1, 5 or -3 for ex.
|
|
50
|
+
this.xDraggedCandlesDelta = 0;
|
|
51
|
+
this.lastXStart = 0;
|
|
52
|
+
this.wheelTrottleTime = 15; // in ms
|
|
53
|
+
/**
|
|
54
|
+
* It observes the wheel event on all panes of the canvas and throttles it to the specified time.
|
|
55
|
+
* It then calculates the zoom sensitivity based on whether the event was triggered by a touchpad or not.
|
|
56
|
+
* If the zoomToCursor configuration is set to true, it calculates the viewport percentage based on the zoomCanvasOffset and canvas width.
|
|
57
|
+
* It then calls the zoomXToPercent method of the scaleModel to zoom in or out based on the zoomIn parameter.
|
|
58
|
+
* If the zoomToCursor configuration is set to false, it calls the zoomXToEnd method of the scaleModel to zoom in or out based on the zoomIn parameter.
|
|
59
|
+
* Finally, it fires the draw event of the bus to redraw the canvas.
|
|
60
|
+
* @param {WheelEvent} e - Wheel event
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
this.zoomXHandler = (e) => {
|
|
64
|
+
const isTouchpad = touchpadDetector(e);
|
|
65
|
+
const zoomIn = e.deltaY < 0;
|
|
66
|
+
const zoomSensitivity = isTouchpad ? getTouchpadSensitivity(this.config) : this.config.scale.zoomSensitivity;
|
|
67
|
+
if (this.config.scale.zoomToCursor) {
|
|
68
|
+
const b = this.canvasBoundsContainer.getBounds(CanvasElement.CANVAS);
|
|
69
|
+
const canvasW = b.width;
|
|
70
|
+
const zoomCanvasOffset = e.offsetX;
|
|
71
|
+
// 0.5 - zoom middle exactly
|
|
72
|
+
// 0..0.5 - zoom to left side
|
|
73
|
+
// 0.5..1 - zoom to right side
|
|
74
|
+
const viewportPercent = zoomCanvasOffset / canvasW;
|
|
75
|
+
this.scale.zoomXToPercent(viewportPercent, zoomIn, false, zoomSensitivity);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.scale.zoomXToEnd(zoomIn, zoomSensitivity);
|
|
79
|
+
}
|
|
80
|
+
this.bus.fireDraw();
|
|
81
|
+
};
|
|
82
|
+
this.onXDragStart = () => {
|
|
83
|
+
this.canvasAnimation.forceStopAnimation(VIEWPORT_ANIMATION_ID);
|
|
84
|
+
this.xDraggedCandlesDelta = 0;
|
|
85
|
+
this.lastXStart = this.scale.xStart;
|
|
86
|
+
};
|
|
87
|
+
this.onXDragTick = (dragInfo) => {
|
|
88
|
+
const { delta: absoluteXDelta } = dragInfo;
|
|
89
|
+
this.currentPoint.x = absoluteXDelta;
|
|
90
|
+
const unitsDelta = pixelsToUnits(absoluteXDelta, this.scale.zoomX);
|
|
91
|
+
this.scale.moveXStart(this.lastXStart - unitsDelta);
|
|
92
|
+
this.bus.fireDraw();
|
|
93
|
+
};
|
|
94
|
+
this.touchHandler = new MainCanvasTouchHandler(this.scale, this.canvasInputListener, this.mainCanvasParent);
|
|
95
|
+
const allPanesHitTest = this.canvasBoundsContainer.getBoundsHitTest(CanvasElement.ALL_PANES);
|
|
96
|
+
//#region drag-n-drop logic
|
|
97
|
+
const dragNDropXComponent = new DragNDropXComponent(allPanesHitTest, {
|
|
98
|
+
onDragStart: this.onXDragStart,
|
|
99
|
+
onDragTick: this.onXDragTick,
|
|
100
|
+
}, this.canvasInputListener, this.chartPanComponent, {
|
|
101
|
+
disableChartPanning: false,
|
|
102
|
+
});
|
|
103
|
+
this.addChildEntity(dragNDropXComponent);
|
|
104
|
+
//#endregion
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* This method is used to activate the zoom functionality of the canvas. It extends the doActivate method of the parent class.
|
|
108
|
+
* @protected
|
|
109
|
+
* @returns {void}
|
|
110
|
+
*/
|
|
111
|
+
doActivate() {
|
|
112
|
+
super.doActivate();
|
|
113
|
+
//#region hit tests
|
|
114
|
+
const allPanesHitTest = this.canvasBoundsContainer.getBoundsHitTest(CanvasElement.ALL_PANES);
|
|
115
|
+
//#endregion
|
|
116
|
+
this.addRxSubscription(merge(this.canvasInputListener.observeWheel(allPanesHitTest), this.canvasInputListener.observePinch(allPanesHitTest))
|
|
117
|
+
.pipe(throttleTime(this.wheelTrottleTime, undefined, { trailing: true, leading: true }))
|
|
118
|
+
.subscribe(this.zoomXHandler));
|
|
119
|
+
this.addRxSubscription(this.canvasInputListener
|
|
120
|
+
.observeScrollGesture()
|
|
121
|
+
.pipe(throttleTime(this.wheelTrottleTime, undefined, { trailing: true, leading: true }))
|
|
122
|
+
.subscribe((e) => {
|
|
123
|
+
let direction = -1;
|
|
124
|
+
const device = deviceDetector();
|
|
125
|
+
if (device === 'apple' || device === 'mobile') {
|
|
126
|
+
direction = 1;
|
|
127
|
+
}
|
|
128
|
+
let deltaX = 0;
|
|
129
|
+
let deltaY = 0;
|
|
130
|
+
deltaX += e.deltaX * direction;
|
|
131
|
+
deltaY += e.deltaY * -direction;
|
|
132
|
+
if (deltaX !== 0 && Math.abs(deltaX) > Math.abs(deltaY)) {
|
|
133
|
+
const unitsDelta = pixelsToUnits(deltaX, this.scale.zoomX);
|
|
134
|
+
this.scale.moveXStart(this.scale.xStart - unitsDelta);
|
|
135
|
+
}
|
|
136
|
+
else if (deltaY !== 0 && Math.abs(deltaY) > Math.abs(deltaX)) {
|
|
137
|
+
this.zoomXHandler(e);
|
|
138
|
+
}
|
|
139
|
+
this.bus.fireDraw();
|
|
140
|
+
}));
|
|
141
|
+
this.addRxSubscription(this.chartPanComponent.chartBaseModel.dataPrependSubject
|
|
142
|
+
.asObservable()
|
|
143
|
+
.subscribe(({ prependedCandlesWidth }) => {
|
|
144
|
+
this.lastXStart += prependedCandlesWidth;
|
|
145
|
+
}));
|
|
146
|
+
this.touchHandler.activate();
|
|
147
|
+
this.addSubscription(this.touchHandler.deactivate.bind(this.touchHandler));
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Registers a handler for panning the chart along the Y-axis.
|
|
151
|
+
* @param {ScaleModel} scaleModel - The scale model of the extent.
|
|
152
|
+
* @param {HitBoundsTest} hitTest - The hit test of the pane.
|
|
153
|
+
* @returns {DragNDropYComponent} - The drag and drop component for panning the chart along the Y-axis.
|
|
154
|
+
*/
|
|
155
|
+
registerChartYPanHandler(scale, hitTest) {
|
|
156
|
+
// we can have multiple extents which can have different yStarts, so we need to store last yStart for each extent
|
|
157
|
+
let lastYStart = scale.yStart;
|
|
158
|
+
// disable all pan handlers when hover data series
|
|
159
|
+
const onYDragStart = () => {
|
|
160
|
+
this.canvasAnimation.forceStopAnimation(VIEWPORT_ANIMATION_ID);
|
|
161
|
+
this.currentPoint = { x: 0, y: 0 };
|
|
162
|
+
lastYStart = scale.yStart;
|
|
163
|
+
};
|
|
164
|
+
const onYDragTick = (dragInfo) => {
|
|
165
|
+
const { delta: absoluteDelta } = dragInfo;
|
|
166
|
+
this.currentPoint.y = absoluteDelta;
|
|
167
|
+
if (scale.state.auto) {
|
|
168
|
+
if (shouldDisableAutoScale(this.currentPoint, scale.state.autoScaleDisableOnDrag)) {
|
|
169
|
+
scale.autoScale(false);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
const unitsDelta = pixelsToUnits(scale.state.inverse ? -absoluteDelta : absoluteDelta, scale.zoomY);
|
|
174
|
+
scale.moveYStart(lastYStart + unitsDelta);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const dragNDropYComponent = new DragNDropYComponent(hitTest, {
|
|
178
|
+
onDragTick: onYDragTick,
|
|
179
|
+
onDragStart: onYDragStart,
|
|
180
|
+
}, this.canvasInputListener, this.chartPanComponent, {
|
|
181
|
+
disableChartPanning: false,
|
|
182
|
+
});
|
|
183
|
+
this.addChildEntity(dragNDropYComponent);
|
|
184
|
+
return dragNDropYComponent;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* This function calculates angle between current point and point(0, 0), and compares the result with config values
|
|
189
|
+
* @param point
|
|
190
|
+
* @param config
|
|
191
|
+
*
|
|
192
|
+
* @doc-tags chart-core,auto-scale,y-axis
|
|
193
|
+
*/
|
|
194
|
+
export const shouldDisableAutoScale = (point, config) => {
|
|
195
|
+
if (!config.enabled) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
const absY = Math.abs(point.y);
|
|
199
|
+
const lenProduct = Math.pow((Math.pow(Math.abs(point.x), 2) + Math.pow(absY, 2)), 0.5);
|
|
200
|
+
const angle = Math.abs(Math.acos(absY / lenProduct));
|
|
201
|
+
return absY > config.yDiff && angle < config.edgeAngle;
|
|
202
|
+
};
|
|
@@ -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
|
*/
|