@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,172 @@
|
|
|
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 { YExtentComponent } from '../components/pane/extent/y-extent-component';
|
|
7
|
+
import { DataSeriesYAxisLabelsProvider } from '../components/y_axis/price_labels/data-series-y-axis-labels.provider';
|
|
8
|
+
import { AtLeastOne } from '../utils/object.utils';
|
|
9
|
+
import { ChartBaseElement } from './chart-base-element';
|
|
10
|
+
import { DataSeriesView } from './data-series-view';
|
|
11
|
+
import { DataSeriesConfig, DataSeriesPaintConfig, DataSeriesType } from './data-series.config';
|
|
12
|
+
import { HighLowWithIndex, ScaleModel } from './scale.model';
|
|
13
|
+
import { HighLowProvider } from './scaling/auto-scale.model';
|
|
14
|
+
import { Index, Unit, Viewable } from './scaling/viewport.model';
|
|
15
|
+
/**
|
|
16
|
+
* Properties are named in order to match VisualCandle interface
|
|
17
|
+
*/
|
|
18
|
+
export declare class VisualSeriesPoint {
|
|
19
|
+
centerUnit: Unit;
|
|
20
|
+
close: Unit;
|
|
21
|
+
constructor(centerUnit: Unit, close: Unit);
|
|
22
|
+
/**
|
|
23
|
+
* returns y coordinate in pixels
|
|
24
|
+
*/
|
|
25
|
+
y(viewable: Viewable): Unit;
|
|
26
|
+
/**
|
|
27
|
+
* returns x coordinate in pixels
|
|
28
|
+
*/
|
|
29
|
+
x(viewable: Viewable): Unit;
|
|
30
|
+
clone(): VisualSeriesPoint;
|
|
31
|
+
}
|
|
32
|
+
export interface DataSeriesPoint {
|
|
33
|
+
timestamp: number;
|
|
34
|
+
close: Unit;
|
|
35
|
+
}
|
|
36
|
+
export interface DataSeriesViewportIndexes {
|
|
37
|
+
dataIdxStart: Index;
|
|
38
|
+
dataIdxEnd: Index;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* DataSeriesModel represents single time series chart.
|
|
42
|
+
* Usually data source is presented as a one-dimension array, but here it can be presented as two-dimension array
|
|
43
|
+
* If the data is presented as two-dim array when every data array will be drawn as a separate time-series
|
|
44
|
+
* For example, linear chart type will be drawn with gaps on the chart
|
|
45
|
+
*/
|
|
46
|
+
export declare class DataSeriesModel<D extends DataSeriesPoint = DataSeriesPoint, V extends VisualSeriesPoint = VisualSeriesPoint> extends ChartBaseElement {
|
|
47
|
+
extentComponent: YExtentComponent;
|
|
48
|
+
id: number;
|
|
49
|
+
name: string;
|
|
50
|
+
hovered: boolean;
|
|
51
|
+
yAxisLabelProvider: DataSeriesYAxisLabelsProvider;
|
|
52
|
+
readonly config: DataSeriesConfig;
|
|
53
|
+
scaleModel: ScaleModel;
|
|
54
|
+
view: DataSeriesView;
|
|
55
|
+
protected _dataPoints: D[][];
|
|
56
|
+
pricePrecisions: number[];
|
|
57
|
+
/**
|
|
58
|
+
* Should be used for paint tools like rectangular drawing or diff cloud
|
|
59
|
+
*/
|
|
60
|
+
linkedDataSeriesModels: DataSeriesModel<D, V>[];
|
|
61
|
+
highLowProvider: HighLowProvider;
|
|
62
|
+
get dataPoints2D(): D[][];
|
|
63
|
+
get dataPoints(): D[];
|
|
64
|
+
protected _dataPointsFlat: D[];
|
|
65
|
+
set dataPoints(points: D[][] | D[]);
|
|
66
|
+
protected _visualPoints: V[][];
|
|
67
|
+
protected _visualPointsFlat: V[];
|
|
68
|
+
dataIdxStart: Index;
|
|
69
|
+
dataIdxEnd: Index;
|
|
70
|
+
get visualPoints(): V[];
|
|
71
|
+
get visualPoints2D(): V[][];
|
|
72
|
+
set visualPoints(points: V[][] | V[]);
|
|
73
|
+
constructor(extentComponent: YExtentComponent, id: number, _config?: AtLeastOne<DataSeriesConfig>);
|
|
74
|
+
protected doActivate(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Sets the data points and recalculates internal state
|
|
77
|
+
* @param {DataSeriesPoint[][] | DataSeriesPoint[]} points - The data points to set for the model. Can be an array of arrays or a single array.
|
|
78
|
+
* @returns {void}
|
|
79
|
+
*/
|
|
80
|
+
setDataPoints(points: D[][] | D[]): void;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the paint configuration object for a specific series part, or the default paint configuration object
|
|
83
|
+
* if the specified series part is not defined in the current DataSeriesView configuration.
|
|
84
|
+
*
|
|
85
|
+
* @param {number} seriesPart - The index of the series part to get the paint configuration for.
|
|
86
|
+
* @returns {DataSeriesPaintConfig} The paint configuration object for the specified series part, or the default paint configuration object.
|
|
87
|
+
*/
|
|
88
|
+
getPaintConfig: (seriesPart: number) => DataSeriesPaintConfig;
|
|
89
|
+
protected _toVisualPoints(data: D[][]): V[][];
|
|
90
|
+
/**
|
|
91
|
+
* Moves the DataSeriesModel to the given extent.
|
|
92
|
+
* @param extent
|
|
93
|
+
*/
|
|
94
|
+
moveToExtent(extent: YExtentComponent): void;
|
|
95
|
+
/**
|
|
96
|
+
* Transforms the given array of data points of type D into an array of visual points of type V.
|
|
97
|
+
* Each visual point object contains a centerUnit property with the index of the point in the input array,
|
|
98
|
+
* and a close property with the close value of the point.
|
|
99
|
+
*
|
|
100
|
+
* @param {D[]} data - The array of data points to transform into visual points.
|
|
101
|
+
* @returns {V[]} An array of visual points, each with a centerUnit and close property.
|
|
102
|
+
*/
|
|
103
|
+
toVisualPoints(data: D[]): V[];
|
|
104
|
+
setType(type: DataSeriesType): void;
|
|
105
|
+
/**
|
|
106
|
+
* Recalculates the visual points of the DataSeriesView based on the current data points.
|
|
107
|
+
* The visual points are stored in the visualPoints property of the DataSeriesView.
|
|
108
|
+
* Should be called 1 time when data are set / updated to chart.
|
|
109
|
+
*/
|
|
110
|
+
recalculateVisualPoints(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Recalculates the indexes of the start and end points of the data viewport,
|
|
113
|
+
* based on the current xStart and xEnd values of the scale model, or on the given xStart and xEnd parameters.
|
|
114
|
+
*
|
|
115
|
+
* @param {number} [xStart=this.scaleModel.xStart] - The start value of the viewport on the x-axis. Defaults to the current xStart value of the scale model.
|
|
116
|
+
* @param {number} [xEnd=this.scaleModel.xEnd] - The end value of the viewport on the x-axis. Defaults to the current xEnd value of the scale model.
|
|
117
|
+
*/
|
|
118
|
+
recalculateDataViewportIndexes(xStart?: number, xEnd?: number): void;
|
|
119
|
+
/**
|
|
120
|
+
* Calculates and returns the indexes of the start and end points of the data viewport,
|
|
121
|
+
* based on the given start and end units on the x-axis.
|
|
122
|
+
*
|
|
123
|
+
* @param {Unit} xStart - The start value of the viewport on the x-axis.
|
|
124
|
+
* @param {Unit} xEnd - The end value of the viewport on the x-axis.
|
|
125
|
+
* @returns {DataSeriesViewportIndexes} An object containing the calculated start and end indexes of the data viewport.
|
|
126
|
+
*/
|
|
127
|
+
calculateDataViewportIndexes(xStart: Unit, xEnd: Unit): DataSeriesViewportIndexes;
|
|
128
|
+
/**
|
|
129
|
+
* Formats the given numerical value using the default value formatter.
|
|
130
|
+
*
|
|
131
|
+
* @param {number} value - The numerical value to be formatted.
|
|
132
|
+
* @returns {string} The formatted value as a string.
|
|
133
|
+
*/
|
|
134
|
+
valueFormatter(value: number): string;
|
|
135
|
+
/**
|
|
136
|
+
* Returns the close value of the visual point at the given index, or 1 if the visual point is not defined.
|
|
137
|
+
* The index defaults to the data index start of the DataSeriesView.
|
|
138
|
+
*
|
|
139
|
+
* @param {number} [idx=this.dataIdxStart] - The index of the visual point to retrieve the close value for.
|
|
140
|
+
* @returns {Unit} The close value of the visual point at the given index, or 1 if the visual point is not defined.
|
|
141
|
+
*/
|
|
142
|
+
getBaseLine: (idx?: number) => Unit;
|
|
143
|
+
/**
|
|
144
|
+
* Returns the string representation of the close value of the given visual point.
|
|
145
|
+
*
|
|
146
|
+
* @param {VisualSeriesPoint} point - The visual point to get the string representation of the close value for.
|
|
147
|
+
* @returns {string} The string representation of the close value of the given visual point.
|
|
148
|
+
*/
|
|
149
|
+
getTextForPoint: (point: VisualSeriesPoint) => string;
|
|
150
|
+
/**
|
|
151
|
+
* Returns a two-dimensional array of the visual points in the viewport of the DataSeriesView.
|
|
152
|
+
* The viewport range can be customized by providing start and end units on the x-axis.
|
|
153
|
+
* If start or end units are not provided, the current viewport range of the DataSeriesView is used.
|
|
154
|
+
*
|
|
155
|
+
* @param {number} [xStart] - The start value of the viewport range on the x-axis.
|
|
156
|
+
* @param {number} [xEnd] - The end value of the viewport range on the x-axis.
|
|
157
|
+
* @returns {V[][]} A two-dimensional array of the visual points in the viewport of the DataSeriesView.
|
|
158
|
+
*/
|
|
159
|
+
getSeriesInViewport(xStart?: number, xEnd?: number): V[][];
|
|
160
|
+
/**
|
|
161
|
+
* Returns last visible on the screen data series value
|
|
162
|
+
* @param seriesIndex
|
|
163
|
+
*/
|
|
164
|
+
getLastVisualSeriesPoint: () => V | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Return last overall data series value (even if not visible)
|
|
167
|
+
* @param seriesIndex
|
|
168
|
+
*/
|
|
169
|
+
getLastDataSeriesPoint: () => V | undefined;
|
|
170
|
+
}
|
|
171
|
+
export declare const calculateDataSeriesHighLow: (visualCandles: VisualSeriesPoint[]) => HighLowWithIndex;
|
|
172
|
+
export declare const defaultValueFormatter: (value: number) => string;
|
|
@@ -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{DataSeriesYAxisLabelsProvider as x}from"../components/y_axis/price_labels/data-series-y-axis-labels.provider";import{binarySearch as l,create2DArray as h,lastOf as P,slice2DArray as v}from"../utils/array.utils";import{floorToDPR as d}from"../utils/device/device-pixel-ratio.utils";import{MathUtils as g}from"../utils/math.utils";import{merge as p}from"../utils/merge.utils";import{cloneUnsafe as m}from"../utils/object.utils";import{ChartBaseElement as I}from"./chart-base-element";import{DataSeriesView as c}from"./data-series-view";import{DEFAULT_DATA_SERIES_CONFIG as u}from"./data-series.config";export class VisualSeriesPoint{constructor(t,i){this.centerUnit=t,this.close=i}y(t){return d(t.toY(this.close))}x(t){return d(t.toX(this.centerUnit))}clone(){return new VisualSeriesPoint(this.centerUnit,this.close)}}export class DataSeriesModel extends I{get dataPoints2D(){return this._dataPoints}get dataPoints(){return this._dataPointsFlat}set dataPoints(t){this._dataPoints=h(t),this._dataPointsFlat=this._dataPoints.flat(),this.visualPoints=this._toVisualPoints(this._dataPoints)}get visualPoints(){return this._visualPointsFlat}get visualPoints2D(){return this._visualPoints}set visualPoints(t){this._visualPoints=h(t),this._visualPointsFlat=this._visualPoints.flat()}constructor(t,i,e=m(u)){var a;super(),this.extentComponent=t,this.id=i,this.name="",this.hovered=!1,this._dataPoints=[],this.pricePrecisions=[2],this.linkedDataSeriesModels=[],this._dataPointsFlat=[],this._visualPoints=[],this._visualPointsFlat=[],this.dataIdxStart=0,this.dataIdxEnd=0,this.getPaintConfig=s=>{var n;return(n=this.config.paintConfig[s])!==null&&n!==void 0?n:this.config.paintConfig[0]},this.getBaseLine=(s=this.dataIdxStart)=>{var n,r;return(r=(n=this.visualPoints[s])===null||n===void 0?void 0:n.close)!==null&&r!==void 0?r:1},this.getTextForPoint=s=>`${s.close}`,this.getLastVisualSeriesPoint=()=>{const s=this.visualPoints,n=l(s,this.scaleModel.xEnd,r=>r.centerUnit).index;return s[n]},this.getLastDataSeriesPoint=()=>{const s=this.visualPoints;return P(s)},this.config=p(e,u),this.scaleModel=t.scaleModel,this.view=new c(this,this.scaleModel,()=>this.extentComponent.getAxisType(),this.getBaseLine),this.yAxisLabelProvider=new x(this,this.config,t.getYAxisBounds,(a=t.yAxisComponent)===null||a===void 0?void 0:a.state),this.highLowProvider=f(this),t.addDataSeries(this),this.activate()}doActivate(){this.addRxSubscription(this.scaleModel.xChanged.subscribe(()=>this.recalculateDataViewportIndexes())),this.addRxSubscription(this.scaleModel.scaleInversedSubject.subscribe(()=>this.recalculateVisualPoints()))}setDataPoints(t){this.dataPoints=t,this.extentComponent.paneComponent.updateView()}_toVisualPoints(t){return t.map(i=>this.toVisualPoints(i))}moveToExtent(t){var i;this.extentComponent.removeDataSeries(this),this.extentComponent=t,this.scaleModel=t.scaleModel,this.view=new c(this,this.scaleModel,()=>this.extentComponent.getAxisType(),this.getBaseLine),this.yAxisLabelProvider.yAxisBoundsProvider=t.getYAxisBounds,this.yAxisLabelProvider.axisState=(i=t.yAxisComponent)===null||i===void 0?void 0:i.state,this.deactivate(),this.activate(),t.addDataSeries(this)}toVisualPoints(t){return t.map((i,e)=>({centerUnit:e,close:i.close}))}setType(t){this.config.type=t,this.extentComponent.dataSeriesCanvasModel.fireDraw()}recalculateVisualPoints(){this.visualPoints=this._toVisualPoints(this.dataPoints2D)}recalculateDataViewportIndexes(t=this.scaleModel.xStart,i=this.scaleModel.xEnd){const{dataIdxStart:e,dataIdxEnd:a}=this.calculateDataViewportIndexes(t,i);this.dataIdxStart=e,this.dataIdxEnd=a}calculateDataViewportIndexes(t,i){const e=l(this.visualPoints,t,s=>s.centerUnit).index,a=l(this.visualPoints,i,s=>s.centerUnit).index;return{dataIdxStart:e,dataIdxEnd:a}}valueFormatter(t){return defaultValueFormatter(t)}getSeriesInViewport(t,i){let e=this.dataIdxStart,a=this.dataIdxEnd;if(i!==void 0&&t!==void 0){const s=this.calculateDataViewportIndexes(t,i);e=s.dataIdxStart,a=s.dataIdxEnd}return v(this.visualPoints2D,e,a)}}export const calculateDataSeriesHighLow=o=>{const t={high:Number.MIN_SAFE_INTEGER,low:Number.MAX_SAFE_INTEGER,highIdx:0,lowIdx:0};for(let i=0;i<o.length;i++){const e=o[i];e.close>t.high&&(t.high=e.close,t.highIdx=i),e.close<t.low&&(t.low=e.close,t.lowIdx=i)}return t};const f=o=>({isHighLowActive:()=>o.config.highLowActive,calculateHighLow:t=>{const i=calculateDataSeriesHighLow(o.getSeriesInViewport(t==null?void 0:t.xStart,t==null?void 0:t.xEnd).flat());return Object.assign(Object.assign({},i),{high:o.view.toAxisUnits(i.high),low:o.view.toAxisUnits(i.low)})}});export const defaultValueFormatter=o=>{const i=s=>Math.ceil(Math.log(Math.abs(s))*Math.LOG10E),a=((s,n=5)=>Math.max(0,n-Math.max(0,i(s))))(o);return g.makeDecimal(o,a)};
|
|
@@ -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
|
+
import { FullChartConfig, DateTimeFormatConfig } from '../chart.config';
|
|
7
|
+
export interface TimeFormatterConfig {
|
|
8
|
+
shortDays?: string[];
|
|
9
|
+
shortMonths?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface DateTimeFormatter {
|
|
12
|
+
(date: Date | number): string;
|
|
13
|
+
}
|
|
14
|
+
export type DateTimeFormatterFactory = (format: string) => DateTimeFormatter;
|
|
15
|
+
export declare const defaultDateTimeFormatter: () => (date: Date | number) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Default chart-core time formatter.
|
|
18
|
+
* @param config
|
|
19
|
+
* @param offsetFunction
|
|
20
|
+
* @doc-tags chart-core,default-config,date-formatter
|
|
21
|
+
*/
|
|
22
|
+
export declare const dateTimeFormatterFactory: (config: FullChartConfig, offsetFunction: (timezone: string) => (time: number) => Date) => DateTimeFormatterFactory;
|
|
23
|
+
export declare const recalculateXFormatter: (xAxisLabelFormat: string | Array<DateTimeFormatConfig>, period: number, formatterFactory: (format: string) => (timestamp: number | Date) => string) => DateTimeFormatter;
|
|
@@ -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 defaultDateTimeFormatter=()=>e=>e.toString(),dateTimeFormatterFactory=(e,n)=>{var a;const d="date.get"+(n((a=e.timezone)!==null&&a!==void 0?a:"")?"":"UTC"),r={YYYY:t("FullYear"),YY:t("FullYear")+" % 100",MMM:s("shortMonths","Month"),MMMM:l(s("shortMonths","Month")),M:"1+"+t("Month"),d:t("Date"),H:t("Hours"),m:t("Minutes"),s:t("Seconds"),sss:t("Milliseconds"),EEE:s("shortDays","Day"),SSS:"this.addTwoZeros("+t("Milliseconds")+")",T:"date.getTime()"};["s","m","H","d","M"].forEach(function(o){r[o+o]="this.addZero("+r[o]+")"});const i=new RegExp(Object.keys(r).sort().reverse().join("|"),"g");function t(o){return d+o+"()"}function s(o,h){return"this."+o+"["+t(h)+"]"}function l(o){return o+".toUpperCase()"}function c(o){return"' + ("+r[o]+") + '"}return function(o){var h;const M={shortDays:p(e),shortMonths:f(e),addZero(u){return u<10?"0"+u:u},addTwoZeros(u){return(u<100?"0":"")+(u<10?"0":"")+u},tzDate:n((h=e.timezone)!==null&&h!==void 0?h:"")||function(u){return u instanceof Date?u:new Date(+u)}};return new Function("date","date=this.tzDate(date); return '"+o.replace(i,c)+"'").bind(M)}};function p(e){var n;return(n=e.shortDays)!==null&&n!==void 0?n:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}function f(e){var n;return(n=e.shortMonths)!==null&&n!==void 0?n:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}export const recalculateXFormatter=(e,n,a)=>{if(e){if(typeof e=="string")return a(e);if(Array.isArray(e)){const d=e.filter(r=>{if(r.showWhen){const i=[];return r.showWhen.periodLessThen&&i.push(()=>{var t,s;return n<((s=(t=r.showWhen)===null||t===void 0?void 0:t.periodLessThen)!==null&&s!==void 0?s:0)}),r.showWhen.periodMoreThen&&i.push(()=>{var t,s;return n>=((s=(t=r.showWhen)===null||t===void 0?void 0:t.periodMoreThen)!==null&&s!==void 0?s:0)}),i.every(t=>t())}else return!0});if(d.length>0){const r=d[0];if(r.format)return a(r.format);if(r.customFormatter)return r.customFormatter}}}return defaultDateTimeFormatter()};
|
|
@@ -0,0 +1,128 @@
|
|
|
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 { CanvasBoundsContainer } from '../canvas/canvas-bounds-container';
|
|
8
|
+
import { CursorType, FullChartConfig } from '../chart.config';
|
|
9
|
+
import { CanvasModel } from './canvas.model';
|
|
10
|
+
import { DrawingManager } from '../drawers/drawing-manager';
|
|
11
|
+
import EventBus from '../events/event-bus';
|
|
12
|
+
import { CanvasInputListenerComponent, Point } from '../inputlisteners/canvas-input-listener.component';
|
|
13
|
+
export type HitTestEvents = 'mousedown' | 'hover' | 'touchstart' | 'dblclick' | 'contextmenu' | 'zoom' | 'mouseup';
|
|
14
|
+
type HitTestType = 'DRAWINGS' | 'DATA_SERIES' | 'EVENTS' | 'NEWS';
|
|
15
|
+
export declare const HIT_TEST_ID_RANGE: Record<HitTestType, [number, number]>;
|
|
16
|
+
/** HitTestCanvasModel
|
|
17
|
+
* Canvas layer for testing mouse events over the models such as Charts, Drawings, Volumes and etc.
|
|
18
|
+
* !!! always add new drawers to hit-test drawingManager BEFORE the DrawerType.HIT_TEST_DRAWINGS to save the hierarchy
|
|
19
|
+
*
|
|
20
|
+
* @doc-tags chart-core,hit-test
|
|
21
|
+
*/
|
|
22
|
+
export declare class HitTestCanvasModel extends CanvasModel {
|
|
23
|
+
private canvasInputListener;
|
|
24
|
+
private canvasBoundsContainer;
|
|
25
|
+
private hitTestSubscribers;
|
|
26
|
+
private eventsSubscriptions;
|
|
27
|
+
private hoverSubject;
|
|
28
|
+
private touchStartSubject;
|
|
29
|
+
private dblClickSubject;
|
|
30
|
+
private rightClickSubject;
|
|
31
|
+
constructor(eventBus: EventBus, canvas: HTMLCanvasElement, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, chartConfig: FullChartConfig, canvasModels: CanvasModel[], resizer?: HTMLElement);
|
|
32
|
+
/**
|
|
33
|
+
* Enables HitTestCanvasModel events listeners.
|
|
34
|
+
*/
|
|
35
|
+
enableUserControls(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Disables HitTestCanvasModel events listeners.
|
|
38
|
+
*/
|
|
39
|
+
disableUserControls(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Adds a new subscriber to the list of hit test subscribers.
|
|
42
|
+
* @param {HitTestSubscriber<unknown>} subscriber - The subscriber to be added.
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
45
|
+
addSubscriber(subscriber: HitTestSubscriber<unknown>): void;
|
|
46
|
+
/**
|
|
47
|
+
* Removes a subscriber from the list of hit test subscribers.
|
|
48
|
+
*
|
|
49
|
+
* @param {HitTestSubscriber<unknown>} subscriber - The subscriber to be removed.
|
|
50
|
+
* @returns {void}
|
|
51
|
+
*/
|
|
52
|
+
removeSubscriber(subscriber: HitTestSubscriber<unknown>): void;
|
|
53
|
+
/**
|
|
54
|
+
* Converts a number to a hexadecimal color code.
|
|
55
|
+
* @param {number} id - The number to be converted.
|
|
56
|
+
* @returns {string} - The hexadecimal color code.
|
|
57
|
+
*/
|
|
58
|
+
idToColor(id: number): string;
|
|
59
|
+
/**
|
|
60
|
+
* This function takes a number representing a color and returns the corresponding ID by dividing it by a big prime number.
|
|
61
|
+
*
|
|
62
|
+
* @param {number} color - The number representing the color.
|
|
63
|
+
* @returns {number} - The ID corresponding to the color.
|
|
64
|
+
*/
|
|
65
|
+
colorToId(color: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* Observes hovered on element event, provides hovered element model when move in.
|
|
68
|
+
*/
|
|
69
|
+
observeHoverOnElement(): Observable<HitTestEvent>;
|
|
70
|
+
/**
|
|
71
|
+
* Observes touch start on element event, provides element model.
|
|
72
|
+
*/
|
|
73
|
+
observeTouchStartOnElement(): Observable<HitTestEvent>;
|
|
74
|
+
/**
|
|
75
|
+
* Observes dblclicked on element event, provides dblclicked element model.
|
|
76
|
+
*/
|
|
77
|
+
observeDblClickOnElement(): Observable<HitTestEvent>;
|
|
78
|
+
/**
|
|
79
|
+
* Observes rightclicked on element event, provides rightclicked element model.
|
|
80
|
+
*/
|
|
81
|
+
observeRightClickOnElement(): Observable<HitTestEvent>;
|
|
82
|
+
private curImgData;
|
|
83
|
+
private prevAnimationFrameId;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves the pixel data at the specified coordinates.
|
|
86
|
+
*
|
|
87
|
+
* @private
|
|
88
|
+
* @param {number} x - The x-coordinate of the pixel.
|
|
89
|
+
* @param {number} y - The y-coordinate of the pixel.
|
|
90
|
+
* @returns {Uint8ClampedArray} - The pixel data at the specified coordinates.
|
|
91
|
+
*/
|
|
92
|
+
private getPixel;
|
|
93
|
+
/**
|
|
94
|
+
* Resolves ht model based on the provided point
|
|
95
|
+
* @param point - The point for which to resolve model
|
|
96
|
+
*/
|
|
97
|
+
resolveModel(point: Point): unknown;
|
|
98
|
+
/**
|
|
99
|
+
* Resolves cursor type based on the provided point
|
|
100
|
+
* @param point - The point for which to resolve cursor type
|
|
101
|
+
* @returns - The resolved cursor type, if any
|
|
102
|
+
*/
|
|
103
|
+
resolveCursor(point: Point): CursorType | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Private method that handles hit test events.
|
|
106
|
+
* @param {Point} point - The point where the event occurred.
|
|
107
|
+
* @param {HitTestEvents} event - The type of event that occurred.
|
|
108
|
+
* @returns {void}
|
|
109
|
+
*/
|
|
110
|
+
private eventHandler;
|
|
111
|
+
}
|
|
112
|
+
export interface HitTestSubscriber<T extends unknown = unknown> {
|
|
113
|
+
getIdRange(): [number, number];
|
|
114
|
+
lookup(id: number): T | undefined;
|
|
115
|
+
onMouseDown?(model: T | null, point?: Point): void;
|
|
116
|
+
onMouseUp?(model: T | null, point?: Point): void;
|
|
117
|
+
onHover?(model: T | null, point?: Point): void;
|
|
118
|
+
onTouchStart?(model: T | null, point?: Point): void;
|
|
119
|
+
onDblClick?(model: T, point?: Point): void;
|
|
120
|
+
onRightClick?(model: T, point?: Point): void;
|
|
121
|
+
onZoom?(model: T, point?: Point): void;
|
|
122
|
+
resolveCursor?(point: Point, model?: T): CursorType | undefined;
|
|
123
|
+
}
|
|
124
|
+
export interface HitTestEvent<T = unknown> {
|
|
125
|
+
readonly point: Point;
|
|
126
|
+
readonly model: T;
|
|
127
|
+
}
|
|
128
|
+
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{merge as C,Subject as d}from"rxjs";import{map as m,throttleTime as E}from"rxjs/operators";import{CanvasElement as x}from"../canvas/canvas-bounds-container";import{CanvasModel as H,initCanvasWithConfig as L}from"./canvas.model";import{animationFrameId as g}from"../utils/perfomance/request-animation-frame-throttle.utils";const k=317;export const HIT_TEST_ID_RANGE={DRAWINGS:[0,199],NEWS:[200,299],DATA_SERIES:[300,2999],EVENTS:[3e3,4e3]};export class HitTestCanvasModel extends H{constructor(e,s,i,n,u,o,a,b){super(e,s,u,a,b,{willReadFrequently:!0,desynchronized:!0}),this.canvasInputListener=i,this.canvasBoundsContainer=n,this.hitTestSubscribers=[],this.eventsSubscriptions=[],this.hoverSubject=new d,this.touchStartSubject=new d,this.dblClickSubject=new d,this.rightClickSubject=new d,this.curImgData=new Uint8ClampedArray(4),this.prevAnimationFrameId=-1,L(this,o),s.style.visibility="hidden",this.enableUserControls()}enableUserControls(){if(this.eventsSubscriptions.length===0){const e=this.canvasBoundsContainer.getBoundsHitTest(x.ALL_PANES),s=this.canvasInputListener.observeMouseMove().pipe(E(100,void 0,{trailing:!0})).subscribe(r=>this.eventHandler(r,"hover")),i=this.canvasInputListener.observeTouchStart().pipe(m(()=>this.canvasInputListener.currentPoint)).subscribe(r=>this.eventHandler(r,"touchstart")),n=C(this.canvasInputListener.observeMouseDown(e),this.canvasInputListener.observeTouchStart().pipe(m(()=>this.canvasInputListener.currentPoint))).subscribe(r=>this.eventHandler(r,"mousedown")),u=C(this.canvasInputListener.observeMouseUp(e),this.canvasInputListener.observeTouchEndDocument().pipe(m(()=>this.canvasInputListener.currentPoint))).subscribe(r=>this.eventHandler(r,"mouseup")),o=this.canvasInputListener.observeDbClick(e).subscribe(r=>this.eventHandler(r,"dblclick")),a=this.canvasInputListener.observeContextMenu(e).pipe(m(()=>Object.assign({},this.canvasInputListener.currentPoint))).subscribe(r=>{this.eventHandler(r,"contextmenu")}),b=this.canvasInputListener.observeWheel(e).subscribe(r=>setTimeout(()=>this.eventHandler(r,"zoom"),0));this.eventsSubscriptions.push(s,n,o,a,b,i,u)}}disableUserControls(){this.eventsSubscriptions.forEach(e=>e.unsubscribe()),this.eventsSubscriptions=[]}addSubscriber(e){this.hitTestSubscribers.push(e)}removeSubscriber(e){this.hitTestSubscribers=this.hitTestSubscribers.filter(s=>s===e)}idToColor(e){const s=(e*k).toString(16);return"#000000".substr(0,7-s.length)+s}colorToId(e){return e/k}observeHoverOnElement(){return this.hoverSubject.asObservable()}observeTouchStartOnElement(){return this.touchStartSubject.asObservable()}observeDblClickOnElement(){return this.dblClickSubject.asObservable()}observeRightClickOnElement(){return this.rightClickSubject.asObservable()}getPixel(e,s){const i=window.devicePixelRatio;return this.prevAnimationFrameId!==g&&(this.curImgData=this.ctx.getImageData(e*i,s*i,1,1).data,this.prevAnimationFrameId=g),this.curImgData}resolveModel(e){const s=this.getPixel(e.x,e.y),i=this.colorToId(s[0]*65536+s[1]*256+s[2]),n=Number(i),[u]=p(this.hitTestSubscribers,n);return u==null?void 0:u.lookup(i)}resolveCursor(e){var s;if(!this.hitTestSubscribers.some(b=>b.resolveCursor!==void 0))return;const i=this.getPixel(e.x,e.y),n=this.colorToId(i[0]*65536+i[1]*256+i[2]),u=Number(n),[o]=p(this.hitTestSubscribers,u),a=o==null?void 0:o.lookup(n);return(s=o==null?void 0:o.resolveCursor)===null||s===void 0?void 0:s.call(o,e,a)}eventHandler(e,s){var i,n,u,o,a,b,r;const S=this.getPixel(e.x,e.y),I=this.colorToId(S[0]*65536+S[1]*256+S[2]),f=Number(I),[t,h]=p(this.hitTestSubscribers,f),c=t==null?void 0:t.lookup(I),v={point:e,model:c};switch(s){case"mousedown":c&&((i=t==null?void 0:t.onMouseDown)===null||i===void 0||i.call(t,c,e)),h.forEach(l=>l.onMouseDown&&l.onMouseDown(null,e));break;case"mouseup":c&&((n=t==null?void 0:t.onMouseUp)===null||n===void 0||n.call(t,c,e)),h.forEach(l=>l.onMouseUp&&l.onMouseUp(null,e));break;case"hover":c&&((u=t==null?void 0:t.onHover)===null||u===void 0||u.call(t,c,e)),h.forEach(l=>l.onHover&&l.onHover(null,e)),this.hoverSubject.next(v);break;case"touchstart":c&&((o=t==null?void 0:t.onTouchStart)===null||o===void 0||o.call(t,c,e)),h.forEach(l=>l.onTouchStart&&l.onTouchStart(null,e)),this.touchStartSubject.next(v);break;case"dblclick":c&&((a=t==null?void 0:t.onDblClick)===null||a===void 0||a.call(t,c,e)),this.dblClickSubject.next(v);break;case"contextmenu":c&&((b=t==null?void 0:t.onRightClick)===null||b===void 0||b.call(t,c,e)),this.rightClickSubject.next(v);break;case"zoom":c&&((r=t==null?void 0:t.onZoom)===null||r===void 0||r.call(t,c,e)),h.forEach(l=>l.onZoom&&l.onZoom(null,e));break;default:break}}}const p=(T,e)=>{let s;const i=[];return T.forEach(n=>{const[u,o]=n.getIdRange();e>=u&&e<=o?s=n:i.push(n)}),[s,i]};
|
|
@@ -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 { ChartBaseModel } from '../components/chart/chart-base.model';
|
|
7
|
+
import { ChartInstrument } from '../components/chart/chart.component';
|
|
8
|
+
import { CandleWidthCalculator, VisualCandleCalculator } from '../components/chart/chart.model';
|
|
9
|
+
import { YExtentComponent } from '../components/pane/extent/y-extent-component';
|
|
10
|
+
import EventBus from '../events/event-bus';
|
|
11
|
+
import { CandleSeriesColors, CandleSeriesModel } from './candle-series.model';
|
|
12
|
+
import { Candle } from './candle.model';
|
|
13
|
+
import { DataSeriesType } from './data-series.config';
|
|
14
|
+
import { ScaleModel } from './scale.model';
|
|
15
|
+
import VisualCandle from './visual-candle';
|
|
16
|
+
/**
|
|
17
|
+
* This model represents main chart data series and is highly tied to chartBaseModel, @see ChartBaseModel
|
|
18
|
+
*/
|
|
19
|
+
export declare class MainCandleSeriesModel extends CandleSeriesModel {
|
|
20
|
+
private readonly baseModel;
|
|
21
|
+
constructor(baseModel: ChartBaseModel<'candle'>, extentComponent: YExtentComponent, id: number, eventBus: EventBus, scaleModel: ScaleModel, instrument: ChartInstrument, candlesTransformersByChartType: Partial<Record<DataSeriesType, VisualCandleCalculator>>, candleWidthByChartType: Partial<Record<DataSeriesType, CandleWidthCalculator>>, colors: CandleSeriesColors);
|
|
22
|
+
set visualPoints(candles: VisualCandle[] | VisualCandle[][]);
|
|
23
|
+
get visualPoints(): VisualCandle[];
|
|
24
|
+
set dataPoints(candles: Candle[] | Candle[][]);
|
|
25
|
+
get dataPoints(): Candle[];
|
|
26
|
+
recalculateMeanCandleWidth(visualCandles: VisualCandle[]): void;
|
|
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{CandleSeriesModel as r}from"./candle-series.model";export class MainCandleSeriesModel extends r{constructor(e,s,a,t,i,n,o,l,d){super(s,a,t,i,n,o,l,d),this.baseModel=e}set visualPoints(e){super.visualPoints=e,this.baseModel.mainVisualPoints=super.visualPoints}get visualPoints(){return super.visualPoints}set dataPoints(e){super.dataPoints=e,this.baseModel.mainDataPoints=super.dataPoints}get dataPoints(){return super.dataPoints}recalculateMeanCandleWidth(e){super.recalculateMeanCandleWidth(e),this.baseModel.meanDataWidth=this.meanCandleWidth}}
|
|
@@ -0,0 +1,180 @@
|
|
|
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 { ChartConfigComponentsOffsets, ChartScale, FullChartConfig } from '../chart.config';
|
|
8
|
+
import { CanvasAnimation } from '../animation/canvas-animation';
|
|
9
|
+
import { AutoScaleViewportSubModel } from './scaling/auto-scale.model';
|
|
10
|
+
import { ZoomXToZoomYRatio } from './scaling/lock-ratio.model';
|
|
11
|
+
import { Price, Unit, ViewportModel, ViewportModelState, Zoom } from './scaling/viewport.model';
|
|
12
|
+
import { BoundsProvider } from './bounds.model';
|
|
13
|
+
export interface HighLowWithIndex {
|
|
14
|
+
high: Price;
|
|
15
|
+
low: Price;
|
|
16
|
+
highIdx: number;
|
|
17
|
+
lowIdx: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ScaleHistoryItem {
|
|
20
|
+
xStart: Unit;
|
|
21
|
+
xEnd: Unit;
|
|
22
|
+
yStart: Unit;
|
|
23
|
+
yEnd: Unit;
|
|
24
|
+
}
|
|
25
|
+
export declare const getDefaultHighLowWithIndex: () => HighLowWithIndex;
|
|
26
|
+
export type ViewportPercent = number;
|
|
27
|
+
type Constraints = (initialState: ViewportModelState, state: ViewportModelState) => ViewportModelState;
|
|
28
|
+
/**
|
|
29
|
+
* The ScaleModel class represents the state of a chart's scale, including the current viewport, zoom level, and auto-scaling settings.
|
|
30
|
+
* It extends the ViewportModel class, which provides the underlying implementation for handling viewports and zoom levels.
|
|
31
|
+
* Controls current visible CHART viewport.
|
|
32
|
+
* Has additional logic:
|
|
33
|
+
* - auto-scale
|
|
34
|
+
* - locked scale
|
|
35
|
+
* - zooming functions
|
|
36
|
+
* - history
|
|
37
|
+
*/
|
|
38
|
+
export declare class ScaleModel extends ViewportModel {
|
|
39
|
+
config: FullChartConfig;
|
|
40
|
+
getBounds: BoundsProvider;
|
|
41
|
+
private canvasAnimation;
|
|
42
|
+
scaleInversedSubject: Subject<boolean>;
|
|
43
|
+
history: ScaleHistoryItem[];
|
|
44
|
+
autoScaleModel: AutoScaleViewportSubModel;
|
|
45
|
+
zoomXYRatio: ZoomXToZoomYRatio;
|
|
46
|
+
offsets: ChartConfigComponentsOffsets;
|
|
47
|
+
xConstraints: Constraints[];
|
|
48
|
+
readonly state: ChartScale;
|
|
49
|
+
constructor(config: FullChartConfig, getBounds: BoundsProvider, canvasAnimation: CanvasAnimation);
|
|
50
|
+
/**
|
|
51
|
+
* The method adds a new "constraint" to the existing list of x-axis constraints for charting.
|
|
52
|
+
* The "constrait" is expected to be an object containing information about the constraints, such as the minimum and maximum values for the x-axis.
|
|
53
|
+
* @param constraint
|
|
54
|
+
*/
|
|
55
|
+
addXConstraint(constraint: Constraints): void;
|
|
56
|
+
/**
|
|
57
|
+
* The method updates the offsets for the scale model based on the provided "offsets" object.
|
|
58
|
+
* Note that the method modifies the offsets and triggers an autoscale
|
|
59
|
+
* @param offsets
|
|
60
|
+
*/
|
|
61
|
+
updateOffsets(offsets: Partial<ChartConfigComponentsOffsets>): void;
|
|
62
|
+
/**
|
|
63
|
+
* @returns current offsets
|
|
64
|
+
*/
|
|
65
|
+
getOffsets(): ChartConfigComponentsOffsets;
|
|
66
|
+
/**
|
|
67
|
+
* Zooms the X axis of the chart to a specified percentage of the viewport.
|
|
68
|
+
* @param viewportPercent The percentage of the viewport width to zoom to.
|
|
69
|
+
* @param zoomIn Whether to zoom in or out.
|
|
70
|
+
* @param forceNoAnimation Whether to skip animation.
|
|
71
|
+
* @param zoomSensitivity The sensitivity of the zoom.
|
|
72
|
+
*/
|
|
73
|
+
zoomXToPercent(viewportPercent: ViewportPercent, zoomIn: boolean, forceNoAnimation?: boolean, zoomSensitivity?: number): void;
|
|
74
|
+
/**
|
|
75
|
+
* Zooms the X axis of the chart relativly to the end of the data range.
|
|
76
|
+
* @param zoomIn - If true, the chart will be zoomed in. If false, the chart will be zoomed out.
|
|
77
|
+
* @param zoomSensitivity - The sensitivity of the zoom. Default value is taken from the configuration object.
|
|
78
|
+
*/
|
|
79
|
+
zoomXToEnd(zoomIn: boolean, zoomSensitivity?: number): void;
|
|
80
|
+
private haltAnimation;
|
|
81
|
+
private zoomXTo;
|
|
82
|
+
/**
|
|
83
|
+
* Moves the viewport to exactly xStart..xEnd place.
|
|
84
|
+
* (you need to fire DRAW event after this)
|
|
85
|
+
* @param xStart - viewport start in units
|
|
86
|
+
* @param xEnd - viewport end in units
|
|
87
|
+
* @param fireChanged
|
|
88
|
+
* @param forceNoAutoScale - force NOT apply auto-scaling (for lazy loading)
|
|
89
|
+
*/
|
|
90
|
+
setXScale(xStart: Unit, xEnd: Unit): void;
|
|
91
|
+
/**
|
|
92
|
+
* Moves both xStart and xEnd without changing the viewport width (zoom).
|
|
93
|
+
* WILL CHANGE the Y axis if scale.auto=true.
|
|
94
|
+
* @param xStart - starting point in units
|
|
95
|
+
*/
|
|
96
|
+
moveXStart(xStart: Unit): void;
|
|
97
|
+
private scalePostProcessor;
|
|
98
|
+
/**
|
|
99
|
+
* Moves both yStart and yEnd without changing the viewport height (zoom).
|
|
100
|
+
* Will not move viewport if scale.auto=true
|
|
101
|
+
* @param yStart - starting point in units
|
|
102
|
+
*/
|
|
103
|
+
moveYStart(yStart: Unit): void;
|
|
104
|
+
/**
|
|
105
|
+
* Automatically scales the chart to fit the data range.
|
|
106
|
+
* @param forceApply - If true, the chart will be forcefully auto-scaled even if animation is in progress.
|
|
107
|
+
*/
|
|
108
|
+
doAutoScale(forceApply?: boolean): void;
|
|
109
|
+
/**
|
|
110
|
+
* Checks if viewport animation is currently in progress.
|
|
111
|
+
* @returns returns true if viewport animation is in progress, false otherwise.
|
|
112
|
+
*/
|
|
113
|
+
isViewportAnimationInProgress(): boolean | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Adds an item to the scale history.
|
|
116
|
+
* @param item - The item to add to the history.
|
|
117
|
+
*/
|
|
118
|
+
pushToHistory(item: ScaleHistoryItem): void;
|
|
119
|
+
/**
|
|
120
|
+
* Removes the most recent item from the scale history and returns it.
|
|
121
|
+
* @returns - The most recent item from the history, or undefined if the history is empty.
|
|
122
|
+
*/
|
|
123
|
+
popFromHistory(): ScaleHistoryItem | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Clears the scale history.
|
|
126
|
+
*/
|
|
127
|
+
clearHistory(): void;
|
|
128
|
+
/**
|
|
129
|
+
* Checks if the X axis bounds are the default values.
|
|
130
|
+
* @returns if false - it means there are candles and it's possible to do scaling and add drawings
|
|
131
|
+
*/
|
|
132
|
+
isDefaultXBounds(): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Checks if the Y axis bounds are the default values.
|
|
135
|
+
* @returns if false - it means there are candles and it's possible to do scaling and add drawings
|
|
136
|
+
*/
|
|
137
|
+
isDefaultYBounds(): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Checks if the scale is ready to be used.
|
|
140
|
+
* @returns - Returns true if the scale is ready, false otherwise.
|
|
141
|
+
*/
|
|
142
|
+
isScaleReady(): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Enables or disables auto-scaling of the chart.
|
|
145
|
+
* @param auto - If true, the chart will be automatically scaled. If false, auto-scaling will be disabled.
|
|
146
|
+
*/
|
|
147
|
+
autoScale(auto?: boolean): void;
|
|
148
|
+
/**
|
|
149
|
+
* Sets whether the price-to-bar ratio should be locked or not.
|
|
150
|
+
* @param value - If true, the price-to-bar ratio will be locked. If false, it will not be locked.
|
|
151
|
+
*/
|
|
152
|
+
setLockPriceToBarRatio(value?: boolean): void;
|
|
153
|
+
/**
|
|
154
|
+
* Recalculates the zoom X/Y ratio based on the current zoom levels.
|
|
155
|
+
*/
|
|
156
|
+
recalculateZoomXYRatio(): void;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The SyncedByXScaleModel class extends the ScaleModel class and adds support for synchronization with other ScaleModel instance, so both instances maintain the same X-axis bounds.
|
|
160
|
+
* This is useful for scenarios where multiple charts need to display the same X-axis data, but with different Y-axis scales.
|
|
161
|
+
*/
|
|
162
|
+
export declare class SyncedByXScaleModel extends ScaleModel {
|
|
163
|
+
private delegate;
|
|
164
|
+
config: FullChartConfig;
|
|
165
|
+
getBounds: BoundsProvider;
|
|
166
|
+
constructor(delegate: ViewportModel, config: FullChartConfig, getBounds: BoundsProvider, canvasAnimation: CanvasAnimation);
|
|
167
|
+
protected doActivate(): void;
|
|
168
|
+
get xStart(): Unit;
|
|
169
|
+
set xStart(value: Unit);
|
|
170
|
+
get xEnd(): Unit;
|
|
171
|
+
set xEnd(value: Unit);
|
|
172
|
+
get zoomX(): Zoom;
|
|
173
|
+
set zoomX(value: Zoom);
|
|
174
|
+
observeXChanged(): import("rxjs").Observable<{
|
|
175
|
+
start: number;
|
|
176
|
+
end: number;
|
|
177
|
+
}>;
|
|
178
|
+
fireChanged(): void;
|
|
179
|
+
}
|
|
180
|
+
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{Subject as c}from"rxjs";import{startViewportModelAnimation as l}from"../animation/viewport-model-animation";import{cloneUnsafe as u}from"../utils/object.utils";import{AutoScaleViewportSubModel as d}from"./scaling/auto-scale.model";import{zoomConstraint as m}from"./scaling/constrait.functions";import{lockedYEndViewportCalculator as a,ratioFromZoomXY as p}from"./scaling/lock-ratio.model";import{moveXStart as f,moveYStart as S}from"./scaling/move-chart.functions";import{ViewportModel as g,compareStates as x}from"./scaling/viewport.model";import{zoomXToEndViewportCalculator as A,zoomXToPercentViewportCalculator as y}from"./scaling/x-zooming.functions";export const getDefaultHighLowWithIndex=()=>({high:Number.NEGATIVE_INFINITY,low:Number.POSITIVE_INFINITY,highIdx:0,lowIdx:0});export class ScaleModel extends g{constructor(t,s,e){super(),this.config=t,this.getBounds=s,this.canvasAnimation=e,this.scaleInversedSubject=new c,this.history=[],this.zoomXYRatio=0,this.xConstraints=[],this.scalePostProcessor=(o,i)=>this.xConstraints.reduce((n,h)=>h(o,n),i),this.state=u(t.scale),this.autoScaleModel=new d(this),this.offsets=this.config.components.offsets,this.addXConstraint((o,i)=>m(o,i,this.config.components.chart,this.getBounds))}addXConstraint(t){this.xConstraints=[...this.xConstraints,t]}updateOffsets(t){this.offsets=Object.assign(Object.assign({},this.offsets),t),this.doAutoScale(!0)}getOffsets(){return this.offsets}zoomXToPercent(t,s,e=!1,o=this.config.scale.zoomSensitivity){this.config.components.yAxis.type==="percent"&&this.haltAnimation();const i=this.export();y(this,i,t,o,s),this.zoomXTo(i,e)}zoomXToEnd(t,s=this.config.scale.zoomSensitivity){this.config.components.yAxis.type==="percent"&&this.haltAnimation();const e=this.export();A(this,e,s,t),this.zoomXTo(e)}haltAnimation(){var t;!((t=this.currentAnimation)===null||t===void 0)&&t.animationInProgress&&(this.currentAnimation.finishAnimation(),this.doAutoScale())}zoomXTo(t,s){const e=Object.assign({},t),o=this.scalePostProcessor(e,t);this.state.lockPriceToBarRatio&&a(o,this.zoomXYRatio),this.state.auto&&this.autoScaleModel.setAutoAndRecalculateState(o,!0),s?this.apply(o):l(this.canvasAnimation,this,o)}setXScale(t,s){const e=this.export();super.setXScale(t,s,!1);const o=this.export(),i=this.scalePostProcessor(e,o);this.state.lockPriceToBarRatio&&a(i,this.zoomXYRatio),this.state.auto&&this.autoScaleModel.setAutoAndRecalculateState(i,!0),this.apply(i)}moveXStart(t){const s=this.export(),e=Object.assign({},s);this.haltAnimation(),f(s,t);const o=this.scalePostProcessor(e,s);this.state.auto&&this.autoScaleModel.setAutoAndRecalculateState(o,!0),this.apply(o)}moveYStart(t){if(this.haltAnimation(),!this.state.auto){const s=this.export();S(s,t),this.apply(s)}}doAutoScale(t=!1){if(!this.isViewportAnimationInProgress()&&this.state.auto||t){const s=this.export();this.autoScaleModel.setAutoAndRecalculateState(s,!0),x(s,this.export())||this.apply(s)}}isViewportAnimationInProgress(){const t=this.currentAnimation;return t==null?void 0:t.animationInProgress}pushToHistory(t){this.history.push(t)}popFromHistory(){return this.history.pop()}clearHistory(){this.history=[]}isDefaultXBounds(){return this.xStart===0&&this.xEnd===0}isDefaultYBounds(){return this.yStart===0&&this.yEnd===0}isScaleReady(){return!this.isDefaultXBounds()&&!this.isDefaultYBounds()}autoScale(t=!0){this.config.components.yAxis.type==="percent"?this.state.auto=!0:this.state.auto=t,t&&(this.clearHistory(),this.doAutoScale())}setLockPriceToBarRatio(t=!1){const{type:s}=this.config.components.yAxis;if(s==="percent"||s==="logarithmic"){this.state.lockPriceToBarRatio=!1;return}t&&this.recalculateZoomXYRatio(),this.state.lockPriceToBarRatio=t}recalculateZoomXYRatio(){this.zoomXYRatio=p(this.zoomX,this.zoomY)}}export class SyncedByXScaleModel extends ScaleModel{constructor(t,s,e,o){super(s,e,o),this.delegate=t,this.config=s,this.getBounds=e}doActivate(){this.addRxSubscription(this.delegate.xChanged.subscribe(()=>this.doAutoScale(this.state.auto)))}get xStart(){return this.delegate.xStart}set xStart(t){this.delegate.xStart=t}get xEnd(){return this.delegate.xEnd}set xEnd(t){this.delegate.xEnd=t}get zoomX(){return this.delegate.zoomX}set zoomX(t){this.delegate.zoomX=t}observeXChanged(){return this.delegate.xChanged}fireChanged(){this.delegate.changed.next(),this.changed.next()}}
|