@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,337 @@
|
|
|
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{unitToPixels
|
|
6
|
+
import { unitToPixels } from '../../model/scaling/viewport.model';
|
|
7
|
+
import { cloneUnsafe, typedEntries_UNSAFE } from '../../utils/object.utils';
|
|
8
|
+
import { fakeVisualCandle } from '../chart/fake-candles';
|
|
9
|
+
import { parseTimeFormatsFromKey } from './time/parser/time-formats-parser.functions';
|
|
10
|
+
import { filterMapGroupedLabelsByCoverUpLevel, getWeightFromTimeFormat, groupLabelsByWeight, overlappingPredicate, } from './time/x-axis-weights.functions';
|
|
11
|
+
import { generateWeightsMapForConfig, mapCandlesToWeightedPoints, } from './time/x-axis-weights.generator';
|
|
12
|
+
export class XAxisTimeLabelsGenerator {
|
|
13
|
+
get labels() {
|
|
14
|
+
return this.getLabelsFromChartType();
|
|
15
|
+
}
|
|
16
|
+
constructor(eventBus, config, chartModel, scale, timeZoneModel, canvasModel) {
|
|
17
|
+
this.eventBus = eventBus;
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.chartModel = chartModel;
|
|
20
|
+
this.scale = scale;
|
|
21
|
+
this.timeZoneModel = timeZoneModel;
|
|
22
|
+
this.canvasModel = canvasModel;
|
|
23
|
+
this.labelsGroupedByWeight = {};
|
|
24
|
+
this.levelsCache = {};
|
|
25
|
+
this.weightToTimeFormatMatcherArray = [];
|
|
26
|
+
this.weightToTimeFormatsDict = {};
|
|
27
|
+
this.extendedLabelsFilterConfig = {
|
|
28
|
+
minute_1: (coverUpLevel) => coverUpLevel >= 2,
|
|
29
|
+
};
|
|
30
|
+
this.formatsByWeightMap = config.components.xAxis.formatsForLabelsConfig;
|
|
31
|
+
const { weightToTimeFormatsDict, weightToTimeFormatMatcherDict } = generateWeightsMapForConfig(this.formatsByWeightMap);
|
|
32
|
+
this.weightToTimeFormatMatcherArray = Object.entries(weightToTimeFormatMatcherDict)
|
|
33
|
+
.map(([k, v]) => [parseInt(k, 10), v])
|
|
34
|
+
.sort(([a], [b]) => b - a);
|
|
35
|
+
this.weightToTimeFormatsDict = weightToTimeFormatsDict;
|
|
36
|
+
}
|
|
37
|
+
getLabelsFromChartType() {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
const labels = (_b = (_a = this.weightedCache) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : [];
|
|
40
|
+
//@ts-ignore
|
|
41
|
+
if (this.config.components.chart.type === 'equivolume') {
|
|
42
|
+
return this.postProcessing(labels);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return labels;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Make a prediction(750) about how many candles we need to fake to fill all X axis by labels
|
|
50
|
+
*/
|
|
51
|
+
getAllCandlesWithFake() {
|
|
52
|
+
const visualCandles = this.chartModel.mainCandleSeries.visualPoints;
|
|
53
|
+
if (visualCandles.length === 0) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
const fakeCandlesForSides = Array.from({ length: 750 });
|
|
57
|
+
const appendFakeCandle = fakeCandlesForSides.map((_, idx) => fakeVisualCandle(this.chartModel.mainCandleSeries.dataPoints, this.chartModel.mainCandleSeries.visualPoints, this.chartModel.mainCandleSeries.meanCandleWidth, visualCandles.length + idx, this.chartModel.getPeriod()));
|
|
58
|
+
return [...visualCandles, ...appendFakeCandle];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Maps an array of weighted points to an array of XAxisLabelWeighted objects.
|
|
62
|
+
* @param {WeightedPoint[]} weightedPoints - An array of weighted points to be mapped.
|
|
63
|
+
* @param {VisualCandle[]} allCandlesWithFake - An array of visual candles to be used for formatting the labels.
|
|
64
|
+
* @returns {XAxisLabelWeighted[]} An array of XAxisLabelWeighted objects.
|
|
65
|
+
*/
|
|
66
|
+
mapWeightedPointsToLabels(weightedPoints, allCandlesWithFake) {
|
|
67
|
+
const arr = new Array(weightedPoints.length);
|
|
68
|
+
weightedPoints.forEach((point, index) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const visualCandle = allCandlesWithFake[index];
|
|
71
|
+
const labelFormat = this.weightToTimeFormatsDict[point.weight];
|
|
72
|
+
const formattedLabel = this.timeZoneModel.getDateTimeFormatter(labelFormat)(visualCandle.candle.timestamp);
|
|
73
|
+
arr[index] = {
|
|
74
|
+
weight: point.weight,
|
|
75
|
+
idx: (_a = visualCandle.candle.idx) !== null && _a !== void 0 ? _a : 0,
|
|
76
|
+
value: visualCandle.centerUnit,
|
|
77
|
+
time: visualCandle.candle.timestamp,
|
|
78
|
+
text: formattedLabel,
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
return arr;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Sets the formats for labels configuration.
|
|
85
|
+
* @param {Record<TimeFormatWithDuration, string>} newFormatsByWeightMap - The new formats by weight map.
|
|
86
|
+
* @returns {void}
|
|
87
|
+
*/
|
|
88
|
+
setFormatsForLabelsConfig(newFormatsByWeightMap) {
|
|
89
|
+
const { weightToTimeFormatsDict, weightToTimeFormatMatcherDict } = generateWeightsMapForConfig(newFormatsByWeightMap);
|
|
90
|
+
this.formatsByWeightMap = newFormatsByWeightMap;
|
|
91
|
+
this.weightToTimeFormatMatcherArray = Object.entries(weightToTimeFormatMatcherDict)
|
|
92
|
+
.map(([k, v]) => [parseInt(k, 10), v])
|
|
93
|
+
.sort(([a], [b]) => b - a);
|
|
94
|
+
this.weightToTimeFormatsDict = weightToTimeFormatsDict;
|
|
95
|
+
this.generateWeightedLabels();
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Generates weighted labels based on allCandlesWithFake, weightToTimeFormatMatcherDict and timeZoneModel.
|
|
99
|
+
* @private
|
|
100
|
+
* @function
|
|
101
|
+
* @returns {void}
|
|
102
|
+
*/
|
|
103
|
+
generateWeightedLabels() {
|
|
104
|
+
const allCandlesWithFake = this.getAllCandlesWithFake();
|
|
105
|
+
const weightedPoints = mapCandlesToWeightedPoints(allCandlesWithFake, this.weightToTimeFormatMatcherArray, this.timeZoneModel.tzOffset(this.config.timezone));
|
|
106
|
+
const weightedLabels = this.mapWeightedPointsToLabels(weightedPoints, allCandlesWithFake);
|
|
107
|
+
this.labelsGroupedByWeight = groupLabelsByWeight(weightedLabels);
|
|
108
|
+
this.weightedCache = undefined;
|
|
109
|
+
this.levelsCache = {};
|
|
110
|
+
this.recalculateCachedLabels();
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Retrieves the labels from the cache for a given coverUpLevel.
|
|
114
|
+
* @param {number} coverUpLevel - The coverUpLevel to retrieve the labels from the cache.
|
|
115
|
+
* @returns {Array<string>|undefined} - The labels for the given coverUpLevel if they exist in the cache, otherwise undefined.
|
|
116
|
+
*/
|
|
117
|
+
getLabelsFromCache(coverUpLevel) {
|
|
118
|
+
if (this.levelsCache[coverUpLevel]) {
|
|
119
|
+
return this.levelsCache[coverUpLevel];
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Updates label of new appeared candle
|
|
125
|
+
* @param {VisualCandle} candle - new updated candle
|
|
126
|
+
* @returns {void}
|
|
127
|
+
*/
|
|
128
|
+
updateLastLabel(candle) {
|
|
129
|
+
const prevCandle = this.chartModel.mainCandleSeries.visualPoints[this.chartModel.mainCandleSeries.visualPoints.length - 2];
|
|
130
|
+
if (prevCandle) {
|
|
131
|
+
const newCandleWithprevious = [prevCandle, candle];
|
|
132
|
+
const weightedPoints = mapCandlesToWeightedPoints(newCandleWithprevious, this.weightToTimeFormatMatcherArray, this.timeZoneModel.tzOffset(this.config.timezone));
|
|
133
|
+
const weightedLabels = this.mapWeightedPointsToLabels([weightedPoints[1]], [candle]);
|
|
134
|
+
const [newWeightedLabel] = weightedLabels;
|
|
135
|
+
this.labelsGroupedByWeight = Object.entries(this.labelsGroupedByWeight).reduce((acc, [weight, labels]) => {
|
|
136
|
+
const isLabelFoundHere = labels.findIndex(item => item.idx === newWeightedLabel.idx);
|
|
137
|
+
let filteredLabels = labels;
|
|
138
|
+
// we need to check it bsc the array from which we delete and the array into which we insert the value will most likely not be the same array
|
|
139
|
+
if (isLabelFoundHere !== -1) {
|
|
140
|
+
filteredLabels = labels.filter(item => item.idx !== newWeightedLabel.idx);
|
|
141
|
+
}
|
|
142
|
+
if (parseInt(weight, 10) === newWeightedLabel.weight) {
|
|
143
|
+
const idx = filteredLabels.findIndex(item => item.idx > newWeightedLabel.idx);
|
|
144
|
+
if (idx !== -1) {
|
|
145
|
+
filteredLabels = [
|
|
146
|
+
...filteredLabels.slice(0, idx),
|
|
147
|
+
newWeightedLabel,
|
|
148
|
+
...filteredLabels.slice(idx),
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
filteredLabels.push(newWeightedLabel);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
acc[weight] = filteredLabels;
|
|
156
|
+
return acc;
|
|
157
|
+
}, {});
|
|
158
|
+
this.weightedCache = undefined;
|
|
159
|
+
this.levelsCache = {};
|
|
160
|
+
this.recalculateCachedLabels();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Creates labels for history candles and merge it with existing
|
|
165
|
+
* @param {VisualCandle} candle - new history candles
|
|
166
|
+
* @returns {void}
|
|
167
|
+
*/
|
|
168
|
+
updateHistoryLabels(candles) {
|
|
169
|
+
const candlesPlusOne = candles.concat(this.chartModel.mainCandleSeries.visualPoints[candles.length]);
|
|
170
|
+
const weightedPoints = mapCandlesToWeightedPoints(candlesPlusOne, this.weightToTimeFormatMatcherArray, this.timeZoneModel.tzOffset(this.config.timezone));
|
|
171
|
+
const weightedLabels = this.mapWeightedPointsToLabels(weightedPoints, candlesPlusOne);
|
|
172
|
+
const historyLabelsByWeight = groupLabelsByWeight(weightedLabels);
|
|
173
|
+
const copyOfNewGroupedLabels = cloneUnsafe(historyLabelsByWeight);
|
|
174
|
+
for (const weight in this.labelsGroupedByWeight) {
|
|
175
|
+
if (copyOfNewGroupedLabels[weight] === undefined) {
|
|
176
|
+
copyOfNewGroupedLabels[weight] = this.labelsGroupedByWeight[weight];
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const lastCandle = this.chartModel.mainCandleSeries.visualPoints[candles.length - 1];
|
|
180
|
+
const allLabelsByWeight = Object.entries(copyOfNewGroupedLabels)
|
|
181
|
+
.sort(([a], [b]) => parseInt(b, 10) - parseInt(a, 10))
|
|
182
|
+
.reduce((acc, [weight, labels]) => {
|
|
183
|
+
const parsedWeight = parseInt(weight, 10);
|
|
184
|
+
const existingLabels = this.labelsGroupedByWeight[parsedWeight];
|
|
185
|
+
if (parsedWeight === this.weightToTimeFormatMatcherArray[0][0]) {
|
|
186
|
+
//we need to delete last label in old labels array
|
|
187
|
+
// this is label from the array with biggest weight, so that's why we use sorting
|
|
188
|
+
existingLabels.shift();
|
|
189
|
+
}
|
|
190
|
+
if (existingLabels) {
|
|
191
|
+
const restLabels = existingLabels.map(label => {
|
|
192
|
+
label.idx = label.idx + candles.length;
|
|
193
|
+
label.value = lastCandle.startUnit + lastCandle.width + label.value;
|
|
194
|
+
return label;
|
|
195
|
+
});
|
|
196
|
+
if (historyLabelsByWeight[parsedWeight]) {
|
|
197
|
+
acc[weight] = labels.concat(restLabels);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
acc[weight] = restLabels;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
acc[weight] = labels;
|
|
205
|
+
}
|
|
206
|
+
return acc;
|
|
207
|
+
}, {});
|
|
208
|
+
this.labelsGroupedByWeight = allLabelsByWeight;
|
|
209
|
+
this.weightedCache = undefined;
|
|
210
|
+
this.levelsCache = {};
|
|
211
|
+
this.recalculateCachedLabels();
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Calls the method generateWeightedLabels to generate labels.
|
|
215
|
+
* @returns {void}
|
|
216
|
+
*/
|
|
217
|
+
generateLabels() {
|
|
218
|
+
this.generateWeightedLabels();
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Recalculates the labels by calling the method recalculateCachedLabels.
|
|
222
|
+
* @returns {void}
|
|
223
|
+
*/
|
|
224
|
+
recalculateLabels() {
|
|
225
|
+
this.recalculateCachedLabels();
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Recalculates cached labels based on the current configuration and zoom level.
|
|
229
|
+
* If there are no grouped labels, the cache is not set.
|
|
230
|
+
* Calculates the maximum label width based on the font size and the maximum format length.
|
|
231
|
+
* Calculates the cover up level based on the maximum label width and the mean candle width.
|
|
232
|
+
* If the cover up level is negative, the cache is not updated.
|
|
233
|
+
* If the cover up level has not changed, the cached labels are returned.
|
|
234
|
+
* Otherwise, the labels are filtered by extended rules and grouped by cover up level.
|
|
235
|
+
* The filtered labels are then cached and returned.
|
|
236
|
+
*/
|
|
237
|
+
recalculateCachedLabels() {
|
|
238
|
+
// skip cache setting if we don't have grouped labels
|
|
239
|
+
if (Object.getOwnPropertyNames(this.labelsGroupedByWeight).length === 0) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const fontSize = this.config.components.xAxis.fontSize;
|
|
243
|
+
const maxFormatLength = Object.values(this.formatsByWeightMap).reduce((max, item) => {
|
|
244
|
+
return Math.max(item.length, max);
|
|
245
|
+
}, 1);
|
|
246
|
+
const maxLabelWidth = fontSize * maxFormatLength;
|
|
247
|
+
const meanCandleWidthPx = unitToPixels(this.chartModel.mainCandleSeries.meanCandleWidth, this.scale.zoomX);
|
|
248
|
+
const coverUpLevel = Math.round(maxLabelWidth / meanCandleWidthPx);
|
|
249
|
+
// for some reason sometimes `this.scale.zoomX` is negative so we dont want to update labels
|
|
250
|
+
if (coverUpLevel < 0 && !isFinite(meanCandleWidthPx)) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (this.weightedCache === undefined || coverUpLevel !== this.weightedCache.coverUpLevel) {
|
|
254
|
+
const labelsFromCache = this.getLabelsFromCache(coverUpLevel);
|
|
255
|
+
if (labelsFromCache) {
|
|
256
|
+
this.weightedCache = {
|
|
257
|
+
labels: labelsFromCache,
|
|
258
|
+
coverUpLevel,
|
|
259
|
+
};
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const labelsToCache = filterMapGroupedLabelsByCoverUpLevel(this.filterLabelsByExtendedRules(this.labelsGroupedByWeight, coverUpLevel), coverUpLevel);
|
|
263
|
+
this.levelsCache[coverUpLevel] = labelsToCache;
|
|
264
|
+
this.weightedCache = {
|
|
265
|
+
labels: labelsToCache,
|
|
266
|
+
coverUpLevel,
|
|
267
|
+
};
|
|
268
|
+
this.eventBus.fireDraw();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Post filtering for equivolume case
|
|
273
|
+
* {@link overlappingPredicate} is used
|
|
274
|
+
* @param {XAxisLabelWeighted[]} labels - array of labels filtered by weights algorithm
|
|
275
|
+
* @returns {XAxisLabelWeighted[]} - array of filtered labels by overlaping predicate
|
|
276
|
+
*/
|
|
277
|
+
postProcessing(labels) {
|
|
278
|
+
var _a, _b;
|
|
279
|
+
const filteredLabels = [];
|
|
280
|
+
// tricky double-iterator to check multiple consequent overlapping labels
|
|
281
|
+
let i = 0;
|
|
282
|
+
let j = 1;
|
|
283
|
+
while (j <= labels.length - 1) {
|
|
284
|
+
const label = labels[i];
|
|
285
|
+
const nextLabel = labels[j];
|
|
286
|
+
const overlappingCondition = overlappingPredicate(this.canvasModel.ctx, this.config, label, nextLabel, this.scale, 30);
|
|
287
|
+
if (overlappingCondition) {
|
|
288
|
+
if (((_a = nextLabel.weight) !== null && _a !== void 0 ? _a : 0) > ((_b = label.weight) !== null && _b !== void 0 ? _b : 0)) {
|
|
289
|
+
i = j;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
filteredLabels.push(label);
|
|
294
|
+
i = j;
|
|
295
|
+
if (j === labels.length - 1) {
|
|
296
|
+
filteredLabels.push(nextLabel);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
j++;
|
|
300
|
+
}
|
|
301
|
+
return filteredLabels;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Filters the labels by extended rules.
|
|
305
|
+
* @private
|
|
306
|
+
*
|
|
307
|
+
* @param {Record<number, XAxisLabelWeighted[]>} labelsGroupedByWeight - Object containing the labels grouped by weight.
|
|
308
|
+
* @param {number} coverUpLevel - The cover up level.
|
|
309
|
+
*
|
|
310
|
+
* @returns {Record<number, XAxisLabelWeighted[]>} - Object containing the filtered labels grouped by weight.
|
|
311
|
+
*/
|
|
312
|
+
filterLabelsByExtendedRules(labelsGroupedByWeight, coverUpLevel) {
|
|
313
|
+
// transform {minute_1: () => boolean} to {215: () => boolean}
|
|
314
|
+
const mappedExtendedFilterConfig = typedEntries_UNSAFE(this.extendedLabelsFilterConfig).reduce((acc, item) => {
|
|
315
|
+
if (!item) {
|
|
316
|
+
return acc;
|
|
317
|
+
}
|
|
318
|
+
const [timeFormat, filterFn] = item;
|
|
319
|
+
if (filterFn) {
|
|
320
|
+
const parsedTimeFormat = parseTimeFormatsFromKey(timeFormat);
|
|
321
|
+
if (parsedTimeFormat) {
|
|
322
|
+
const weightFromValue = getWeightFromTimeFormat(parsedTimeFormat);
|
|
323
|
+
acc[weightFromValue] = filterFn;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return acc;
|
|
327
|
+
}, {});
|
|
328
|
+
// filter by cover up level
|
|
329
|
+
return typedEntries_UNSAFE(labelsGroupedByWeight).reduce((acc, [weight, labels]) => {
|
|
330
|
+
if (mappedExtendedFilterConfig[weight] && mappedExtendedFilterConfig[weight](coverUpLevel)) {
|
|
331
|
+
return acc;
|
|
332
|
+
}
|
|
333
|
+
acc[weight] = labels;
|
|
334
|
+
return acc;
|
|
335
|
+
}, {});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
@@ -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,40 @@
|
|
|
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{ChartBaseElement
|
|
6
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
7
|
+
import { EVENT_DRAW } from '../../events/events';
|
|
8
|
+
/**
|
|
9
|
+
* Custom labels on X axis.
|
|
10
|
+
*/
|
|
11
|
+
export class XAxisLabelsModel extends ChartBaseElement {
|
|
12
|
+
constructor(eventBus, labelProviders) {
|
|
13
|
+
super();
|
|
14
|
+
this.eventBus = eventBus;
|
|
15
|
+
this.labelProviders = labelProviders;
|
|
16
|
+
this.labels = [];
|
|
17
|
+
this.initModel();
|
|
18
|
+
/**
|
|
19
|
+
* TODO refactor this, should NOT be recalculated on each DRAW, rather coordinates should be updated in drawer
|
|
20
|
+
* @doc-tags refactor
|
|
21
|
+
*/
|
|
22
|
+
this.addSubscription(this.eventBus.on(EVENT_DRAW, () => this.recalculateLabels()));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Initializes the model by recalculating the labels.
|
|
26
|
+
*/
|
|
27
|
+
initModel() {
|
|
28
|
+
this.recalculateLabels();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Recalculates the labels by clearing the existing labels and adding new labels from the label providers.
|
|
32
|
+
* @returns {void}
|
|
33
|
+
*/
|
|
34
|
+
recalculateLabels() {
|
|
35
|
+
this.labels = [];
|
|
36
|
+
for (const provider of this.labelProviders) {
|
|
37
|
+
this.labels.push(...provider.getUnorderedLabels());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -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
|
*/
|
|
@@ -15,7 +15,7 @@ import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
|
15
15
|
* @doc-tags scaling,zoom,viewport
|
|
16
16
|
*/
|
|
17
17
|
export declare class XAxisScaleHandler extends ChartBaseElement {
|
|
18
|
-
private
|
|
18
|
+
private scale;
|
|
19
19
|
private canvasInputListener;
|
|
20
20
|
private canvasBoundsContainer;
|
|
21
21
|
private chartPanComponent;
|
|
@@ -23,7 +23,7 @@ export declare class XAxisScaleHandler extends ChartBaseElement {
|
|
|
23
23
|
lastXStart: Unit;
|
|
24
24
|
lastXWidth: Unit;
|
|
25
25
|
lastXPxWidth: Pixel;
|
|
26
|
-
constructor(
|
|
26
|
+
constructor(scale: ScaleModel, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, chartPanComponent: ChartPanComponent, chartModel: ChartModel);
|
|
27
27
|
/**
|
|
28
28
|
* This method is used to activate the canvas input listener and add a subscription to it.
|
|
29
29
|
* It calls the parent class's doActivate method and then subscribes to the canvasInputListener's observeDbClick method.
|
|
@@ -1,6 +1,65 @@
|
|
|
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{ChartBaseElement
|
|
6
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
7
|
+
import { CanvasElement } from '../../canvas/canvas-bounds-container';
|
|
8
|
+
import { DragNDropXComponent } from '../dran-n-drop_helper/drag-n-drop-x.component';
|
|
9
|
+
/**
|
|
10
|
+
* Handles the mouse drag on X axis - to zoom the viewport horizontally.
|
|
11
|
+
* @doc-tags scaling,zoom,viewport
|
|
12
|
+
*/
|
|
13
|
+
export class XAxisScaleHandler extends ChartBaseElement {
|
|
14
|
+
constructor(scale, canvasInputListener, canvasBoundsContainer, chartPanComponent, chartModel) {
|
|
15
|
+
super();
|
|
16
|
+
this.scale = scale;
|
|
17
|
+
this.canvasInputListener = canvasInputListener;
|
|
18
|
+
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
19
|
+
this.chartPanComponent = chartPanComponent;
|
|
20
|
+
this.chartModel = chartModel;
|
|
21
|
+
this.lastXStart = 0;
|
|
22
|
+
this.lastXWidth = 0;
|
|
23
|
+
this.lastXPxWidth = 0;
|
|
24
|
+
this.onXDragStart = () => {
|
|
25
|
+
this.lastXStart = this.scale.xStart;
|
|
26
|
+
this.lastXWidth = this.scale.xEnd - this.scale.xStart;
|
|
27
|
+
const bounds = this.canvasBoundsContainer.getBounds(CanvasElement.X_AXIS);
|
|
28
|
+
this.lastXPxWidth = bounds.width - this.canvasInputListener.currentPoint.x;
|
|
29
|
+
};
|
|
30
|
+
this.onXDragTick = (dragInfo) => {
|
|
31
|
+
const { delta: absoluteXDelta } = dragInfo;
|
|
32
|
+
const newPxWidth = this.lastXPxWidth - absoluteXDelta;
|
|
33
|
+
// cursor goes beyond x-axis - maximum scale is reached
|
|
34
|
+
if (newPxWidth < 0) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const xZoomMult = this.lastXPxWidth / newPxWidth;
|
|
38
|
+
const newWidth = this.lastXWidth * xZoomMult;
|
|
39
|
+
const newXStart = this.lastXStart + (this.lastXWidth - newWidth);
|
|
40
|
+
this.scale.setXScale(newXStart, this.scale.xEnd);
|
|
41
|
+
};
|
|
42
|
+
const dragNDropXComponent = new DragNDropXComponent(this.canvasBoundsContainer.getBoundsHitTest(CanvasElement.X_AXIS), {
|
|
43
|
+
onDragStart: this.onXDragStart,
|
|
44
|
+
onDragTick: this.onXDragTick,
|
|
45
|
+
}, this.canvasInputListener, this.chartPanComponent, {
|
|
46
|
+
disableChartPanning: false,
|
|
47
|
+
});
|
|
48
|
+
this.addChildEntity(dragNDropXComponent);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* This method is used to activate the canvas input listener and add a subscription to it.
|
|
52
|
+
* It calls the parent class's doActivate method and then subscribes to the canvasInputListener's observeDbClick method.
|
|
53
|
+
* The subscription is added to the RxJS subscription list.
|
|
54
|
+
* When the subscription is triggered, the doBasicScale method is called.
|
|
55
|
+
* @protected
|
|
56
|
+
* @returns {void}
|
|
57
|
+
*/
|
|
58
|
+
doActivate() {
|
|
59
|
+
super.doActivate();
|
|
60
|
+
this.addRxSubscription(this.canvasInputListener
|
|
61
|
+
.observeDbClick(this.canvasBoundsContainer.getBoundsHitTest(CanvasElement.X_AXIS))
|
|
62
|
+
.subscribe(() => this.chartModel.doBasicScale()));
|
|
63
|
+
this.addRxSubscription(this.chartModel.candlesPrependSubject.subscribe(({ prependedCandlesWidth }) => (this.lastXStart += prependedCandlesWidth)));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -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,87 @@
|
|
|
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{CanvasElement
|
|
6
|
+
import { CanvasElement } from '../../canvas/canvas-bounds-container';
|
|
7
|
+
import { calculateTextWidth } from '../../utils/canvas/canvas-font-measure-tool.utils';
|
|
8
|
+
/**
|
|
9
|
+
* This Drawer draws regular time labels for X Axis.
|
|
10
|
+
*/
|
|
11
|
+
export class XAxisTimeLabelsDrawer {
|
|
12
|
+
constructor(config, canvasModel, viewportModel, canvasBoundsContainer, labelsProvider, drawPredicate = () => true) {
|
|
13
|
+
this.config = config;
|
|
14
|
+
this.canvasModel = canvasModel;
|
|
15
|
+
this.viewportModel = viewportModel;
|
|
16
|
+
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
17
|
+
this.labelsProvider = labelsProvider;
|
|
18
|
+
this.drawPredicate = drawPredicate;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Draws the X-axis labels on the canvas.
|
|
22
|
+
* If the drawPredicate is true, it will draw the labels.
|
|
23
|
+
* @returns {void}
|
|
24
|
+
*/
|
|
25
|
+
draw() {
|
|
26
|
+
var _a;
|
|
27
|
+
if (this.drawPredicate()) {
|
|
28
|
+
const ctx = this.canvasModel.ctx;
|
|
29
|
+
const xAxisColors = this.config.colors.xAxis;
|
|
30
|
+
const fontFamily = this.config.components.xAxis.fontFamily;
|
|
31
|
+
const font = XAxisTimeLabelsDrawer.getFontFromConfig(this.config);
|
|
32
|
+
const fontHeight = this.config.components.xAxis.fontSize;
|
|
33
|
+
const offsetTop = (_a = this.config.components.xAxis.padding.top) !== null && _a !== void 0 ? _a : 0;
|
|
34
|
+
ctx.save();
|
|
35
|
+
ctx.font = font;
|
|
36
|
+
ctx.fillStyle = xAxisColors.backgroundColor;
|
|
37
|
+
const bounds = this.canvasBoundsContainer.getBounds(CanvasElement.X_AXIS);
|
|
38
|
+
ctx.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
|
|
39
|
+
const color = this.config.colors.xAxis.labelTextColor;
|
|
40
|
+
const labels = this.labelsProvider();
|
|
41
|
+
this.drawLabels(ctx, labels, bounds, color, fontHeight, fontFamily, offsetTop);
|
|
42
|
+
ctx.restore();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Draws labels on a canvas context.
|
|
47
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
48
|
+
* @param {NumericAxisLabel[]} labels - An array of NumericAxisLabel objects containing the value and text of each label.
|
|
49
|
+
* @param {Bounds} bounds - The bounds of the viewport.
|
|
50
|
+
* @param {string} color - The color of the labels.
|
|
51
|
+
* @param {number} fontHeight - The height of the font in pixels.
|
|
52
|
+
* @param {string} fontFamily - The font family to use for the labels.
|
|
53
|
+
* @param {number} offsetTop - The offset from the top of the viewport to draw the labels.
|
|
54
|
+
* @returns {void}
|
|
55
|
+
*/
|
|
56
|
+
drawLabels(ctx, labels, bounds, color, fontHeight, fontFamily, offsetTop) {
|
|
57
|
+
const font = `${fontHeight}px ${fontFamily}`;
|
|
58
|
+
ctx.fillStyle = color;
|
|
59
|
+
for (const label of labels) {
|
|
60
|
+
const x = this.viewportModel.toX(label.value) - calculateTextWidth(label.text, ctx, font) / 2;
|
|
61
|
+
// skip labels outside viewport
|
|
62
|
+
if (x < 0 || x > bounds.width) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const y = bounds.y + fontHeight - 1 + offsetTop; // -1 for font drawing inconsistency
|
|
66
|
+
const labelText = label.text;
|
|
67
|
+
ctx.font = font;
|
|
68
|
+
ctx.fillText(labelText, x, y);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Returns a font string based on the provided FullChartConfig object.
|
|
73
|
+
* @param {FullChartConfig} config - The FullChartConfig object containing the font style, size and family.
|
|
74
|
+
* @returns {string} - The font string in the format of "fontStyle fontSize fontFamily".
|
|
75
|
+
*/
|
|
76
|
+
static getFontFromConfig(config) {
|
|
77
|
+
return `${config.components.xAxis.fontStyle} ${config.components.xAxis.fontSize}px ${config.components.xAxis.fontFamily}`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns an array of canvas IDs.
|
|
81
|
+
*
|
|
82
|
+
* @returns {Array<string>} An array containing the ID of the canvas.
|
|
83
|
+
*/
|
|
84
|
+
getCanvasIds() {
|
|
85
|
+
return [this.canvasModel.canvasId];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -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
|
*/
|
|
@@ -30,7 +30,7 @@ export declare class XAxisComponent extends ChartBaseElement {
|
|
|
30
30
|
private config;
|
|
31
31
|
canvasModel: CanvasModel;
|
|
32
32
|
chartComponent: ChartComponent;
|
|
33
|
-
private
|
|
33
|
+
private scale;
|
|
34
34
|
private chartResizeHandler;
|
|
35
35
|
private timeZoneModel;
|
|
36
36
|
xAxisDrawer: XAxisTimeLabelsDrawer;
|
|
@@ -38,7 +38,7 @@ export declare class XAxisComponent extends ChartBaseElement {
|
|
|
38
38
|
xAxisLabelsGenerator: XAxisLabelsGenerator;
|
|
39
39
|
readonly xAxisLabelsModel: XAxisLabelsModel;
|
|
40
40
|
xAxisScaleHandler: XAxisScaleHandler;
|
|
41
|
-
constructor(eventBus: EventBus, config: FullChartConfig, canvasModel: CanvasModel, chartComponent: ChartComponent,
|
|
41
|
+
constructor(eventBus: EventBus, config: FullChartConfig, canvasModel: CanvasModel, chartComponent: ChartComponent, scale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, canvasInputListener: CanvasInputListenerComponent, chartResizeHandler: ChartResizeHandler, drawingManager: DrawingManager, timeZoneModel: TimeZoneModel, chartPanComponent: ChartPanComponent, cursorHandler: CursorHandler, backgroundCanvasModel: CanvasModel);
|
|
42
42
|
/**
|
|
43
43
|
* This method is used to activate the chart and update the labels if there is a new data set or equivolume type.
|
|
44
44
|
* It subscribes to the chart type change, candles set subject, candles updated subject, and time zone change to generate new labels.
|