@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,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { BehaviorSubject } from 'rxjs';
|
|
7
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
8
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
9
|
+
import { Point } from '../../inputlisteners/canvas-input-listener.component';
|
|
10
|
+
import { HitTestSubscriber } from '../../model/hit-test-canvas.model';
|
|
11
|
+
export declare class EventsModel extends ChartBaseElement implements HitTestSubscriber {
|
|
12
|
+
private canvasModel;
|
|
13
|
+
events: EventWithId[];
|
|
14
|
+
hoveredEvent: BehaviorSubject<Required<EventWithId> | null>;
|
|
15
|
+
constructor(canvasModel: CanvasModel);
|
|
16
|
+
/**
|
|
17
|
+
* Sets the events array of the object to the provided array of events after indexing them.
|
|
18
|
+
* @param {EconomicEvent[]} events - An array of events to be set as the events array of the object.
|
|
19
|
+
* @returns {void}
|
|
20
|
+
*/
|
|
21
|
+
setEvents(events: EconomicEvent[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Private method to index events with unique ids and sort them by timestamp
|
|
24
|
+
* @param {EconomicEvent[]} events - Array of events to be indexed
|
|
25
|
+
* @returns {EventWithId[]} - Array of indexed events with unique ids
|
|
26
|
+
*/
|
|
27
|
+
private indexEvents;
|
|
28
|
+
/**
|
|
29
|
+
* Returns an array of two numbers representing the range of IDs for event hit tests.
|
|
30
|
+
* @returns {Array<number>} An array of two numbers representing the range of IDs for event hit tests.
|
|
31
|
+
*/
|
|
32
|
+
getIdRange(): [number, number];
|
|
33
|
+
/**
|
|
34
|
+
* Returns the event with the specified id.
|
|
35
|
+
* @param {number} id - The id of the event to look up.
|
|
36
|
+
* @returns {EventWithId} - The event with the specified id.
|
|
37
|
+
*/
|
|
38
|
+
lookup(id: number): EventWithId;
|
|
39
|
+
/**
|
|
40
|
+
* Function that handles the hover event on a canvas element.
|
|
41
|
+
* @param {EventWithId} event - The event that is being hovered.
|
|
42
|
+
* @param {Point} [point] - The point where the event is being hovered.
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
45
|
+
onHover(event: Required<EventWithId> | null, point: Point): void;
|
|
46
|
+
/**
|
|
47
|
+
* Handles the touch start event.
|
|
48
|
+
*
|
|
49
|
+
* @param {EventWithId} event - The touch start event.
|
|
50
|
+
* @param {Point} [point] - The point where the touch started.
|
|
51
|
+
* @returns {void}
|
|
52
|
+
*/
|
|
53
|
+
onTouchStart(event: Required<EventWithId>, point: Point): void;
|
|
54
|
+
}
|
|
55
|
+
export type EventType = 'earnings' | 'dividends' | 'splits' | 'conference-calls';
|
|
56
|
+
export type EventWithId = EconomicEvent & {
|
|
57
|
+
id: number;
|
|
58
|
+
point?: Point;
|
|
59
|
+
};
|
|
60
|
+
export interface EconomicEvent {
|
|
61
|
+
type: EventType;
|
|
62
|
+
timestamp: number;
|
|
63
|
+
style: 'rhombus' | 'rhombus-small' | 'rhombus-large';
|
|
64
|
+
}
|
|
@@ -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 n}from"rxjs";import{ChartBaseElement as o}from"../../model/chart-base-element";import{HIT_TEST_ID_RANGE as i}from"../../model/hit-test-canvas.model";export class EventsModel extends o{constructor(t){super(),this.canvasModel=t,this.events=[],this.hoveredEvent=new n(null)}setEvents(t){this.events=this.indexEvents(t)}indexEvents(t){const e=this.getIdRange()[0];return t.map((s,r)=>Object.assign(Object.assign({},s),{id:r+e})).sort((s,r)=>s.timestamp-r.timestamp)}getIdRange(){return i.EVENTS}lookup(t){return this.events.filter(e=>e.id===t)[0]}onHover(t,e){this.hoveredEvent.getValue()!==t&&(t&&(t.point=e),this.hoveredEvent.next(t),this.canvasModel.fireDraw())}onTouchStart(t,e){this.onHover(t,e)}}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { NumericAxisLabel } from '../labels_generator/numeric-axis-labels.generator';
|
|
7
|
+
import { BoundsProvider } from '../../model/bounds.model';
|
|
8
|
+
import { FullChartConfig } from '../../chart.config';
|
|
9
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
10
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
11
|
+
import { CompositeDrawer } from '../../drawers/composite.drawer';
|
|
12
|
+
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
13
|
+
import { Unit, ViewportModel } from '../../model/scaling/viewport.model';
|
|
14
|
+
export declare class GridComponent extends ChartBaseElement {
|
|
15
|
+
private drawerName;
|
|
16
|
+
private drawingManager;
|
|
17
|
+
private readonly drawer;
|
|
18
|
+
constructor(canvasModel: CanvasModel, viewportModel: ViewportModel, config: FullChartConfig, drawerName: string, drawingManager: DrawingManager | CompositeDrawer, xBoundsProvider: BoundsProvider, yBoundsProvider: BoundsProvider, xLabelsProvider: () => NumericAxisLabel[], yLabelsProvider: () => NumericAxisLabel[], getBaseLine?: () => Unit, drawPredicate?: () => boolean);
|
|
19
|
+
/**
|
|
20
|
+
* This method is used to deactivate the drawer and remove it from the drawing manager.
|
|
21
|
+
* @protected
|
|
22
|
+
* @function
|
|
23
|
+
* @name doDeactivate
|
|
24
|
+
* @returns {void}
|
|
25
|
+
*/
|
|
26
|
+
protected doDeactivate(): void;
|
|
27
|
+
/**
|
|
28
|
+
* This method is used to activate the drawer. It calls the parent class's doActivate method and adds the drawer to the drawing manager.
|
|
29
|
+
* @protected
|
|
30
|
+
* @function
|
|
31
|
+
* @returns {void}
|
|
32
|
+
*/
|
|
33
|
+
protected doActivate(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{ChartBaseElement as m}from"../../model/chart-base-element";import{GridDrawer as c}from"./grid.drawer";export class GridComponent extends m{constructor(r,e,a,t,i,d,s,o,n,w,h){super(),this.drawerName=t,this.drawingManager=i,this.drawer=new c(r,e,a,d,s,o,n,h,w)}doDeactivate(){super.doDeactivate(),this.drawingManager.removeDrawer(this.drawer)}doActivate(){super.doActivate(),this.drawingManager.addDrawer(this.drawer,this.drawerName)}}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { NumericAxisLabel } from '../labels_generator/numeric-axis-labels.generator';
|
|
7
|
+
import { BoundsProvider } from '../../model/bounds.model';
|
|
8
|
+
import { FullChartConfig } from '../../chart.config';
|
|
9
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
10
|
+
import { Drawer } from '../../drawers/drawing-manager';
|
|
11
|
+
import { Unit, ViewportModel } from '../../model/scaling/viewport.model';
|
|
12
|
+
export interface GridLine {
|
|
13
|
+
readonly pos?: number;
|
|
14
|
+
readonly pixels: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Draws grid lines on chart.
|
|
18
|
+
*/
|
|
19
|
+
export declare class GridDrawer implements Drawer {
|
|
20
|
+
private canvasModel;
|
|
21
|
+
private viewportModel;
|
|
22
|
+
private config;
|
|
23
|
+
private xBoundsProvider;
|
|
24
|
+
private yBoundsProvider;
|
|
25
|
+
private xLabelsProvider;
|
|
26
|
+
private yLabelsProvider;
|
|
27
|
+
private drawPredicate;
|
|
28
|
+
private getBaseLine?;
|
|
29
|
+
constructor(canvasModel: CanvasModel, viewportModel: ViewportModel, config: FullChartConfig, xBoundsProvider: BoundsProvider, yBoundsProvider: BoundsProvider, xLabelsProvider: () => NumericAxisLabel[], yLabelsProvider: () => NumericAxisLabel[], drawPredicate?: () => boolean, getBaseLine?: (() => Unit) | undefined);
|
|
30
|
+
/**
|
|
31
|
+
* Draws the chart on the canvas if the drawPredicate is true.
|
|
32
|
+
* @returns {void}
|
|
33
|
+
*/
|
|
34
|
+
draw(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Draws a zero line on the y-axis if the chart is a percentage chart and the zeroPercentLine option is enabled.
|
|
37
|
+
* @param {CanvasRenderingContext2D} ctx - The 2D rendering context of the canvas element.
|
|
38
|
+
*/
|
|
39
|
+
drawZeroLine(ctx: CanvasRenderingContext2D): void;
|
|
40
|
+
/**
|
|
41
|
+
* Draws vertical grid lines on the canvas context provided.
|
|
42
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
45
|
+
drawVertical(ctx: CanvasRenderingContext2D): void;
|
|
46
|
+
/**
|
|
47
|
+
* This function is responsible for drawing horizontal grid lines on the chart. It takes a CanvasRenderingContext2D object as a parameter. It first retrieves the y-axis labels using the yLabelsProvider method. If there are any labels and the horizontal grid is enabled in the configuration, it sets the line width, color, and dash style. It then retrieves the y-bounds using the yBoundsProvider method. For each label, it calculates the y-coordinate using the toY method of the viewportModel object. It also calculates the label's y-offset using the getLabelYOffset method. If the y-coordinate is within the bounds of the chart, it draws a horizontal line using the beginPath, moveTo, lineTo, and stroke methods of the CanvasRenderingContext2D object.
|
|
48
|
+
*/
|
|
49
|
+
drawHorizontal(ctx: CanvasRenderingContext2D): void;
|
|
50
|
+
/**
|
|
51
|
+
* Returns an array of strings containing the ID of the canvas model.
|
|
52
|
+
* @returns {Array<string>} An array of strings containing the ID of the canvas model.
|
|
53
|
+
*/
|
|
54
|
+
getCanvasIds(): Array<string>;
|
|
55
|
+
}
|
|
@@ -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{avoidAntialiasing as r}from"../../utils/canvas/canvas-drawing-functions.utils";import{DEFAULT_PRICE_LABEL_PADDING as c,getLabelYOffset as g}from"../y_axis/y-axis-labels.drawer";import{floor as h}from"../../utils/math.utils";export class GridDrawer{constructor(o,e,i,n,t,s,a,d=()=>!0,l){this.canvasModel=o,this.viewportModel=e,this.config=i,this.xBoundsProvider=n,this.yBoundsProvider=t,this.xLabelsProvider=s,this.yLabelsProvider=a,this.drawPredicate=d,this.getBaseLine=l}draw(){if(this.drawPredicate()){const o=this.canvasModel.ctx;r(o,()=>this.drawVertical(o)),r(o,()=>this.drawHorizontal(o)),r(o,()=>this.drawZeroLine(o))}}drawZeroLine(o){if(this.getBaseLine&&this.config.components.yAxis.type==="percent"&&this.config.components.yAxis.zeroPercentLine){const e=this.xBoundsProvider(),i=h(this.getBaseLine());o.beginPath(),o.strokeStyle=this.config.colors.yAxis.zeroPercentLine,o.setLineDash([]),o.moveTo(e.x,i),o.lineTo(e.x+e.width,i),o.stroke(),o.closePath()}}drawVertical(o){const e=this.xLabelsProvider();if(e.length&&this.config.components.grid.vertical){o.lineWidth=this.config.components.grid.width,o.strokeStyle=this.config.colors.chartAreaTheme.gridColor,o.setLineDash(this.config.components.grid.dash||[]);const i=this.xBoundsProvider(),n=i.x+i.width;for(const t of e){const s=h(this.viewportModel.toX(t.value));s>i.x&&s<n&&(o.beginPath(),o.moveTo(s,i.y),o.lineTo(s,i.y+i.height),o.stroke())}}}drawHorizontal(o){const e=this.yLabelsProvider();if(e.length&&this.config.components.grid.horizontal){o.lineWidth=this.config.components.grid.width,o.strokeStyle=this.config.colors.chartAreaTheme.gridColor,o.setLineDash(this.config.components.grid.dash||[]);const i=this.yBoundsProvider();for(const n of e){const t=h(this.viewportModel.toY(n.value)),s=g(n.text,o,c);t>i.y+s&&t<i.y+i.height-s&&(o.beginPath(),o.moveTo(i.x,t),o.lineTo(i.x+i.width,t),o.stroke())}}}getCanvasIds(){return[this.canvasModel.canvasId]}}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
7
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
8
|
+
import { FullChartConfig } from '../../chart.config';
|
|
9
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
10
|
+
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
11
|
+
import { ChartModel } from '../chart/chart.model';
|
|
12
|
+
/**
|
|
13
|
+
* Shows the highest and lowest prices labels over all candles in chart (not only in viewport).
|
|
14
|
+
*/
|
|
15
|
+
export declare class HighLowComponent extends ChartBaseElement {
|
|
16
|
+
constructor(config: FullChartConfig, canvasModel: CanvasModel, chartModel: ChartModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager);
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{ChartBaseElement as s}from"../../model/chart-base-element";import{HighLowDrawer as w}from"./high-low.drawer";export class HighLowComponent extends s{constructor(r,o,e,t,a){super();const n=new w(o,e,r,t);a.addDrawer(n,"HIGH_LOW")}}
|
|
@@ -0,0 +1,69 @@
|
|
|
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 { Drawer } from '../../drawers/drawing-manager';
|
|
7
|
+
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
8
|
+
import { FullChartConfig } from '../../chart.config';
|
|
9
|
+
import { ChartModel } from '../chart/chart.model';
|
|
10
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
11
|
+
export declare class HighLowDrawer implements Drawer {
|
|
12
|
+
private canvasModel;
|
|
13
|
+
private chartModel;
|
|
14
|
+
private config;
|
|
15
|
+
private canvasBoundsContainer;
|
|
16
|
+
constructor(canvasModel: CanvasModel, chartModel: ChartModel, config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer);
|
|
17
|
+
/**
|
|
18
|
+
* This function is responsible for drawing the high and low markers on the chart canvas. It checks if the highLow component is visible and if the chartModel is ready. If so, it retrieves the high, low, highIdx, and lowIdx from the chartModel's mainCandleSeries zippedHighLow property.
|
|
19
|
+
* The function then calculates the global indexes of the high and low candles by adding the viewportStartCandleGlobalIdx to the highIdx and lowIdx respectively. It then saves the canvas context and sets the font to the highLow font specified in the config.
|
|
20
|
+
* Finally, it calls the drawMarkerLabel function twice, passing in the canvas context, the final global index of the high or low candle, the high or low value, and a string indicating whether it is a high or low marker. After both markers have been drawn, the canvas context is restored.
|
|
21
|
+
*/
|
|
22
|
+
draw(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Draws a marker label on the canvas context at a specific position.
|
|
25
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
26
|
+
* @param {number} candleIdx - The index of the candle.
|
|
27
|
+
* @param {number} yValue - The y value of the marker.
|
|
28
|
+
* @param {MarkerType} type - The type of the marker.
|
|
29
|
+
* @returns {void}
|
|
30
|
+
*/
|
|
31
|
+
private drawMarkerLabel;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a string that represents a marker text for a given yValue and type.
|
|
34
|
+
*
|
|
35
|
+
* @private
|
|
36
|
+
* @param {number} yValue - The yValue to format.
|
|
37
|
+
* @param {MarkerType} type - The type of the marker ('high' or 'low').
|
|
38
|
+
* @returns {string} - The formatted marker text.
|
|
39
|
+
*/
|
|
40
|
+
private getMarkerText;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the y-coordinate of a marker on the chart.
|
|
43
|
+
* @param {CanvasRenderingContext2D} ctx - The rendering context of the canvas.
|
|
44
|
+
* @param {number} yValue - The y-value of the marker.
|
|
45
|
+
* @param {boolean} [offset=false] - Whether to add an offset to the y-coordinate.
|
|
46
|
+
* @returns {number} The y-coordinate of the marker.
|
|
47
|
+
*/
|
|
48
|
+
private getMarkerY;
|
|
49
|
+
/**
|
|
50
|
+
* Checks if the given Y coordinate is within the bounds of the chart.
|
|
51
|
+
* @param {number} y - The Y coordinate to check.
|
|
52
|
+
* @returns {boolean} - Returns true if the Y coordinate is within the bounds of the chart, otherwise returns false.
|
|
53
|
+
*/
|
|
54
|
+
private checkMarkerInBounds;
|
|
55
|
+
/**
|
|
56
|
+
* Calculates the x position of the marker for a given candle index and text
|
|
57
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas rendering context
|
|
58
|
+
* @param {number} candleIdx - The index of the candle
|
|
59
|
+
* @param {string} text - The text to be displayed
|
|
60
|
+
* @returns {number} - The x position of the marker
|
|
61
|
+
*/
|
|
62
|
+
private getMarkerX;
|
|
63
|
+
/**
|
|
64
|
+
* Returns an array of canvas IDs.
|
|
65
|
+
*
|
|
66
|
+
* @returns {Array<string>} An array containing the ID of the canvas model.
|
|
67
|
+
*/
|
|
68
|
+
getCanvasIds(): Array<string>;
|
|
69
|
+
}
|
|
@@ -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{CanvasElement as h}from"../../canvas/canvas-bounds-container";import{getTextLineHeight as c}from"../../utils/canvas/canvas-text-functions.utils";export class HighLowDrawer{constructor(t,o,r,e){this.canvasModel=t,this.chartModel=o,this.config=r,this.canvasBoundsContainer=e}draw(){if(this.config.components.highLow.visible&&this.chartModel.isReady()){const{high:t,low:o,highIdx:r,lowIdx:e}=this.chartModel.mainCandleSeries.zippedHighLow,s=this.chartModel.mainCandleSeries.dataIdxStart,i=s+r,n=s+e,a=this.canvasModel.ctx;a.save(),a.font=this.config.components.highLow.font,this.drawMarkerLabel(a,i,t,"high"),this.drawMarkerLabel(a,n,o,"low"),a.restore()}}drawMarkerLabel(t,o,r,e){const s=this.getMarkerY(t,r,e==="low");if(!this.checkMarkerInBounds(s))return;const i=this.getMarkerText(r,e),n=this.getMarkerX(t,o,i);t.fillStyle=e==="high"?this.config.colors.highLowTheme.highColor:this.config.colors.highLowTheme.lowColor,t.fillText(i,n,s)}getMarkerText(t,o){const r=this.chartModel.pane.regularFormatter(t);return`${o==="high"?"H:":"L:"} ${r}`}getMarkerY(t,o,r=!1){const e=this.chartModel.toY(o);if(r){const s=c(t);return e+s}return e}checkMarkerInBounds(t){const o=this.canvasBoundsContainer.getBounds(h.CHART);return t>o.y&&t<o.y+o.height}getMarkerX(t,o,r){let e=this.chartModel.toX(o);const s=this.canvasBoundsContainer.getBounds(h.CHART),i=4,n=t.measureText(r).width;return e+i+n>s.width&&(e=e-(i+n)),e+i}getCanvasIds(){return[this.canvasModel.canvasId]}}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 } from '../../chart.config';
|
|
7
|
+
import { Highlight } from './highlights.model';
|
|
8
|
+
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
9
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
10
|
+
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
11
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
12
|
+
import { ChartModel } from '../chart/chart.model';
|
|
13
|
+
import EventBus from '../../events/event-bus';
|
|
14
|
+
export declare class HighlightsComponent extends ChartBaseElement {
|
|
15
|
+
private eventBus;
|
|
16
|
+
private config;
|
|
17
|
+
private readonly highlightsModel;
|
|
18
|
+
private highLightsDrawer;
|
|
19
|
+
constructor(eventBus: EventBus, config: FullChartConfig, chartModel: ChartModel, canvasModel: CanvasModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager);
|
|
20
|
+
/**
|
|
21
|
+
* Returns the highlights from the highlightsModel
|
|
22
|
+
* @returns {Array} An array of highlights
|
|
23
|
+
*/
|
|
24
|
+
getHighlights(): Highlight[];
|
|
25
|
+
/**
|
|
26
|
+
* Sets the highlights of the highlights model.
|
|
27
|
+
* @param {Highlight[]} highlights - An array of Highlight objects to be set as the highlights of the model.
|
|
28
|
+
* @returns {void}
|
|
29
|
+
*/
|
|
30
|
+
setHighlights(highlights: Highlight[]): void;
|
|
31
|
+
/**
|
|
32
|
+
* Sets the visibility of the highlights component.
|
|
33
|
+
* @param {boolean} visible - A boolean value indicating whether the highlights should be visible or not. Default value is true.
|
|
34
|
+
* @returns {void}
|
|
35
|
+
*/
|
|
36
|
+
setHighlightsVisible(visible?: boolean): void;
|
|
37
|
+
/**
|
|
38
|
+
* Returns an observable that emits when the highlights are updated.
|
|
39
|
+
* @returns {Observable} An observable that emits when the highlights are updated.
|
|
40
|
+
*/
|
|
41
|
+
observeHighlightsUpdated(): import("rxjs").Observable<Highlight[]>;
|
|
42
|
+
}
|
|
@@ -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{HighlightsModel as r}from"./highlights.model";import{HighlightsDrawer as l}from"./highlights.drawer";import{ChartBaseElement as o}from"../../model/chart-base-element";const d="HIGHLIGHTS_PLUGIN";export class HighlightsComponent extends o{constructor(h,i,t,s,e,g){super(),this.eventBus=h,this.config=i,this.highlightsModel=new r(t),this.addChildEntity(this.highlightsModel),this.highLightsDrawer=new l(this.highlightsModel,t,s,e,i),g.addDrawer(this.highLightsDrawer,d)}getHighlights(){return this.highlightsModel.getHighlights()}setHighlights(h){this.highlightsModel.setHighlights(h)}setHighlightsVisible(h=!0){this.config.components.highlights.visible=h,this.eventBus.fireDraw(this.highLightsDrawer.getCanvasIds())}observeHighlightsUpdated(){return this.highlightsModel.observeHighlightsUpdated()}}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 } from '../../chart.config';
|
|
7
|
+
import { HighlightsModel } from './highlights.model';
|
|
8
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
9
|
+
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
10
|
+
import { Drawer } from '../../drawers/drawing-manager';
|
|
11
|
+
import { ChartModel } from '../chart/chart.model';
|
|
12
|
+
export declare class HighlightsDrawer implements Drawer {
|
|
13
|
+
private highlightsModel;
|
|
14
|
+
private chartModel;
|
|
15
|
+
private canvasModel;
|
|
16
|
+
private canvasBoundsContainer;
|
|
17
|
+
private config;
|
|
18
|
+
constructor(highlightsModel: HighlightsModel, chartModel: ChartModel, canvasModel: CanvasModel, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Draws highlights on the chart canvas if they are visible.
|
|
21
|
+
* @function
|
|
22
|
+
* @name draw
|
|
23
|
+
* @memberof ChartComponent.prototype
|
|
24
|
+
*
|
|
25
|
+
* @returns {void}
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* chartComponent.draw();
|
|
29
|
+
*/
|
|
30
|
+
draw(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Calculates the position of the highlight label based on the given parameters.
|
|
33
|
+
* @param {HighlightTextPlacement} placement - The placement of the highlight text.
|
|
34
|
+
* @param {Bounds} bounds - The bounds of the highlight.
|
|
35
|
+
* @param {[number, number]} highlightFromTo - The start and end position of the highlight.
|
|
36
|
+
* @param {number} labelWidth - The width of the label.
|
|
37
|
+
* @returns {[number, number]} - The x and y position of the highlight label.
|
|
38
|
+
*/
|
|
39
|
+
private resolveHighlightLabelPosition;
|
|
40
|
+
/**
|
|
41
|
+
* Draws borders on a canvas context for a given chart.
|
|
42
|
+
* @param {HighlightBorder} border - The border to draw.
|
|
43
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
44
|
+
* @param {number} fromX - The starting x-coordinate of the border.
|
|
45
|
+
* @param {number} toX - The ending x-coordinate of the border.
|
|
46
|
+
* @param {Bounds} chartBounds - The bounds of the chart to draw the border on.
|
|
47
|
+
* @returns {void}
|
|
48
|
+
*/
|
|
49
|
+
private drawBorders;
|
|
50
|
+
/**
|
|
51
|
+
* Returns an array of canvas IDs.
|
|
52
|
+
*
|
|
53
|
+
* @returns {Array<string>} An array containing the canvas ID.
|
|
54
|
+
*/
|
|
55
|
+
getCanvasIds(): Array<string>;
|
|
56
|
+
}
|
|
@@ -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{calculateTextWidth as A}from"../../utils/canvas/canvas-font-measure-tool.utils";import{HIGHLIGHTS_TYPES as F}from"./highlights.model";import{CanvasElement as x}from"../../canvas/canvas-bounds-container";import{unitToPixels as X}from"../../model/scaling/viewport.model";import{clipToBounds as G}from"../../drawers/data-series.drawer";const n=[20,10];export class HighlightsDrawer{constructor(e,o,s,l,i){this.highlightsModel=e,this.chartModel=o,this.canvasModel=s,this.canvasBoundsContainer=l,this.config=i}draw(){var e,o,s,l;if(this.config.components.highlights.visible){const i=this.chartModel.getCandles(),t=this.canvasModel.ctx,d=this.highlightsModel.getVisualHighlights();if(this.highlightsModel.getHighlights().length&&i.length!==0&&this.chartModel.scaleModel.isScaleReady()){const r=this.canvasBoundsContainer.getBounds(x.ALL_PANES);t.save(),G(t,r);const w=(e=this.config.components.highlights.border.width)!==null&&e!==void 0?e:1,E=(o=this.config.components.highlights.border.dash)!==null&&o!==void 0?o:[0,0],H=(s=this.config.components.highlights.fontSize)!==null&&s!==void 0?s:11,L=(l=this.config.components.highlights.fontFamily)!==null&&l!==void 0?l:"monospace",p=`${H}px ${L}, monospace`;t.font=p,t.lineWidth=w,t.setLineDash(E),F.forEach(y=>{var f,g;const S=d[y];if(S){const a=this.config.colors.highlights[y],k=(f=a==null?void 0:a.border)!==null&&f!==void 0?f:"#ffffff",B=(g=a==null?void 0:a.background)!==null&&g!==void 0?g:"#ffffff";t.save(),t.beginPath(),t.fillStyle=B,t.strokeStyle=k,S.forEach(h=>{var v,m,b;const P=this.chartModel.candleFromTimestamp(h.from),D=X(P.width,this.chartModel.scaleModel.zoomX),c=P.xStart(this.chartModel.scaleModel),_=this.chartModel.candleFromTimestamp(h.to),C=X(_.width,this.chartModel.scaleModel.zoomX),u=_.xStart(this.chartModel.scaleModel)+C;if(h.border&&this.drawBorders(h.border,t,c+D,u-C,r),t.fillRect(c,r.y,u-c,r.y+r.height),h.label){const T=(v=h.label.text)!==null&&v!==void 0?v:"",M=this.config.colors.highlights[h.type];t.save(),t.fillStyle=(m=M==null?void 0:M.label)!==null&&m!==void 0?m:"#ffffff";const I=A(T,t,p),[W,z]=this.resolveHighlightLabelPosition((b=h.label.placement)!==null&&b!==void 0?b:"left-left",r,[c,u],I);t.fillText(T,W,z),t.restore()}}),t.closePath(),t.restore()}}),t.restore()}}}resolveHighlightLabelPosition(e,o,s,l){const[i,t]=s;switch(e){case"right-left":return[t-n[1]-l,o.y+n[0]];case"left-left":return[i-n[1]-l,o.y+n[0]];case"right-right":return[t+n[1],o.y+n[0]];case"left-right":default:return[i+n[1],o.y+n[0]]}}drawBorders(e,o,s,l,i){const t=e.left,d=e.right;t&&(o.beginPath(),o.moveTo(s,i.y),o.lineTo(s,i.y+i.height),o.stroke(),o.closePath()),d&&(o.beginPath(),o.moveTo(l,i.y),o.lineTo(l,i.y+i.height),o.stroke(),o.closePath())}getCanvasIds(){return[this.canvasModel.canvasId]}}
|
|
@@ -0,0 +1,66 @@
|
|
|
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/internal/Observable';
|
|
7
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
8
|
+
import { ChartModel } from '../chart/chart.model';
|
|
9
|
+
export type HighlightTextPlacement = 'left-left' | 'left-right' | 'right-left' | 'right-right';
|
|
10
|
+
export declare const HIGHLIGHTS_TYPES: readonly ["AFTER_MARKET", "PRE_MARKET", "NO_TRADING", "REGULAR"];
|
|
11
|
+
export type HighlightType = typeof HIGHLIGHTS_TYPES[number];
|
|
12
|
+
export type VisualHighlights = Partial<Record<HighlightType, Highlight[]>>;
|
|
13
|
+
export interface Highlight {
|
|
14
|
+
type: HighlightType;
|
|
15
|
+
from: number;
|
|
16
|
+
to: number;
|
|
17
|
+
border?: HighlightBorder;
|
|
18
|
+
label?: {
|
|
19
|
+
text?: string;
|
|
20
|
+
placement?: HighlightTextPlacement;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface HighlightBorder {
|
|
24
|
+
right?: boolean;
|
|
25
|
+
left?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class HighlightsModel extends ChartBaseElement {
|
|
28
|
+
private chartModel;
|
|
29
|
+
private highlights;
|
|
30
|
+
private visualHighlights;
|
|
31
|
+
private highlightsUpdatedSubject;
|
|
32
|
+
constructor(chartModel: ChartModel);
|
|
33
|
+
/**
|
|
34
|
+
* Activates the chart by subscribing to the xChanged event of the scaleModel.
|
|
35
|
+
* If there are highlights, it recalculates the visual highlights.
|
|
36
|
+
*/
|
|
37
|
+
activate(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Returns an array of Highlight objects.
|
|
40
|
+
* @returns {Highlight[]} - An array of Highlight objects.
|
|
41
|
+
*/
|
|
42
|
+
getHighlights(): Highlight[];
|
|
43
|
+
/**
|
|
44
|
+
* Returns the visual highlights object.
|
|
45
|
+
*
|
|
46
|
+
* @returns {VisualHighlights} The visual highlights object.
|
|
47
|
+
*/
|
|
48
|
+
getVisualHighlights(): VisualHighlights;
|
|
49
|
+
/**
|
|
50
|
+
* Recalculates the visual highlights based on the current chart model and highlights.
|
|
51
|
+
* @private
|
|
52
|
+
* @returns {void}
|
|
53
|
+
*/
|
|
54
|
+
private recalculateVisualHighlights;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the highlights of the component and updates the visual highlights accordingly.
|
|
57
|
+
* @param {Highlight[]} highlights - An array of Highlight objects to be set as the new highlights.
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
setHighlights(highlights: Highlight[]): void;
|
|
61
|
+
/**
|
|
62
|
+
* Returns an Observable that emits an array of Highlight objects whenever the highlightsUpdatedSubject emits a new value.
|
|
63
|
+
* @returns {Observable<Highlight[]>} An Observable that emits an array of Highlight objects.
|
|
64
|
+
*/
|
|
65
|
+
observeHighlightsUpdated(): Observable<Highlight[]>;
|
|
66
|
+
}
|
|
@@ -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 l}from"rxjs";import{ChartBaseElement as a}from"../../model/chart-base-element";import{getElementsInRange as r}from"../../utils/array.utils";export const HIGHLIGHTS_TYPES=["AFTER_MARKET","PRE_MARKET","NO_TRADING","REGULAR"];const o=24*60*60*1e3;export class HighlightsModel extends a{constructor(t){super(),this.chartModel=t,this.highlights=[],this.visualHighlights={},this.highlightsUpdatedSubject=new l}activate(){this.addRxSubscription(this.chartModel.scaleModel.xChanged.subscribe(()=>this.highlights.length&&this.recalculateVisualHighlights()))}getHighlights(){return this.highlights}getVisualHighlights(){return this.visualHighlights}recalculateVisualHighlights(){this.visualHighlights={};const t=this.chartModel.getFirstTimestamp(),h=this.chartModel.getLastTimestamp()+o;r(this.highlights,t,h,c).forEach(i=>{var s;this.visualHighlights[i.type]||(this.visualHighlights[i.type]=[]),(s=this.visualHighlights[i.type])===null||s===void 0||s.push(i)})}setHighlights(t){this.highlights=t,this.highlights.sort((h,e)=>h.to-e.to),this.highlightsUpdatedSubject.next(this.highlights),this.highlights.length?this.recalculateVisualHighlights():this.visualHighlights={}}observeHighlightsUpdated(){return this.highlightsUpdatedSubject.asObservable()}}const c=g=>g.to;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { Unit } from '../../model/scaling/viewport.model';
|
|
8
|
+
import { AnimationFrameCache } from '../../utils/perfomance/animation-frame-cache.utils';
|
|
9
|
+
export type PriceAxisType = 'regular' | 'percent' | 'logarithmic';
|
|
10
|
+
export interface LabelsGenerator {
|
|
11
|
+
readonly observeLabelsChanged: () => Observable<NumericAxisLabel[]>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generator of axes labels.
|
|
15
|
+
*/
|
|
16
|
+
export declare class NumericAxisLabelsGenerator implements LabelsGenerator {
|
|
17
|
+
private increment;
|
|
18
|
+
private startEndProvider;
|
|
19
|
+
private lengthProvider;
|
|
20
|
+
valueFormatter: (value: number) => string;
|
|
21
|
+
private withZero;
|
|
22
|
+
protected axisTypeProvider: () => PriceAxisType;
|
|
23
|
+
private baseLineProvider;
|
|
24
|
+
private labelFilter;
|
|
25
|
+
private singleLabelHeightPixels;
|
|
26
|
+
/**
|
|
27
|
+
* Multipliers which are using for price increments to
|
|
28
|
+
* calculate horizontal grid and price lines step.
|
|
29
|
+
*/
|
|
30
|
+
private gridDistanceMultipliers;
|
|
31
|
+
labelsCache: AnimationFrameCache<Array<NumericAxisLabel>>;
|
|
32
|
+
lastSingleLabelHeightValue: number;
|
|
33
|
+
distanceBetweenLabelsChangeSubject: Subject<NumericAxisLabel[][]>;
|
|
34
|
+
newGeneratedLabelsSubject: Subject<NumericAxisLabel[]>;
|
|
35
|
+
private lastStart;
|
|
36
|
+
private lastEnd;
|
|
37
|
+
constructor(increment: number | null, startEndProvider: () => [Unit, Unit], lengthProvider: () => Unit, valueFormatter: (value: number) => string, withZero: boolean, axisTypeProvider: () => PriceAxisType, baseLineProvider: () => number, labelFilter?: (labels: NumericAxisLabel[]) => NumericAxisLabel[], singleLabelHeightPixels?: number);
|
|
38
|
+
private generateRegularLabels;
|
|
39
|
+
private generatePercentLabels;
|
|
40
|
+
private generateLogarithmLabels;
|
|
41
|
+
doGenerateLabels(): NumericAxisLabel[];
|
|
42
|
+
private calculateMinMax;
|
|
43
|
+
private getAxisStep;
|
|
44
|
+
observeDistanceBetweenLabelsChanged(): Observable<NumericAxisLabel[][]>;
|
|
45
|
+
observeLabelsChanged(): Observable<NumericAxisLabel[]>;
|
|
46
|
+
protected calculateIncrement(valueLength: number): Unit;
|
|
47
|
+
protected adjustIncrementOnAxisType(increment: number): number;
|
|
48
|
+
generateNumericLabels(): Array<NumericAxisLabel>;
|
|
49
|
+
private static getLabelBounds;
|
|
50
|
+
/**
|
|
51
|
+
* Calculates the distance between two axis labels as:
|
|
52
|
+
* - Take increment (0.01 for price or 1 for natural number);
|
|
53
|
+
* - Take step which was calculated as (chart height / max lines count provided by config (or default 10));
|
|
54
|
+
* - Multiplying increment with gridDistanceMultipliers until it will greater then step
|
|
55
|
+
* @param step
|
|
56
|
+
* @param increment
|
|
57
|
+
*/
|
|
58
|
+
private calculateAxisStep;
|
|
59
|
+
}
|
|
60
|
+
export interface NumericAxisLabel {
|
|
61
|
+
text: string;
|
|
62
|
+
value: Unit;
|
|
63
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{Subject as h}from"rxjs";import{logValueToUnit as u,percentToUnit as d,calcLogValue as b}from"../../model/scaling/viewport.model";import{AnimationFrameCache as g}from"../../utils/perfomance/animation-frame-cache.utils";import{identity as m}from"../../utils/function.utils";import{MathUtils as l}from"../../utils/math.utils";import{PriceIncrementsUtils as L}from"../../utils/price-increments.utils";const x=0,p=.01;export class NumericAxisLabelsGenerator{constructor(e,s,a,t,i=!1,r,n,c=m,o=23){this.increment=e,this.startEndProvider=s,this.lengthProvider=a,this.valueFormatter=t,this.withZero=i,this.axisTypeProvider=r,this.baseLineProvider=n,this.labelFilter=c,this.singleLabelHeightPixels=o,this.gridDistanceMultipliers=[2,4,5,10],this.lastSingleLabelHeightValue=0,this.distanceBetweenLabelsChangeSubject=new h,this.newGeneratedLabelsSubject=new h,this.lastStart=0,this.lastEnd=0,this.labelsCache=new g(()=>this.labelFilter(this.doGenerateLabels()))}generateRegularLabels(e,s,a){const t=[];this.withZero&&t.push({value:0,text:"0"});let i=l.roundToNearest(e,a);for(;i<s;){const r=l.roundToNearest(i,a),n=this.valueFormatter(r);t.push({value:r,text:n}),i=l.roundDecimal(i+a)}return t}generatePercentLabels(e,s,a){const t=[],i=this.baseLineProvider();let r=l.roundToNearest(e,a);for(;r<s;){const n=l.roundToNearest(r,a),c=d(n,i),o=this.valueFormatter(c);t.push({value:n,text:o}),r=l.roundDecimal(r+a)}return t}generateLogarithmLabels(e,s,a){const t=[];let i=l.roundToNearest(e,a);for(;i<s;){const r=u(i),n=this.valueFormatter(r);t.push({value:i,text:n}),i=l.roundDecimal(i+a)}return t}doGenerateLabels(){var e;const s=this.lengthProvider();if(s<=0)return[];const[a,t]=this.calculateMinMax(),i=this.getAxisStep(a,t,s);this.lastSingleLabelHeightValue||(this.lastSingleLabelHeightValue=i);let r;const n=this.axisTypeProvider();if(n==="logarithmic"?r=this.generateLogarithmLabels(a,t,i):n==="percent"?r=this.generatePercentLabels(a,t,i):r=this.generateRegularLabels(a,t,i),this.lastSingleLabelHeightValue!==i&&this.labelsCache.cache){const c=(e=this.labelsCache.getLastCachedValue())!==null&&e!==void 0?e:[];this.distanceBetweenLabelsChangeSubject.next([c,r]),this.lastSingleLabelHeightValue=i}return this.newGeneratedLabelsSubject.next(r),r}calculateMinMax(){const[e,s]=this.startEndProvider(),a=this.lengthProvider(),t=NumericAxisLabelsGenerator.getLabelBounds(e,s,a);return[t[0],t[1]]}getAxisStep(e,s,a){const t=s-e,i=a/this.singleLabelHeightPixels,r=this.calculateIncrement(t),n=t/i;return this.calculateAxisStep(n,r)}observeDistanceBetweenLabelsChanged(){return this.distanceBetweenLabelsChangeSubject.asObservable()}observeLabelsChanged(){return this.newGeneratedLabelsSubject.asObservable()}calculateIncrement(e){if(this.increment)return this.increment;if(!isNaN(e)){const s=L.autoDetectIncrementOfValueRange(e);return this.adjustIncrementOnAxisType(s)}return this.adjustIncrementOnAxisType(p)}adjustIncrementOnAxisType(e){switch(this.axisTypeProvider()){case"percent":return e;case"logarithmic":const[s]=this.calculateMinMax(),t=u(s)+e;return b(t)-s;case"regular":return e}}generateNumericLabels(){const[e,s]=this.startEndProvider();return(e!==this.lastStart||s!==this.lastEnd)&&this.labelsCache.invalidate(),this.lastStart=e,this.lastEnd=s,this.labelsCache.calculateOrGet()}static getLabelBounds(e,s,a){const t=Math.abs((s-e)*(x/a));return[e-t,s+t]}calculateAxisStep(e,s){if(s===0)return console.error("NumericAxisLabelsGenerator failed at calculateAxisStep: increment = 0"),0;let a=s,t=s,i=0;for(;a<e&&a>0;)i>=this.gridDistanceMultipliers.length&&(i=0,t*=10),a=t*this.gridDistanceMultipliers[i++];return a}}
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
7
|
+
import EventBus from '../../events/event-bus';
|
|
8
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
9
|
+
import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
|
|
10
|
+
import { ScaleModel } from '../../model/scale.model';
|
|
11
|
+
import { ChartModel } from '../chart/chart.model';
|
|
12
|
+
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
13
|
+
export declare class NavigationMapMoveHandler extends ChartBaseElement {
|
|
14
|
+
private bus;
|
|
15
|
+
private chartModel;
|
|
16
|
+
private scaleModel;
|
|
17
|
+
private canvasInputListeners;
|
|
18
|
+
private canvasBoundsContainer;
|
|
19
|
+
private chartPanComponent;
|
|
20
|
+
private leftKnotDragStartXRelative;
|
|
21
|
+
private rightKnotDragStartXRelative;
|
|
22
|
+
private lastMousePosition;
|
|
23
|
+
constructor(bus: EventBus, chartModel: ChartModel, scaleModel: ScaleModel, canvasInputListeners: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, chartPanComponent: ChartPanComponent);
|
|
24
|
+
/**
|
|
25
|
+
* Method that activates the navigation map buttons and subscribes to their click and touch events.
|
|
26
|
+
* It also subscribes to the xChanged event of the scaleModel and updates the canvasBoundsContainer accordingly.
|
|
27
|
+
* @returns {void}
|
|
28
|
+
*/
|
|
29
|
+
protected doActivate(): void;
|
|
30
|
+
private leftKnotDragStart;
|
|
31
|
+
private leftKnotDragTick;
|
|
32
|
+
private rightKnotDragStart;
|
|
33
|
+
private rightKnotDragTick;
|
|
34
|
+
private sliderDragStart;
|
|
35
|
+
private sliderDragTick;
|
|
36
|
+
}
|
|
@@ -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{CanvasElement as s}from"../../canvas/canvas-bounds-container";import{ChartBaseElement as B}from"../../model/chart-base-element";import{DragNDropXComponent as c}from"../dran-n-drop_helper/drag-n-drop-x.component";const d=4;export class NavigationMapMoveHandler extends B{constructor(o,r,n,l,u,g){super(),this.bus=o,this.chartModel=r,this.scaleModel=n,this.canvasInputListeners=l,this.canvasBoundsContainer=u,this.chartPanComponent=g,this.leftKnotDragStartXRelative=0,this.rightKnotDragStartXRelative=0,this.lastMousePosition=0,this.leftKnotDragStart=a=>{const t=this.canvasBoundsContainer.getBounds(s.N_MAP_CHART);this.leftKnotDragStartXRelative=a.x-t.x-d},this.leftKnotDragTick=a=>{const{delta:t}=a,i=this.canvasBoundsContainer.getBounds(s.N_MAP_CHART).width,e=(this.leftKnotDragStartXRelative+t)/i;this.canvasBoundsContainer.leftRatio=e,this.scaleModel.setXScale(Math.round(this.chartModel.mainCandleSeries.dataPoints.length*this.canvasBoundsContainer.leftRatio),this.scaleModel.xEnd)},this.rightKnotDragStart=a=>{const t=this.canvasBoundsContainer.getBounds(s.N_MAP_CHART);this.rightKnotDragStartXRelative=a.x-t.x+d},this.rightKnotDragTick=a=>{const{delta:t}=a,i=this.canvasBoundsContainer.getBounds(s.N_MAP_CHART).width,e=(this.rightKnotDragStartXRelative+t)/i;this.canvasBoundsContainer.rightRatio=e,this.scaleModel.setXScale(this.scaleModel.xStart,Math.round(this.chartModel.mainCandleSeries.dataPoints.length*this.canvasBoundsContainer.rightRatio))},this.sliderDragStart=()=>{this.lastMousePosition=0},this.sliderDragTick=a=>{const{delta:t}=a,h=this.canvasBoundsContainer.getBounds(s.N_MAP_CHART),i=this.chartModel.mainCandleSeries.meanCandleWidth/(h.width/this.chartModel.mainCandleSeries.dataPoints.length),e=(this.lastMousePosition-t)*i;this.scaleModel.moveXStart(this.scaleModel.xStart-e),this.lastMousePosition=t};const C=this.canvasBoundsContainer.getBoundsHitTest(s.N_MAP_KNOT_L),v=this.canvasBoundsContainer.getBoundsHitTest(s.N_MAP_KNOT_R),M=new c(C,{onDragStart:this.leftKnotDragStart,onDragTick:this.leftKnotDragTick},this.canvasInputListeners,this.chartPanComponent),S=new c(v,{onDragStart:this.rightKnotDragStart,onDragTick:this.rightKnotDragTick},this.canvasInputListeners,this.chartPanComponent);this.addChildEntity(M),this.addChildEntity(S);const p=this.canvasBoundsContainer.getBoundsHitTest(s.N_MAP_SLIDER_WINDOW),D=new c(p,{onDragStart:this.sliderDragStart,onDragTick:this.sliderDragTick},this.canvasInputListeners,this.chartPanComponent);this.addChildEntity(D)}doActivate(){super.doActivate();const o=this.canvasBoundsContainer.getBoundsHitTest(s.N_MAP_BTN_L);this.addRxSubscription(this.canvasInputListeners.observeClick(o).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart-1)})),this.addRxSubscription(this.canvasInputListeners.observeTouchStart(o).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart-1)}));const r=this.canvasBoundsContainer.getBoundsHitTest(s.N_MAP_BTN_R);this.addRxSubscription(this.canvasInputListeners.observeClick(r).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart+1)})),this.addRxSubscription(this.canvasInputListeners.observeTouchStart(r).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart+1)})),this.addRxSubscription(this.scaleModel.xChanged.subscribe(()=>{const n=this.chartModel.mainCandleSeries;this.canvasBoundsContainer.leftRatio=n.dataIdxStart/(n.dataPoints.length-1),this.canvasBoundsContainer.rightRatio=n.dataIdxEnd/(n.dataPoints.length-1),this.canvasBoundsContainer.recalculateNavigationMapElementBounds(),this.bus.fireDraw()}))}}
|