@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
package/dist/chart/bootstrap.js
CHANGED
|
@@ -1,6 +1,454 @@
|
|
|
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{merge as Y}from"rxjs";import{CanvasAnimation as N}from"./animation/canvas-animation";import{CHART_UUID as W,CanvasBoundsContainer as Z,CanvasElement as x}from"./canvas/canvas-bounds-container";import{CursorHandler as X}from"./canvas/cursor.handler";import{createDefaultLayoutTemplate as j,extractElements as q}from"./canvas/layout-creator";import{mergeWithDefaultConfig as J}from"./chart.config";import{ChartBaseModel as K}from"./components/chart/chart-base.model";import{ChartComponent as Q}from"./components/chart/chart.component";import{ChartModel as $}from"./components/chart/chart.model";import{CrossToolComponent as tt}from"./components/cross_tool/cross-tool.component";import{EventsComponent as et}from"./components/events/events.component";import{GridComponent as st}from"./components/grid/grid.component";import{HighLowComponent as nt}from"./components/high_low/high-low.component";import{HighlightsComponent as ot}from"./components/highlights/highlights.component";import{NavigationMapComponent as it}from"./components/navigation_map/navigation-map.component";import{ChartPanComponent as rt}from"./components/pan/chart-pan.component";import{PaneManager as at}from"./components/pane/pane-manager.component";import{SnapshotComponent as ht}from"./components/snapshot/snapshot.component";import{VolumesComponent as ct}from"./components/volumes/volumes.component";import{WaterMarkComponent as mt}from"./components/watermark/water-mark.component";import{XAxisComponent as dt}from"./components/x_axis/x-axis.component";import{YAxisComponent as pt}from"./components/y_axis/y-axis.component";import{ClearCanvasDrawer as S}from"./drawers/clear-canvas.drawer";import{DrawingManager as lt}from"./drawers/drawing-manager";import Ct from"./events/event-bus";import{EVENT_DRAW as ut}from"./events/events";import{CandleTapHandler as vt}from"./inputhandlers/candle-tap.handler";import{ChartResizeHandler as gt}from"./inputhandlers/chart-resize.handler";import{CrossEventProducerComponent as ft}from"./inputhandlers/cross-event-producer.component";import{HoverProducerComponent as Mt}from"./inputhandlers/hover-producer.component";import{CanvasInputListenerComponent as wt}from"./inputlisteners/canvas-input-listener.component";import{createCanvasModel as f,createMainCanvasModel as bt}from"./model/canvas.model";import{HitTestCanvasModel as Tt}from"./model/hit-test-canvas.model";import{ScaleModel as Et}from"./model/scale.model";import{TimeZoneModel as Ht}from"./model/time-zone.model";import{clearerSafe as At}from"./utils/function.utils";import{merge as St}from"./utils/merge.utils";export default class B{constructor(t,n={}){var s,h;this.components=[],this.chartComponents=[],this.userInputListenerComponents=[],this.canvasModels=[],this.parentElement=t;const e=n;J(e),this.config=e;const M=j(e);t.innerHTML="",t.appendChild(M.content),this.id=(s=t.getAttribute("data-id"))!==null&&s!==void 0?s:"",e.fixedSize&&(t.style.width=e.fixedSize.width+"px",t.style.height=e.fixedSize.height+"px");const C=new Ht(e);this.timeZoneModel=C;const w=this.timeZoneModel.getFormatterFactory(),r=q(t);this.elements=r;const i=new Ct;this.bus=i;const u=new gt(t,(h=r.chartResizer)!==null&&h!==void 0?h:t,i,this.canvasModels,e);this.chartResizeHandler=u,u.subscribeResize(),this.components.push(u.unsubscribeAnimationUpdate.bind(u));const o=new lt(i,u);this.drawingManager=o;const p=bt(i,r.mainCanvas,r.chartResizer,this.config.components.chart.type,this.config,o,this.canvasModels);this.mainCanvasModel=p;const E=f(i,r.overDataSeriesCanvas,e,o,this.canvasModels,r.chartResizer);this.overSeriesCanvasModel=E;const I=new S(E);o.addDrawer(I,"OVER_SERIES_CLEAR"),this.dataSeriesCanvasModel=f(i,r.dataSeriesCanvas,e,o,this.canvasModels,r.chartResizer);const D=new S(this.dataSeriesCanvasModel);o.addDrawer(D,"SERIES_CLEAR");const F=f(i,r.yAxisLabelsCanvas,e,o,this.canvasModels,r.chartResizer),a=new Z(e,i,p,w,u);this.canvasBoundsContainer=a;const b=r.mainCanvas.parentElement;if(b===null)throw new Error("Couldn't get main canvas parent");const c=new wt(i,b);this.canvasInputListener=c,this.chartComponents.push(this.canvasInputListener);const g=new Tt(i,r.hitTestCanvas,c,a,o,e,this.canvasModels,r.chartResizer);this.hitTestCanvasModel=g;const P=new S(g);o.addDrawer(P,"HIT_TEST_CLEAR");const H=new N(i);this.canvasAnimation=H;const m=new Et(e,()=>a.getBounds(x.CHART),H);this.scaleModel=m;const T=f(i,r.backgroundCanvas,e,o,this.canvasModels,r.chartResizer,{willReadFrequently:!0});this.backgroundCanvasModel=T,this.cursorHandler=new X(r.canvasArea,c,a,g),this.chartComponents.push(this.cursorHandler),this.crossEventProducer=new ft(c,a),this.chartComponents.push(this.crossEventProducer);const L=new K("candle"),v=new rt(i,m,a,e,H,c,b,L);this.chartPanComponent=v,this.chartComponents.push(v),this.userInputListenerComponents.push(v.chartAreaPanHandler);const l=new at(L,this.userInputListenerComponents,i,m,a,e,H,c,o,this.dataSeriesCanvasModel,this.cursorHandler,this.crossEventProducer,v,p);this.paneManager=l,this.chartComponents.push(l),this.chartModel=new $(L,l,i,this.dataSeriesCanvasModel,e,m,w,b,a,u);const A=new Q(this.chartModel,this.dataSeriesCanvasModel,e,m,a,o,g,c,T,v,l,this.cursorHandler);this.chartComponents.push(A),this.chartComponent=A;const d=this.chartComponent.chartModel;this.chartModel=d,this.canvasBoundsContainer.setMainCandleSeries(this.chartModel.mainCandleSeries),g.addSubscriber(l.hitTestController),this.xAxisComponent=new dt(i,e,p,A,m,a,c,u,this.drawingManager,C,v,this.cursorHandler,T),this.chartComponents.push(this.xAxisComponent),this.userInputListenerComponents.push(this.xAxisComponent.xAxisScaleHandler);const z=new S(p);o.addDrawer(z,"MAIN_CLEAR");const _=new vt(b,d,c,e);this.chartComponents.push(_),this.watermarkComponent=new mt(l,d,i,e,a,E,o),this.chartComponents.push(this.watermarkComponent);const U=f(i,r.crossToolCanvas,e,o,this.canvasModels,r.chartResizer);this.highlightsComponent=new ot(i,e,d,p,a,o),this.chartComponents.push(this.highlightsComponent),e.useUTCTimeOverride&&e.dateFormatter&&!e.dateFormatter.utcTimeOverride&&(e.dateFormatter.utcTimeOverride=this.createUTCTimeOverrideConfig(d)),this.navigationMapComponent=new it(i,d,p,e,c,a,o,w,v,this.cursorHandler),this.chartComponents.push(this.navigationMapComponent),this.userInputListenerComponents.push(this.navigationMapComponent.navigationMapMoveHandler);const O=new nt(e,this.dataSeriesCanvasModel,d,a,o);this.chartComponents.push(O),this.yAxisComponent=new pt(i,e,p,F,T,d,m,this.canvasInputListener,a,this.drawingManager,v,l,this.cursorHandler),this.chartComponents.push(this.yAxisComponent),this.userInputListenerComponents.push(this.yAxisComponent.yAxisScaleHandler),this.volumesComponent=new ct(this.dataSeriesCanvasModel,A,m,a,o,e,l,this.yAxisComponent),this.chartComponents.push(this.volumesComponent);const V=new st(p,m,e,"GRID",o,()=>this.canvasBoundsContainer.getBounds(x.ALL_PANES),()=>this.canvasBoundsContainer.getBounds(x.PANE_UUID(W)),()=>this.xAxisComponent.xAxisLabelsGenerator.labels,()=>this.yAxisComponent.yAxisModel.yAxisBaseLabelsModel.labels,()=>this.chartModel.toY(this.chartModel.getBaseLine()),()=>e.components.grid.visible);this.chartComponents.push(V),this.hoverProducer=new Mt(this.crossEventProducer,m,e,d,c,this.canvasBoundsContainer,this.paneManager,C,w),this.chartComponents.push(this.hoverProducer),this.crossToolComponent=new tt(e,U,a,o,l,this.crossEventProducer,this.hoverProducer),this.chartComponents.push(this.crossToolComponent);const k=f(i,r.snapshotCanvas,e,o,this.canvasModels,r.chartResizer),R=new ht(this.elements,k);this.snapshotComponent=R,this.chartComponents.push(R);const y=new et(e,E,g,d,a,o,w,this.cursorHandler,T);this.eventsComponent=y,this.chartComponents.push(y),this.chartComponents.forEach(G=>G.activate()),this.enableUserControls(),o.reorderDrawers(e.drawingOrder),this.clearer=At(this.components)}createUTCTimeOverrideConfig(t){const n=new RegExp("HH|H|mm|m|s|ss|sss|SSS");return{pattern:"MM/dd/YY",test:s=>n.test(s)&&(t.getPeriod()||0)>=86400}}static mergeConfig(t,n){for(const s in n)s in t?typeof t[s]=="object"&&B.mergeConfig(t[s],n[s]):t[s]=n[s];return t}getConfig(){return this.config}setRtl(t){this.config.rtl=t,this.bus.fire(ut)}setChartType(t){this.chartComponent.setChartType(t)}disableUserControls(){this.userInputListenerComponents.forEach(t=>t.deactivate()),this.hitTestCanvasModel.disableUserControls()}enableUserControls(){this.userInputListenerComponents.forEach(t=>t.activate()),this.hitTestCanvasModel.enableUserControls()}setGridConfig(t){var n,s,h,e,M;const C=this.config.components.grid;C.visible=(n=t.visible)!==null&&n!==void 0?n:!1,C.dash=(s=t.dash)!==null&&s!==void 0?s:[0,0],C.width=(h=t.width)!==null&&h!==void 0?h:1,C.color=(e=t.color)!==null&&e!==void 0?e:"#FFFFFF",this.config.colors.chartAreaTheme.gridColor=(M=t.color)!==null&&M!==void 0?M:"#FFFFFF",this.redraw()}setGridVisible(t){this.config.components&&this.config.components.grid&&(this.config.components.grid.visible=t,this.redraw())}setGridVertical(t){this.config.components.grid.vertical=t,this.redraw()}setGridHorizontal(t){this.config.components.grid.horizontal=t,this.redraw()}deactivate(){this.clearer(),this.disableUserControls(),this.chartComponents.forEach(t=>t.deactivate())}redraw(){this.bus.fireDraw()}getOffsets(){return this.config.components&&this.config.components.offsets}showSeparateVolumes(t=!1){this.volumesComponent&&(this.volumesComponent.setShowVolumesSeparatly(t),this.canvasBoundsContainer.updateYAxisWidths())}setAutoScale(t=!0){this.scaleModel.autoScale(t)}setShowCandleBorders(t=!0){this.config.components&&this.config.components.chart&&(this.config.components.chart.showCandlesBorder=t,this.redraw())}valueToY(t){return this.chartModel.toY(t)}setHighLowVisible(t=!0){this.config.components&&this.config.components.highLow&&(this.config.components.highLow.visible=t,this.redraw())}setCrossToolVisible(t="cross-and-labels"){this.config.components&&this.config.components.crossTool&&(this.config.components.crossTool.type=t,this.redraw())}setHighlightsVisible(t=!0){var n;!((n=this.config.components)===null||n===void 0)&&n.highlights&&(this.config.components.highlights.visible=t,this.redraw())}setHighlightsData(t){this.highlightsComponent.setHighlights(t)}setColors(t){St(this.config.colors,t,{addIfMissing:!0,overrideExisting:!0}),this.redraw()}addMouseMoveOnChartElementHandler(t,n){const s=this.canvasBoundsContainer.getBoundsHitTest(t),h=this.canvasInputListener.observeMouseMove(s).subscribe(n);return()=>h.unsubscribe()}addMouseEnterOnChartElementHandler(t,n,s=!1){const h=this.canvasBoundsContainer.getBoundsHitTest(t),e=this.canvasInputListener.observeMouseEnter(h,s).subscribe(n);return()=>e.unsubscribe()}addClickOnChartElementHandler(t,n){const s=this.canvasBoundsContainer.getBoundsHitTest(t),h=this.canvasInputListener.observeClick(s).subscribe(n);return()=>h.unsubscribe()}addDragEventsListener(t,n){const s=this.canvasBoundsContainer.getBoundsHitTest(t),h=Y(this.canvasInputListener.observeYDrag(s),this.canvasInputListener.observeXDrag(s)).subscribe(n);return()=>h.unsubscribe()}destroy(){this.bus.setMuted(!0),this.chartComponents.forEach(t=>t.disable()),this.parentElement.childNodes.forEach(t=>t.remove()),this.parentElement.style.width="",this.parentElement.style.height=""}registerComponent(t,n){const s=t(this);this.components.push(s),n&&n(s),s.activate()}registerPaneFormatters(t,n){var s;(s=this.paneManager.paneComponents[t])===null||s===void 0||s.setPaneValueFormatters(n)}}
|
|
6
|
+
import { merge as mergeRx } from 'rxjs';
|
|
7
|
+
import { CanvasAnimation } from './animation/canvas-animation';
|
|
8
|
+
import { CHART_UUID, CanvasBoundsContainer, CanvasElement } from './canvas/canvas-bounds-container';
|
|
9
|
+
import { CursorHandler } from './canvas/cursor.handler';
|
|
10
|
+
import { createDefaultLayoutTemplate, extractElements } from './canvas/layout-creator';
|
|
11
|
+
import { mergeWithDefaultConfig } from './chart.config';
|
|
12
|
+
import { ChartBaseModel } from './components/chart/chart-base.model';
|
|
13
|
+
import { ChartComponent } from './components/chart/chart.component';
|
|
14
|
+
import { ChartModel } from './components/chart/chart.model';
|
|
15
|
+
import { CrossToolComponent } from './components/cross_tool/cross-tool.component';
|
|
16
|
+
import { DynamicObjectsComponent } from './components/dynamic-objects/dynamic-objects.component';
|
|
17
|
+
import { EventsComponent } from './components/events/events.component';
|
|
18
|
+
import { GridComponent } from './components/grid/grid.component';
|
|
19
|
+
import { HighLowComponent } from './components/high_low/high-low.component';
|
|
20
|
+
import { HighlightsComponent } from './components/highlights/highlights.component';
|
|
21
|
+
import { NavigationMapComponent } from './components/navigation_map/navigation-map.component';
|
|
22
|
+
import { ChartPanComponent } from './components/pan/chart-pan.component';
|
|
23
|
+
import { PaneManager } from './components/pane/pane-manager.component';
|
|
24
|
+
import { SnapshotComponent } from './components/snapshot/snapshot.component';
|
|
25
|
+
import { VolumesComponent } from './components/volumes/volumes.component';
|
|
26
|
+
import { WaterMarkComponent } from './components/watermark/water-mark.component';
|
|
27
|
+
import { XAxisComponent } from './components/x_axis/x-axis.component';
|
|
28
|
+
import { LastCandleLabelsProvider } from './components/y_axis/price_labels/last-candle-labels.provider';
|
|
29
|
+
import { LabelsGroups } from './components/y_axis/price_labels/y-axis-labels.model';
|
|
30
|
+
import { YAxisPriceLabelsDrawer } from './components/y_axis/price_labels/y-axis-price-labels.drawer';
|
|
31
|
+
import { YAxisDrawer } from './components/y_axis/y-axis.drawer';
|
|
32
|
+
import { ClearCanvasDrawer } from './drawers/clear-canvas.drawer';
|
|
33
|
+
import { CompositeDrawer } from './drawers/composite.drawer';
|
|
34
|
+
import { DrawingManager } from './drawers/drawing-manager';
|
|
35
|
+
import EventBus from './events/event-bus';
|
|
36
|
+
import { CandleTapHandler } from './inputhandlers/candle-tap.handler';
|
|
37
|
+
import { ChartResizeHandler } from './inputhandlers/chart-resize.handler';
|
|
38
|
+
import { CrossEventProducerComponent } from './inputhandlers/cross-event-producer.component';
|
|
39
|
+
import { HoverProducerComponent } from './inputhandlers/hover-producer.component';
|
|
40
|
+
import { CanvasInputListenerComponent } from './inputlisteners/canvas-input-listener.component';
|
|
41
|
+
import { createCanvasModel, createMainCanvasModel } from './model/canvas.model';
|
|
42
|
+
import { HitTestCanvasModel } from './model/hit-test-canvas.model';
|
|
43
|
+
import { ScaleModel } from './model/scale.model';
|
|
44
|
+
import { TimeZoneModel } from './model/time-zone.model';
|
|
45
|
+
import { clearerSafe } from './utils/function.utils';
|
|
46
|
+
import { merge } from './utils/merge.utils';
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated use {Chart} instead
|
|
49
|
+
*/
|
|
50
|
+
export default class ChartBootstrap {
|
|
51
|
+
constructor(element, userConfig = {}) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
this.components = [];
|
|
54
|
+
this.chartComponents = [];
|
|
55
|
+
// components list which listen for mouse and keyboard
|
|
56
|
+
this.userInputListenerComponents = [];
|
|
57
|
+
this.canvasModels = [];
|
|
58
|
+
this.parentElement = element;
|
|
59
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
60
|
+
const config = userConfig;
|
|
61
|
+
mergeWithDefaultConfig(config);
|
|
62
|
+
this.config = config;
|
|
63
|
+
const chartLayoutTemplate = createDefaultLayoutTemplate(config);
|
|
64
|
+
element.innerHTML = '';
|
|
65
|
+
element.appendChild(chartLayoutTemplate.content);
|
|
66
|
+
this.id = (_a = element.getAttribute('data-id')) !== null && _a !== void 0 ? _a : '';
|
|
67
|
+
if (config.fixedSize) {
|
|
68
|
+
element.style.width = config.fixedSize.width + 'px';
|
|
69
|
+
element.style.height = config.fixedSize.height + 'px';
|
|
70
|
+
}
|
|
71
|
+
const timeZoneModel = new TimeZoneModel(config);
|
|
72
|
+
this.timeZoneModel = timeZoneModel;
|
|
73
|
+
const formatterFactory = this.timeZoneModel.getFormatterFactory();
|
|
74
|
+
const elements = extractElements(element);
|
|
75
|
+
this.elements = elements;
|
|
76
|
+
const eventBus = new EventBus();
|
|
77
|
+
this.bus = eventBus;
|
|
78
|
+
const chartResizeHandler = new ChartResizeHandler(element, (_b = elements.chartResizer) !== null && _b !== void 0 ? _b : element, eventBus, this.canvasModels, config);
|
|
79
|
+
this.chartResizeHandler = chartResizeHandler;
|
|
80
|
+
chartResizeHandler.subscribeResize();
|
|
81
|
+
this.components.push(chartResizeHandler.unsubscribeAnimationUpdate.bind(chartResizeHandler));
|
|
82
|
+
const drawingManager = new DrawingManager(eventBus, chartResizeHandler);
|
|
83
|
+
this.drawingManager = drawingManager;
|
|
84
|
+
const mainCanvasModel = createMainCanvasModel(eventBus, elements.mainCanvas, elements.chartResizer, this.config.components.chart.type, this.config, drawingManager, this.canvasModels);
|
|
85
|
+
this.mainCanvasModel = mainCanvasModel;
|
|
86
|
+
this.dynamicObjectsCanvasModel = createCanvasModel(eventBus, elements.dynamicObjectsCanvas, config, drawingManager, this.canvasModels, elements.chartResizer);
|
|
87
|
+
const dataSeriesCanvasClearDrawer = new ClearCanvasDrawer(this.dynamicObjectsCanvasModel);
|
|
88
|
+
drawingManager.addDrawer(dataSeriesCanvasClearDrawer, 'SERIES_CLEAR');
|
|
89
|
+
const yAxisLabelsCanvasModel = createCanvasModel(eventBus, elements.yAxisLabelsCanvas, config, drawingManager, this.canvasModels, elements.chartResizer);
|
|
90
|
+
const canvasBoundsContainer = new CanvasBoundsContainer(config, eventBus, mainCanvasModel, formatterFactory, chartResizeHandler);
|
|
91
|
+
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
92
|
+
//#region main canvas user input listeners
|
|
93
|
+
const mainCanvasParent = elements.mainCanvas.parentElement;
|
|
94
|
+
if (mainCanvasParent === null) {
|
|
95
|
+
throw new Error(`Couldn't get main canvas parent`);
|
|
96
|
+
}
|
|
97
|
+
const canvasInputListener = new CanvasInputListenerComponent(eventBus, mainCanvasParent);
|
|
98
|
+
this.canvasInputListener = canvasInputListener;
|
|
99
|
+
this.chartComponents.push(this.canvasInputListener);
|
|
100
|
+
//#endregion
|
|
101
|
+
const hitTestCanvasModel = new HitTestCanvasModel(eventBus, elements.hitTestCanvas, canvasInputListener, canvasBoundsContainer, drawingManager, config, this.canvasModels, elements.chartResizer);
|
|
102
|
+
this.hitTestCanvasModel = hitTestCanvasModel;
|
|
103
|
+
const hitTestClearCanvas = new ClearCanvasDrawer(hitTestCanvasModel);
|
|
104
|
+
drawingManager.addDrawer(hitTestClearCanvas, 'HIT_TEST_CLEAR');
|
|
105
|
+
//#endregion
|
|
106
|
+
// canvas animation container
|
|
107
|
+
const canvasAnimation = new CanvasAnimation(eventBus);
|
|
108
|
+
this.canvasAnimation = canvasAnimation;
|
|
109
|
+
//#region ScaleModel init
|
|
110
|
+
const scaleModel = new ScaleModel(config, () => canvasBoundsContainer.getBounds(CanvasElement.PANE_UUID(CHART_UUID)), canvasAnimation);
|
|
111
|
+
this.scaleModel = scaleModel;
|
|
112
|
+
//#endregion
|
|
113
|
+
const backgroundCanvasModel = createCanvasModel(eventBus, elements.backgroundCanvas, config, drawingManager, this.canvasModels, elements.chartResizer, {
|
|
114
|
+
// can be read frequently, see {redrawBackgroundArea} function
|
|
115
|
+
willReadFrequently: true,
|
|
116
|
+
});
|
|
117
|
+
this.backgroundCanvasModel = backgroundCanvasModel;
|
|
118
|
+
this.cursorHandler = new CursorHandler(elements.canvasArea, canvasInputListener, canvasBoundsContainer, hitTestCanvasModel);
|
|
119
|
+
this.chartComponents.push(this.cursorHandler);
|
|
120
|
+
this.crossEventProducer = new CrossEventProducerComponent(canvasInputListener, canvasBoundsContainer);
|
|
121
|
+
this.chartComponents.push(this.crossEventProducer);
|
|
122
|
+
const chartBaseModel = new ChartBaseModel('candle');
|
|
123
|
+
this.chartBaseModel = chartBaseModel;
|
|
124
|
+
const chartPanComponent = new ChartPanComponent(eventBus, scaleModel, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, mainCanvasParent, chartBaseModel);
|
|
125
|
+
this.chartPanComponent = chartPanComponent;
|
|
126
|
+
this.chartComponents.push(chartPanComponent);
|
|
127
|
+
this.userInputListenerComponents.push(chartPanComponent.chartAreaPanHandler);
|
|
128
|
+
const paneManager = new PaneManager(chartBaseModel, this.dynamicObjectsCanvasModel, this.userInputListenerComponents, eventBus, scaleModel, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, drawingManager, this.cursorHandler, this.crossEventProducer, chartPanComponent, mainCanvasModel, yAxisLabelsCanvasModel);
|
|
129
|
+
this.paneManager = paneManager;
|
|
130
|
+
const mainPane = this.paneManager.panes[CHART_UUID];
|
|
131
|
+
this.mainPane = mainPane;
|
|
132
|
+
this.chartComponents.push(paneManager);
|
|
133
|
+
// dynamic objects component
|
|
134
|
+
this.dynamicObjects = new DynamicObjectsComponent(this.dynamicObjectsCanvasModel, drawingManager);
|
|
135
|
+
this.chartComponents.push(this.dynamicObjects);
|
|
136
|
+
this.chartModel = new ChartModel(chartBaseModel, paneManager, eventBus, this.dynamicObjectsCanvasModel, config, scaleModel, formatterFactory, mainCanvasParent, canvasBoundsContainer, chartResizeHandler);
|
|
137
|
+
//#region main chart component init
|
|
138
|
+
const chartComponent = new ChartComponent(this.chartModel, this.dynamicObjectsCanvasModel, config, scaleModel, canvasBoundsContainer, drawingManager, hitTestCanvasModel, canvasInputListener, backgroundCanvasModel, chartPanComponent, paneManager, this.cursorHandler, this.dynamicObjects);
|
|
139
|
+
this.chartComponents.push(chartComponent);
|
|
140
|
+
this.chartComponent = chartComponent;
|
|
141
|
+
const chartModel = this.chartComponent.chartModel;
|
|
142
|
+
this.chartModel = chartModel;
|
|
143
|
+
this.canvasBoundsContainer.setMainCandleSeries(this.chartModel.mainCandleSeries);
|
|
144
|
+
hitTestCanvasModel.addSubscriber(paneManager.hitTestController);
|
|
145
|
+
// X-axis component
|
|
146
|
+
this.xAxisComponent = new XAxisComponent(eventBus, config, mainCanvasModel, chartComponent, scaleModel, canvasBoundsContainer, canvasInputListener, chartResizeHandler, this.drawingManager, timeZoneModel, chartPanComponent, this.cursorHandler, backgroundCanvasModel);
|
|
147
|
+
this.chartComponents.push(this.xAxisComponent);
|
|
148
|
+
this.userInputListenerComponents.push(this.xAxisComponent.xAxisScaleHandler);
|
|
149
|
+
const mainCanvasClearDrawer = new ClearCanvasDrawer(mainCanvasModel);
|
|
150
|
+
drawingManager.addDrawer(mainCanvasClearDrawer, 'MAIN_CLEAR');
|
|
151
|
+
const candleTap = new CandleTapHandler(mainCanvasParent, chartModel, canvasInputListener, config);
|
|
152
|
+
this.chartComponents.push(candleTap);
|
|
153
|
+
// watermark component
|
|
154
|
+
this.watermarkComponent = new WaterMarkComponent(paneManager, chartModel, eventBus, config, canvasBoundsContainer, this.dynamicObjectsCanvasModel, drawingManager);
|
|
155
|
+
this.chartComponents.push(this.watermarkComponent);
|
|
156
|
+
const crossToolCanvasModel = createCanvasModel(eventBus, elements.crossToolCanvas, config, drawingManager, this.canvasModels, elements.chartResizer);
|
|
157
|
+
this.highlightsComponent = new HighlightsComponent(eventBus, config, chartModel, mainCanvasModel, canvasBoundsContainer, drawingManager);
|
|
158
|
+
this.chartComponents.push(this.highlightsComponent);
|
|
159
|
+
// setup default rules for UTC datetime override
|
|
160
|
+
if (config.useUTCTimeOverride && config.dateFormatter && !config.dateFormatter.utcTimeOverride) {
|
|
161
|
+
config.dateFormatter.utcTimeOverride = this.createUTCTimeOverrideConfig(chartModel);
|
|
162
|
+
}
|
|
163
|
+
// X navigation area component
|
|
164
|
+
this.navigationMapComponent = new NavigationMapComponent(eventBus, chartModel, mainCanvasModel, config, canvasInputListener, canvasBoundsContainer, drawingManager, formatterFactory, chartPanComponent, this.cursorHandler);
|
|
165
|
+
this.chartComponents.push(this.navigationMapComponent);
|
|
166
|
+
this.userInputListenerComponents.push(this.navigationMapComponent.navigationMapMoveHandler);
|
|
167
|
+
// high low component
|
|
168
|
+
const highLowComponent = new HighLowComponent(config, this.dynamicObjectsCanvasModel, chartModel, canvasBoundsContainer, drawingManager);
|
|
169
|
+
this.chartComponents.push(highLowComponent);
|
|
170
|
+
this.initYAxisDrawer(yAxisLabelsCanvasModel);
|
|
171
|
+
this.yAxisComponent = mainPane.mainExtent.yAxis;
|
|
172
|
+
// default labels provider
|
|
173
|
+
const lastCandleLabelsProvider = new LastCandleLabelsProvider(this.chartModel, this.config, this.chartModel.lastCandleLabelsByChartType, this.yAxisComponent.getLabelsColorResolver.bind(this.yAxisComponent));
|
|
174
|
+
this.yAxisComponent.registerYAxisLabelsProvider(lastCandleLabelsProvider, LabelsGroups.MAIN);
|
|
175
|
+
this.volumesComponent = new VolumesComponent(this.dynamicObjectsCanvasModel, chartComponent, scaleModel, canvasBoundsContainer, drawingManager, config, paneManager, this.dynamicObjects);
|
|
176
|
+
this.chartComponents.push(this.volumesComponent);
|
|
177
|
+
// grid component
|
|
178
|
+
const mainChartGridComponent = new GridComponent(mainCanvasModel, scaleModel, config, this.yAxisComponent.state, 'GRID', drawingManager, () => this.canvasBoundsContainer.getBounds(CanvasElement.ALL_PANES), () => this.canvasBoundsContainer.getBounds(CanvasElement.PANE_UUID(CHART_UUID)), () => this.xAxisComponent.xAxisLabelsGenerator.labels, () => this.yAxisComponent.model.baseLabelsModel.labels, () => mainPane.mainExtent.toY(mainPane.mainExtent.getBaseline()), () => config.components.grid.visible);
|
|
179
|
+
this.chartComponents.push(mainChartGridComponent);
|
|
180
|
+
this.hoverProducer = new HoverProducerComponent(this.crossEventProducer, scaleModel, config, chartModel, canvasInputListener, this.canvasBoundsContainer, this.paneManager, timeZoneModel, formatterFactory);
|
|
181
|
+
this.chartComponents.push(this.hoverProducer);
|
|
182
|
+
this.crossToolComponent = new CrossToolComponent(config, crossToolCanvasModel, canvasBoundsContainer, drawingManager, paneManager, this.crossEventProducer, this.hoverProducer);
|
|
183
|
+
this.chartComponents.push(this.crossToolComponent);
|
|
184
|
+
// Snapshot component
|
|
185
|
+
const snapshotCanvasModel = createCanvasModel(eventBus, elements.snapshotCanvas, config, drawingManager, this.canvasModels, elements.chartResizer);
|
|
186
|
+
const snapshotComponent = new SnapshotComponent(this.elements, snapshotCanvasModel);
|
|
187
|
+
this.snapshotComponent = snapshotComponent;
|
|
188
|
+
this.chartComponents.push(snapshotComponent);
|
|
189
|
+
// events
|
|
190
|
+
const eventsComponent = new EventsComponent(config, this.dynamicObjectsCanvasModel, hitTestCanvasModel, chartModel, canvasBoundsContainer, drawingManager, formatterFactory, this.cursorHandler, backgroundCanvasModel);
|
|
191
|
+
this.eventsComponent = eventsComponent;
|
|
192
|
+
this.chartComponents.push(eventsComponent);
|
|
193
|
+
// Temporary solution - all in one place
|
|
194
|
+
this.chartComponents.forEach(c => c.activate());
|
|
195
|
+
this.enableUserControls();
|
|
196
|
+
drawingManager.reorderDrawers(config.drawingOrder);
|
|
197
|
+
this.clearer = clearerSafe(this.components);
|
|
198
|
+
}
|
|
199
|
+
initYAxisDrawer(yAxisLabelsCanvasModel) {
|
|
200
|
+
const yAxisCompositeDrawer = new CompositeDrawer();
|
|
201
|
+
const clearYAxis = new ClearCanvasDrawer(yAxisLabelsCanvasModel);
|
|
202
|
+
yAxisCompositeDrawer.addDrawer(clearYAxis, 'YAXIS_CLEAR');
|
|
203
|
+
this.drawingManager.addDrawer(yAxisCompositeDrawer, 'Y_AXIS');
|
|
204
|
+
const yAxisDrawer = new YAxisDrawer(this.config, yAxisLabelsCanvasModel, this.paneManager);
|
|
205
|
+
yAxisCompositeDrawer.addDrawer(yAxisDrawer);
|
|
206
|
+
const yAxisLabelsDrawer = new YAxisPriceLabelsDrawer(yAxisLabelsCanvasModel, this.backgroundCanvasModel, this.canvasBoundsContainer, this.config.colors.yAxis, this.paneManager);
|
|
207
|
+
yAxisCompositeDrawer.addDrawer(yAxisLabelsDrawer);
|
|
208
|
+
}
|
|
209
|
+
// TODO remove chartModel dependency, put period to global config somewhere
|
|
210
|
+
/**
|
|
211
|
+
* Creates a configuration object for overriding UTC time in a chart.
|
|
212
|
+
* @param {ChartModel} chartModel - The chart model object.
|
|
213
|
+
* @returns {Object} - The configuration object containing a pattern and a test function.
|
|
214
|
+
* The pattern is a string representing the date format to be used for the override.
|
|
215
|
+
* The test function checks if the pattern contains hours/minutes/seconds and if the current chart period is more than 1 day.
|
|
216
|
+
* If both conditions are met, the function returns true, indicating that the override should be applied.
|
|
217
|
+
* Note: The chartModel dependency should be removed and the period should be put in a global config somewhere.
|
|
218
|
+
*/
|
|
219
|
+
createUTCTimeOverrideConfig(chartModel) {
|
|
220
|
+
// default rules for UTC datetime override - if datetime pattern contains hours/minutes/seconds and current
|
|
221
|
+
// chart period is more than 1d we override it with simple UTC date without any specific timezones applied
|
|
222
|
+
const re = new RegExp('HH|H|mm|m|s|ss|sss|SSS');
|
|
223
|
+
return {
|
|
224
|
+
pattern: 'MM/dd/YY',
|
|
225
|
+
test: (pattern) => re.test(pattern) && (chartModel.getPeriod() || 0) >= 86400,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Merges a local configuration object with a global configuration object recursively.
|
|
230
|
+
* @template L - Type of the local configuration object.
|
|
231
|
+
* @param {L} local - The local configuration object to be merged.
|
|
232
|
+
* @param {Record<string, any>} global - The global configuration object to be merged.
|
|
233
|
+
* @returns {L} - The merged local configuration object.
|
|
234
|
+
*/
|
|
235
|
+
static mergeConfig(local, global) {
|
|
236
|
+
for (const k in global) {
|
|
237
|
+
if (k in local) {
|
|
238
|
+
if (typeof local[k] === 'object') {
|
|
239
|
+
ChartBootstrap.mergeConfig(local[k], global[k]);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
// @ts-ignore
|
|
244
|
+
local[k] = global[k];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return local;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Returns the FullChartConfig object.
|
|
251
|
+
*
|
|
252
|
+
* @returns {FullChartConfig} The FullChartConfig object.
|
|
253
|
+
*/
|
|
254
|
+
getConfig() {
|
|
255
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
256
|
+
return this.config;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Disables user controls by deactivating all userInputListenerComponents and disabling hitTestCanvasModel.
|
|
260
|
+
* @returns {void}
|
|
261
|
+
*/
|
|
262
|
+
disableUserControls() {
|
|
263
|
+
this.userInputListenerComponents.forEach(component => component.deactivate());
|
|
264
|
+
this.hitTestCanvasModel.disableUserControls();
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Enables user controls for the hit test canvas model and all the user input listener components.
|
|
268
|
+
* @returns {void}
|
|
269
|
+
*/
|
|
270
|
+
enableUserControls() {
|
|
271
|
+
this.userInputListenerComponents.forEach(component => component.activate());
|
|
272
|
+
this.hitTestCanvasModel.enableUserControls();
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Sets the configuration for the grid component of the chart.
|
|
276
|
+
* @param {GridComponentConfig} config - The configuration object for the grid component.
|
|
277
|
+
* @returns {void}
|
|
278
|
+
*/
|
|
279
|
+
setGridConfig(config) {
|
|
280
|
+
var _a, _b, _c, _d, _e;
|
|
281
|
+
const gridComponent = this.config.components.grid;
|
|
282
|
+
gridComponent.visible = (_a = config.visible) !== null && _a !== void 0 ? _a : false;
|
|
283
|
+
gridComponent.dash = (_b = config.dash) !== null && _b !== void 0 ? _b : [0, 0];
|
|
284
|
+
gridComponent.width = (_c = config.width) !== null && _c !== void 0 ? _c : 1;
|
|
285
|
+
gridComponent.color = (_d = config.color) !== null && _d !== void 0 ? _d : '#FFFFFF';
|
|
286
|
+
this.config.colors.chartAreaTheme.gridColor = (_e = config.color) !== null && _e !== void 0 ? _e : '#FFFFFF';
|
|
287
|
+
this.redraw();
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Sets the visibility of the grid component.
|
|
291
|
+
* @param {boolean} visible - A boolean value indicating whether the grid should be visible or not.
|
|
292
|
+
* @returns {void}
|
|
293
|
+
*/
|
|
294
|
+
setGridVisible(visible) {
|
|
295
|
+
if (this.config.components && this.config.components.grid) {
|
|
296
|
+
this.config.components.grid.visible = visible;
|
|
297
|
+
this.redraw();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Sets the visibility of the vertical grid lines in the grid component.
|
|
302
|
+
* @param {boolean} showVertical - A boolean value indicating whether to show or hide the vertical grid lines.
|
|
303
|
+
* @returns {void}
|
|
304
|
+
*/
|
|
305
|
+
setGridVertical(showVertical) {
|
|
306
|
+
this.config.components.grid.vertical = showVertical;
|
|
307
|
+
this.redraw();
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Sets the visibility of the horizontal grid lines in the chart.
|
|
311
|
+
* @param {boolean} showHorizontal - A boolean value indicating whether to show or hide the horizontal grid lines.
|
|
312
|
+
* @returns {void}
|
|
313
|
+
*/
|
|
314
|
+
setGridHorizontal(showHorizontal) {
|
|
315
|
+
this.config.components.grid.horizontal = showHorizontal;
|
|
316
|
+
this.redraw();
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* This method triggers the 'draw' event on the 'bus' object.
|
|
320
|
+
* @returns {void}
|
|
321
|
+
*/
|
|
322
|
+
redraw() {
|
|
323
|
+
this.bus.fireDraw();
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Returns the offsets of the chart components from the chart configuration object.
|
|
327
|
+
*
|
|
328
|
+
* @returns {ChartConfigComponentsOffsets} The offsets of the chart components.
|
|
329
|
+
*/
|
|
330
|
+
getOffsets() {
|
|
331
|
+
return this.config.components && this.config.components.offsets;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Sets the visibility of the borders of the candles in the chart.
|
|
335
|
+
* @param {boolean} show - A boolean value indicating whether to show or hide the borders of the candles. Default value is true.
|
|
336
|
+
* @returns {void}
|
|
337
|
+
*/
|
|
338
|
+
setShowCandleBorders(show = true) {
|
|
339
|
+
if (this.config.components && this.config.components.chart) {
|
|
340
|
+
this.config.components.chart.showCandlesBorder = show;
|
|
341
|
+
this.redraw();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Sets the visibility of the high-low component.
|
|
346
|
+
* @param {boolean} visible - Whether the high-low component should be visible or not. Default is true.
|
|
347
|
+
* @returns {void}
|
|
348
|
+
*/
|
|
349
|
+
setHighLowVisible(visible = true) {
|
|
350
|
+
if (this.config.components && this.config.components.highLow) {
|
|
351
|
+
this.config.components.highLow.visible = visible;
|
|
352
|
+
this.redraw();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Sets the visibility of the cross tool component.
|
|
357
|
+
* @param {string} type - The type of cross tool to be displayed. Default value is 'cross-and-labels'.
|
|
358
|
+
* @returns {void}
|
|
359
|
+
*/
|
|
360
|
+
setCrossToolVisible(type = 'cross-and-labels') {
|
|
361
|
+
if (this.config.components && this.config.components.crossTool) {
|
|
362
|
+
this.config.components.crossTool.type = type;
|
|
363
|
+
this.redraw();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* @deprecated use {@link highlightsComponent.setHighlightsVisible} instead
|
|
368
|
+
*/
|
|
369
|
+
setHighlightsVisible(visible = true) {
|
|
370
|
+
var _a;
|
|
371
|
+
if ((_a = this.config.components) === null || _a === void 0 ? void 0 : _a.highlights) {
|
|
372
|
+
this.config.components.highlights.visible = visible;
|
|
373
|
+
this.redraw();
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* @deprecated use {@link highlightsComponent.setHighlights} instead
|
|
378
|
+
*/
|
|
379
|
+
setHighlightsData(data) {
|
|
380
|
+
this.highlightsComponent.setHighlights(data);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Sets the colors of the chart.
|
|
384
|
+
*
|
|
385
|
+
* @param {DeepPartial<ChartColors>} colors - An object containing the colors to be set.
|
|
386
|
+
* @returns {void}
|
|
387
|
+
*/
|
|
388
|
+
setColors(colors) {
|
|
389
|
+
merge(this.config.colors, colors, {
|
|
390
|
+
addIfMissing: true,
|
|
391
|
+
overrideExisting: true,
|
|
392
|
+
});
|
|
393
|
+
this.redraw();
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Adds a mouse move event listener to a canvas element.
|
|
397
|
+
* @param {string} canvasElement - The ID of the canvas element to add the listener to.
|
|
398
|
+
* @param {function} handler - The function to be called when the mouse moves over the canvas element.
|
|
399
|
+
* @returns {function} - A function that removes the event listener when called.
|
|
400
|
+
*/
|
|
401
|
+
addMouseMoveOnChartElementHandler(canvasElement, handler) {
|
|
402
|
+
const elementBoundsHitTest = this.canvasBoundsContainer.getBoundsHitTest(canvasElement);
|
|
403
|
+
const subscription = this.canvasInputListener.observeMouseMove(elementBoundsHitTest).subscribe(handler);
|
|
404
|
+
return () => subscription.unsubscribe();
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Adds a mouse enter event handler to a chart element.
|
|
408
|
+
*
|
|
409
|
+
* @param {string} canvasElement - The ID of the canvas element to attach the event handler to.
|
|
410
|
+
* @param {(mouseEnter: boolean) => void} handler - The function to be called when the mouse enters or leaves the element.
|
|
411
|
+
* @param {boolean} [skipWhileDragging=false] - Whether to skip the event while the user is dragging the chart.
|
|
412
|
+
* @returns {Function} - A function that can be called to unsubscribe from the event.
|
|
413
|
+
*/
|
|
414
|
+
addMouseEnterOnChartElementHandler(canvasElement, handler, skipWhileDragging = false) {
|
|
415
|
+
const elementBoundsHitTest = this.canvasBoundsContainer.getBoundsHitTest(canvasElement);
|
|
416
|
+
const subscription = this.canvasInputListener
|
|
417
|
+
.observeMouseEnter(elementBoundsHitTest, skipWhileDragging)
|
|
418
|
+
.subscribe(handler);
|
|
419
|
+
return () => subscription.unsubscribe();
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Adds a click event listener to a chart element on the canvas.
|
|
423
|
+
* @param {string} canvasElement - The element on the canvas to add the click event listener to.
|
|
424
|
+
* @param {function} handler - The function to be called when the element is clicked. It takes a Point object as a parameter.
|
|
425
|
+
* @returns {function} - A function that can be called to unsubscribe the click event listener.
|
|
426
|
+
*/
|
|
427
|
+
addClickOnChartElementHandler(canvasElement, handler) {
|
|
428
|
+
const elementBoundsHitTest = this.canvasBoundsContainer.getBoundsHitTest(canvasElement);
|
|
429
|
+
const subscription = this.canvasInputListener.observeClick(elementBoundsHitTest).subscribe(handler);
|
|
430
|
+
return () => subscription.unsubscribe();
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Adds a drag event listener to the specified canvas element.
|
|
434
|
+
* @param {string} canvasElement - The ID of the canvas element to add the listener to.
|
|
435
|
+
* @param {(xPosition: number) => void} handler - The function to be called when a drag event occurs. It takes the x position of the drag event as a parameter.
|
|
436
|
+
* @returns {() => void} - A function that can be called to unsubscribe from the drag event listener.
|
|
437
|
+
*/
|
|
438
|
+
addDragEventsListener(canvasElement, handler) {
|
|
439
|
+
const elementBoundsHitTest = this.canvasBoundsContainer.getBoundsHitTest(canvasElement);
|
|
440
|
+
const subscription = mergeRx(this.canvasInputListener.observeYDrag(elementBoundsHitTest), this.canvasInputListener.observeXDrag(elementBoundsHitTest)).subscribe(handler);
|
|
441
|
+
return () => subscription.unsubscribe();
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Registers a chart component and includes it in the the chart lifecycle
|
|
445
|
+
* @param initComponent - a function for component init
|
|
446
|
+
* @param onComponentInit - will be called after component init
|
|
447
|
+
*/
|
|
448
|
+
registerComponent(initComponent, onComponentInit) {
|
|
449
|
+
const component = initComponent(this);
|
|
450
|
+
this.components.push(component);
|
|
451
|
+
onComponentInit && onComponentInit(component);
|
|
452
|
+
component.activate();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
@@ -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
|
*/
|
|
@@ -184,11 +184,6 @@ export declare class CanvasBoundsContainer {
|
|
|
184
184
|
* @returns {void}
|
|
185
185
|
*/
|
|
186
186
|
setPanesOrder(panesOrder: string[]): void;
|
|
187
|
-
/**
|
|
188
|
-
* Returns the widths of the Y axis if it is visible, otherwise returns [0].
|
|
189
|
-
* @returns {number} The width of the Y axis.
|
|
190
|
-
*/
|
|
191
|
-
private getYAxisWidth;
|
|
192
187
|
/**
|
|
193
188
|
* Recalculates the height ratios of the panes by calling the calculateGraphsHeightRatios() and recalculateBounds() methods.
|
|
194
189
|
*/
|