@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,347 @@
|
|
|
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
|
+
import { ChartResizeHandler } from '../inputhandlers/chart-resize.handler';
|
|
11
|
+
import { Point } from '../inputlisteners/canvas-input-listener.component';
|
|
12
|
+
import { CandleSeriesModel } from '../model/candle-series.model';
|
|
13
|
+
import { Pixel } from '../model/scaling/viewport.model';
|
|
14
|
+
import { DateTimeFormatterFactory } from '../model/date-time.formatter';
|
|
15
|
+
import { Bounds } from '../model/bounds.model';
|
|
16
|
+
import { AtLeastOne } from '../utils/object.utils';
|
|
17
|
+
import { YAxisBoundsContainer, YAxisWidths } from './y-axis-bounds.container';
|
|
18
|
+
export declare const CHART_UUID = "CHART";
|
|
19
|
+
export declare class CanvasElement {
|
|
20
|
+
static CANVAS: string;
|
|
21
|
+
static N_MAP: string;
|
|
22
|
+
static X_AXIS: string;
|
|
23
|
+
static N_MAP_KNOT_L: string;
|
|
24
|
+
static N_MAP_KNOT_R: string;
|
|
25
|
+
static N_MAP_BTN_L: string;
|
|
26
|
+
static N_MAP_BTN_R: string;
|
|
27
|
+
static N_MAP_SLIDER_WINDOW: string;
|
|
28
|
+
static N_MAP_CHART: string;
|
|
29
|
+
static N_MAP_LABEL_R: string;
|
|
30
|
+
static N_MAP_LABEL_L: string;
|
|
31
|
+
static PANE_UUID: (uuid: string) => string;
|
|
32
|
+
static PANE_UUID_Y_AXIS: (uuid: string, idx?: number) => string;
|
|
33
|
+
static PANE_UUID_RESIZER: (uuid: string) => string;
|
|
34
|
+
static ALL_PANES: string;
|
|
35
|
+
static CHART_WITH_Y_AXIS: string;
|
|
36
|
+
static EVENTS: string;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated - use CanvasElement.PANE_UUID(CHART_UUID) instead
|
|
39
|
+
*/
|
|
40
|
+
static CHART: string;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated - use CanvasElement.PANE_UUID_Y_AXIS(CHART_UUID) instead
|
|
43
|
+
*/
|
|
44
|
+
static Y_AXIS: string;
|
|
45
|
+
}
|
|
46
|
+
export declare const DEFAULT_BOUNDS: Bounds;
|
|
47
|
+
/**
|
|
48
|
+
* This component listens EVENT_DRAW and recalculates bounds of canvas chart elements.
|
|
49
|
+
* {@link getBounds} method will always give actual placement of element you want.
|
|
50
|
+
*
|
|
51
|
+
* NOTE: this class was designed exclusively for {@link getBounds} method
|
|
52
|
+
* please think twice when adding additional logic here (does it affect element bounds? or it's smth else)
|
|
53
|
+
*/
|
|
54
|
+
export declare class CanvasBoundsContainer {
|
|
55
|
+
private config;
|
|
56
|
+
private eventBus;
|
|
57
|
+
private canvasModel;
|
|
58
|
+
private formatterFactory;
|
|
59
|
+
private mainCandleSeries?;
|
|
60
|
+
bounds: Record<string, Bounds>;
|
|
61
|
+
canvasOnPageLocation: Bounds;
|
|
62
|
+
panesOrder: Array<string>;
|
|
63
|
+
panesOrderChangedSubject: Subject<string[]>;
|
|
64
|
+
xAxisHeight: number | undefined;
|
|
65
|
+
yAxisWidths: YAxisWidths;
|
|
66
|
+
leftRatio: number;
|
|
67
|
+
rightRatio: number;
|
|
68
|
+
private boundsChangedSubject;
|
|
69
|
+
barResizerChangedSubject: Subject<void>;
|
|
70
|
+
private _graphsHeightRatio;
|
|
71
|
+
get graphsHeightRatio(): Record<string, number>;
|
|
72
|
+
graphsHeightRatioChangedSubject: Subject<Record<string, number>>;
|
|
73
|
+
private boundsChangedSubscriptions;
|
|
74
|
+
readonly yAxisBoundsContainer: YAxisBoundsContainer;
|
|
75
|
+
constructor(config: FullChartConfig, eventBus: EventBus, canvasModel: CanvasModel, formatterFactory: DateTimeFormatterFactory, chartResizeHandler: ChartResizeHandler);
|
|
76
|
+
updateYAxisWidths(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Adds a pane to the list of panes and recalculates the height ratios of all panes.
|
|
79
|
+
* @param {string} uuid - The unique identifier of the pane to be added.
|
|
80
|
+
* @param {number} [order] - The order in which the pane should be added. If not provided, the pane will be added to the end of the list.
|
|
81
|
+
*/
|
|
82
|
+
addPaneBounds(uuid: string, order?: number): void;
|
|
83
|
+
/**
|
|
84
|
+
* Overrides the height ratios of the chart with the provided height ratios.
|
|
85
|
+
* @param {Record<string, number>} heightRatios - An object containing the height ratios to be set.
|
|
86
|
+
* @returns {void}
|
|
87
|
+
* @throws {Error} If the sum of the height ratios is not equal to 1.
|
|
88
|
+
|
|
89
|
+
*/
|
|
90
|
+
overrideChartHeightRatios(heightRatios: Record<string, number>): void;
|
|
91
|
+
/**
|
|
92
|
+
* Moves a pane up in the panesOrder array.
|
|
93
|
+
* @param {string} uuid - The unique identifier of the pane to be moved.
|
|
94
|
+
* @returns {void}
|
|
95
|
+
*/
|
|
96
|
+
movePaneUp(uuid: string): void;
|
|
97
|
+
/**
|
|
98
|
+
* Moves the pane down in the panesOrder array.
|
|
99
|
+
* @param {string} uuid - The unique identifier of the pane to be moved.
|
|
100
|
+
* @returns {void}
|
|
101
|
+
*/
|
|
102
|
+
movePaneDown(uuid: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* Reorders current panes according to newPanesOrder
|
|
105
|
+
* if element in newPanesOrder doesn't exist in real panes order - it will ignored
|
|
106
|
+
* Example:
|
|
107
|
+
* panesOrder: ['1', '2', '3']
|
|
108
|
+
* newPanesOrder: ['3', '1']
|
|
109
|
+
* result: ['3', '2', '1']
|
|
110
|
+
*/
|
|
111
|
+
reorderPanes(newPanesOrder: string[]): void;
|
|
112
|
+
/**
|
|
113
|
+
* Removes the bounds of a pane with the given uuid from the canvas element.
|
|
114
|
+
* @param {string} uuid - The uuid of the pane to remove.
|
|
115
|
+
* @returns {void}
|
|
116
|
+
*/
|
|
117
|
+
removedPaneBounds(uuid: string): void;
|
|
118
|
+
/**
|
|
119
|
+
* Recalculates the bounds of the chart elements based on the current configuration and canvas size.
|
|
120
|
+
* The function updates the bounds of the canvas, the main chart, the panes, the y-axis, and the chart with y-axis.
|
|
121
|
+
* It also updates the navigation map element bounds, all bounds page coordinates, and notifies the bounds subscribers.
|
|
122
|
+
* @function
|
|
123
|
+
* @name recalculateBounds
|
|
124
|
+
* @memberof ChartWidget
|
|
125
|
+
* @returns {void}
|
|
126
|
+
*/
|
|
127
|
+
recalculateBounds(): void;
|
|
128
|
+
/**
|
|
129
|
+
* Updates the canvasOnPageLocation property with the provided PickedDOMRect object.
|
|
130
|
+
* @param {PickedDOMRect} bcr - The PickedDOMRect object containing the new values for x, y, width, and height.
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
private updateCanvasOnPageLocation;
|
|
134
|
+
/**
|
|
135
|
+
* Updates the page coordinates of all bounds.
|
|
136
|
+
* @private
|
|
137
|
+
*/
|
|
138
|
+
private updateAllBoundsPageCoordinates;
|
|
139
|
+
/**
|
|
140
|
+
* Returns the bounds of the events component.
|
|
141
|
+
* @private
|
|
142
|
+
* @param {Bounds} chartPane - The bounds of the chart pane.
|
|
143
|
+
* @returns {Bounds} - The bounds of the events component.
|
|
144
|
+
*/
|
|
145
|
+
private getEventsBounds;
|
|
146
|
+
/**
|
|
147
|
+
* Returns the bounds of the navigation map element.
|
|
148
|
+
* @param {Bounds} canvas - The bounds of the canvas element.
|
|
149
|
+
* @returns {Bounds} - The bounds of the navigation map element.
|
|
150
|
+
* @private
|
|
151
|
+
*/
|
|
152
|
+
private getNavMapBounds;
|
|
153
|
+
/**
|
|
154
|
+
* Returns the bounds of the X axis based on the provided parameters.
|
|
155
|
+
* @private
|
|
156
|
+
* @param {Bounds} nMap - The bounds of the nMap.
|
|
157
|
+
* @param {Bounds} canvas - The bounds of the canvas.
|
|
158
|
+
* @returns {Bounds} - The bounds of the X axis.
|
|
159
|
+
*/
|
|
160
|
+
private getXAxisBounds;
|
|
161
|
+
/**
|
|
162
|
+
* Calculates the height of the X axis based on the font size, font family and padding values.
|
|
163
|
+
* If the height has already been calculated, it returns the cached value.
|
|
164
|
+
* @returns {number} The height of the X axis.
|
|
165
|
+
*/
|
|
166
|
+
getXAxisHeight(): number;
|
|
167
|
+
/**
|
|
168
|
+
* Sets the width of the Y axis.
|
|
169
|
+
*
|
|
170
|
+
* @param {YAxisWidths} yAxisWidths - The width of the Y axis.
|
|
171
|
+
* @returns {void}
|
|
172
|
+
*/
|
|
173
|
+
setYAxisWidths(yAxisWidths: YAxisWidths): void;
|
|
174
|
+
/**
|
|
175
|
+
*
|
|
176
|
+
* Sets the height of the X axis.
|
|
177
|
+
* @param {number} xAxisHeight - The height of the X axis.
|
|
178
|
+
* @returns {void}
|
|
179
|
+
*/
|
|
180
|
+
setXAxisHeight(xAxisHeight: number): void;
|
|
181
|
+
/**
|
|
182
|
+
* Sets the order of the panes.
|
|
183
|
+
* @param {string[]} panesOrder - An array of strings representing the order of the panes.
|
|
184
|
+
* @returns {void}
|
|
185
|
+
*/
|
|
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
|
+
/**
|
|
193
|
+
* Recalculates the height ratios of the panes by calling the calculateGraphsHeightRatios() and recalculateBounds() methods.
|
|
194
|
+
*/
|
|
195
|
+
recalculatePanesHeightRatios(): void;
|
|
196
|
+
/**
|
|
197
|
+
* Calculates the height ratios of the graphs in the chart.
|
|
198
|
+
* It first gets the height ratio of the main chart and then calculates the height ratios of the other graphs.
|
|
199
|
+
* It then calculates the free space available for the other graphs and distributes it among them based on their previous height ratios.
|
|
200
|
+
* If there are new graphs added, it calculates their height ratios based on the number of new graphs and the total number of graphs.
|
|
201
|
+
* @private
|
|
202
|
+
*/
|
|
203
|
+
private calculateGraphsHeightRatios;
|
|
204
|
+
/**
|
|
205
|
+
* Recalculates the bounds of the navigation map elements based on the current configuration and viewport.
|
|
206
|
+
* If the navigation map is visible, it calculates the bounds of the following elements:
|
|
207
|
+
* - Navigation map
|
|
208
|
+
* - Time labels
|
|
209
|
+
* - Left and right buttons
|
|
210
|
+
* - Knots
|
|
211
|
+
* - Slider
|
|
212
|
+
* - Chart
|
|
213
|
+
*
|
|
214
|
+
* The bounds of each element are calculated based on the current viewport and configuration values.
|
|
215
|
+
* If the time labels are visible, it calculates the width of the left and right time labels based on the first and last visible candle timestamps.
|
|
216
|
+
* The width of the time labels is used to calculate the position and size of the left and right buttons, as well as the position of the knots.
|
|
217
|
+
* The position and size of the knots are calculated based on the left and right ratios, which represent the position of the knots relative to the left and right buttons.
|
|
218
|
+
* The position and size of the slider and chart are calculated based on the position and size of the knots and buttons.
|
|
219
|
+
*/
|
|
220
|
+
recalculateNavigationMapElementBounds(): void;
|
|
221
|
+
/**
|
|
222
|
+
* Checks if the volumes are set to be visible and if they should be shown in a separate pane
|
|
223
|
+
*
|
|
224
|
+
* @returns {boolean} - Returns true if the volumes are set to be visible and if they should be shown in a separate pane, otherwise returns false
|
|
225
|
+
*/
|
|
226
|
+
isVolumesInSeparatePane(): boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Gets current canvas element bounds.
|
|
229
|
+
* @param {string} el - CanvasElement.ELEMENT_NAME
|
|
230
|
+
* @return {Bounds} bounds of element
|
|
231
|
+
*/
|
|
232
|
+
getBounds(el: string): Bounds;
|
|
233
|
+
/**
|
|
234
|
+
* Returns the position of CANVAS on whole page.
|
|
235
|
+
* Use it to calculate relative coordinates for mouse movement hit test - crosstool for example.
|
|
236
|
+
*/
|
|
237
|
+
getCanvasOnPageLocation(): Point;
|
|
238
|
+
/**
|
|
239
|
+
* Gets current panes bounds.
|
|
240
|
+
*/
|
|
241
|
+
getBoundsPanes(): Record<string, Bounds>;
|
|
242
|
+
/**
|
|
243
|
+
* Gets hit-test fn for canvas element.
|
|
244
|
+
* @param {string} el - CanvasElement.ELEMENT_NAME
|
|
245
|
+
* @param {boolean} reverse - reverses the hit test condition
|
|
246
|
+
* @param {number} extensionX - extended hitBoundsTest in horizontal direction
|
|
247
|
+
* @param {number} extensionY - extended hitBoundsTest in vertical direction
|
|
248
|
+
* @param wholePage
|
|
249
|
+
* @return {HitBoundsTest} hit-test fn
|
|
250
|
+
*/
|
|
251
|
+
getBoundsHitTest(el: string, options?: AtLeastOne<HitBoundsTestOptions>): HitBoundsTest;
|
|
252
|
+
/**
|
|
253
|
+
* Returns a function that tests if a given point is inside a given bounds object.
|
|
254
|
+
* @param {Bounds} bounds - The bounds object to test against.
|
|
255
|
+
* @param {Object} options - An object containing options for the hit test.
|
|
256
|
+
* @param {number} [options.extensionX=0] - The amount of extension in the x-axis.
|
|
257
|
+
* @param {number} [options.extensionY=0] - The amount of extension in the y-axis.
|
|
258
|
+
* @param {boolean} [options.wholePage=false] - Whether to test against the whole page or just the bounds object.
|
|
259
|
+
* @returns {HitBoundsTest} - A function that takes in x and y coordinates and returns true if the point is inside the bounds object.
|
|
260
|
+
*/
|
|
261
|
+
static hitTestOf(bounds: Bounds, options?: AtLeastOne<HitBoundsTestOptions>): HitBoundsTest;
|
|
262
|
+
/**
|
|
263
|
+
* This method indicates whether it's possible to render the chart, in particular if its width and height > 0.
|
|
264
|
+
*/
|
|
265
|
+
isChartBoundsAvailable(): boolean;
|
|
266
|
+
/**
|
|
267
|
+
* Resizes a pane vertically.
|
|
268
|
+
* @param {string} uuid - The unique identifier of the pane.
|
|
269
|
+
* @param {number} y - The amount of pixels to resize the pane by.
|
|
270
|
+
* @returns {void}
|
|
271
|
+
*/
|
|
272
|
+
resizePaneVertically(uuid: string, y: number): void;
|
|
273
|
+
/**
|
|
274
|
+
* Resizes a pane vertically based on the provided index and delta in pixels.
|
|
275
|
+
* @param {number} idx - The index of the pane to be resized.
|
|
276
|
+
* @param {number} yDeltaPixels - The delta in pixels to resize the pane.
|
|
277
|
+
* @returns {void}
|
|
278
|
+
*/
|
|
279
|
+
private doResizePaneVertically;
|
|
280
|
+
/**
|
|
281
|
+
* Notifies all subscribers about bounds changes
|
|
282
|
+
* @function
|
|
283
|
+
* @name notifyBoundsSubscribers
|
|
284
|
+
* @returns {void}
|
|
285
|
+
*/
|
|
286
|
+
private notifyBoundsSubscribers;
|
|
287
|
+
/**
|
|
288
|
+
* Subscribe to element bounds changes.
|
|
289
|
+
* Multiple subscriptions will share the same subject.
|
|
290
|
+
* @param el - element name
|
|
291
|
+
*/
|
|
292
|
+
observeBoundsChanged(el: string): import("rxjs").Observable<Bounds>;
|
|
293
|
+
/**
|
|
294
|
+
* Returns an observable that emits when the bounds of the object change.
|
|
295
|
+
* @returns {Observable} An observable that emits when the bounds of the object change.
|
|
296
|
+
*/
|
|
297
|
+
observeAnyBoundsChanged(): import("rxjs").Observable<void>;
|
|
298
|
+
/**
|
|
299
|
+
* Creates a copy of the provided bounds object.
|
|
300
|
+
*
|
|
301
|
+
* @private
|
|
302
|
+
* @param {Bounds} bounds - The bounds object to be copied.
|
|
303
|
+
* @returns {Bounds} - A new bounds object with the same properties as the original.
|
|
304
|
+
*/
|
|
305
|
+
private copyOf;
|
|
306
|
+
/**
|
|
307
|
+
* Copies the values of the `from` object to the `to` object.
|
|
308
|
+
* @param {Bounds} from - The object to copy the values from.
|
|
309
|
+
* @param {Bounds} to - The object to copy the values to.
|
|
310
|
+
*/
|
|
311
|
+
private copyBounds;
|
|
312
|
+
/**
|
|
313
|
+
* Checks if two Bounds objects have the same x, y, width and height values.
|
|
314
|
+
* @param {Bounds} b1 - The first Bounds object to compare.
|
|
315
|
+
* @param {Bounds} b2 - The second Bounds object to compare.
|
|
316
|
+
* @returns {boolean} - Returns true if both Bounds objects have the same x, y, width and height values, otherwise returns false.
|
|
317
|
+
*/
|
|
318
|
+
private sameBounds;
|
|
319
|
+
/**
|
|
320
|
+
* Applies default bounds to the provided bounds object.
|
|
321
|
+
* @param {Bounds} bounds - The bounds object to apply default bounds to.
|
|
322
|
+
* @returns {void}
|
|
323
|
+
* @private
|
|
324
|
+
*/
|
|
325
|
+
private applyDefaultBounds;
|
|
326
|
+
/**
|
|
327
|
+
* Sets the main candle series for the CanvasBoundsContainer.
|
|
328
|
+
* @param {CandleSeriesModel} candleSeries - The candle series to be set as the main candle series.
|
|
329
|
+
* @returns {void}
|
|
330
|
+
* @deprecated This method should be removed as candleSeries is not a part of CanvasBoundsContainer.
|
|
331
|
+
*/
|
|
332
|
+
setMainCandleSeries(candleSeries: CandleSeriesModel): void;
|
|
333
|
+
}
|
|
334
|
+
export declare const isInBounds: (point: Point, bounds: Bounds) => boolean;
|
|
335
|
+
export declare const isInVerticalBounds: (y: number, bounds: Bounds) => boolean;
|
|
336
|
+
export declare const limitYToBounds: (y: Pixel, bounds: Bounds) => number;
|
|
337
|
+
export interface HitBoundsTest {
|
|
338
|
+
(x: number, y: number): boolean;
|
|
339
|
+
}
|
|
340
|
+
export interface HitBoundsTestOptions {
|
|
341
|
+
extensionX: number;
|
|
342
|
+
extensionY: number;
|
|
343
|
+
wholePage: boolean;
|
|
344
|
+
}
|
|
345
|
+
export type HitBoundsTestOptionsPartial = AtLeastOne<HitBoundsTestOptions>;
|
|
346
|
+
export declare const DEFAULT_HIT_TEST_OPTIONS: HitBoundsTestOptions;
|
|
347
|
+
export declare const areBoundsChanged: (prev: Bounds, next: Bounds) => boolean;
|
|
@@ -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 F,Subject as E}from"rxjs";import{distinctUntilChanged as z,map as k}from"rxjs/operators";import{arrayCompare as Y,arrayRemove2 as K,flat as Z,moveInArrayMutable as H,reorderArray as G}from"../utils/array.utils";import{isMobile as W}from"../utils/device/browser.utils";import{calcTimeLabelBounds as q}from"../components/navigation_map/navigation-map.model";import{calculateSymbolHeight as $}from"../utils/canvas/canvas-font-measure-tool.utils";import{YAxisBoundsContainer as J}from"./y-axis-bounds.container";export const CHART_UUID="CHART";class s{}s.CANVAS="CANVAS",s.N_MAP="N_MAP",s.X_AXIS="X_AXIS",s.N_MAP_KNOT_L="N_MAP_KNOT_L",s.N_MAP_KNOT_R="N_MAP_KNOT_R",s.N_MAP_BTN_L="N_MAP_BTN_L",s.N_MAP_BTN_R="N_MAP_BTN_R",s.N_MAP_SLIDER_WINDOW="N_MAP_SLIDER_WINDOW",s.N_MAP_CHART="N_MAP_CHART",s.N_MAP_LABEL_R="N_MAP_LABEL_R",s.N_MAP_LABEL_L="N_MAP_LABEL_L",s.PANE_UUID=c=>"PANE_"+c,s.PANE_UUID_Y_AXIS=(c,t=0)=>"PANE_"+c+"_Y_AXIS_"+t,s.PANE_UUID_RESIZER=c=>"PANE_"+c+"_RESIZER",s.ALL_PANES="ALL_PANES",s.CHART_WITH_Y_AXIS="CHART_WITH_Y_AXIS",s.EVENTS="EVENTS",s.CHART=s.PANE_UUID(CHART_UUID),s.Y_AXIS=s.PANE_UUID_Y_AXIS(CHART_UUID);export{s as CanvasElement};export const DEFAULT_BOUNDS={x:0,y:0,pageX:0,pageY:0,width:0,height:0};const Q=20,j=35,I=15,V=1.5,M=W()?8*V:8,tt=1e-6;export class CanvasBoundsContainer{get graphsHeightRatio(){return this._graphsHeightRatio}constructor(t,e,i,h,n){this.config=t,this.eventBus=e,this.canvasModel=i,this.formatterFactory=h,this.bounds={},this.canvasOnPageLocation={x:0,y:0,pageX:0,pageY:0,width:0,height:0},this.panesOrder=[],this.panesOrderChangedSubject=new E,this.xAxisHeight=void 0,this.yAxisWidths={right:[0],left:[0]},this.leftRatio=0,this.rightRatio=0,this.boundsChangedSubject=new E,this.barResizerChangedSubject=new E,this._graphsHeightRatio={chart:1},this.graphsHeightRatioChangedSubject=new E,this.boundsChangedSubscriptions={},n.canvasResized.subscribe(r=>{let a=r;a||(a=this.canvasModel.canvas.getBoundingClientRect()),this.updateCanvasOnPageLocation(a),this.recalculateBounds()}),this.yAxisBoundsContainer=new J(this.config,this.canvasModel)}updateYAxisWidths(){const t=this.yAxisBoundsContainer.getYAxisWidths();this.setYAxisWidths(t)}addPaneBounds(t,e){if(this.panesOrder.indexOf(t)===-1){if(this.panesOrder.push(t),e!==void 0){const i=this.panesOrder.indexOf(t);H(this.panesOrder,i,e)}this.recalculatePanesHeightRatios(),this.panesOrderChangedSubject.next(this.panesOrder)}}overrideChartHeightRatios(t){const e=Object.assign(Object.assign({},this.graphsHeightRatio),t),i=Object.values(e).reduce((h,n)=>h+n,0);Math.abs(i-1)<tt?(this._graphsHeightRatio=e,this.recalculateBounds()):console.error(`Result ratio should be equal 1, but equal ${i}`)}movePaneUp(t){const e=this.panesOrder.indexOf(t);e!==-1&&(H(this.panesOrder,e,e-1),this.recalculateBounds(),this.eventBus.fireDraw(),this.panesOrderChangedSubject.next(this.panesOrder))}movePaneDown(t){const e=this.panesOrder.indexOf(t);e!==-1&&(H(this.panesOrder,e,e+1),this.recalculateBounds(),this.eventBus.fireDraw(),this.panesOrderChangedSubject.next(this.panesOrder))}reorderPanes(t){this.panesOrder=G(this.panesOrder,t),this.recalculateBounds(),this.panesOrderChangedSubject.next(this.panesOrder)}removedPaneBounds(t){K(this.panesOrder,t),delete this.graphsHeightRatio[t],delete this.bounds[s.PANE_UUID(t)],this.yAxisWidths.left.concat(this.yAxisWidths.right).forEach((e,i)=>delete this.bounds[s.PANE_UUID_Y_AXIS(t,i)]),delete this.bounds[s.PANE_UUID_RESIZER(t)],this.recalculatePanesHeightRatios(),this.panesOrderChangedSubject.next(this.panesOrder)}recalculateBounds(){const t=this.canvasOnPageLocation.width,e=this.canvasOnPageLocation.height,i=this.config.components.paneResizer.height,h=this.getBounds(s.CANVAS);h.x=0,h.y=0,h.width=t,h.height=e;const n=this.getYAxisWidth(),r=this.getNavMapBounds(h),a=this.getXAxisBounds(r,h),o=e-a.height-r.height,l=n.left.reduce((u,_)=>u+_,0),f=n.right.reduce((u,_)=>u+_,0),g=0,O=h.width-f,A=g+l,b=0,m=h.width-l-f;let p=b;this.panesOrder.forEach((u,_)=>{var N;const x=this.graphsHeightRatio[this.panesOrder[_]],B=this.config.components.paneResizer.visible;B&&(_!==0?v(this.bounds,s.PANE_UUID_RESIZER(u),0,p,h.width,i,this.canvasOnPageLocation):v(this.bounds,s.PANE_UUID_RESIZER(u),0,0,0,0,this.canvasOnPageLocation));const C=v(this.bounds,s.PANE_UUID(u),A,B?p+i:p,m,B?o*x-this.config.components.paneResizer.height:o*x,this.canvasOnPageLocation);if(this.config.components.yAxis.visible){const S=this.yAxisBoundsContainer.extentsOrder.get(u);if(S===void 0)return;const T=B?p+i:p,U=B?o*x-i:o*x;let X=A-((N=n.left[0])!==null&&N!==void 0?N:0),D=O;S.left.forEach((L,y)=>{var w;v(this.bounds,s.PANE_UUID_Y_AXIS(u,L),X,T,n.left[y],U,this.canvasOnPageLocation),X-=(w=n.left[y+1])!==null&&w!==void 0?w:0}),S.right.forEach((L,y)=>{v(this.bounds,s.PANE_UUID_Y_AXIS(u,L),D,T,n.right[y],U,this.canvasOnPageLocation),D+=n.right[y]})}else v(this.bounds,s.PANE_UUID_Y_AXIS(u),0,0,0,0,this.canvasOnPageLocation);p=C.y+C.height});const d=this.getBounds(s.ALL_PANES);d.x=A,d.y=b,d.width=m,d.height=p;const P=this.getBounds(s.CHART_WITH_Y_AXIS),R=this.getBounds(s.PANE_UUID(CHART_UUID));this.getEventsBounds(R),this.copyBounds(R,P),P.width=h.width,this.recalculateNavigationMapElementBounds(),this.updateAllBoundsPageCoordinates(),this.notifyBoundsSubscribers()}updateCanvasOnPageLocation(t){this.canvasOnPageLocation=Object.assign(Object.assign({},this.canvasOnPageLocation),{x:t.x,y:t.y,width:t.width,height:t.height})}updateAllBoundsPageCoordinates(){for(const t of Object.keys(this.bounds)){const e=this.bounds[t];e.pageX=e.x+this.canvasOnPageLocation.x,e.pageY=e.y+this.canvasOnPageLocation.y}}getEventsBounds(t){const e=this.getBounds(s.EVENTS);return this.config.components.events.visible?(e.x=0,e.y=t.y+t.height-this.config.components.events.height,e.width=t.width,e.height=this.config.components.events.height):this.applyDefaultBounds(e),e}getNavMapBounds(t){const e=this.getBounds(s.N_MAP);return this.config.components.navigationMap.visible?(e.x=0,e.y=t.height-j,e.width=t.width,e.height=j):this.applyDefaultBounds(e),e}getXAxisBounds(t,e){const i=this.getBounds(s.X_AXIS);return this.config.components.xAxis.visible?(i.x=0,i.y=e.height-this.getXAxisHeight()-t.height,i.width=e.width,i.height=this.getXAxisHeight()):this.applyDefaultBounds(i),i}getXAxisHeight(){var t,e;if(!this.xAxisHeight){const i=this.config.components.xAxis.fontSize+"px "+this.config.components.xAxis.fontFamily,h=$(i,this.canvasModel.ctx);this.xAxisHeight=h+((t=this.config.components.xAxis.padding.top)!==null&&t!==void 0?t:0)+((e=this.config.components.xAxis.padding.bottom)!==null&&e!==void 0?e:0)}return this.xAxisHeight}setYAxisWidths(t){(!Y(this.yAxisWidths.left,t.left)||!Y(this.yAxisWidths.right,t.right))&&(this.yAxisWidths=t,this.recalculateBounds())}setXAxisHeight(t){t!==this.xAxisHeight&&(this.xAxisHeight=t,this.recalculateBounds())}setPanesOrder(t){this.panesOrder=t,this.recalculateBounds()}getYAxisWidth(){return this.config.components.yAxis.visible?this.yAxisWidths:{right:[0],left:[0]}}recalculatePanesHeightRatios(){this.calculateGraphsHeightRatios(),this.recalculateBounds()}calculateGraphsHeightRatios(){let t=this.graphsHeightRatio[CHART_UUID];const e=[];e.push(...this.panesOrder.filter(g=>g!==CHART_UUID)),this.panesOrder.forEach(g=>{this.graphsHeightRatio[g]===0&&delete this.graphsHeightRatio[g]});const i=e.map(g=>this.graphsHeightRatio[g]===void 0?void 0:this.graphsHeightRatio[g]),h=i.filter(g=>g!==void 0).length,n=i.filter(g=>g===void 0).length;let r=0,a=0,o=1,l=0;n>0&&([o,l]=it(e.length),t*=o),h===0&&(t=1-l*n),a=1-t-l*n,i.forEach(g=>{g&&(a-=g*o)}),r=a/(e.length+1);const f=i.map(g=>g?g*o+r:l+r);t+=r,this._graphsHeightRatio={},this.graphsHeightRatio[CHART_UUID]=t,f.forEach((g,O)=>{const A=e[O];this.graphsHeightRatio[A]=g})}recalculateNavigationMapElementBounds(){var t,e,i,h;if(this.config.components.navigationMap.visible){const n=this.getBounds(s.N_MAP),{height:r,width:a}=this.config.components.navigationMap.knots,o=r!=null?r:0,l=W()?a*V:a!=null?a:0,f=o?n.y+(n.height-o)/2:n.y,g=(e=(t=this.config.components.navigationMap)===null||t===void 0?void 0:t.timeLabels)===null||e===void 0?void 0:e.visible,O=x=>q(this.canvasModel.ctx,x,this.formatterFactory,this.config)[0],A=Z((h=(i=this.mainCandleSeries)===null||i===void 0?void 0:i.getSeriesInViewport())!==null&&h!==void 0?h:[]),b=g&&A.length?O(A[0].candle.timestamp):0,m=g&&A.length?O(A[A.length-1].candle.timestamp):0,p=Math.max(b,m);if(g){const x=this.getBounds(s.N_MAP_LABEL_L);x.x=n.x,x.y=n.y,x.width=p,x.height=n.height;const B=this.getBounds(s.N_MAP_LABEL_R);B.x=n.x+n.width-p,B.y=n.y,B.width=p,B.height=n.height}const d=this.getBounds(s.N_MAP_BTN_L);d.x=n.x+p,d.y=n.y,d.width=I,d.height=n.height;const P=this.getBounds(s.N_MAP_BTN_R);P.x=n.x+n.width-I-p,P.y=n.y,P.width=I,P.height=n.height;const R=this.getBounds(s.N_MAP_KNOT_L);R.x=(P.x-d.x-d.width)*this.leftRatio+d.x+d.width,R.y=f,R.width=l!=null?l:M,R.height=o!=null?o:n.height;const u=this.getBounds(s.N_MAP_KNOT_R);u.x=(P.x-d.x-d.width)*this.rightRatio+d.x+d.width-M,u.y=f,u.width=l!=null?l:M,u.height=o!=null?o:n.height;const _=this.getBounds(s.N_MAP_SLIDER_WINDOW);_.x=R.x+R.width,_.y=n.y,_.width=u.x-_.x,_.height=n.height;const N=this.getBounds(s.N_MAP_CHART);N.x=d.x+d.width,N.y=n.y,N.width=P.x-N.x,N.height=n.height}}isVolumesInSeparatePane(){return this.config.components.volumes.visible&&this.config.components.volumes.showSeparately}getBounds(t){return this.bounds[t]===void 0&&(this.bounds[t]=this.copyOf(DEFAULT_BOUNDS)),this.bounds[t]}getCanvasOnPageLocation(){return this.canvasOnPageLocation}getBoundsPanes(){return this.panesOrder.reduce((t,e)=>Object.assign(Object.assign({},t),{[e]:this.bounds[s.PANE_UUID(e)]}),{})}getBoundsHitTest(t,e=DEFAULT_HIT_TEST_OPTIONS){const{extensionX:i,extensionY:h,wholePage:n}=Object.assign(Object.assign({},DEFAULT_HIT_TEST_OPTIONS),e);return n?(r,a)=>{const o=this.getBounds(t);return r>o.pageX-i&&r<o.pageX+o.width+i&&a>o.pageY-h&&a<o.pageY+o.height+h}:(r,a)=>{const o=this.getBounds(t);return r>o.x-i&&r<o.x+o.width+i&&a>o.y-h&&a<o.y+o.height+h}}static hitTestOf(t,e=DEFAULT_HIT_TEST_OPTIONS){const{extensionX:i,extensionY:h,wholePage:n}=Object.assign(Object.assign({},DEFAULT_HIT_TEST_OPTIONS),e);return n?(r,a)=>r>t.pageX-i&&r<t.pageX+t.width+i&&a>t.pageY-h&&a<t.pageY+t.height+h:(r,a)=>r>t.x-i&&r<t.x+t.width+i&&a>t.y-h&&a<t.y+t.height+h}isChartBoundsAvailable(){const t=this.getBounds(s.CANVAS);return t.width>0&&t.height>0}resizePaneVertically(t,e){const i=this.panesOrder.indexOf(t),h=this.getBounds(s.PANE_UUID_RESIZER(t));this.doResizePaneVertically(i,h.y-e),this.barResizerChangedSubject.next()}doResizePaneVertically(t,e){const i=t-1,h=this.getBounds(s.ALL_PANES).height,n=this.config.components.paneResizer.height+Q,r=h*this.graphsHeightRatio[this.panesOrder[t]],a=h*this.graphsHeightRatio[this.panesOrder[i]],o=r+e>n,l=a-e>n;if(o&&l){const f=e/h;this.graphsHeightRatio[this.panesOrder[t]]+=f,this.graphsHeightRatio[this.panesOrder[i]]-=f,this.recalculateBounds()}}notifyBoundsSubscribers(){Object.keys(this.boundsChangedSubscriptions).forEach(t=>{this.boundsChangedSubscriptions[t].next(this.getBounds(t))}),this.boundsChangedSubject.next()}observeBoundsChanged(t){let e=this.boundsChangedSubscriptions[t];return e||(e=new F(this.getBounds(t)),this.boundsChangedSubscriptions[t]=e),e.pipe(k(i=>this.copyOf(i)),z((i,h)=>this.sameBounds(i,h)))}observeAnyBoundsChanged(){return this.boundsChangedSubject.asObservable()}copyOf(t){return Object.assign({},t)}copyBounds(t,e){e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height}sameBounds(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}applyDefaultBounds(t){this.copyBounds(DEFAULT_BOUNDS,t)}setMainCandleSeries(t){this.mainCandleSeries=t}}const et={0:1,1:.8,2:.6,3:.5,4:.4,5:.2},it=c=>{var t;const e=(t=et[c])!==null&&t!==void 0?t:.4,i=(1-e)/c;return[e,i]};export const isInBounds=(c,t)=>c.x>t.x&&c.x<t.x+t.width&&c.y>t.y&&c.y<t.y+t.height,isInVerticalBounds=(c,t)=>c>t.y&&c<t.y+t.height;const v=(c,t,e,i,h,n,r)=>{const a=c[t];if(a)return a.x=e,a.y=i,a.pageX=e+r.x,a.pageY=i+r.y,a.width=h,a.height=n,a;const o={x:e,y:i,pageX:e+r.x,pageY:i+r.y,width:h,height:n};return c[t]=o,o};export const limitYToBounds=(c,t)=>Math.min(Math.max(c,t.y),t.y+t.height),DEFAULT_HIT_TEST_OPTIONS={extensionX:0,extensionY:0,wholePage:!1},areBoundsChanged=(c,t)=>c.width===t.width&&c.height===t.height;
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
declare const _default: (devexpertsPromoLink: boolean) => string;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 default a=>`<div data-element="chartResizer" style="position: relative; min-height: 20px; height: 100%; width: 100%; touch-action: manipulation; z-index: 0;">
|
|
7
|
+
<div data-element="chartContainer" style="position: absolute; height: 100%; width: 100%;" class="chart chartArea--graph">
|
|
8
|
+
<div data-element="canvasArea" style="position: relative; height: 100%; width: 100%; touch-action: manipulation;">
|
|
9
|
+
<canvas data-element="snapshotCanvas" style="z-index: 0"></canvas>
|
|
10
|
+
<canvas data-element="backgroundCanvas" style="z-index: 1"></canvas>
|
|
11
|
+
<canvas data-element="mainCanvas" style="z-index: 2"></canvas>
|
|
12
|
+
<canvas data-element="staticDrawingCanvas" style="z-index: 3"></canvas>
|
|
13
|
+
<canvas data-element="dataSeriesCanvas" style="z-index: 5"></canvas>
|
|
14
|
+
<canvas data-element="overDataSeriesCanvas" style="z-index: 6"></canvas>
|
|
15
|
+
<canvas data-element="dynamicDrawingCanvas" style="z-index: 7"></canvas>
|
|
16
|
+
<canvas data-element="yAxisLabelsCanvas" style="z-index: 8"></canvas>
|
|
17
|
+
<canvas data-element="crossToolCanvas" style="z-index: 9"></canvas>
|
|
18
|
+
<canvas data-element="hitTestCanvas" style="z-index: 10"></canvas>
|
|
19
|
+
${a?` <p style="position: absolute; visibility: hidden;">If you have any suggestions or are experiencing any issues, please feel free to contact us at <a href="https://devexperts.com/dxcharts/">devexperts.com</a></p>
|
|
20
|
+
`:""} </div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
@@ -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
|
+
export interface ChartElements {
|
|
7
|
+
canvasArea?: HTMLElement;
|
|
8
|
+
snapshotCanvas?: HTMLCanvasElement;
|
|
9
|
+
backgroundCanvas?: HTMLCanvasElement;
|
|
10
|
+
mainCanvas?: HTMLCanvasElement;
|
|
11
|
+
dataSeriesCanvas?: HTMLCanvasElement;
|
|
12
|
+
overDataSeriesCanvas?: HTMLCanvasElement;
|
|
13
|
+
staticDrawingCanvas?: HTMLCanvasElement;
|
|
14
|
+
dynamicDrawingCanvas?: HTMLCanvasElement;
|
|
15
|
+
yAxisLabelsCanvas?: HTMLCanvasElement;
|
|
16
|
+
crossToolCanvas?: HTMLCanvasElement;
|
|
17
|
+
hitTestCanvas?: HTMLCanvasElement;
|
|
18
|
+
chartResizer?: HTMLElement;
|
|
19
|
+
chartContainer?: HTMLElement;
|
|
20
|
+
}
|
|
21
|
+
export type ValidatedChartElements = Required<ChartElements>;
|
|
22
|
+
export declare const validateChartElements: (els: ChartElements) => els is Required<ChartElements>;
|
|
@@ -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 validateChartElements=a=>{const n=a.canvasArea!==null,l=a.snapshotCanvas!==null,s=a.backgroundCanvas!==null,t=a.mainCanvas!==null,v=a.overDataSeriesCanvas!==null,i=a.staticDrawingCanvas!==null,o=a.dynamicDrawingCanvas!==null,c=a.yAxisLabelsCanvas!==null,r=a.crossToolCanvas!==null,e=a.hitTestCanvas!==null,C=a.chartResizer!==null,b=a.chartContainer!==null,A=a.dataSeriesCanvas!==null;return n&&l&&s&&t&&v&&i&&o&&c&&r&&e&&C&&b&&A};
|
|
@@ -0,0 +1,71 @@
|
|
|
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, Subject } from 'rxjs';
|
|
7
|
+
import { CursorType } from '../chart.config';
|
|
8
|
+
import { CanvasInputListenerComponent } from '../inputlisteners/canvas-input-listener.component';
|
|
9
|
+
import { Bounds } from '../model/bounds.model';
|
|
10
|
+
import { ChartBaseElement } from '../model/chart-base-element';
|
|
11
|
+
import { HitTestCanvasModel } from '../model/hit-test-canvas.model';
|
|
12
|
+
import { CanvasBoundsContainer } from './canvas-bounds-container';
|
|
13
|
+
/**
|
|
14
|
+
* This class is responsible for changing cursor for different entities which are drawn on the canvas.
|
|
15
|
+
* @doc-tags chart-core,cursor
|
|
16
|
+
*/
|
|
17
|
+
export declare class CursorHandler extends ChartBaseElement {
|
|
18
|
+
private element;
|
|
19
|
+
private canvasInputListener;
|
|
20
|
+
private canvasBoundsContainer;
|
|
21
|
+
private hitTestCanvasModel;
|
|
22
|
+
private normalLayer;
|
|
23
|
+
private extensionLayer;
|
|
24
|
+
cursorChangedSubject: Subject<string>;
|
|
25
|
+
constructor(element: HTMLElement, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, hitTestCanvasModel: HitTestCanvasModel);
|
|
26
|
+
/**
|
|
27
|
+
* This method is called when the user activates the canvas. It subscribes to the mouse move event and checks if the mouse pointer is over any of the elements in the normalLayer or extensionLayer. If the mouse pointer is over any of the elements, it updates the cursor to the corresponding cursor of the element.
|
|
28
|
+
*/
|
|
29
|
+
protected doActivate(): void;
|
|
30
|
+
/***
|
|
31
|
+
* @param elId
|
|
32
|
+
* @param bounds
|
|
33
|
+
* @param cursorType
|
|
34
|
+
* @param extension is an extra area beyond the borders of the bounds
|
|
35
|
+
*/
|
|
36
|
+
setCursorForBounds(elId: string, bounds: Bounds, cursorType: CursorType, extension?: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* Sets a cursor for a canvas element
|
|
39
|
+
* @param {string} canvasEl - The canvas element to add the cursor to
|
|
40
|
+
* @param {CursorType} cursor - The type of cursor to add
|
|
41
|
+
* @param {number} [extensionRadius] - The extension radius of the cursor
|
|
42
|
+
*/
|
|
43
|
+
setCursorForCanvasEl(canvasEl: string, cursor: CursorType, extensionRadius?: number): void;
|
|
44
|
+
/**
|
|
45
|
+
* Removes the cursor for a given canvas element.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} canvasEl - The canvas element to remove the cursor from.
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
removeCursorForCanvasEl(canvasEl: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Returns an Observable that emits the latest CursorType value whenever the cursorChangedSubject emits a new value.
|
|
53
|
+
* The emitted value is guaranteed to be distinct from the previous one.
|
|
54
|
+
* @returns {Observable<CursorType>} An Observable that emits the latest CursorType value.
|
|
55
|
+
*/
|
|
56
|
+
observeCursorChanged(): Observable<CursorType>;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the cursor type for a given canvas element and optionally extends the hit test area.
|
|
59
|
+
* @param {string} canvasElement - The ID of the canvas element to observe.
|
|
60
|
+
* @param {CursorType} cursorType - The type of cursor to set.
|
|
61
|
+
* @param {number} [extensionY] - Optional extension of the hit test area in the Y axis.
|
|
62
|
+
* @returns {void}
|
|
63
|
+
*/
|
|
64
|
+
private observeCursorType;
|
|
65
|
+
/**
|
|
66
|
+
* Updates the cursor type of an element based on the mouse enter or leave event.
|
|
67
|
+
* @param {CursorType} cursorType - The type of cursor to be set on the element.
|
|
68
|
+
* @returns {void}
|
|
69
|
+
*/
|
|
70
|
+
updateCursor(cursorType: CursorType): void;
|
|
71
|
+
}
|
|
@@ -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 i}from"rxjs";import{distinctUntilChanged as n,throttleTime as a}from"rxjs/operators";import{ChartBaseElement as u}from"../model/chart-base-element";import{CanvasBoundsContainer as h}from"./canvas-bounds-container";export class CursorHandler extends u{constructor(e,t,s,r){super(),this.element=e,this.canvasInputListener=t,this.canvasBoundsContainer=s,this.hitTestCanvasModel=r,this.normalLayer=new Map,this.extensionLayer=new Map,this.cursorChangedSubject=new i}doActivate(){super.doActivate(),this.canvasInputListener.observeMouseMoveNoDrag().pipe(a(100,void 0,{trailing:!0})).subscribe(e=>{const t=this.hitTestCanvasModel.resolveCursor(e);if(t!==void 0){this.updateCursor(t);return}e&&(this.normalLayer.forEach(s=>{s.hitTest(e.x,e.y)&&this.updateCursor(s.cursor)}),this.extensionLayer.forEach(s=>{s.hitTest(e.x,e.y)&&this.updateCursor(s.cursor)}))})}setCursorForBounds(e,t,s,r=0){const o=h.hitTestOf(t,{extensionY:r});r?this.extensionLayer.set(e,{cursor:s,hitTest:o}):this.normalLayer.set(e,{cursor:s,hitTest:o})}setCursorForCanvasEl(e,t,s){this.observeCursorType(e,t,s)}removeCursorForCanvasEl(e){this.normalLayer.delete(e),this.extensionLayer.delete(e)}observeCursorChanged(){return this.cursorChangedSubject.pipe(n())}observeCursorType(e,t,s){const r=s?this.canvasBoundsContainer.getBoundsHitTest(e,{extensionY:s}):this.canvasBoundsContainer.getBoundsHitTest(e);s?this.extensionLayer.set(e,{cursor:t,hitTest:r}):this.normalLayer.set(e,{cursor:t,hitTest:r})}updateCursor(e){this.element.style.cursor!==e&&(this.element.style.cursor=e,this.cursorChangedSubject.next(e))}}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 { ValidatedChartElements } from './chart-elements';
|
|
7
|
+
import { FullChartConfig } from '../chart.config';
|
|
8
|
+
/**
|
|
9
|
+
* Creates a default layout template for a canvas chart.
|
|
10
|
+
* @function
|
|
11
|
+
* @returns {HTMLTemplateElement} - The default layout template for a canvas chart.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createDefaultLayoutTemplate(config: FullChartConfig): HTMLTemplateElement;
|
|
14
|
+
/**
|
|
15
|
+
* Extracts chart elements from a given container and returns them as a validated object.
|
|
16
|
+
* @param {Element} container - The container element to search for chart elements.
|
|
17
|
+
* @returns {ValidatedChartElements} - An object containing the chart elements as properties.
|
|
18
|
+
* @throws {Error} - If some chart elements are missing.
|
|
19
|
+
*/
|
|
20
|
+
export declare function extractElements(container: Element): ValidatedChartElements;
|
|
@@ -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{validateChartElements as o}from"./chart-elements";import l from"./canvas-chart-html";export function createDefaultLayoutTemplate(t){const e=document.createElement("template");return e.innerHTML=l(t.devexpertsPromoLink),e}export function extractElements(t){const e={},n=Array.from(t.querySelectorAll("[data-element]"));if(n.length!==0&&n.forEach(a=>{var r;e[(r=a.getAttribute("data-element"))!==null&&r!==void 0?r:""]=a}),o(e))return e;throw new Error("Some chart elements are missing")}
|
|
@@ -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 { FullChartConfig, YAxisAlign } from '../chart.config';
|
|
7
|
+
import { CanvasModel } from '../model/canvas.model';
|
|
8
|
+
export interface YAxisWidthContributor {
|
|
9
|
+
getLargestLabel: () => string;
|
|
10
|
+
getYAxisIndex: () => number;
|
|
11
|
+
getYAxisAlign: () => YAxisAlign;
|
|
12
|
+
getPaneUUID: () => string;
|
|
13
|
+
}
|
|
14
|
+
export type ExtentsOrder = Map<string, // uuid of the pane
|
|
15
|
+
{
|
|
16
|
+
left: number[];
|
|
17
|
+
right: number[];
|
|
18
|
+
}>;
|
|
19
|
+
export interface YAxisWidths {
|
|
20
|
+
left: number[];
|
|
21
|
+
right: number[];
|
|
22
|
+
}
|
|
23
|
+
export declare class YAxisBoundsContainer {
|
|
24
|
+
private config;
|
|
25
|
+
private mainCanvasModel;
|
|
26
|
+
extentsOrder: ExtentsOrder;
|
|
27
|
+
constructor(config: FullChartConfig, mainCanvasModel: CanvasModel);
|
|
28
|
+
yAxisWidthContributors: YAxisWidthContributor[];
|
|
29
|
+
/**
|
|
30
|
+
* Registers a YAxisWidthContributor to the chart.
|
|
31
|
+
*
|
|
32
|
+
* @param {YAxisWidthContributor} contributor - The YAxisWidthContributor to be registered.
|
|
33
|
+
* @returns {void}
|
|
34
|
+
*/
|
|
35
|
+
registerYAxisWidthContributor(contributor: YAxisWidthContributor): void;
|
|
36
|
+
/**
|
|
37
|
+
* Removes a YAxisWidthContributor from the chart.
|
|
38
|
+
*
|
|
39
|
+
* @param {YAxisWidthContributor} contributor - The YAxisWidthContributor to be removed.
|
|
40
|
+
* @returns {void}
|
|
41
|
+
*/
|
|
42
|
+
removeYAxisWidthContributor(contributor: YAxisWidthContributor): void;
|
|
43
|
+
/**
|
|
44
|
+
* Calculates the width of a given text using the font from the yAxis component of the chart configuration
|
|
45
|
+
* @param {string} text - The text to calculate the width of
|
|
46
|
+
* @returns {number} - The width of the text in pixels
|
|
47
|
+
*/
|
|
48
|
+
private getTextWidth;
|
|
49
|
+
/**
|
|
50
|
+
* Updates width of Y axis.
|
|
51
|
+
* Considers max text of YAxis labels.
|
|
52
|
+
*/
|
|
53
|
+
getYAxisWidths(): YAxisWidths;
|
|
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{getFontFromConfig as g}from"../chart.config";import{calculateTextWidth as c}from"../utils/canvas/canvas-font-measure-tool.utils";export class YAxisBoundsContainer{constructor(t,i){this.config=t,this.mainCanvasModel=i,this.extentsOrder=new Map,this.yAxisWidthContributors=[]}registerYAxisWidthContributor(t){this.yAxisWidthContributors.push(t)}removeYAxisWidthContributor(t){this.yAxisWidthContributors=this.yAxisWidthContributors.filter(i=>i!==t)}getTextWidth(t){const i=g(this.config.components.yAxis);return c(t,this.mainCanvasModel.ctx,i)}getYAxisWidths(){this.extentsOrder.clear();const t=[],i=[],l=this.config.components.yAxis.labelBoxMargin.start+this.config.components.yAxis.labelBoxMargin.end;return this.yAxisWidthContributors.forEach(n=>{var o,r,h;const x=this.getTextWidth(n.getLargestLabel())+l,a=n.getYAxisIndex(),d=n.getPaneUUID(),s=(o=this.extentsOrder.get(d))!==null&&o!==void 0?o:{left:[],right:[]};if(n.getYAxisAlign()==="left"){const e=s.left.length;t[e]=Math.max((r=t[e])!==null&&r!==void 0?r:0,x),s.left.push(a)}else{const e=s.right.length;i[e]=Math.max((h=i[e])!==null&&h!==void 0?h:0,x),s.right.push(a)}this.extentsOrder.set(d,s)}),{left:t,right:i}}}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { FullChartConfig } from './chart.config';
|
|
8
|
+
import { CanvasInputListenerComponent } from './inputlisteners/canvas-input-listener.component';
|
|
9
|
+
import { CanvasBoundsContainer } from './canvas/canvas-bounds-container';
|
|
10
|
+
/**
|
|
11
|
+
* Abstraction over ChartBootstrap and PL chart.
|
|
12
|
+
*/
|
|
13
|
+
export default interface ChartContainer {
|
|
14
|
+
bus: EventBus;
|
|
15
|
+
config: FullChartConfig;
|
|
16
|
+
canvasInputListener: CanvasInputListenerComponent;
|
|
17
|
+
canvasBoundsContainer: CanvasBoundsContainer;
|
|
18
|
+
}
|