@devexperts/dxcharts-lite 1.0.1
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/LICENSE +151 -0
- package/README.md +184 -0
- package/dist/chart/animation/canvas-animation.d.ts +96 -0
- package/dist/chart/animation/canvas-animation.js +6 -0
- package/dist/chart/animation/types/animation.d.ts +35 -0
- package/dist/chart/animation/types/animation.js +6 -0
- package/dist/chart/animation/types/color-alpha-animation.d.ts +43 -0
- package/dist/chart/animation/types/color-alpha-animation.js +6 -0
- package/dist/chart/animation/types/color-transition-animation.d.ts +59 -0
- package/dist/chart/animation/types/color-transition-animation.js +6 -0
- package/dist/chart/animation/types/viewport-movement-animation.d.ts +44 -0
- package/dist/chart/animation/types/viewport-movement-animation.js +6 -0
- package/dist/chart/animation/viewport-model-animation.d.ts +15 -0
- package/dist/chart/animation/viewport-model-animation.js +6 -0
- package/dist/chart/bootstrap.d.ts +266 -0
- package/dist/chart/bootstrap.js +6 -0
- package/dist/chart/canvas/canvas-bounds-container.d.ts +347 -0
- package/dist/chart/canvas/canvas-bounds-container.js +6 -0
- package/dist/chart/canvas/canvas-chart-html.d.ts +7 -0
- package/dist/chart/canvas/canvas-chart-html.js +23 -0
- package/dist/chart/canvas/chart-elements.d.ts +22 -0
- package/dist/chart/canvas/chart-elements.js +6 -0
- package/dist/chart/canvas/cursor.handler.d.ts +71 -0
- package/dist/chart/canvas/cursor.handler.js +6 -0
- package/dist/chart/canvas/layout-creator.d.ts +20 -0
- package/dist/chart/canvas/layout-creator.js +6 -0
- package/dist/chart/canvas/y-axis-bounds.container.d.ts +54 -0
- package/dist/chart/canvas/y-axis-bounds.container.js +6 -0
- package/dist/chart/chart-container.d.ts +18 -0
- package/dist/chart/chart-container.js +6 -0
- package/dist/chart/chart.config.d.ts +774 -0
- package/dist/chart/chart.config.js +6 -0
- package/dist/chart/components/chart/basic-scale.d.ts +22 -0
- package/dist/chart/components/chart/basic-scale.js +6 -0
- package/dist/chart/components/chart/candle-transformer.functions.d.ts +11 -0
- package/dist/chart/components/chart/candle-transformer.functions.js +6 -0
- package/dist/chart/components/chart/candle-width-calculator.functions.d.ts +7 -0
- package/dist/chart/components/chart/candle-width-calculator.functions.js +6 -0
- package/dist/chart/components/chart/candle.functions.d.ts +19 -0
- package/dist/chart/components/chart/candle.functions.js +6 -0
- package/dist/chart/components/chart/chart-area-pan.handler.d.ts +88 -0
- package/dist/chart/components/chart/chart-area-pan.handler.js +6 -0
- package/dist/chart/components/chart/chart-base.model.d.ts +55 -0
- package/dist/chart/components/chart/chart-base.model.js +6 -0
- package/dist/chart/components/chart/chart.component.d.ts +251 -0
- package/dist/chart/components/chart/chart.component.js +6 -0
- package/dist/chart/components/chart/chart.model.d.ts +448 -0
- package/dist/chart/components/chart/chart.model.js +6 -0
- package/dist/chart/components/chart/data-series.high-low-provider.d.ts +25 -0
- package/dist/chart/components/chart/data-series.high-low-provider.js +6 -0
- package/dist/chart/components/chart/fake-candles.d.ts +18 -0
- package/dist/chart/components/chart/fake-candles.js +6 -0
- package/dist/chart/components/chart/price.formatter.d.ts +12 -0
- package/dist/chart/components/chart/price.formatter.js +6 -0
- package/dist/chart/components/chart/secondary-chart-colors-pool.d.ts +43 -0
- package/dist/chart/components/chart/secondary-chart-colors-pool.js +6 -0
- package/dist/chart/components/cross_tool/cross-tool.component.d.ts +69 -0
- package/dist/chart/components/cross_tool/cross-tool.component.js +6 -0
- package/dist/chart/components/cross_tool/cross-tool.drawer.d.ts +32 -0
- package/dist/chart/components/cross_tool/cross-tool.drawer.js +6 -0
- package/dist/chart/components/cross_tool/cross-tool.model.d.ts +63 -0
- package/dist/chart/components/cross_tool/cross-tool.model.js +6 -0
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.d.ts +44 -0
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +6 -0
- package/dist/chart/components/cross_tool/types/none.drawer.d.ts +9 -0
- package/dist/chart/components/cross_tool/types/none.drawer.js +6 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.d.ts +27 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +6 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.d.ts +23 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +6 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.d.ts +46 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +6 -0
- package/dist/chart/components/events/events-hit-test.drawer.d.ts +34 -0
- package/dist/chart/components/events/events-hit-test.drawer.js +6 -0
- package/dist/chart/components/events/events.component.d.ts +45 -0
- package/dist/chart/components/events/events.component.js +6 -0
- package/dist/chart/components/events/events.drawer.d.ts +87 -0
- package/dist/chart/components/events/events.drawer.js +6 -0
- package/dist/chart/components/events/events.model.d.ts +64 -0
- package/dist/chart/components/events/events.model.js +6 -0
- package/dist/chart/components/grid/grid.component.d.ts +34 -0
- package/dist/chart/components/grid/grid.component.js +6 -0
- package/dist/chart/components/grid/grid.drawer.d.ts +55 -0
- package/dist/chart/components/grid/grid.drawer.js +6 -0
- package/dist/chart/components/high_low/high-low.component.d.ts +17 -0
- package/dist/chart/components/high_low/high-low.component.js +6 -0
- package/dist/chart/components/high_low/high-low.drawer.d.ts +69 -0
- package/dist/chart/components/high_low/high-low.drawer.js +6 -0
- package/dist/chart/components/highlights/highlights.component.d.ts +42 -0
- package/dist/chart/components/highlights/highlights.component.js +6 -0
- package/dist/chart/components/highlights/highlights.drawer.d.ts +56 -0
- package/dist/chart/components/highlights/highlights.drawer.js +6 -0
- package/dist/chart/components/highlights/highlights.model.d.ts +66 -0
- package/dist/chart/components/highlights/highlights.model.js +6 -0
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.d.ts +63 -0
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.js +6 -0
- package/dist/chart/components/navigation_map/navigation-map-move.handler.d.ts +36 -0
- package/dist/chart/components/navigation_map/navigation-map-move.handler.js +6 -0
- package/dist/chart/components/navigation_map/navigation-map.component.d.ts +52 -0
- package/dist/chart/components/navigation_map/navigation-map.component.js +6 -0
- package/dist/chart/components/navigation_map/navigation-map.drawer.d.ts +96 -0
- package/dist/chart/components/navigation_map/navigation-map.drawer.js +6 -0
- package/dist/chart/components/navigation_map/navigation-map.model.d.ts +25 -0
- package/dist/chart/components/navigation_map/navigation-map.model.js +7 -0
- package/dist/chart/components/pan/chart-pan.component.d.ts +52 -0
- package/dist/chart/components/pan/chart-pan.component.js +6 -0
- package/dist/chart/components/pane/extent/y-extent-component.d.ts +91 -0
- package/dist/chart/components/pane/extent/y-extent-component.js +6 -0
- package/dist/chart/components/pane/pane-hit-test.controller.d.ts +39 -0
- package/dist/chart/components/pane/pane-hit-test.controller.js +6 -0
- package/dist/chart/components/pane/pane-manager.component.d.ts +87 -0
- package/dist/chart/components/pane/pane-manager.component.js +6 -0
- package/dist/chart/components/pane/pane.component.d.ts +193 -0
- package/dist/chart/components/pane/pane.component.js +6 -0
- package/dist/chart/components/resizer/bar-resizer.component.d.ts +72 -0
- package/dist/chart/components/resizer/bar-resizer.component.js +6 -0
- package/dist/chart/components/resizer/bar-resizer.drawer.d.ts +34 -0
- package/dist/chart/components/resizer/bar-resizer.drawer.js +6 -0
- package/dist/chart/components/snapshot/snapshot.component.d.ts +31 -0
- package/dist/chart/components/snapshot/snapshot.component.js +6 -0
- package/dist/chart/components/volumes/separate-volumes.component.d.ts +45 -0
- package/dist/chart/components/volumes/separate-volumes.component.js +6 -0
- package/dist/chart/components/volumes/volume-color-resolvers.functions.d.ts +11 -0
- package/dist/chart/components/volumes/volume-color-resolvers.functions.js +6 -0
- package/dist/chart/components/volumes/volumes.component.d.ts +59 -0
- package/dist/chart/components/volumes/volumes.component.js +6 -0
- package/dist/chart/components/volumes/volumes.drawer.d.ts +71 -0
- package/dist/chart/components/volumes/volumes.drawer.js +6 -0
- package/dist/chart/components/volumes/volumes.formatter.d.ts +6 -0
- package/dist/chart/components/volumes/volumes.formatter.js +6 -0
- package/dist/chart/components/volumes/volumes.model.d.ts +32 -0
- package/dist/chart/components/volumes/volumes.model.js +6 -0
- package/dist/chart/components/watermark/water-mark.component.d.ts +75 -0
- package/dist/chart/components/watermark/water-mark.component.js +6 -0
- package/dist/chart/components/watermark/water-mark.drawer.d.ts +68 -0
- package/dist/chart/components/watermark/water-mark.drawer.js +6 -0
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.d.ts +25 -0
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.js +6 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.d.ts +55 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.js +6 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.d.ts +23 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.js +6 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.d.ts +28 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.js +6 -0
- package/dist/chart/components/x_axis/time/parser/time-formats.model.d.ts +33 -0
- package/dist/chart/components/x_axis/time/parser/time-formats.model.js +6 -0
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.d.ts +62 -0
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.js +6 -0
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.d.ts +33 -0
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.js +6 -0
- package/dist/chart/components/x_axis/x-axis-draw.functions.d.ts +17 -0
- package/dist/chart/components/x_axis/x-axis-draw.functions.js +6 -0
- package/dist/chart/components/x_axis/x-axis-labels.drawer.d.ts +42 -0
- package/dist/chart/components/x_axis/x-axis-labels.drawer.js +6 -0
- package/dist/chart/components/x_axis/x-axis-labels.generator.d.ts +141 -0
- package/dist/chart/components/x_axis/x-axis-labels.generator.js +6 -0
- package/dist/chart/components/x_axis/x-axis-labels.model.d.ts +39 -0
- package/dist/chart/components/x_axis/x-axis-labels.model.js +6 -0
- package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +38 -0
- package/dist/chart/components/x_axis/x-axis-scale.handler.js +6 -0
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.d.ts +54 -0
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +6 -0
- package/dist/chart/components/x_axis/x-axis.component.d.ts +73 -0
- package/dist/chart/components/x_axis/x-axis.component.js +6 -0
- package/dist/chart/components/y_axis/label-color.functions.d.ts +18 -0
- package/dist/chart/components/y_axis/label-color.functions.js +6 -0
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.d.ts +22 -0
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.js +6 -0
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +33 -0
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +6 -0
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.d.ts +27 -0
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +6 -0
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.d.ts +35 -0
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +6 -0
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +23 -0
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +6 -0
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +159 -0
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +6 -0
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +23 -0
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +6 -0
- package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +31 -0
- package/dist/chart/components/y_axis/y-axis-base-labels.model.js +6 -0
- package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +70 -0
- package/dist/chart/components/y_axis/y-axis-labels.drawer.js +6 -0
- package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +32 -0
- package/dist/chart/components/y_axis/y-axis-scale.handler.js +6 -0
- package/dist/chart/components/y_axis/y-axis.component.d.ts +158 -0
- package/dist/chart/components/y_axis/y-axis.component.js +6 -0
- package/dist/chart/components/y_axis/y-axis.drawer.d.ts +72 -0
- package/dist/chart/components/y_axis/y-axis.drawer.js +6 -0
- package/dist/chart/components/y_axis/y-axis.model.d.ts +33 -0
- package/dist/chart/components/y_axis/y-axis.model.js +6 -0
- package/dist/chart/drawers/chart-background.drawer.d.ts +19 -0
- package/dist/chart/drawers/chart-background.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/area.drawer.d.ts +13 -0
- package/dist/chart/drawers/chart-type-drawers/area.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.d.ts +14 -0
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.d.ts +15 -0
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.d.ts +25 -0
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.d.ts +13 -0
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/line.drawer.d.ts +13 -0
- package/dist/chart/drawers/chart-type-drawers/line.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.d.ts +13 -0
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +6 -0
- package/dist/chart/drawers/clear-canvas.drawer.d.ts +16 -0
- package/dist/chart/drawers/clear-canvas.drawer.js +6 -0
- package/dist/chart/drawers/composite.drawer.d.ts +25 -0
- package/dist/chart/drawers/composite.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.d.ts +23 -0
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +6 -0
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.d.ts +17 -0
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.d.ts +8 -0
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.js +6 -0
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.d.ts +21 -0
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.d.ts +11 -0
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/linear.drawer.d.ts +12 -0
- package/dist/chart/drawers/data-series-drawers/linear.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/points.drawer.d.ts +11 -0
- package/dist/chart/drawers/data-series-drawers/points.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.d.ts +9 -0
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/text.drawer.d.ts +13 -0
- package/dist/chart/drawers/data-series-drawers/text.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.d.ts +12 -0
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.d.ts +12 -0
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +6 -0
- package/dist/chart/drawers/data-series.drawer.d.ts +39 -0
- package/dist/chart/drawers/data-series.drawer.js +6 -0
- package/dist/chart/drawers/drawing-manager.d.ts +61 -0
- package/dist/chart/drawers/drawing-manager.js +6 -0
- package/dist/chart/drawers/ht-data-series.drawer.d.ts +22 -0
- package/dist/chart/drawers/ht-data-series.drawer.js +6 -0
- package/dist/chart/events/event-bus.d.ts +48 -0
- package/dist/chart/events/event-bus.js +6 -0
- package/dist/chart/events/events.d.ts +8 -0
- package/dist/chart/events/events.js +6 -0
- package/dist/chart/inputhandlers/candle-tap.handler.d.ts +27 -0
- package/dist/chart/inputhandlers/candle-tap.handler.js +6 -0
- package/dist/chart/inputhandlers/chart-resize.handler.d.ts +67 -0
- package/dist/chart/inputhandlers/chart-resize.handler.js +6 -0
- package/dist/chart/inputhandlers/cross-event-producer.component.d.ts +44 -0
- package/dist/chart/inputhandlers/cross-event-producer.component.js +6 -0
- package/dist/chart/inputhandlers/hover-producer.component.d.ts +140 -0
- package/dist/chart/inputhandlers/hover-producer.component.js +6 -0
- package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +54 -0
- package/dist/chart/inputhandlers/main-canvas-touch.handler.js +6 -0
- package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +311 -0
- package/dist/chart/inputlisteners/canvas-input-listener.component.js +6 -0
- package/dist/chart/model/baseline.model.d.ts +54 -0
- package/dist/chart/model/baseline.model.js +6 -0
- package/dist/chart/model/bounds.model.d.ts +16 -0
- package/dist/chart/model/bounds.model.js +6 -0
- package/dist/chart/model/candle-hover.d.ts +35 -0
- package/dist/chart/model/candle-hover.js +6 -0
- package/dist/chart/model/candle-series-high-low.provider.d.ts +20 -0
- package/dist/chart/model/candle-series-high-low.provider.js +6 -0
- package/dist/chart/model/candle-series.model.d.ts +150 -0
- package/dist/chart/model/candle-series.model.js +6 -0
- package/dist/chart/model/candle.model.d.ts +46 -0
- package/dist/chart/model/candle.model.js +6 -0
- package/dist/chart/model/canvas.model.d.ts +131 -0
- package/dist/chart/model/canvas.model.js +6 -0
- package/dist/chart/model/chart-base-element.d.ts +103 -0
- package/dist/chart/model/chart-base-element.js +6 -0
- package/dist/chart/model/compare-series-hover.d.ts +22 -0
- package/dist/chart/model/compare-series-hover.js +6 -0
- package/dist/chart/model/data-series-view.d.ts +58 -0
- package/dist/chart/model/data-series-view.js +6 -0
- package/dist/chart/model/data-series.config.d.ts +31 -0
- package/dist/chart/model/data-series.config.js +6 -0
- package/dist/chart/model/data-series.model.d.ts +172 -0
- package/dist/chart/model/data-series.model.js +6 -0
- package/dist/chart/model/date-time.formatter.d.ts +23 -0
- package/dist/chart/model/date-time.formatter.js +6 -0
- package/dist/chart/model/hit-test-canvas.model.d.ts +128 -0
- package/dist/chart/model/hit-test-canvas.model.js +6 -0
- package/dist/chart/model/main-candle-series.model.d.ts +27 -0
- package/dist/chart/model/main-candle-series.model.js +6 -0
- package/dist/chart/model/scale.model.d.ts +180 -0
- package/dist/chart/model/scale.model.js +6 -0
- package/dist/chart/model/scaling/auto-scale.model.d.ts +79 -0
- package/dist/chart/model/scaling/auto-scale.model.js +6 -0
- package/dist/chart/model/scaling/constrait.functions.d.ts +43 -0
- package/dist/chart/model/scaling/constrait.functions.js +6 -0
- package/dist/chart/model/scaling/lock-ratio.model.d.ts +16 -0
- package/dist/chart/model/scaling/lock-ratio.model.js +6 -0
- package/dist/chart/model/scaling/move-chart.functions.d.ts +20 -0
- package/dist/chart/model/scaling/move-chart.functions.js +6 -0
- package/dist/chart/model/scaling/viewport.model.d.ts +223 -0
- package/dist/chart/model/scaling/viewport.model.js +6 -0
- package/dist/chart/model/scaling/x-zooming.functions.d.ts +26 -0
- package/dist/chart/model/scaling/x-zooming.functions.js +6 -0
- package/dist/chart/model/time-zone.model.d.ts +65 -0
- package/dist/chart/model/time-zone.model.js +6 -0
- package/dist/chart/model/visual-candle.d.ts +106 -0
- package/dist/chart/model/visual-candle.js +6 -0
- package/dist/chart/utils/__tests__/array.utils.test.d.ts +6 -0
- package/dist/chart/utils/__tests__/array.utils.test.js +6 -0
- package/dist/chart/utils/__tests__/object.utils.test.d.ts +6 -0
- package/dist/chart/utils/__tests__/object.utils.test.js +6 -0
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.d.ts +6 -0
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.js +6 -0
- package/dist/chart/utils/array.utils.d.ts +101 -0
- package/dist/chart/utils/array.utils.js +6 -0
- package/dist/chart/utils/auto-period-detector.utils.d.ts +16 -0
- package/dist/chart/utils/auto-period-detector.utils.js +6 -0
- package/dist/chart/utils/candles-generator-ts.utils.d.ts +41 -0
- package/dist/chart/utils/candles-generator-ts.utils.js +6 -0
- package/dist/chart/utils/candles-generator.utils.d.ts +13 -0
- package/dist/chart/utils/candles-generator.utils.js +6 -0
- package/dist/chart/utils/candles.utils.d.ts +8 -0
- package/dist/chart/utils/candles.utils.js +6 -0
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.d.ts +68 -0
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.js +6 -0
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.d.ts +20 -0
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.js +6 -0
- package/dist/chart/utils/canvas/canvas-text-functions.utils.d.ts +76 -0
- package/dist/chart/utils/canvas/canvas-text-functions.utils.js +6 -0
- package/dist/chart/utils/color.utils.d.ts +6 -0
- package/dist/chart/utils/color.utils.js +6 -0
- package/dist/chart/utils/device/browser.utils.d.ts +9 -0
- package/dist/chart/utils/device/browser.utils.js +6 -0
- package/dist/chart/utils/device/device-detector.utils.d.ts +12 -0
- package/dist/chart/utils/device/device-detector.utils.js +6 -0
- package/dist/chart/utils/device/device-pixel-ratio.utils.d.ts +16 -0
- package/dist/chart/utils/device/device-pixel-ratio.utils.js +6 -0
- package/dist/chart/utils/device/touchpad.utils.d.ts +30 -0
- package/dist/chart/utils/device/touchpad.utils.js +6 -0
- package/dist/chart/utils/dom.utils.d.ts +13 -0
- package/dist/chart/utils/dom.utils.js +6 -0
- package/dist/chart/utils/function.utils.d.ts +13 -0
- package/dist/chart/utils/function.utils.js +6 -0
- package/dist/chart/utils/math.utils.d.ts +40 -0
- package/dist/chart/utils/math.utils.js +6 -0
- package/dist/chart/utils/merge.utils.d.ts +27 -0
- package/dist/chart/utils/merge.utils.js +6 -0
- package/dist/chart/utils/object.utils.d.ts +46 -0
- package/dist/chart/utils/object.utils.js +6 -0
- package/dist/chart/utils/perfomance/animation-frame-cache.utils.d.ts +53 -0
- package/dist/chart/utils/perfomance/animation-frame-cache.utils.js +6 -0
- package/dist/chart/utils/perfomance/debounce.utils.d.ts +6 -0
- package/dist/chart/utils/perfomance/debounce.utils.js +6 -0
- package/dist/chart/utils/perfomance/memoize.utils.d.ts +21 -0
- package/dist/chart/utils/perfomance/memoize.utils.js +6 -0
- package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.d.ts +15 -0
- package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.js +6 -0
- package/dist/chart/utils/perfomance/throttle.utils.d.ts +15 -0
- package/dist/chart/utils/perfomance/throttle.utils.js +6 -0
- package/dist/chart/utils/price-increments.utils.d.ts +44 -0
- package/dist/chart/utils/price-increments.utils.js +6 -0
- package/dist/chart/utils/uuid.utils.d.ts +6 -0
- package/dist/chart/utils/uuid.utils.js +6 -0
- package/dist/dxchart.min.js +26 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +6 -0
- package/package.json +103 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { PaneManager } from '../components/pane/pane-manager.component';
|
|
7
|
+
import { Bounds } from '../model/bounds.model';
|
|
8
|
+
import { DataSeriesModel, VisualSeriesPoint } from '../model/data-series.model';
|
|
9
|
+
import { CanvasModel } from '../model/canvas.model';
|
|
10
|
+
import { Drawer } from './drawing-manager';
|
|
11
|
+
export interface ChartDrawerConfig {
|
|
12
|
+
singleColor?: string;
|
|
13
|
+
forceBold?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface SeriesDrawer {
|
|
16
|
+
draw: (ctx: CanvasRenderingContext2D,
|
|
17
|
+
/**
|
|
18
|
+
* You can pass two-dimension array to divide series into multiple parts
|
|
19
|
+
*/
|
|
20
|
+
points: VisualSeriesPoint[][], model: DataSeriesModel, drawerConfig: ChartDrawerConfig) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const transformToTwoDimension: (points: VisualSeriesPoint[] | VisualSeriesPoint[][]) => VisualSeriesPoint[][];
|
|
23
|
+
/**
|
|
24
|
+
* Basic data series drawer.
|
|
25
|
+
* Have multiple paint tools: linear, histogram, points, text above/below candle and others.
|
|
26
|
+
*
|
|
27
|
+
* (may support multiple layers in future)
|
|
28
|
+
*/
|
|
29
|
+
export declare class DataSeriesDrawer implements Drawer {
|
|
30
|
+
private paneManager;
|
|
31
|
+
private canvasModel;
|
|
32
|
+
private readonly seriesDrawers;
|
|
33
|
+
constructor(paneManager: PaneManager, canvasModel: CanvasModel, seriesDrawers: Record<string, SeriesDrawer>);
|
|
34
|
+
draw(): void;
|
|
35
|
+
drawSeries(ctx: CanvasRenderingContext2D, series: DataSeriesModel): void;
|
|
36
|
+
getCanvasIds(): Array<string>;
|
|
37
|
+
}
|
|
38
|
+
export declare const clipToBounds: (ctx: CanvasRenderingContext2D, bounds: Bounds) => void;
|
|
39
|
+
export declare const setLineWidth: (ctx: CanvasRenderingContext2D, lineWidth: number, dataSeries: DataSeriesModel, drawerConfig: ChartDrawerConfig, seriesSelectedWidth?: number) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{flatMap as i}from"../utils/array.utils";export const transformToTwoDimension=r=>Array.isArray(r[0])?r:[r];export class DataSeriesDrawer{constructor(e,t,a){this.paneManager=e,this.canvasModel=t,this.seriesDrawers=a}draw(){const e=this.canvasModel.ctx;i(Object.values(this.paneManager.paneComponents),t=>t.yExtentComponents).forEach(t=>{e.save(),clipToBounds(e,t.getBounds()),t.dataSeries.forEach(a=>this.drawSeries(e,a)),e.restore()})}drawSeries(e,t){if(t.config.visible){const a=t.config.type,s=this.seriesDrawers[a];if(s){const o=t.getSeriesInViewport(t.scaleModel.xStart-1,t.scaleModel.xEnd+1);o&&o.length>=1&&s.draw(e,o,t,{})}else console.error(`Data series drawer with type ${a} isn't registered!`)}}getCanvasIds(){return[this.canvasModel.canvasId]}}export const clipToBounds=(r,e)=>{r.beginPath(),r.rect(e.x,e.y,e.width,e.height),r.clip(),r.closePath()},setLineWidth=(r,e,t,a,s=e)=>{a.forceBold?r.lineWidth=a.forceBold:t.hovered?r.lineWidth=s:r.lineWidth=e};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import EventBus from '../events/event-bus';
|
|
7
|
+
import { ChartResizeHandler } from '../inputhandlers/chart-resize.handler';
|
|
8
|
+
export declare const HIT_TEST_PREFIX = "HIT_TEST_";
|
|
9
|
+
declare const drawerTypes: readonly ["MAIN_BACKGROUND", "MAIN_CLEAR", "HIT_TEST_CLEAR", "YAXIS_CLEAR", "SERIES_CLEAR", "OVER_SERIES_CLEAR", "HIT_TEST_DRAWINGS", "GRID", "VOLUMES", "UNDERLAY_VOLUMES_AREA", "X_AXIS", "Y_AXIS", "HIGH_LOW", "DRAWINGS", "DATA_SERIES", "N_MAP_CHART", "PL_CHART", "WATERMARK", "EMPTY_CHART", "OFFLINE_CHART", "LABELS", "EVENTS", "HIT_TEST_EVENTS", "ZERO_LINE", "PL_ZERO_LINE_BACKGROUND", "CROSS_TOOL"];
|
|
10
|
+
export type DrawerType = typeof drawerTypes[number];
|
|
11
|
+
/**
|
|
12
|
+
* Manages the drawing process.
|
|
13
|
+
* Can re-order drawers to make one be on top of the other.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DrawingManager {
|
|
16
|
+
private chartResizeHandler;
|
|
17
|
+
private drawingOrder;
|
|
18
|
+
private drawersMap;
|
|
19
|
+
private readonly drawHitTestCanvas;
|
|
20
|
+
private canvasIdsList;
|
|
21
|
+
private animFrameId;
|
|
22
|
+
constructor(eventBus: EventBus, chartResizeHandler: ChartResizeHandler);
|
|
23
|
+
/**
|
|
24
|
+
* Updates canvases' sizes and executes redraw without animation frame.
|
|
25
|
+
* This is required for multi-chart canvas update synchronization.
|
|
26
|
+
* If all canvases update in separate animation frames - we see visual lag. Instead we should do all updates and then redraw.
|
|
27
|
+
* @doc-tags tricky,canvas,resize
|
|
28
|
+
*/
|
|
29
|
+
redrawCanvasesImmediate(): void;
|
|
30
|
+
drawLastBar(): void;
|
|
31
|
+
forceDraw(canvasIds?: Array<string>): void;
|
|
32
|
+
/**
|
|
33
|
+
* Indicates whether it is possible to draw chart or not.
|
|
34
|
+
* @returns {boolean} true if chart is drawable
|
|
35
|
+
*/
|
|
36
|
+
isDrawable(): boolean;
|
|
37
|
+
drawHitTestOnly(): void;
|
|
38
|
+
addDrawer(drawer: Drawer, name?: string): void;
|
|
39
|
+
addDrawerAfter(drawer: Drawer, newDrawerName: string, drawerToPutAfterName: string): void;
|
|
40
|
+
addDrawerBefore(drawer: Drawer, newDrawerName: string, drawerToPutBeforeName: string): boolean;
|
|
41
|
+
getDrawerByName(name: string): Drawer;
|
|
42
|
+
getNameByDrawer(drawer: Drawer): string | undefined;
|
|
43
|
+
removeDrawerByName(name: string): void;
|
|
44
|
+
removeDrawer(drawer: Drawer): void;
|
|
45
|
+
reorderDrawers(newOrder: string[]): void;
|
|
46
|
+
}
|
|
47
|
+
export interface Drawer {
|
|
48
|
+
draw(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Used for optimization when we have to update only the last candle
|
|
51
|
+
* Doesn't work for line chart types
|
|
52
|
+
* TODO rework, method should not be a part of abstract drawer, maybe Candle drawer or something like this
|
|
53
|
+
* @doc-tags tricky
|
|
54
|
+
*/
|
|
55
|
+
drawLastBar?: () => void;
|
|
56
|
+
getCanvasIds(): Array<string>;
|
|
57
|
+
}
|
|
58
|
+
export declare class DynamicDrawerType {
|
|
59
|
+
static paneResizer(id: string): string;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{EVENT_DRAW as h}from"../events/events";import{MIN_SUPPORTED_CANVAS_SIZE as t}from"../model/canvas.model";import{arrayIntersect as w,reorderArray as o}from"../utils/array.utils";import{animationFrameThrottled as E}from"../utils/perfomance/request-animation-frame-throttle.utils";import{uuid as d}from"../utils/uuid.utils";export const HIT_TEST_PREFIX="HIT_TEST_";const I=["MAIN_BACKGROUND","MAIN_CLEAR","HIT_TEST_CLEAR","YAXIS_CLEAR","SERIES_CLEAR","OVER_SERIES_CLEAR","HIT_TEST_DRAWINGS","GRID","VOLUMES","UNDERLAY_VOLUMES_AREA","X_AXIS","Y_AXIS","HIGH_LOW","DRAWINGS","DATA_SERIES","N_MAP_CHART","PL_CHART","WATERMARK","EMPTY_CHART","OFFLINE_CHART","LABELS","EVENTS","HIT_TEST_EVENTS","ZERO_LINE","PL_ZERO_LINE_BACKGROUND","CROSS_TOOL"];export class DrawingManager{constructor(i,r){this.chartResizeHandler=r,this.drawingOrder=[],this.drawersMap={},this.canvasIdsList=[],this.animFrameId=`draw_${d()}`,this.drawHitTestCanvas=()=>{this.drawingOrder.forEach(e=>{e.indexOf(HIT_TEST_PREFIX)!==-1&&this.drawersMap[e].draw()})},i.on(h,e=>{r.wasResized()&&(this.canvasIdsList&&(e&&e.length!==0?this.canvasIdsList=this.canvasIdsList.concat(e):this.canvasIdsList=void 0),E(this.animFrameId,()=>{this.forceDraw(this.canvasIdsList),this.canvasIdsList=[],this.drawHitTestCanvas()}))})}redrawCanvasesImmediate(){this.chartResizeHandler.fireUpdates(),this.forceDraw()}drawLastBar(){this.drawingOrder.forEach(i=>{if(i.indexOf(HIT_TEST_PREFIX)===-1){const r=this.drawersMap[i];r.drawLastBar&&r.drawLastBar()}})}forceDraw(i){this.isDrawable()&&this.drawingOrder.forEach(r=>{if(r.indexOf(HIT_TEST_PREFIX)===-1){const e=this.drawersMap[r];if(!i||i.length===0){e.draw();return}w(i,e.getCanvasIds()).length&&e.draw()}})}isDrawable(){var i,r,e,s;return((r=(i=this.chartResizeHandler.previousBCR)===null||i===void 0?void 0:i.height)!==null&&r!==void 0?r:0)>t.width&&((s=(e=this.chartResizeHandler.previousBCR)===null||e===void 0?void 0:e.width)!==null&&s!==void 0?s:0)>t.height}drawHitTestOnly(){this.drawHitTestCanvas()}addDrawer(i,r=d()){this.drawingOrder.indexOf(r)===-1&&this.drawingOrder.push(r),this.drawersMap[r]=i}addDrawerAfter(i,r,e){this.addDrawer(i,r);const s=this.drawingOrder.indexOf(r);this.drawingOrder.splice(s,1);const a=this.drawingOrder.indexOf(e);this.drawingOrder.splice(a+1,0,r),this.reorderDrawers(this.drawingOrder)}addDrawerBefore(i,r,e){this.addDrawer(i,r);const s=this.drawingOrder.indexOf(e);if(s!==-1){const a=this.drawingOrder.indexOf(r);return this.drawingOrder.splice(a,1),this.drawingOrder.splice(s,0,r),this.reorderDrawers(this.drawingOrder),!0}return!1}getDrawerByName(i){return this.drawersMap[i]}getNameByDrawer(i){for(const r in this.drawersMap)if(this.drawersMap[r]===i)return r}removeDrawerByName(i){const r=this.drawersMap[i];this.removeDrawer(r)}removeDrawer(i){Object.keys(this.drawersMap).forEach(r=>{if(this.drawersMap[r]===i){delete this.drawersMap[r];const e=this.drawingOrder.indexOf(r);e!==-1&&this.drawingOrder.splice(e,1)}})}reorderDrawers(i){this.drawingOrder=o(this.drawingOrder,i)}}export class DynamicDrawerType{static paneResizer(i){return`PANE_RESIZER_${i}`}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { PaneManager } from '../components/pane/pane-manager.component';
|
|
7
|
+
import { DataSeriesModel } from '../model/data-series.model';
|
|
8
|
+
import { HitTestCanvasModel } from '../model/hit-test-canvas.model';
|
|
9
|
+
import { SeriesDrawer } from './data-series.drawer';
|
|
10
|
+
import { Drawer } from './drawing-manager';
|
|
11
|
+
/***
|
|
12
|
+
* HitTest Chart drawer. It's used to draw hit test for chart types on the hit-test canvas.
|
|
13
|
+
*/
|
|
14
|
+
export declare class HTDataSeriesDrawer implements Drawer {
|
|
15
|
+
private readonly seriesDrawers;
|
|
16
|
+
private canvasModel;
|
|
17
|
+
private paneManager;
|
|
18
|
+
constructor(seriesDrawers: Record<string, SeriesDrawer>, canvasModel: HitTestCanvasModel, paneManager: PaneManager);
|
|
19
|
+
draw(): void;
|
|
20
|
+
drawSeries(ctx: CanvasRenderingContext2D, series: DataSeriesModel): void;
|
|
21
|
+
getCanvasIds(): Array<string>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{flatMap as s}from"../utils/array.utils";import{clipToBounds as n}from"./data-series.drawer";export class HTDataSeriesDrawer{constructor(o,a,t){this.seriesDrawers=o,this.canvasModel=a,this.paneManager=t}draw(){const o=this.canvasModel.ctx;s(Object.values(this.paneManager.paneComponents),a=>a.yExtentComponents).forEach(a=>{o.save(),n(o,a.getBounds()),a.dataSeries.forEach(t=>this.drawSeries(o,t)),o.restore()})}drawSeries(o,a){if(a.config.visible){const t=a.config.type,e=this.seriesDrawers[t];if(e){const r={singleColor:this.canvasModel.idToColor(a.id),forceBold:7};e.draw(o,a.getSeriesInViewport(a.scaleModel.xStart-1,a.scaleModel.xEnd+1),a,r)}}}getCanvasIds(){return[this.canvasModel.canvasId]}}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { EVENT_DRAW, EVENT_RESIZED } from './events';
|
|
8
|
+
export interface EventBusFireAsync {
|
|
9
|
+
(type: typeof EVENT_RESIZED, event?: ClientRect | DOMRect): number | void;
|
|
10
|
+
(type: string, event?: string): number | void;
|
|
11
|
+
(type: string, event?: string): number | void;
|
|
12
|
+
}
|
|
13
|
+
export interface EventBusFire {
|
|
14
|
+
(type: typeof EVENT_RESIZED, event?: ClientRect | DOMRect): number | void;
|
|
15
|
+
(type: string, ...args: unknown[]): void;
|
|
16
|
+
}
|
|
17
|
+
export interface EventBusOn {
|
|
18
|
+
(type: typeof EVENT_RESIZED, fn: (bcr?: DOMRect) => void): () => void;
|
|
19
|
+
(type: typeof EVENT_DRAW, fn: (canvasIds: Array<string>) => void): () => void;
|
|
20
|
+
(type: string, fn: (...args: unknown[]) => void): () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Event bus for chart.
|
|
24
|
+
* @doc-tags core-components
|
|
25
|
+
*/
|
|
26
|
+
export default class EventBus {
|
|
27
|
+
private UNKNOWN_ARR;
|
|
28
|
+
/** Registered event handlers. */
|
|
29
|
+
private handlers;
|
|
30
|
+
/** State which can enable / disable events processing. */
|
|
31
|
+
private muted;
|
|
32
|
+
constructor();
|
|
33
|
+
/**
|
|
34
|
+
* Triggers the draw event for the specified canvas IDs.
|
|
35
|
+
* @param {Array<string>} canvasIds - An optional array of canvas IDs to trigger the draw event for.
|
|
36
|
+
*/
|
|
37
|
+
fireDraw(canvasIds?: Array<string>): void;
|
|
38
|
+
unsub: (type: string, fn: (...args: any[]) => void) => void;
|
|
39
|
+
add: (method: (...args: unknown[]) => void, type: string, fn: (...args: any[]) => void) => () => void;
|
|
40
|
+
on: EventBusOn;
|
|
41
|
+
observe: (type: string) => Observable<any>;
|
|
42
|
+
onPrior: (type: string, fn: (...args: any[]) => void) => () => void;
|
|
43
|
+
off: (type: string, fn: (...args: any[]) => void) => void;
|
|
44
|
+
fire: EventBusFire;
|
|
45
|
+
fireAsync: EventBusFireAsync;
|
|
46
|
+
setMuted: (val: boolean) => void;
|
|
47
|
+
clear: () => void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{Subject as h}from"rxjs";import{arrayRemove as r}from"../utils/array.utils";import{EVENT_DRAW as u}from"./events";export default class d{constructor(){this.UNKNOWN_ARR=[],this.handlers={},this.muted=!1,this.unsub=(t,s)=>{const i=this.handlers[t];i!==void 0&&r.call(i,s)},this.add=(t,s,i)=>(s in this.handlers?t.call(this.handlers[s],i):this.handlers[s]=[i],this.unsub.bind(this,s,i)),this.on=(t,s)=>this.add(this.UNKNOWN_ARR.push,t,s),this.observe=t=>{const s=new h,i=s.next.bind(s),n=s.unsubscribe.bind(s);return this.on(t,i),s.unsubscribe=()=>{this.unsub(t,i),n()},s.asObservable()},this.onPrior=(t,s)=>this.add(this.UNKNOWN_ARR.unshift,t,s),this.off=this.unsub,this.fire=(t,...s)=>{var i;if(!this.muted){const n=(i=this.handlers[t])!==null&&i!==void 0?i:[];let e;for(e=0,n.length;e<n.length;e++)n[e].apply(null,s)}},this.fireAsync=(t,s)=>{if(!this.muted)return window.setTimeout(this.fire.bind(this,t,s),0)},this.setMuted=t=>{this.muted=t},this.clear=()=>{this.handlers={}}}fireDraw(t){this.fire(u,t)}}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EVENT_RESIZED: "resized_local";
|
|
7
|
+
export declare const EVENT_DRAW: "draw";
|
|
8
|
+
export declare const EVENT_DRAW_LAST_CANDLE: "draw_last_candle";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
export const EVENT_RESIZED="resized_local",EVENT_DRAW="draw",EVENT_DRAW_LAST_CANDLE="draw_last_candle";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { ChartModel } from '../components/chart/chart.model';
|
|
7
|
+
import { CanvasInputListenerComponent } from '../inputlisteners/canvas-input-listener.component';
|
|
8
|
+
import { ChartBaseElement } from '../model/chart-base-element';
|
|
9
|
+
import { FullChartConfig } from '../chart.config';
|
|
10
|
+
export declare class CandleTapHandler extends ChartBaseElement {
|
|
11
|
+
constructor(mainCanvasParent: Element, chartModel: ChartModel, canvasInputListeners: CanvasInputListenerComponent, config: FullChartConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Sets the candle as active when a touch event occurs on the chart.
|
|
14
|
+
* @param {TouchEvent} e - The touch event that occurred on the chart.
|
|
15
|
+
* @param {Element} mainCanvasParent - The parent element of the main canvas.
|
|
16
|
+
* @param {ChartModel} chartModel - The chart model object.
|
|
17
|
+
*/
|
|
18
|
+
private setCandleAsActive;
|
|
19
|
+
/**
|
|
20
|
+
* Calculates the X position of a touch event relative to the main canvas parent element.
|
|
21
|
+
* @param {Touch} touch - The touch event object.
|
|
22
|
+
* @param {Element} mainCanvasParent - The parent element of the main canvas.
|
|
23
|
+
* @returns {number} - The X position of the touch event relative to the main canvas parent element.
|
|
24
|
+
* @todo Check if this body calculations can potentially work incorrectly in the widget.
|
|
25
|
+
*/
|
|
26
|
+
private getTouchXPosition;
|
|
27
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{ChartBaseElement as i}from"../model/chart-base-element";import{map as l,distinctUntilChanged as r}from"rxjs/operators";export class CandleTapHandler extends i{constructor(t,c,e,n){super(),e.observeTouchStart().pipe(l(o=>n.components.chart.highlightActiveCandle?o:void 0),r()).subscribe(o=>{o&&this.setCandleAsActive(o,t,c)})}setCandleAsActive(t,c,e){if(t.touches.length===1){const n=t.touches.item(0);if(n!==null){const o=this.getTouchXPosition(n,c),s=e.candleFromX(o);s&&e.mainCandleSeries.setActiveCandle(s)}}}getTouchXPosition(t,c){const e=c.getBoundingClientRect(),n=document.body.scrollLeft||document.documentElement.scrollLeft;return t.pageX-e.left-n}}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { Subject } from 'rxjs';
|
|
7
|
+
import { FullChartConfig } from '../chart.config';
|
|
8
|
+
import { CanvasModel } from '../model/canvas.model';
|
|
9
|
+
import EventBus from '../events/event-bus';
|
|
10
|
+
export type PickedDOMRect = Pick<DOMRect, 'x' | 'y' | 'width' | 'height'>;
|
|
11
|
+
/**
|
|
12
|
+
* Tracks chart element size and emits events whenever it changes.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ChartResizeHandler {
|
|
15
|
+
private frameElement;
|
|
16
|
+
private resizerElement;
|
|
17
|
+
private bus;
|
|
18
|
+
private canvasModels;
|
|
19
|
+
private config?;
|
|
20
|
+
private elementResizeDetector;
|
|
21
|
+
previousBCR: PickedDOMRect | undefined;
|
|
22
|
+
private animFrameId;
|
|
23
|
+
canvasResized: Subject<PickedDOMRect>;
|
|
24
|
+
constructor(frameElement: HTMLElement, resizerElement: HTMLElement, bus: EventBus, canvasModels: CanvasModel[], config?: FullChartConfig | undefined);
|
|
25
|
+
/**
|
|
26
|
+
* Subscribe to resize events
|
|
27
|
+
* Use it to update chart animations.
|
|
28
|
+
* TODO activate / deactivate cycle
|
|
29
|
+
*/
|
|
30
|
+
subscribeResize(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Handles the resize event by throttling the animation frame and firing updates.
|
|
33
|
+
* @private
|
|
34
|
+
* @function
|
|
35
|
+
* @returns {void}
|
|
36
|
+
*/
|
|
37
|
+
private handleResize;
|
|
38
|
+
/**
|
|
39
|
+
* Updates the canvas models and fires events if the bounding client rectangle of the resizer element has changed.
|
|
40
|
+
* @function
|
|
41
|
+
* @name fireUpdates
|
|
42
|
+
* @memberof ClassName
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
45
|
+
fireUpdates(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Checks if the dimensions of two PickedDOMRect objects are different.
|
|
48
|
+
* @param {PickedDOMRect} previousBCR - The previous bounding client rectangle.
|
|
49
|
+
* @param {PickedDOMRect} newBCR - The new bounding client rectangle.
|
|
50
|
+
* @returns {boolean} - Returns true if the dimensions are different, false otherwise.
|
|
51
|
+
*/
|
|
52
|
+
private isBCRDimensionsDiffer;
|
|
53
|
+
/**
|
|
54
|
+
* Unsubscribes from the element resize detector to stop updating the chart animation.
|
|
55
|
+
* @function
|
|
56
|
+
* @name unsubscribeAnimationUpdate
|
|
57
|
+
* @memberof ChartResizeHandler
|
|
58
|
+
* @instance
|
|
59
|
+
* @returns {void}
|
|
60
|
+
*/
|
|
61
|
+
unsubscribeAnimationUpdate(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Checks if the canvas has been resized by comparing the previous bounding client rect with the current one.
|
|
64
|
+
* @returns {boolean} - Returns true if the canvas has been resized, false otherwise.
|
|
65
|
+
*/
|
|
66
|
+
wasResized(): boolean;
|
|
67
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{Subject as n}from"rxjs";import{EVENT_DRAW as h,EVENT_RESIZED as o}from"../events/events";import{uuid as a}from"../utils/uuid.utils";import{animationFrameThrottledPrior as m}from"../utils/perfomance/request-animation-frame-throttle.utils";export class ChartResizeHandler{constructor(e,i,s,t,r){this.frameElement=e,this.resizerElement=i,this.bus=s,this.canvasModels=t,this.config=r,this.previousBCR=void 0,this.animFrameId=`resize_${a()}`,this.canvasResized=new n,this.elementResizeDetector=new ResizeObserver(()=>this.handleResize())}subscribeResize(){this.elementResizeDetector.observe(this.resizerElement)}handleResize(){m(this.animFrameId,()=>this.fireUpdates())}fireUpdates(){const e=this.resizerElement.getBoundingClientRect(),i={x:e.x,y:e.y,width:e.width,height:e.height};this.config||(this.frameElement.style.height=this.resizerElement.clientHeight+"px"),(this.previousBCR===void 0||this.isBCRDimensionsDiffer(this.previousBCR,i))&&(this.previousBCR=i,this.canvasModels.forEach(s=>this.previousBCR&&s.updateDPR(this.previousBCR)),this.canvasResized.next(i),this.bus.fire(o,i),this.bus.fire(h))}isBCRDimensionsDiffer(e,i){return e.height!==i.height||e.width!==i.width}unsubscribeAnimationUpdate(){if(this.resizerElement)try{this.elementResizeDetector.unobserve(this.resizerElement)}catch(e){console.warn("ChartResizeHandler.ts, unsubscribeAnimationUpdate failed")}}wasResized(){return this.previousBCR!==void 0}}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { BehaviorSubject, Subscription } from 'rxjs';
|
|
7
|
+
import { CanvasBoundsContainer, HitBoundsTest, HitBoundsTestOptionsPartial } from '../canvas/canvas-bounds-container';
|
|
8
|
+
import { CanvasInputListenerComponent } from '../inputlisteners/canvas-input-listener.component';
|
|
9
|
+
import { ChartBaseElement } from '../model/chart-base-element';
|
|
10
|
+
import { Unsubscriber } from '../utils/function.utils';
|
|
11
|
+
export type CrossEvent = [number, number, string];
|
|
12
|
+
export declare class CrossEventProducerComponent extends ChartBaseElement {
|
|
13
|
+
private canvasInputListener;
|
|
14
|
+
private canvasBoundsContainer;
|
|
15
|
+
panesSubscriptions: Partial<Record<string, Subscription>>;
|
|
16
|
+
crossSubject: BehaviorSubject<CrossEvent | null>;
|
|
17
|
+
constructor(canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer);
|
|
18
|
+
protected doActivate(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Emits a null value to the `cross` subject, effectively closing the current cross.
|
|
21
|
+
*/
|
|
22
|
+
fireCrossClose(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Unsubscribes from the mouse over event for a specific pane.
|
|
25
|
+
* @param {string} uuid - The unique identifier of the pane.
|
|
26
|
+
* @returns {void}
|
|
27
|
+
*/
|
|
28
|
+
unsubscribeMouseOver(uuid: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Subscribes to mouse over event on canvas elements.
|
|
31
|
+
* @param {string} uuid - Unique identifier for the subscription.
|
|
32
|
+
* @param {string[]} canvasElementNames - Array of canvas element names to subscribe to.
|
|
33
|
+
* @param {HitBoundsTestOptionsPartial} [options] - Optional hit bounds test options.
|
|
34
|
+
* @returns {Subscription} - Returns a subscription object.
|
|
35
|
+
*/
|
|
36
|
+
subscribeMouseOver(uuid: string, canvasElementNames: string[], options?: HitBoundsTestOptionsPartial): Unsubscriber;
|
|
37
|
+
/**
|
|
38
|
+
* Subscribes to mouse over event on a hit test area identified by uuid.
|
|
39
|
+
* @param {string} uuid - The unique identifier of the hit test area.
|
|
40
|
+
* @param {HitBoundsTest} hitTest - The hit test area.
|
|
41
|
+
* @returns {Subscription} - The subscription object.
|
|
42
|
+
*/
|
|
43
|
+
subscribeMouseOverHT(uuid: string, hitTest: HitBoundsTest): Unsubscriber;
|
|
44
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{BehaviorSubject as a,combineLatest as b,filter as v}from"rxjs";import{ChartBaseElement as p}from"../model/chart-base-element";export class CrossEventProducerComponent extends p{constructor(e,s){super(),this.canvasInputListener=e,this.canvasBoundsContainer=s,this.panesSubscriptions={},this.crossSubject=new a(null)}doActivate(){super.doActivate()}fireCrossClose(){this.crossSubject.next(null)}unsubscribeMouseOver(e){var s;(s=this.panesSubscriptions[e])===null||s===void 0||s.unsubscribe()}subscribeMouseOver(e,s,o){const i=s.map(r=>this.canvasBoundsContainer.getBoundsHitTest(r,o)),t=(r,n)=>i.some(u=>u(r,n));return this.subscribeMouseOverHT(e,t)}subscribeMouseOverHT(e,s){const o=this.canvasInputListener.observeMouseMoveDocument(),i=this.canvasInputListener.observeMouseEnter(s);let t=!1;const r=b([o,i]).pipe(v(([,n])=>!t||t&&n)).subscribe(([n,u])=>{if(u){const c=[n.x,n.y,e];this.crossSubject.next(c),t=!1}else this.crossSubject.next(null),t=!0});return this.panesSubscriptions[e]=r,()=>r.unsubscribe()}}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { BehaviorSubject } from 'rxjs';
|
|
7
|
+
import { CanvasBoundsContainer } from '../canvas/canvas-bounds-container';
|
|
8
|
+
import { FullChartConfig } from '../chart.config';
|
|
9
|
+
import { ChartModel } from '../components/chart/chart.model';
|
|
10
|
+
import { PaneManager } from '../components/pane/pane-manager.component';
|
|
11
|
+
import { CanvasInputListenerComponent } from '../inputlisteners/canvas-input-listener.component';
|
|
12
|
+
import { CandleHover, CandleHoverProducerPart } from '../model/candle-hover';
|
|
13
|
+
import { ChartBaseElement } from '../model/chart-base-element';
|
|
14
|
+
import { CompareSeriesHover, CompareSeriesHoverProducerPart } from '../model/compare-series-hover';
|
|
15
|
+
import { DateTimeFormatter } from '../model/date-time.formatter';
|
|
16
|
+
import { ScaleModel } from '../model/scale.model';
|
|
17
|
+
import VisualCandle from '../model/visual-candle';
|
|
18
|
+
import { CrossEvent, CrossEventProducerComponent } from './cross-event-producer.component';
|
|
19
|
+
import { TimeZoneModel } from '../model/time-zone.model';
|
|
20
|
+
export interface BaseHover {
|
|
21
|
+
readonly x: number;
|
|
22
|
+
readonly y: number;
|
|
23
|
+
readonly timestamp: number;
|
|
24
|
+
readonly timeFormatted: string;
|
|
25
|
+
readonly paneId: string;
|
|
26
|
+
}
|
|
27
|
+
export interface HoverParts {
|
|
28
|
+
readonly candleHover: CandleHover | undefined;
|
|
29
|
+
readonly compareSeriesHover: CompareSeriesHover[];
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
export interface Hover extends BaseHover, HoverParts {
|
|
33
|
+
}
|
|
34
|
+
export interface HoverProducerPart<T = unknown> {
|
|
35
|
+
getData(hover: BaseHover): T;
|
|
36
|
+
}
|
|
37
|
+
export interface HoverProducerParts {
|
|
38
|
+
candleHover: CandleHoverProducerPart;
|
|
39
|
+
compareSeriesHover: CompareSeriesHoverProducerPart;
|
|
40
|
+
[key: string]: HoverProducerPart;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Produces the Hover event.
|
|
44
|
+
* Hover is used for displaying values in legend and NOT related to displaying cross tool.
|
|
45
|
+
*/
|
|
46
|
+
export declare class HoverProducerComponent extends ChartBaseElement {
|
|
47
|
+
private crossEventProducer;
|
|
48
|
+
private scaleModel;
|
|
49
|
+
private config;
|
|
50
|
+
private chartModel;
|
|
51
|
+
private canvasInputListener;
|
|
52
|
+
private canvasBoundsContainer;
|
|
53
|
+
private paneManager;
|
|
54
|
+
private timeZoneModel;
|
|
55
|
+
private formatterFactory;
|
|
56
|
+
hoverSubject: BehaviorSubject<Hover | null>;
|
|
57
|
+
get hover(): Hover | null;
|
|
58
|
+
private longTouchActivated;
|
|
59
|
+
private hoverProducerParts;
|
|
60
|
+
xFormatter: DateTimeFormatter;
|
|
61
|
+
constructor(crossEventProducer: CrossEventProducerComponent, scaleModel: ScaleModel, config: FullChartConfig, chartModel: ChartModel, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, paneManager: PaneManager, timeZoneModel: TimeZoneModel, formatterFactory: (format: string) => (timestamp: number | Date) => string);
|
|
62
|
+
/**
|
|
63
|
+
* This method is responsible for activating the chart hover functionality. It subscribes to several observables to
|
|
64
|
+
* update the hover when the chart is updated or when the user interacts with it. It also handles special behavior
|
|
65
|
+
* for mobile devices, such as disabling panning and showing the cross tool on long touch.
|
|
66
|
+
*
|
|
67
|
+
* @protected
|
|
68
|
+
* @memberof ChartHover
|
|
69
|
+
* @returns {void}
|
|
70
|
+
*/
|
|
71
|
+
protected doActivate(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Recalculates the cross tool X formatter.
|
|
74
|
+
* @function
|
|
75
|
+
* @private
|
|
76
|
+
* @returns {void}
|
|
77
|
+
*/
|
|
78
|
+
private recalculateCrossToolXFormatter;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a hover object from a VisualCandle object.
|
|
81
|
+
* @param {VisualCandle} candle - The VisualCandle object to create the hover from.
|
|
82
|
+
* @returns {Hover | undefined} - The created hover object or undefined if the input is invalid.
|
|
83
|
+
*/
|
|
84
|
+
private createHoverFromCandle;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a hover object based on the provided x and y coordinates.
|
|
87
|
+
* @param {number} x - The x coordinate of the hover.
|
|
88
|
+
* @param {number} y - The y coordinate of the hover.
|
|
89
|
+
* @returns {Hover | undefined} - The hover object or undefined if there are no candles in the chart model.
|
|
90
|
+
* @todo Check if uuid is still useful here.
|
|
91
|
+
*/
|
|
92
|
+
private createHover;
|
|
93
|
+
/**
|
|
94
|
+
* Creates a hover from a VisualCandle object and fires it.
|
|
95
|
+
* @param {VisualCandle} candle - The VisualCandle object to create the hover from.
|
|
96
|
+
*/
|
|
97
|
+
createAndFireHoverFromCandle(candle: VisualCandle): void;
|
|
98
|
+
/**
|
|
99
|
+
* Update current hover using a VisualCandle and fires it.
|
|
100
|
+
* @param {VisualCandle} candle - The VisualCandle object to create the hover from.
|
|
101
|
+
*/
|
|
102
|
+
updateHover(candle: VisualCandle): void;
|
|
103
|
+
/**
|
|
104
|
+
* Creates a hover element at the specified coordinates and fires it with the option to show the cross tool
|
|
105
|
+
* @param {CrossEvent} [x,y] - The coordinates where the hover element will be created
|
|
106
|
+
* @param {boolean} [showCrossTool=true] - Whether to show the cross tool or not
|
|
107
|
+
* @returns {void}
|
|
108
|
+
*/
|
|
109
|
+
createAndFireHover([x, y, uuid]: CrossEvent): void;
|
|
110
|
+
/**
|
|
111
|
+
* Private method that handles the hover event. If a hover event is provided, it sets the last hover to the provided hover.
|
|
112
|
+
* If the device is mobile and the cross tool type is not 'none', it sets the active candle to the hovered candle only when a long tap is detected.
|
|
113
|
+
* The showCrossToolOverride is set to true only when a long tap is detected on mobile devices, otherwise it is set to the value of showCrossTool parameter.
|
|
114
|
+
* Finally, it fires the EVENT_HOVER event with the provided hover and showCrossToolOverride.
|
|
115
|
+
* If no hover event is provided, it fires the EVENT_CLOSE_HOVER event.
|
|
116
|
+
*
|
|
117
|
+
* @param {Hover} [hover] - The hover event to handle.
|
|
118
|
+
* @param {boolean} [showCrossTool=true] - A boolean value indicating whether to show the cross tool or not.
|
|
119
|
+
* @returns {void}
|
|
120
|
+
*/
|
|
121
|
+
private fireHover;
|
|
122
|
+
/**
|
|
123
|
+
* Fires the last hover update if there is a last cross.
|
|
124
|
+
*/
|
|
125
|
+
fireLastCross(): void;
|
|
126
|
+
/**
|
|
127
|
+
* Registers a hover producer part with the given id.
|
|
128
|
+
*
|
|
129
|
+
* @param {string} id - The id of the hover producer part.
|
|
130
|
+
* @param {HoverProducerPart} hoverProducerPart - The hover producer part to register.
|
|
131
|
+
* @returns {void}
|
|
132
|
+
*/
|
|
133
|
+
registerHoverProducerPart(id: string, hoverProducerPart: HoverProducerPart): void;
|
|
134
|
+
/**
|
|
135
|
+
* Removes a hover producer part from the hoverProducerParts object.
|
|
136
|
+
* @param {string} id - The id of the hover producer part to be removed.
|
|
137
|
+
* @returns {void}
|
|
138
|
+
*/
|
|
139
|
+
unregisterHoverProducerPart(id: string): void;
|
|
140
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{BehaviorSubject as l,merge as u}from"rxjs";import{CHART_UUID as v,CanvasElement as m}from"../canvas/canvas-bounds-container";import{CandleHoverProducerPart as b}from"../model/candle-hover";import{ChartBaseElement as p}from"../model/chart-base-element";import{CompareSeriesHoverProducerPart as C}from"../model/compare-series-hover";import{recalculateXFormatter as P}from"../model/date-time.formatter";import{isMobile as g}from"../utils/device/browser.utils";export class HoverProducerComponent extends p{get hover(){return this.hoverSubject.getValue()}constructor(t,e,r,s,o,i,c,n,a){super(),this.crossEventProducer=t,this.scaleModel=e,this.config=r,this.chartModel=s,this.canvasInputListener=o,this.canvasBoundsContainer=i,this.paneManager=c,this.timeZoneModel=n,this.formatterFactory=a,this.hoverSubject=new l(null),this.longTouchActivated=!1,this.xFormatter=()=>"";const h=new b(this.chartModel),d=new C(this.chartModel);this.hoverProducerParts={candleHover:h,compareSeriesHover:d}}doActivate(){super.doActivate(),this.addRxSubscription(this.chartModel.candlesSetSubject.subscribe(()=>{const e=this.chartModel.getLastVisualCandle();e&&this.createAndFireHoverFromCandle(e)})),this.addRxSubscription(this.chartModel.candlesUpdatedSubject.subscribe(()=>{const e=this.chartModel.getLastVisualCandle();this.hover!==null&&e!==void 0&&e.candle.timestamp===this.hover.timestamp&&this.updateHover(e)})),this.addRxSubscription(this.crossEventProducer.crossSubject.subscribe(e=>{e===null?this.hoverSubject.next(null):this.createAndFireHover(e)})),this.addRxSubscription(this.scaleModel.xChanged.subscribe(()=>this.fireLastCross())),this.addRxSubscription(this.canvasInputListener.observeTouchStart().subscribe(e=>{const r=e.touches[0].clientX,s=e.touches[0].clientY-this.canvasBoundsContainer.canvasOnPageLocation.y;this.chartModel.candleFromX(r,!0)&&this.createAndFireHover([r,s,""])}));const t=this.canvasBoundsContainer.getBoundsHitTest(m.ALL_PANES);this.addRxSubscription(this.canvasInputListener.observeLongTouch(t).subscribe(e=>{this.paneManager.chartPanComponent.deactivatePanHandlers(),this.longTouchActivated=!0;const r=e.touches[0].clientX,s=e.touches[0].clientY-this.canvasBoundsContainer.canvasOnPageLocation.y;this.createAndFireHover([r,s,""])})),this.addRxSubscription(this.canvasInputListener.observeTouchEndDocument().subscribe(()=>{this.paneManager.chartPanComponent.activateChartPanHandlers(),this.longTouchActivated&&(this.longTouchActivated=!1,this.crossEventProducer.fireCrossClose())})),this.addRxSubscription(u(this.chartModel.candlesSetSubject,this.timeZoneModel.observeTimeZoneChanged()).subscribe(()=>this.recalculateCrossToolXFormatter()))}recalculateCrossToolXFormatter(){const t=this.config.components.crossTool.xAxisLabelFormat;this.xFormatter=P(t,this.chartModel.getPeriod(),this.formatterFactory)}createHoverFromCandle(t){const e=t.xCenter(this.chartModel.scaleModel),r=this.chartModel.scaleModel.toY(t.close);return this.createHover(e,r,v)}createHover(t,e,r){if(this.chartModel.getCandles().length===0)return;const o=this.chartModel.candleFromX(t,!0).timestamp,i={x:t,y:e,timestamp:o,timeFormatted:this.xFormatter(o),paneId:r},c=Object.entries(this.hoverProducerParts).reduce((n,a)=>Object.assign(Object.assign({},n),{[a[0]]:a[1].getData(i)}),{});return Object.assign(Object.assign({},i),c)}createAndFireHoverFromCandle(t){const e=this.createHoverFromCandle(t);this.fireHover(e)}updateHover(t){const e=this.createHoverFromCandle(t);if(this.hover&&e){const r=Object.assign(Object.assign({},e),{x:this.hover.x,y:this.hover.y});this.fireHover(r)}}createAndFireHover([t,e,r]){const s=this.createHover(t,e,r);this.fireHover(s)}fireHover(t){var e;if(t){if(g()&&this.config.components.crossTool.type!=="none"){const r=(e=t.candleHover)===null||e===void 0?void 0:e.visualCandle.candle;r&&this.chartModel.mainCandleSeries.setActiveCandle(r)}this.hoverSubject.next(t)}else this.crossEventProducer.fireCrossClose()}fireLastCross(){const t=this.crossEventProducer.crossSubject.getValue();t&&this.createAndFireHover(t)}registerHoverProducerPart(t,e){this.hoverProducerParts=Object.assign(Object.assign({},this.hoverProducerParts),{[t]:e})}unregisterHoverProducerPart(t){delete this.hoverProducerParts[t]}}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { ChartBaseElement } from '../model/chart-base-element';
|
|
7
|
+
import { CanvasInputListenerComponent } from '../inputlisteners/canvas-input-listener.component';
|
|
8
|
+
import { ScaleModel } from '../model/scale.model';
|
|
9
|
+
/**
|
|
10
|
+
* Handles chart touch events.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MainCanvasTouchHandler extends ChartBaseElement {
|
|
13
|
+
private scaleModel;
|
|
14
|
+
private canvasInputListeners;
|
|
15
|
+
private mainCanvasParent;
|
|
16
|
+
private touchedCandleIndexes;
|
|
17
|
+
constructor(scaleModel: ScaleModel, canvasInputListeners: CanvasInputListenerComponent, mainCanvasParent: Element);
|
|
18
|
+
/**
|
|
19
|
+
* Activates canvas input listeners for touch start and touch move events.
|
|
20
|
+
* @protected
|
|
21
|
+
* @returns {void}
|
|
22
|
+
*/
|
|
23
|
+
protected doActivate(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Handles the touch start event.
|
|
26
|
+
* @param {TouchEvent} e - The touch event.
|
|
27
|
+
* @returns {void}
|
|
28
|
+
*/
|
|
29
|
+
private handleTouchStartEvent;
|
|
30
|
+
/**
|
|
31
|
+
* Handles touch move event
|
|
32
|
+
* @param {TouchEvent} e - The touch event object
|
|
33
|
+
* @returns {void}
|
|
34
|
+
|
|
35
|
+
private handleTouchMoveEvent(e: TouchEvent): void {
|
|
36
|
+
if (e.touches.length === 2) {
|
|
37
|
+
this.pinchHandler(this.touchedCandleIndexes, this.getXPositions(e));
|
|
38
|
+
}
|
|
39
|
+
}*/
|
|
40
|
+
private handleTouchMoveEvent;
|
|
41
|
+
/**
|
|
42
|
+
* Gets candle positions touched by user in pixels.
|
|
43
|
+
* @param e - touch event with "touches" array
|
|
44
|
+
* @return Array<number> - X coordinates of touches on the canvas
|
|
45
|
+
*/
|
|
46
|
+
private getXPositions;
|
|
47
|
+
/**
|
|
48
|
+
* Handles the pinch gesture on the chart.
|
|
49
|
+
* @param {Array<number>} candleIndexes - An array of two numbers representing the indexes of the first and last visible candles on the chart.
|
|
50
|
+
* @param {number[]} touchPositions - An array of two numbers representing the touch positions on the screen.
|
|
51
|
+
* @returns {void}
|
|
52
|
+
*/
|
|
53
|
+
pinchHandler(candleIndexes: Array<number>, touchPositions: number[]): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{ChartBaseElement as c}from"../model/chart-base-element";export class MainCanvasTouchHandler extends c{constructor(t,e,s){super(),this.scaleModel=t,this.canvasInputListeners=e,this.mainCanvasParent=s,this.touchedCandleIndexes=[0,0]}doActivate(){this.addRxSubscription(this.canvasInputListeners.observeTouchStart().subscribe(t=>this.handleTouchStartEvent(t))),this.addRxSubscription(this.canvasInputListeners.observeTouchMove().subscribe(t=>this.handleTouchMoveEvent(t)))}handleTouchStartEvent(t){t.touches.length===2&&(this.touchedCandleIndexes=this.getXPositions(t).map(e=>this.scaleModel.fromX(e)))}handleTouchMoveEvent(t){t.touches.length===2&&this.pinchHandler(this.touchedCandleIndexes,this.getXPositions(t))}getXPositions(t){const e=this.mainCanvasParent.getBoundingClientRect(),s=[0,0],a=document.body.scrollLeft||document.documentElement.scrollLeft;for(let n=0,h=t.touches.length;n<h;n++){const o=t.touches[n];s[n]=o.pageX-e.left-a}return s}pinchHandler(t,e){const s=(e[0]*t[1]-e[1]*t[0])/(e[0]-e[1]),a=s+(t[0]-t[1])/(e[0]-e[1])*this.scaleModel.getBounds().width;this.scaleModel.setXScale(s,a)}}
|