@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,249 @@
|
|
|
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 { getTextLines, drawText, getTextLineHeight, prepareTextForFill, } from '../../utils/canvas/canvas-text-functions.utils';
|
|
8
|
+
import { getFormattedTimeLabel } from './navigation-map.model';
|
|
9
|
+
import { flat } from '../../utils/array.utils';
|
|
10
|
+
const BTN_ARROW_WIDTH = 4;
|
|
11
|
+
export class NavigationMapDrawer {
|
|
12
|
+
constructor(config, chartModel, canvasModel, canvasBoundsContainer, formatterFactory, visualCandlesProvider) {
|
|
13
|
+
this.config = config;
|
|
14
|
+
this.chartModel = chartModel;
|
|
15
|
+
this.canvasModel = canvasModel;
|
|
16
|
+
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
17
|
+
this.formatterFactory = formatterFactory;
|
|
18
|
+
this.visualCandlesProvider = visualCandlesProvider;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Draws the navigation map on the canvas if it is visible in the configuration.
|
|
22
|
+
* It first gets the bounds of all the necessary elements on the canvas.
|
|
23
|
+
* Then it fills the background of the navigation map with the configured color.
|
|
24
|
+
* Draws a line at the top of the navigation map with the configured color.
|
|
25
|
+
* Draws the left and right arrow buttons if their width is not zero.
|
|
26
|
+
* Draws the chart with the configured colors and fills it with a gradient if the gradient colors are configured.
|
|
27
|
+
* Draws the slider with the left and right knots and the slider window.
|
|
28
|
+
* Draws the time labels.
|
|
29
|
+
* @returns {void}
|
|
30
|
+
*/
|
|
31
|
+
draw() {
|
|
32
|
+
if (this.config.components.navigationMap.visible) {
|
|
33
|
+
const candles = this.visualCandlesProvider();
|
|
34
|
+
if (candles.length) {
|
|
35
|
+
const nMap = this.canvasBoundsContainer.getBounds(CanvasElement.N_MAP);
|
|
36
|
+
const btnL = this.canvasBoundsContainer.getBounds(CanvasElement.N_MAP_BTN_L);
|
|
37
|
+
const btnR = this.canvasBoundsContainer.getBounds(CanvasElement.N_MAP_BTN_R);
|
|
38
|
+
const knotL = this.canvasBoundsContainer.getBounds(CanvasElement.N_MAP_KNOT_L);
|
|
39
|
+
const knotR = this.canvasBoundsContainer.getBounds(CanvasElement.N_MAP_KNOT_R);
|
|
40
|
+
const slider = this.canvasBoundsContainer.getBounds(CanvasElement.N_MAP_SLIDER_WINDOW);
|
|
41
|
+
const chart = this.canvasBoundsContainer.getBounds(CanvasElement.N_MAP_CHART);
|
|
42
|
+
const ctx = this.canvasModel.ctx;
|
|
43
|
+
ctx.fillStyle = this.config.colors.navigationMap.backgroundColor;
|
|
44
|
+
ctx.fillRect(nMap.x, nMap.y, nMap.width, nMap.height);
|
|
45
|
+
// bar resizer at the very top
|
|
46
|
+
ctx.strokeStyle = this.config.colors.paneResizer.lineColor;
|
|
47
|
+
ctx.lineWidth = 1;
|
|
48
|
+
ctx.beginPath();
|
|
49
|
+
ctx.moveTo(nMap.x, nMap.y);
|
|
50
|
+
ctx.lineTo(nMap.x + nMap.width, nMap.y);
|
|
51
|
+
ctx.closePath();
|
|
52
|
+
ctx.stroke();
|
|
53
|
+
// btn left and right
|
|
54
|
+
if (btnL.width !== 0) {
|
|
55
|
+
this.drawLeftArrowButton(ctx, btnL, this.config);
|
|
56
|
+
}
|
|
57
|
+
if (btnR.width !== 0) {
|
|
58
|
+
this.drawRightArrowButton(ctx, btnR, this.config);
|
|
59
|
+
}
|
|
60
|
+
// chart
|
|
61
|
+
ctx.fillStyle = this.config.colors.navigationMap.mapFillColor;
|
|
62
|
+
ctx.beginPath();
|
|
63
|
+
ctx.moveTo(chart.x, chart.y + chart.height);
|
|
64
|
+
for (const candle of candles) {
|
|
65
|
+
ctx.lineTo(candle[0], candle[1]);
|
|
66
|
+
}
|
|
67
|
+
ctx.lineTo(chart.x + chart.width, chart.y + chart.height);
|
|
68
|
+
ctx.lineTo(chart.x, chart.y + chart.height);
|
|
69
|
+
ctx.closePath();
|
|
70
|
+
if (this.config.colors.navigationMap.mapGradientTopColor &&
|
|
71
|
+
this.config.colors.navigationMap.mapGradientBottomColor) {
|
|
72
|
+
const grd = ctx.createLinearGradient(chart.x, chart.y, chart.x, chart.y + chart.height);
|
|
73
|
+
grd.addColorStop(0, this.config.colors.navigationMap.mapGradientTopColor);
|
|
74
|
+
grd.addColorStop(1, this.config.colors.navigationMap.mapGradientBottomColor);
|
|
75
|
+
ctx.fillStyle = grd;
|
|
76
|
+
}
|
|
77
|
+
ctx.fill();
|
|
78
|
+
if (this.config.colors.navigationMap.mapColor) {
|
|
79
|
+
ctx.strokeStyle = this.config.colors.navigationMap.mapColor;
|
|
80
|
+
ctx.stroke();
|
|
81
|
+
}
|
|
82
|
+
// slider
|
|
83
|
+
this.drawSlider(ctx, knotL, knotR, btnL, slider);
|
|
84
|
+
// time labels
|
|
85
|
+
this.drawTimeLabels(ctx);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Moves the left knot and the slider to the right of the left arrow button if the left knot is to the left of the button.
|
|
91
|
+
* @param {Bounds} knotL - The bounds of the left knot.
|
|
92
|
+
* @param {Bounds} knotR - The bounds of the right knot.
|
|
93
|
+
* @param {Bounds} btnL - The bounds of the left arrow button.
|
|
94
|
+
* @param {Bounds} slider - The bounds of the slider.
|
|
95
|
+
*/
|
|
96
|
+
blockDrawSliderOnLeftArrow(knotL, knotR, btnL, slider) {
|
|
97
|
+
if (knotL.x <= btnL.x + btnL.width) {
|
|
98
|
+
knotL.x = btnL.x + btnL.width;
|
|
99
|
+
slider.x = knotL.x + knotL.width;
|
|
100
|
+
knotR.x = slider.x + slider.width;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Draws a slider on a canvas context with given bounds for knots, button and slider.
|
|
105
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
106
|
+
* @param {Bounds} knotL - The bounds for the left knot.
|
|
107
|
+
* @param {Bounds} knotR - The bounds for the right knot.
|
|
108
|
+
* @param {Bounds} btnL - The bounds for the left button.
|
|
109
|
+
* @param {Bounds} slider - The bounds for the slider.
|
|
110
|
+
* @returns {void}
|
|
111
|
+
*/
|
|
112
|
+
drawSlider(ctx, knotL, knotR, btnL, slider) {
|
|
113
|
+
//Slider can't move above the left arrow
|
|
114
|
+
this.blockDrawSliderOnLeftArrow(knotL, knotR, btnL, slider);
|
|
115
|
+
// knots
|
|
116
|
+
this.drawKnotButton(ctx, knotL, this.config, true);
|
|
117
|
+
this.drawKnotButton(ctx, knotR, this.config, false);
|
|
118
|
+
// slider
|
|
119
|
+
ctx.fillStyle = this.config.colors.navigationMap.sliderColor;
|
|
120
|
+
ctx.fillRect(slider.x, slider.y, slider.width, slider.height);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Draws a left arrow button on a canvas context with the provided bounds and configuration
|
|
124
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on
|
|
125
|
+
* @param {Bounds} bounds - The bounds of the button to be drawn
|
|
126
|
+
* @param {FullChartConfig} config - The configuration object containing the colors to be used for the button and arrow
|
|
127
|
+
* @returns {void}
|
|
128
|
+
*/
|
|
129
|
+
drawLeftArrowButton(ctx, bounds, config) {
|
|
130
|
+
ctx.fillStyle = config.colors.navigationMap.buttonColor;
|
|
131
|
+
ctx.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
|
|
132
|
+
ctx.beginPath();
|
|
133
|
+
const leftX = Math.round(bounds.x + bounds.width / 2 - BTN_ARROW_WIDTH / 2);
|
|
134
|
+
const midY = Math.round(bounds.y + bounds.height / 2);
|
|
135
|
+
ctx.moveTo(leftX, midY);
|
|
136
|
+
ctx.lineTo(leftX + BTN_ARROW_WIDTH, midY + BTN_ARROW_WIDTH);
|
|
137
|
+
ctx.lineTo(leftX + BTN_ARROW_WIDTH, midY - BTN_ARROW_WIDTH);
|
|
138
|
+
ctx.fillStyle = config.colors.navigationMap.buttonArrowColor;
|
|
139
|
+
ctx.fill();
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Draws a right arrow button on a canvas context with the provided bounds and configuration
|
|
143
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on
|
|
144
|
+
* @param {Bounds} bounds - The bounds of the button to be drawn
|
|
145
|
+
* @param {FullChartConfig} config - The configuration object containing the colors to be used for the button and arrow
|
|
146
|
+
* @returns {void}
|
|
147
|
+
*/
|
|
148
|
+
drawRightArrowButton(ctx, bounds, config) {
|
|
149
|
+
ctx.fillStyle = config.colors.navigationMap.buttonColor;
|
|
150
|
+
ctx.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
|
|
151
|
+
ctx.beginPath();
|
|
152
|
+
const leftX = Math.round(bounds.x + bounds.width / 2 - BTN_ARROW_WIDTH / 2);
|
|
153
|
+
const midY = Math.round(bounds.y + bounds.height / 2);
|
|
154
|
+
ctx.moveTo(leftX, midY - BTN_ARROW_WIDTH);
|
|
155
|
+
ctx.lineTo(leftX, midY + BTN_ARROW_WIDTH);
|
|
156
|
+
ctx.lineTo(leftX + BTN_ARROW_WIDTH, midY);
|
|
157
|
+
ctx.fillStyle = config.colors.navigationMap.buttonArrowColor;
|
|
158
|
+
ctx.fill();
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Draws a knot button on a canvas context with the given bounds and configuration.
|
|
162
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
163
|
+
* @param {Bounds} bounds - The bounds of the knot button.
|
|
164
|
+
* @param {FullChartConfig} config - The configuration for the chart.
|
|
165
|
+
* @param {boolean} isLeft - Whether the knot button is on the left side of the chart.
|
|
166
|
+
* @returns {void}
|
|
167
|
+
*/
|
|
168
|
+
drawKnotButton(ctx, bounds, config, isLeft) {
|
|
169
|
+
const borderWidth = config.components.navigationMap.knots.border;
|
|
170
|
+
ctx.fillStyle = config.colors.navigationMap.knotColor;
|
|
171
|
+
const xWithBorder = isLeft ? bounds.x - borderWidth : bounds.x + borderWidth;
|
|
172
|
+
ctx.fillRect(xWithBorder, bounds.y, bounds.width, bounds.height);
|
|
173
|
+
ctx.lineWidth = config.components.navigationMap.knots.lineWidth;
|
|
174
|
+
if (borderWidth > 0) {
|
|
175
|
+
ctx.beginPath();
|
|
176
|
+
ctx.moveTo(xWithBorder, bounds.y);
|
|
177
|
+
ctx.lineTo(xWithBorder, bounds.y + bounds.height);
|
|
178
|
+
ctx.lineTo(xWithBorder + bounds.width, bounds.y + bounds.height);
|
|
179
|
+
ctx.lineTo(xWithBorder + bounds.width, bounds.y);
|
|
180
|
+
ctx.lineTo(xWithBorder, bounds.y);
|
|
181
|
+
ctx.lineWidth = borderWidth;
|
|
182
|
+
ctx.strokeStyle = config.colors.navigationMap.knotBorderColor;
|
|
183
|
+
ctx.stroke();
|
|
184
|
+
}
|
|
185
|
+
ctx.beginPath();
|
|
186
|
+
ctx.moveTo(xWithBorder + bounds.width / 2, bounds.y + bounds.height / 4);
|
|
187
|
+
ctx.lineTo(xWithBorder + bounds.width / 2, bounds.y + (3 * bounds.height) / 4);
|
|
188
|
+
ctx.strokeStyle = config.colors.navigationMap.knotLineColor;
|
|
189
|
+
ctx.stroke();
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Draws time labels on the navigation map canvas.
|
|
193
|
+
* @param {CanvasRenderingContext2D} ctx - The 2D rendering context for the canvas.
|
|
194
|
+
* @returns {void}
|
|
195
|
+
*/
|
|
196
|
+
drawTimeLabels(ctx) {
|
|
197
|
+
const candleSource = flat(this.chartModel.mainCandleSeries.getSeriesInViewport());
|
|
198
|
+
const timeLabelsConfig = this.config.components.navigationMap.timeLabels;
|
|
199
|
+
const timeLabelsVisible = timeLabelsConfig.visible;
|
|
200
|
+
if (candleSource.length && timeLabelsVisible) {
|
|
201
|
+
const startViewportTimestamp = candleSource[0].candle.timestamp;
|
|
202
|
+
const endViewportTimestamp = candleSource[candleSource.length - 1].candle.timestamp;
|
|
203
|
+
const textLabelL = this.canvasBoundsContainer.getBounds(CanvasElement.N_MAP_LABEL_L);
|
|
204
|
+
const textLabelR = this.canvasBoundsContainer.getBounds(CanvasElement.N_MAP_LABEL_R);
|
|
205
|
+
const timeLabelsColor = this.config.colors.navigationMap.timeLabelsTextColor;
|
|
206
|
+
const textProperties = {
|
|
207
|
+
textFill: timeLabelsColor,
|
|
208
|
+
textFontFamily: timeLabelsConfig.fontFamily,
|
|
209
|
+
textSize: `${timeLabelsConfig.fontSize}px`,
|
|
210
|
+
};
|
|
211
|
+
const leftLabelProperties = {
|
|
212
|
+
dateFormat: timeLabelsConfig.dateFormat,
|
|
213
|
+
padding: timeLabelsConfig.padding,
|
|
214
|
+
textProperties: Object.assign(Object.assign({}, textProperties), { textAlign: 'left' }),
|
|
215
|
+
};
|
|
216
|
+
const rightLabelProperties = {
|
|
217
|
+
dateFormat: timeLabelsConfig.dateFormat,
|
|
218
|
+
padding: timeLabelsConfig.padding,
|
|
219
|
+
textProperties: Object.assign(Object.assign({}, textProperties), { textAlign: 'right' }),
|
|
220
|
+
};
|
|
221
|
+
this.drawTimeLabel(ctx, textLabelL, startViewportTimestamp, leftLabelProperties);
|
|
222
|
+
this.drawTimeLabel(ctx, textLabelR, endViewportTimestamp, rightLabelProperties);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Draws a time label on a canvas context.
|
|
227
|
+
* @private
|
|
228
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
229
|
+
* @param {Bounds} bounds - The bounds of the label.
|
|
230
|
+
* @param {number} timestamp - The timestamp to display.
|
|
231
|
+
* @param {NMapTimeLabelProperties} config - The configuration for the label.
|
|
232
|
+
* @returns {void}
|
|
233
|
+
*/
|
|
234
|
+
drawTimeLabel(ctx, bounds, timestamp, config) {
|
|
235
|
+
const padding = config.padding;
|
|
236
|
+
const text = getFormattedTimeLabel(timestamp, config.dateFormat, this.formatterFactory);
|
|
237
|
+
prepareTextForFill(ctx, config.textProperties);
|
|
238
|
+
const lineHeight = getTextLineHeight(ctx);
|
|
239
|
+
const lines = getTextLines(text);
|
|
240
|
+
drawText(ctx, lines, bounds.x + padding.x, bounds.y + lineHeight + padding.y, config.textProperties);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Returns an array of string containing the canvas ID.
|
|
244
|
+
* @returns {Array<string>} An array of string containing the canvas ID.
|
|
245
|
+
*/
|
|
246
|
+
getCanvasIds() {
|
|
247
|
+
return [this.canvasModel.canvasId];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
@@ -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,7 +1,38 @@
|
|
|
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{getTextBounds
|
|
7
|
-
|
|
6
|
+
import { getTextBounds, getTextLines } from '../../utils/canvas/canvas-text-functions.utils';
|
|
7
|
+
/**
|
|
8
|
+
* Calculates the bounds of a time label based on the provided timestamp, formatterFactory, and config.
|
|
9
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas rendering context.
|
|
10
|
+
* @param {number} timestamp - The timestamp to be formatted.
|
|
11
|
+
* @param {DateTimeFormatterFactory} formatterFactory - The factory used to create the formatter for the timestamp.
|
|
12
|
+
* @param {FullChartConfig} config - The configuration object for the chart.
|
|
13
|
+
* @returns {[number, number]} - An array containing the width and height of the time label, including padding.
|
|
14
|
+
*/
|
|
15
|
+
export function calcTimeLabelBounds(ctx, timestamp, formatterFactory, config) {
|
|
16
|
+
const timeLabelsConfig = config.components.navigationMap.timeLabels;
|
|
17
|
+
const paddings = timeLabelsConfig.padding;
|
|
18
|
+
const textWithCR = getFormattedTimeLabel(timestamp, timeLabelsConfig.dateFormat, formatterFactory);
|
|
19
|
+
const textLines = getTextLines(textWithCR);
|
|
20
|
+
const textProperties = {
|
|
21
|
+
textFontFamily: timeLabelsConfig.fontFamily,
|
|
22
|
+
textSize: `${timeLabelsConfig.fontSize}px`,
|
|
23
|
+
};
|
|
24
|
+
const [textWidth, textHeight] = getTextBounds(ctx, textLines, textProperties);
|
|
25
|
+
return [textWidth + paddings.x * 2, textHeight + paddings.y * 2];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns a formatted time label.
|
|
29
|
+
*
|
|
30
|
+
* @param {number} timestamp - The timestamp to format.
|
|
31
|
+
* @param {string} format - The format to use for the timestamp.
|
|
32
|
+
* @param {DateTimeFormatterFactory} formatterFactory - The factory function to create a formatter for the given format.
|
|
33
|
+
* @returns {string} The formatted time label with line breaks instead of spaces.
|
|
34
|
+
*/
|
|
35
|
+
export function getFormattedTimeLabel(timestamp, format, formatterFactory) {
|
|
36
|
+
const text = formatterFactory(format)(timestamp);
|
|
37
|
+
return text.split(' ').join('\n');
|
|
38
|
+
}
|
|
@@ -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
|
*/
|
|
@@ -14,7 +14,7 @@ import { ChartAreaPanHandler } from '../chart/chart-area-pan.handler';
|
|
|
14
14
|
import { BaseType, ChartBaseModel } from '../chart/chart-base.model';
|
|
15
15
|
export declare class ChartPanComponent extends ChartBaseElement {
|
|
16
16
|
private eventBus;
|
|
17
|
-
private
|
|
17
|
+
private mainScale;
|
|
18
18
|
private canvasBoundsContainer;
|
|
19
19
|
private config;
|
|
20
20
|
private canvasAnimation;
|
|
@@ -23,7 +23,7 @@ export declare class ChartPanComponent extends ChartBaseElement {
|
|
|
23
23
|
chartBaseModel: ChartBaseModel<BaseType>;
|
|
24
24
|
chartPanComponents: Array<ChartEntity>;
|
|
25
25
|
chartAreaPanHandler: ChartAreaPanHandler;
|
|
26
|
-
constructor(eventBus: EventBus,
|
|
26
|
+
constructor(eventBus: EventBus, mainScale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig, canvasAnimation: CanvasAnimation, canvasInputListener: CanvasInputListenerComponent, mainCanvasParent: Element, chartBaseModel: ChartBaseModel<BaseType>);
|
|
27
27
|
/**
|
|
28
28
|
* Activates the chart pan handlers.
|
|
29
29
|
* @protected
|
|
@@ -1,6 +1,56 @@
|
|
|
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 { ChartAreaPanHandler } from '../chart/chart-area-pan.handler';
|
|
8
|
+
export class ChartPanComponent extends ChartBaseElement {
|
|
9
|
+
constructor(eventBus, mainScale, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, mainCanvasParent, chartBaseModel) {
|
|
10
|
+
super();
|
|
11
|
+
this.eventBus = eventBus;
|
|
12
|
+
this.mainScale = mainScale;
|
|
13
|
+
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.canvasAnimation = canvasAnimation;
|
|
16
|
+
this.canvasInputListener = canvasInputListener;
|
|
17
|
+
this.mainCanvasParent = mainCanvasParent;
|
|
18
|
+
this.chartBaseModel = chartBaseModel;
|
|
19
|
+
this.chartPanComponents = [];
|
|
20
|
+
this.chartAreaPanHandler = new ChartAreaPanHandler(this.eventBus, this.config, this.mainScale, this.mainCanvasParent, this.canvasInputListener, this.canvasBoundsContainer, this.canvasAnimation, this);
|
|
21
|
+
this.chartPanComponents.push(this.chartAreaPanHandler);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Activates the chart pan handlers.
|
|
25
|
+
* @protected
|
|
26
|
+
* @returns {void}
|
|
27
|
+
*/
|
|
28
|
+
doActivate() {
|
|
29
|
+
this.activateChartPanHandlers();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* This method is used to deactivate the pan handlers.
|
|
33
|
+
* @returns {void}
|
|
34
|
+
* @protected
|
|
35
|
+
*/
|
|
36
|
+
doDeactivate() {
|
|
37
|
+
this.deactivatePanHandlers();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Activates user mouse handlers on main chart view.
|
|
41
|
+
* @function
|
|
42
|
+
* @name activateChartPanHandlers
|
|
43
|
+
* @memberof [object Object]
|
|
44
|
+
* @instance
|
|
45
|
+
* @returns {void}
|
|
46
|
+
*/
|
|
47
|
+
activateChartPanHandlers() {
|
|
48
|
+
this.chartPanComponents.forEach(c => c.activate());
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Deactivates all the pan handlers of the chart.
|
|
52
|
+
*/
|
|
53
|
+
deactivatePanHandlers() {
|
|
54
|
+
this.chartPanComponents.forEach(c => c.deactivate());
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -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
|
*/
|
|
@@ -10,36 +10,35 @@ import { ChartBaseElement } from '../../../model/chart-base-element';
|
|
|
10
10
|
import { DataSeriesModel } from '../../../model/data-series.model';
|
|
11
11
|
import { ScaleModel } from '../../../model/scale.model';
|
|
12
12
|
import { HighLowProvider } from '../../../model/scaling/auto-scale.model';
|
|
13
|
-
import { Unit } from '../../../model/scaling/viewport.model';
|
|
13
|
+
import { Pixel, Price, Unit } from '../../../model/scaling/viewport.model';
|
|
14
14
|
import { ChartBaseModel } from '../../chart/chart-base.model';
|
|
15
15
|
import { DragNDropYComponent } from '../../dran-n-drop_helper/drag-n-drop-y.component';
|
|
16
|
-
import {
|
|
16
|
+
import { YAxisComponent } from '../../y_axis/y-axis.component';
|
|
17
17
|
import { PaneHitTestController } from '../pane-hit-test.controller';
|
|
18
|
-
import {
|
|
18
|
+
import { PaneComponent, YExtentFormatters } from '../pane.component';
|
|
19
19
|
export interface YExtentCreationOptions {
|
|
20
|
-
|
|
20
|
+
scale: ScaleModel;
|
|
21
21
|
order: number;
|
|
22
22
|
useDefaultHighLow: boolean;
|
|
23
|
-
useDefaultYAxis: boolean;
|
|
24
23
|
cursor: string;
|
|
25
24
|
paneFormatters: YExtentFormatters;
|
|
26
25
|
increment: number | null;
|
|
27
26
|
}
|
|
28
27
|
export declare class YExtentComponent extends ChartBaseElement {
|
|
29
|
-
|
|
28
|
+
paneUUID: string;
|
|
30
29
|
idx: number;
|
|
31
30
|
paneComponent: PaneComponent;
|
|
32
31
|
private chartBaseModel;
|
|
33
32
|
private canvasBoundsContainer;
|
|
34
33
|
private hitTestController;
|
|
35
|
-
|
|
36
|
-
readonly
|
|
37
|
-
readonly yAxisComponent: ExtentYAxis | undefined;
|
|
34
|
+
dynamicObjectsCanvasModel: CanvasModel;
|
|
35
|
+
readonly scale: ScaleModel;
|
|
38
36
|
readonly dragNDrop: DragNDropYComponent;
|
|
39
37
|
dataSeries: Set<DataSeriesModel>;
|
|
40
38
|
formatters: YExtentFormatters;
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
yAxis: YAxisComponent;
|
|
40
|
+
mainDataSeries?: DataSeriesModel;
|
|
41
|
+
constructor(paneUUID: string, idx: number, paneComponent: PaneComponent, chartBaseModel: ChartBaseModel<'candle'>, canvasBoundsContainer: CanvasBoundsContainer, hitTestController: PaneHitTestController, dynamicObjectsCanvasModel: CanvasModel, scale: ScaleModel, createYAxisComponent: (formatter: (value: number) => string, dataSeriesProvider: () => DataSeriesModel | undefined) => YAxisComponent, dragNDrop: DragNDropYComponent, dataSeries?: Set<DataSeriesModel>, formatters?: YExtentFormatters);
|
|
43
42
|
protected doDeactivate(): void;
|
|
44
43
|
getYAxisBounds: () => Bounds;
|
|
45
44
|
yAxisHT: import("../../../canvas/canvas-bounds-container").HitBoundsTest;
|
|
@@ -48,6 +47,7 @@ export declare class YExtentComponent extends ChartBaseElement {
|
|
|
48
47
|
* @returns {Bounds} The bounds of the scale model.
|
|
49
48
|
*/
|
|
50
49
|
getBounds(): Bounds;
|
|
50
|
+
getBaseline(): number;
|
|
51
51
|
private toVisualPoints;
|
|
52
52
|
/**
|
|
53
53
|
* Creates a new DataSeriesModel object.
|
|
@@ -60,6 +60,7 @@ export declare class YExtentComponent extends ChartBaseElement {
|
|
|
60
60
|
* @returns {void}
|
|
61
61
|
*/
|
|
62
62
|
addDataSeries(series: DataSeriesModel): void;
|
|
63
|
+
toY: (value: Price) => Pixel;
|
|
63
64
|
/**
|
|
64
65
|
* Removes a data series from the chart.
|
|
65
66
|
*
|
|
@@ -67,13 +68,6 @@ export declare class YExtentComponent extends ChartBaseElement {
|
|
|
67
68
|
* @returns {void}
|
|
68
69
|
*/
|
|
69
70
|
removeDataSeries(series: DataSeriesModel): void;
|
|
70
|
-
/**
|
|
71
|
-
* Returns the type of the y-axis component for the current pane.
|
|
72
|
-
*
|
|
73
|
-
* @returns {PriceAxisType} The 'regular' type of the y-axis component for the current pane.
|
|
74
|
-
*
|
|
75
|
-
*/
|
|
76
|
-
getAxisType(): PriceAxisType;
|
|
77
71
|
valueFormatter: (value: Unit, dataSeries?: DataSeriesModel) => string;
|
|
78
72
|
get regularFormatter(): (value: number) => string;
|
|
79
73
|
/**
|
|
@@ -1,6 +1,125 @@
|
|
|
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 { ChartBaseElement } from '../../../model/chart-base-element';
|
|
8
|
+
import { DataSeriesModel, VisualSeriesPoint, defaultValueFormatter, } from '../../../model/data-series.model';
|
|
9
|
+
import { mergeHighLow } from '../../../model/scaling/auto-scale.model';
|
|
10
|
+
import { createYExtentFormatters } from '../../chart/price.formatter';
|
|
11
|
+
export class YExtentComponent extends ChartBaseElement {
|
|
12
|
+
constructor(paneUUID, idx, paneComponent, chartBaseModel, canvasBoundsContainer, hitTestController, dynamicObjectsCanvasModel, scale, createYAxisComponent, dragNDrop, dataSeries = new Set(), formatters = {
|
|
13
|
+
regular: defaultValueFormatter,
|
|
14
|
+
}) {
|
|
15
|
+
super();
|
|
16
|
+
this.paneUUID = paneUUID;
|
|
17
|
+
this.idx = idx;
|
|
18
|
+
this.paneComponent = paneComponent;
|
|
19
|
+
this.chartBaseModel = chartBaseModel;
|
|
20
|
+
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
21
|
+
this.hitTestController = hitTestController;
|
|
22
|
+
this.dynamicObjectsCanvasModel = dynamicObjectsCanvasModel;
|
|
23
|
+
this.scale = scale;
|
|
24
|
+
this.dragNDrop = dragNDrop;
|
|
25
|
+
this.dataSeries = dataSeries;
|
|
26
|
+
this.formatters = formatters;
|
|
27
|
+
this.getYAxisBounds = () => {
|
|
28
|
+
return this.canvasBoundsContainer.getBounds(CanvasElement.PANE_UUID_Y_AXIS(this.paneUUID, this.idx));
|
|
29
|
+
};
|
|
30
|
+
this.yAxisHT = this.canvasBoundsContainer.getBoundsHitTest(CanvasElement.PANE_UUID_Y_AXIS(this.paneUUID, this.idx));
|
|
31
|
+
this.toVisualPoints = (points) => points.map(p => new VisualSeriesPoint(this.chartBaseModel.dataFromTimestamp(p.timestamp).centerUnit, p.close));
|
|
32
|
+
this.toY = (value) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
return (_b = (_a = this.mainDataSeries) === null || _a === void 0 ? void 0 : _a.view.toY(value)) !== null && _b !== void 0 ? _b : 1;
|
|
35
|
+
};
|
|
36
|
+
this.valueFormatter = (value, dataSeries) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const formatter = (_a = this.formatters[this.yAxis.getAxisType()]) !== null && _a !== void 0 ? _a : this.formatters.regular;
|
|
39
|
+
return formatter(value, dataSeries);
|
|
40
|
+
};
|
|
41
|
+
this.addChildEntity(scale);
|
|
42
|
+
this.setValueFormatters(createYExtentFormatters(this));
|
|
43
|
+
this.yAxis = createYAxisComponent(this.valueFormatter.bind(this), () => this.mainDataSeries);
|
|
44
|
+
this.addChildEntity(this.yAxis);
|
|
45
|
+
}
|
|
46
|
+
doDeactivate() {
|
|
47
|
+
super.doDeactivate();
|
|
48
|
+
this.dataSeries.forEach(ds => {
|
|
49
|
+
this.paneComponent.seriesRemovedSubject.next(ds);
|
|
50
|
+
ds.deactivate();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns the bounds of the scale model.
|
|
55
|
+
* @returns {Bounds} The bounds of the scale model.
|
|
56
|
+
*/
|
|
57
|
+
getBounds() {
|
|
58
|
+
return this.scale.getBounds();
|
|
59
|
+
}
|
|
60
|
+
getBaseline() {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
return (_b = (_a = this.mainDataSeries) === null || _a === void 0 ? void 0 : _a.getBaseline()) !== null && _b !== void 0 ? _b : 1;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates a new DataSeriesModel object.
|
|
66
|
+
* @returns {DataSeriesModel} - The newly created DataSeriesModel object.
|
|
67
|
+
*/
|
|
68
|
+
createDataSeries() {
|
|
69
|
+
const series = new DataSeriesModel(this, this.hitTestController.getNewDataSeriesHitTestId());
|
|
70
|
+
series.toVisualPoints = this.toVisualPoints;
|
|
71
|
+
return series;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Adds a new data series to the chart.
|
|
75
|
+
* @param {DataSeriesModel} series - The data series to be added.
|
|
76
|
+
* @returns {void}
|
|
77
|
+
*/
|
|
78
|
+
addDataSeries(series) {
|
|
79
|
+
this.dataSeries.add(series);
|
|
80
|
+
if (this.dataSeries.size === 1) {
|
|
81
|
+
this.mainDataSeries = series;
|
|
82
|
+
}
|
|
83
|
+
this.paneComponent.updateView();
|
|
84
|
+
this.paneComponent.seriesAddedSubject.next(series);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Removes a data series from the chart.
|
|
88
|
+
*
|
|
89
|
+
* @param {DataSeriesModel} series - The data series to be removed.
|
|
90
|
+
* @returns {void}
|
|
91
|
+
*/
|
|
92
|
+
removeDataSeries(series) {
|
|
93
|
+
this.dataSeries.delete(series);
|
|
94
|
+
this.paneComponent.updateView();
|
|
95
|
+
this.paneComponent.seriesRemovedSubject.next(series);
|
|
96
|
+
}
|
|
97
|
+
get regularFormatter() {
|
|
98
|
+
return this.formatters.regular;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Sets the pane value formatters for the current instance.
|
|
102
|
+
* @param {YExtentFormatters} formatters - The pane value formatters to be set.
|
|
103
|
+
*/
|
|
104
|
+
setValueFormatters(formatters) {
|
|
105
|
+
this.formatters = formatters;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Returns the regular value from Y coordinate.
|
|
109
|
+
* @param {number} y - The Y coordinate.
|
|
110
|
+
* @returns {number} - The regular value.
|
|
111
|
+
*/
|
|
112
|
+
regularValueFromY(y) {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
return (_b = (_a = this.mainDataSeries) === null || _a === void 0 ? void 0 : _a.view.priceFromY(y)) !== null && _b !== void 0 ? _b : this.scale.fromY(y);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export const createDefaultYExtentHighLowProvider = (extent) => ({
|
|
118
|
+
isHighLowActive: () => true,
|
|
119
|
+
calculateHighLow: state => {
|
|
120
|
+
const highLows = Array.from(extent.dataSeries)
|
|
121
|
+
.filter(ds => ds.highLowProvider.isHighLowActive())
|
|
122
|
+
.map(ds => ds.highLowProvider.calculateHighLow(state));
|
|
123
|
+
return mergeHighLow(highLows);
|
|
124
|
+
},
|
|
125
|
+
});
|
|
@@ -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
|
*/
|