@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,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 V,CHART_UUID as q}from"../../../canvas/canvas-bounds-container";import{getFontFromConfig as I}from"../../../chart.config";import{redrawBackgroundArea as z}from"../../../drawers/chart-background.drawer";import{avoidAntialiasing as J,drawLine as K}from"../../../utils/canvas/canvas-drawing-functions.utils";import{calculateSymbolHeight as N,calculateTextWidth as R}from"../../../utils/canvas/canvas-font-measure-tool.utils";import{floor as O}from"../../../utils/math.utils";import{drawBadgeLabel as Q,drawPlainLabel as Z,drawRectLabel as $}from"../y-axis-labels.drawer";export const DEFAULT_LABEL_APPEARANCE_TYPE="badge";const X=4;export const priceLabelDrawersMap={badge:Q,rectangle:$,plain:Z};export function drawLabel(o,n,e,m,t,B,l,_){var s,d,c,r,a;const p=t.y,f=t.labelText,T=(s=t.mode)!==null&&s!==void 0?s:"label",x=(d=t.labelType)!==null&&d!==void 0?d:DEFAULT_LABEL_APPEARANCE_TYPE,g=t.description,A=(c=t.textFont)!==null&&c!==void 0?c:I(l),w=t.bgColor,b=(r=t.lineColor)!==null&&r!==void 0?r:w,h=R(g!=null?g:"",o,A)+8,D=O(t.y),y=N(A,o),E=p-y/2,j=p+y/2-E;o.save(),o.fillStyle=w,o.strokeStyle=b;const i=B.getBounds(V.PANE_UUID(q)),G=priceLabelDrawersMap[x],C=l.labels.descriptions,M=v(e,D,j),Y=()=>C&&L(n,o,e,m,t,l.align,l);let F,P;const U=2;l.align==="right"?(F=i.x,P=C?i.x+i.width-h:i.x+i.width+U):(F=C?i.x+h:i.x-U,P=i.x+i.width);const k=(a=t.lineY)!==null&&a!==void 0?a:t.y,H=()=>M&&J(o,()=>K(o,F,k,P,k,1)),W=()=>G(o,e,f,p,t,l,_,!1,n);switch(T){case"line":H(),Y();break;case"line-label":H(),Y(),W();break;case"label":Y(),W();break;case"none":break}o.restore()}const v=(o,n,e)=>n>o.y+e/2&&n<o.y+o.height-e/2;function L(o,n,e,m,t,B="right",l){var _,s,d;const c=t.description;if(!c||c.length===0)return;const r=t.y,a=I(l),p=R(c,n,a),f=N(a,n),T=(_=t.paddingTop)!==null&&_!==void 0?_:X,x=(s=t.paddingBottom)!==null&&s!==void 0?s:X,g=r-f/2-T,w=r+f/2+x-g;if(r<e.y+w/2||r>e.y+e.height-w/2)return;n.save();const b=p+5,h=4,D=p+h*2,y=m.x+m.width,E=B==="right"?y-D:m.x+h;z(o,n,E,g,b,w,.8),n.fillStyle=(d=t.descColor)!==null&&d!==void 0?d:t.bgColor,n.font=a;const S=B==="right"?y-p-h*2:m.x+h*2;n.fillText(c,S,r+f/2-1),n.restore()}
|
|
@@ -0,0 +1,159 @@
|
|
|
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 { ChartConfigComponentsYAxis, FullChartConfig, YAxisLabelMode } from '../../../chart.config';
|
|
9
|
+
import EventBus from '../../../events/event-bus';
|
|
10
|
+
import { Bounds } from '../../../model/bounds.model';
|
|
11
|
+
import { CanvasModel } from '../../../model/canvas.model';
|
|
12
|
+
import { ChartBaseElement } from '../../../model/chart-base-element';
|
|
13
|
+
import { Unit } from '../../../model/scaling/viewport.model';
|
|
14
|
+
import { ChartModel } from '../../chart/chart.model';
|
|
15
|
+
import { YAxisLabelDrawConfig } from '../y-axis-labels.drawer';
|
|
16
|
+
export type YAxisVisualLabelType = 'badge' | 'rectangle' | 'plain';
|
|
17
|
+
export interface VisualYAxisLabel extends YAxisLabelDrawConfig {
|
|
18
|
+
y: Unit;
|
|
19
|
+
labelText: string;
|
|
20
|
+
mode?: YAxisLabelMode;
|
|
21
|
+
labelType?: YAxisVisualLabelType;
|
|
22
|
+
lineY?: number;
|
|
23
|
+
labelWeight?: number;
|
|
24
|
+
description?: string;
|
|
25
|
+
subGroupId?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface LabelGroup {
|
|
28
|
+
labels: VisualYAxisLabel[];
|
|
29
|
+
bounds?: Bounds;
|
|
30
|
+
axisState?: ChartConfigComponentsYAxis;
|
|
31
|
+
}
|
|
32
|
+
export type ProviderGroups = Record<string, YAxisLabelsProvider[]>;
|
|
33
|
+
export declare const LabelsGroups: {
|
|
34
|
+
readonly MAIN: "MAIN";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Different labels on Y axis:
|
|
38
|
+
* - last candle price
|
|
39
|
+
* - bid/ask
|
|
40
|
+
* - countdown
|
|
41
|
+
* - prev.day price
|
|
42
|
+
* - high low in viewport
|
|
43
|
+
* - drawings
|
|
44
|
+
* - studies
|
|
45
|
+
* - ...
|
|
46
|
+
* Anything but the base labels which are generated in other component {@link YAxisBaseLabelsModel}
|
|
47
|
+
*/
|
|
48
|
+
export declare class YAxisLabelsModel extends ChartBaseElement {
|
|
49
|
+
eventBus: EventBus;
|
|
50
|
+
private chartModel;
|
|
51
|
+
private canvasBoundsContainer;
|
|
52
|
+
private config;
|
|
53
|
+
private canvasModel;
|
|
54
|
+
private updateYAxisWidth;
|
|
55
|
+
orderedLabels: LabelGroup[];
|
|
56
|
+
/**
|
|
57
|
+
* an easier way to manage custom y-axis labels, than y-axis labels providers, but doesn't support overlapping avoidance
|
|
58
|
+
*/
|
|
59
|
+
readonly customLabels: Record<string, VisualYAxisLabel>;
|
|
60
|
+
private labelsProviders;
|
|
61
|
+
private labelsPositionRecalculatedSubject;
|
|
62
|
+
private animFrameId;
|
|
63
|
+
constructor(eventBus: EventBus, chartModel: ChartModel, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig, canvasModel: CanvasModel, updateYAxisWidth: () => void);
|
|
64
|
+
/**
|
|
65
|
+
* This method is used to activate the chart and subscribe to the observables that will trigger the update of the labels.
|
|
66
|
+
* It calls the parent method doActivate() and adds a new Rx subscription to the merge of the following observables:
|
|
67
|
+
* - chartModel.observeCandlesChanged()
|
|
68
|
+
* - canvasBoundsContainer.observeBoundsChanged(CanvasElement.CHART)
|
|
69
|
+
* - chartModel.nextCandleTimeStampSubject
|
|
70
|
+
* - canvasBoundsContainer.barResizerChangedSubject
|
|
71
|
+
* - chartModel.scaleModel.changed
|
|
72
|
+
* When any of these observables emit a new value, the updateLabels() method is called.
|
|
73
|
+
* @protected
|
|
74
|
+
*/
|
|
75
|
+
protected doActivate(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Initializes the model by calling the methods to initialize the label groups and recalculate the labels.
|
|
78
|
+
* Then, it fires the draw event on the canvas model.
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
private initModel;
|
|
82
|
+
/**
|
|
83
|
+
* Initializes the labels groups.
|
|
84
|
+
* If there are labels providers, it creates a group for each one and adds the providers to their respective groups.
|
|
85
|
+
* @returns {void}
|
|
86
|
+
*/
|
|
87
|
+
private initLabelsGroups;
|
|
88
|
+
/**
|
|
89
|
+
* Updates YAxis ordered labels.
|
|
90
|
+
* @param adjustYAxisWidth - provide "true", if you need to adjust width after new labels will be calculated.
|
|
91
|
+
*/
|
|
92
|
+
updateLabels(adjustYAxisWidth?: boolean): void;
|
|
93
|
+
/**
|
|
94
|
+
* Recalculates the labels based on the current configuration and label providers.
|
|
95
|
+
* It generates label groups and calculates their coordinates based on their weight and the label height.
|
|
96
|
+
* The coordinates are generated in the order they were passed to the generator.
|
|
97
|
+
* The ordered labels are then updated with the new coordinates and reversed.
|
|
98
|
+
* @returns {void}
|
|
99
|
+
*/
|
|
100
|
+
recalculateLabels(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a new group with the given name if it doesn't exist yet.
|
|
103
|
+
* @param {string} groupName - The name of the group to be created.
|
|
104
|
+
* @returns {void}
|
|
105
|
+
*/
|
|
106
|
+
private createGroup;
|
|
107
|
+
/**
|
|
108
|
+
* Adds a YAxisLabelsProvider component to a group.
|
|
109
|
+
*
|
|
110
|
+
* @param {YAxisLabelsProvider} component - The component to add to the group.
|
|
111
|
+
* @param {string} groupName - The name of the group to add the component to.
|
|
112
|
+
* @param {string} id - The id of the component to add to the group.
|
|
113
|
+
* @returns {void}
|
|
114
|
+
*/
|
|
115
|
+
private addToGroup;
|
|
116
|
+
/**
|
|
117
|
+
* Updates the coordinates of the labels in a LabelGroup object based on an array of points.
|
|
118
|
+
* @param {LabelGroup} labels - The LabelGroup object containing the labels to be updated.
|
|
119
|
+
* @param {number[]} points - An array of points to be used to update the y-coordinate of each label.
|
|
120
|
+
* @returns {LabelGroup} - A new LabelGroup object with updated label coordinates.
|
|
121
|
+
*/
|
|
122
|
+
private updateLabelsCoordinates;
|
|
123
|
+
/**
|
|
124
|
+
* Returns an Observable that emits a void value whenever the labels position is recalculated.
|
|
125
|
+
* The Observable is created from the labelsPositionRecalculatedSubject Subject.
|
|
126
|
+
* @returns {Observable<void>} An Observable that emits a void value whenever the labels position is recalculated.
|
|
127
|
+
*/
|
|
128
|
+
observeLabelsPositionsRecalculated(): Observable<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Registers a Y axis labels provider for a given group name and ID.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} groupName - The name of the group to which the provider belongs.
|
|
133
|
+
* @param {YAxisLabelsProvider} provider - The provider to be registered.
|
|
134
|
+
* @param {string} id - The ID of the provider to be registered.
|
|
135
|
+
* @returns {void}
|
|
136
|
+
*/
|
|
137
|
+
registerYAxisLabelsProvider(groupName: string, provider: YAxisLabelsProvider, id: string): void;
|
|
138
|
+
/**
|
|
139
|
+
* Unregisters a Y axis labels provider.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} groupName - The name of the group to which the provider belongs.
|
|
142
|
+
* @param {string} id - The ID of the provider to unregister.
|
|
143
|
+
*
|
|
144
|
+
* @returns {void}
|
|
145
|
+
*/
|
|
146
|
+
unregisterYAxisLabelsProvider(groupName: string, id: string): void;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* YAxisLabelsProvider interface used to write price labels providers
|
|
150
|
+
* for YAxisLabelsModel.
|
|
151
|
+
* Under the hood, YAxisLabelsModel calls Provider.getUnorderedLabels method
|
|
152
|
+
* on each provider, and generates Y coordinates for each label
|
|
153
|
+
* according to non-overlapping condition
|
|
154
|
+
* Then, with the info which was got from the Providers and Y coordinates
|
|
155
|
+
* follows the draw cycle of labels
|
|
156
|
+
*/
|
|
157
|
+
export interface YAxisLabelsProvider {
|
|
158
|
+
readonly getUnorderedLabels: () => LabelGroup[];
|
|
159
|
+
}
|
|
@@ -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 h,Subject as b}from"rxjs";import{CanvasElement as c,CHART_UUID as v}from"../../../canvas/canvas-bounds-container";import{ChartBaseElement as u}from"../../../model/chart-base-element";import{animationFrameThrottledPrior as p}from"../../../utils/perfomance/request-animation-frame-throttle.utils";import{uuid as m}from"../../../utils/uuid.utils";import{calcLabelsYCoordinates as f}from"./labels-positions-calculator";import{flat as d}from"../../../utils/array.utils";export const LabelsGroups={MAIN:"MAIN"};export class YAxisLabelsModel extends u{constructor(e,s,t,i,r,l){super(),this.eventBus=e,this.chartModel=s,this.canvasBoundsContainer=t,this.config=i,this.canvasModel=r,this.updateYAxisWidth=l,this.orderedLabels=[],this.customLabels={},this.labelsProviders={},this.labelsPositionRecalculatedSubject=new b,this.animFrameId=`anim_cache_${m()}`,this.initModel()}doActivate(){super.doActivate(),this.addRxSubscription(h(this.chartModel.observeCandlesChanged(),this.canvasBoundsContainer.observeBoundsChanged(c.PANE_UUID(v)),this.chartModel.nextCandleTimeStampSubject,this.canvasBoundsContainer.barResizerChangedSubject,this.chartModel.scaleModel.changed).subscribe(()=>{this.updateLabels()}))}initModel(){this.initLabelsGroups(),this.recalculateLabels(),this.canvasModel.fireDraw()}initLabelsGroups(){if(Object.keys(this.labelsProviders).length!==0)for(const e of Object.keys(this.labelsProviders))this.createGroup(e),Object.entries(this.labelsProviders[e]).forEach(([s,t])=>{this.addToGroup(t,e,s)})}updateLabels(e=!1){this.recalculateLabels(),p(this.animFrameId,()=>{e&&this.updateYAxisWidth(),this.canvasModel.fireDraw()})}recalculateLabels(){var e,s;this.orderedLabels=[];const t=this.config.components.yAxis.fontSize+((e=this.config.components.yAxis.labelBoxMargin.top)!==null&&e!==void 0?e:0)+((s=this.config.components.yAxis.labelBoxMargin.bottom)!==null&&s!==void 0?s:0);for(const i of Object.values(this.labelsProviders)){const r=d(Object.values(i).map(a=>a.getUnorderedLabels())),l=d(r.map(a=>a.labels)).map(a=>{var o;return{y:a.y,weight:(o=a.labelWeight)!==null&&o!==void 0?o:Number.POSITIVE_INFINITY}}),n=f(l,t);r.forEach(a=>{const o=n.splice(0,a.labels.length);this.orderedLabels.push(this.updateLabelsCoordinates(a,o))})}this.orderedLabels=this.orderedLabels.reverse()}createGroup(e){!this.labelsProviders[e]&&(this.labelsProviders[e]={})}addToGroup(e,s,t){this.labelsProviders[s]&&(Object.values(this.labelsProviders[s]).includes(e)||(this.labelsProviders[s][t]=e))}updateLabelsCoordinates(e,s){return Object.assign(Object.assign({},e),{labels:e.labels.map((t,i)=>Object.assign(Object.assign({},t),{lineY:t.y,y:s[i]}))})}observeLabelsPositionsRecalculated(){return this.labelsPositionRecalculatedSubject.asObservable()}registerYAxisLabelsProvider(e,s,t){var i;const r=(i=this.labelsProviders[e])!==null&&i!==void 0?i:{};r[t]=s,this.labelsProviders[e]=r,this.initModel()}unregisterYAxisLabelsProvider(e,s){var t;const i=(t=this.labelsProviders[e])!==null&&t!==void 0?t:{};delete i[s],this.labelsProviders[e]&&Object.keys(this.labelsProviders[e]).length===0&&delete this.labelsProviders[e],this.initModel()}}
|
|
@@ -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 { CanvasBoundsContainer } from '../../../canvas/canvas-bounds-container';
|
|
7
|
+
import { ChartConfigComponentsYAxis, FullChartColors } from '../../../chart.config';
|
|
8
|
+
import { Drawer } from '../../../drawers/drawing-manager';
|
|
9
|
+
import { CanvasModel } from '../../../model/canvas.model';
|
|
10
|
+
import { LabelGroup, VisualYAxisLabel } from './y-axis-labels.model';
|
|
11
|
+
export declare class YAxisPriceLabelsDrawer implements Drawer {
|
|
12
|
+
private labelsProvider;
|
|
13
|
+
private yAxisLabelsCanvasModel;
|
|
14
|
+
private backgroundCanvasModel;
|
|
15
|
+
private yAxisState;
|
|
16
|
+
private canvasBoundsContainer;
|
|
17
|
+
private yAxisColors;
|
|
18
|
+
private readonly customLabels;
|
|
19
|
+
constructor(labelsProvider: () => LabelGroup[], yAxisLabelsCanvasModel: CanvasModel, backgroundCanvasModel: CanvasModel, yAxisState: ChartConfigComponentsYAxis, canvasBoundsContainer: CanvasBoundsContainer, yAxisColors: FullChartColors['yAxis'], customLabels: Record<string, VisualYAxisLabel>);
|
|
20
|
+
draw(): void;
|
|
21
|
+
drawHighlightedBackgroundBetweenLabels(): void;
|
|
22
|
+
getCanvasIds(): Array<string>;
|
|
23
|
+
}
|
|
@@ -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 c,CHART_UUID as h,limitYToBounds as u}from"../../../canvas/canvas-bounds-container";import{fillRect as C}from"../../../utils/canvas/canvas-drawing-functions.utils";import{drawLabel as b}from"./price-label.drawer";export class YAxisPriceLabelsDrawer{constructor(t,d,e,i,r,o,a){this.labelsProvider=t,this.yAxisLabelsCanvasModel=d,this.backgroundCanvasModel=e,this.yAxisState=i,this.canvasBoundsContainer=r,this.yAxisColors=o,this.customLabels=a}draw(){const t=this.yAxisLabelsCanvasModel.ctx,d=this.backgroundCanvasModel.ctx,e=this.canvasBoundsContainer.getBounds(c.PANE_UUID_Y_AXIS(h)),i=this.canvasBoundsContainer.getBounds(c.ALL_PANES);this.drawHighlightedBackgroundBetweenLabels(),this.labelsProvider().forEach(o=>{var a;const l=(a=o.bounds)!==null&&a!==void 0?a:e;o.labels.forEach(s=>{var n;return b(t,d,l,i,s,this.canvasBoundsContainer,(n=o.axisState)!==null&&n!==void 0?n:this.yAxisState,this.yAxisColors)})}),Object.values(this.customLabels).forEach(o=>b(t,d,e,i,o,this.canvasBoundsContainer,this.yAxisState,this.yAxisColors))}drawHighlightedBackgroundBetweenLabels(){const t=this.yAxisLabelsCanvasModel.ctx,d=this.labelsProvider(),e={};d.forEach(i=>{i.labels.forEach(r=>{var o,a,l;if(r.subGroupId){const s=(o=e[r.subGroupId])!==null&&o!==void 0?o:[];if(e[r.subGroupId]=s,s.push(r),s.length===2){const n=(a=i.bounds)!==null&&a!==void 0?a:this.canvasBoundsContainer.getBounds(c.PANE_UUID_Y_AXIS(h));t.save(),t.fillStyle=(l=s[0].highlightColor)!==null&&l!==void 0?l:s[0].bgColor;const[v,x]=s[0].y>s[1].y?[s[1].y,s[0].y]:[s[0].y,s[1].y];C(t,{x:n.x,y:u(v,n)},{x:n.x+n.width-6,y:u(x,n)}),t.restore()}}})})}getCanvasIds(){return[this.yAxisLabelsCanvasModel.canvasId]}}
|
|
@@ -0,0 +1,31 @@
|
|
|
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, NumericAxisLabelsGenerator } from '../labels_generator/numeric-axis-labels.generator';
|
|
7
|
+
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
8
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
9
|
+
import { ScaleModel } from '../../model/scale.model';
|
|
10
|
+
export declare class YAxisBaseLabelsModel extends ChartBaseElement {
|
|
11
|
+
private scaleModel;
|
|
12
|
+
private yAxisLabelsGenerator;
|
|
13
|
+
private canvasBoundsContainer;
|
|
14
|
+
labels: Array<NumericAxisLabel>;
|
|
15
|
+
private prevYAxisHeight;
|
|
16
|
+
private animFrameId;
|
|
17
|
+
constructor(scaleModel: ScaleModel, yAxisLabelsGenerator: NumericAxisLabelsGenerator, canvasBoundsContainer: CanvasBoundsContainer);
|
|
18
|
+
/**
|
|
19
|
+
* This method is used to activate the component. It calls the parent's doActivate method and subscribes to the merge of two observables:
|
|
20
|
+
* - this.scaleModel.yChanged
|
|
21
|
+
* - this.canvasBoundsContainer.observeBoundsChanged
|
|
22
|
+
* The merge of these two observables is used to update the labels of the component when either the y-axis scale model changes or the canvas bounds change.
|
|
23
|
+
* If the height of the canvas bounds changes by more than 1.5 times the previous height, the labels cache is invalidated and the previous y-axis height is updated.
|
|
24
|
+
*/
|
|
25
|
+
protected doActivate(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Updates the labels of the chart's y-axis by generating new numeric labels using the yAxisLabelsGenerator object.
|
|
28
|
+
* Then, it calls the updateYAxisWidth method to update the width of the y-axis.
|
|
29
|
+
*/
|
|
30
|
+
updateLabels(): void;
|
|
31
|
+
}
|
|
@@ -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 t}from"rxjs";import{filter as a,map as r,tap as o}from"rxjs/operators";import{CanvasElement as n}from"../../canvas/canvas-bounds-container";import{ChartBaseElement as h}from"../../model/chart-base-element";import{uuid as m}from"../../utils/uuid.utils";import{animationFrameThrottledPrior as l}from"../../utils/perfomance/request-animation-frame-throttle.utils";import{isDiffersBy as d}from"../../utils/math.utils";export class YAxisBaseLabelsModel extends h{constructor(e,s,i){super(),this.scaleModel=e,this.yAxisLabelsGenerator=s,this.canvasBoundsContainer=i,this.labels=[],this.prevYAxisHeight=0,this.animFrameId=`anim_cache_${m()}`}doActivate(){super.doActivate(),this.addRxSubscription(t(this.scaleModel.yChanged,this.canvasBoundsContainer.observeBoundsChanged(n.Y_AXIS).pipe(r(e=>e.height),a(e=>d(e,this.prevYAxisHeight,1.5)),o(e=>{this.yAxisLabelsGenerator.labelsCache.invalidate(),this.prevYAxisHeight=e}))).subscribe(()=>this.updateLabels()))}updateLabels(){this.labels=this.yAxisLabelsGenerator.generateNumericLabels(),l(this.animFrameId,()=>this.canvasBoundsContainer.updateYAxisWidths())}}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { ChartConfigComponentsYAxis, FullChartColors } from '../../chart.config';
|
|
7
|
+
import { Bounds } from '../../model/bounds.model';
|
|
8
|
+
export interface YAxisLabelDrawProps {
|
|
9
|
+
ctx: CanvasRenderingContext2D;
|
|
10
|
+
bounds: Bounds;
|
|
11
|
+
text: string;
|
|
12
|
+
centralY: number;
|
|
13
|
+
config: YAxisLabelDrawConfig;
|
|
14
|
+
subGroupId?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface YAxisLabelDrawConfig {
|
|
17
|
+
textFont?: string;
|
|
18
|
+
textColor?: string;
|
|
19
|
+
bgColor: string;
|
|
20
|
+
highlightColor?: string;
|
|
21
|
+
descColor?: string;
|
|
22
|
+
lineColor?: string;
|
|
23
|
+
paddingTop?: number;
|
|
24
|
+
paddingBottom?: number;
|
|
25
|
+
paddingEnd?: number;
|
|
26
|
+
paddingStart?: number;
|
|
27
|
+
rounded?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare const DEFAULT_PRICE_LABEL_PADDING = 4;
|
|
30
|
+
/**
|
|
31
|
+
* Draws badge label on Y axis with provided parameters.
|
|
32
|
+
* @param ctx - canvas 2D context to draw on
|
|
33
|
+
* @param bounds - bounds of Y axis
|
|
34
|
+
* @param text - text to draw
|
|
35
|
+
* @param centralY - y
|
|
36
|
+
* @param config - label styles config
|
|
37
|
+
* @param align
|
|
38
|
+
* @param yAxisState
|
|
39
|
+
*/
|
|
40
|
+
export declare function drawBadgeLabel(ctx: CanvasRenderingContext2D, bounds: Bounds, text: string, centralY: number, config: YAxisLabelDrawConfig, yAxisState: ChartConfigComponentsYAxis, yAxisColors: FullChartColors['yAxis'], drawOutside?: boolean): void;
|
|
41
|
+
/**
|
|
42
|
+
* Draws rectangle label on Y axis with provided parameters.
|
|
43
|
+
* @param ctx - canvas 2D context to draw on
|
|
44
|
+
* @param bounds - bounds of Y axis
|
|
45
|
+
* @param text - text to draw
|
|
46
|
+
* @param centralY - y
|
|
47
|
+
* @param config - label styles config
|
|
48
|
+
* @param align
|
|
49
|
+
* @param yAxisState
|
|
50
|
+
*/
|
|
51
|
+
export declare function drawRectLabel(ctx: CanvasRenderingContext2D, bounds: Bounds, text: string, centralY: number, config: YAxisLabelDrawConfig, yAxisState: ChartConfigComponentsYAxis, yAxisColors: FullChartColors['yAxis'], drawOutside?: boolean): void;
|
|
52
|
+
/**
|
|
53
|
+
* Draws rectangle label on Y axis with provided parameters but with transparent background.
|
|
54
|
+
* @param ctx - canvas 2D context to draw on
|
|
55
|
+
* @param bounds - bounds of Y axis
|
|
56
|
+
* @param text - text to draw
|
|
57
|
+
* @param centralY - y
|
|
58
|
+
* @param config - label styles config
|
|
59
|
+
* @param align
|
|
60
|
+
* @param yAxisState
|
|
61
|
+
*/
|
|
62
|
+
export declare function drawPlainLabel(ctx: CanvasRenderingContext2D, bounds: Bounds, text: string, centralY: number, config: YAxisLabelDrawConfig, yAxisState: ChartConfigComponentsYAxis, yAxisColors: FullChartColors['yAxis'], drawOutside?: boolean, backgroundCtx?: CanvasRenderingContext2D): void;
|
|
63
|
+
/**
|
|
64
|
+
* Offset from the center of label to the top/bottom.
|
|
65
|
+
*
|
|
66
|
+
* @param font Label font
|
|
67
|
+
* @param ctx Drawing context
|
|
68
|
+
* @param paddingTop - extra padding from top
|
|
69
|
+
*/
|
|
70
|
+
export declare function getLabelYOffset(font: string, ctx: CanvasRenderingContext2D, paddingTop?: number): number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{getFontFromConfig as M}from"../../chart.config";import{redrawBackgroundArea as q}from"../../drawers/chart-background.drawer";import{drawPriceLabel as z,drawRoundedRect as J}from"../../utils/canvas/canvas-drawing-functions.utils";import{calculateSymbolHeight as D,calculateTextWidth as X}from"../../utils/canvas/canvas-font-measure-tool.utils";import{getLabelTextColorByBackgroundColor as j}from"../../utils/canvas/canvas-text-functions.utils";import{round as G}from"../../utils/math.utils";export const DEFAULT_PRICE_LABEL_PADDING=4;export function drawBadgeLabel(o,t,m,n,l,d,b,R=!1){var _,a,g,p,v,h,s;const r=d.align,f=(_=l.textFont)!==null&&_!==void 0?_:M(d),B=l.bgColor,E=(a=l.textColor)!==null&&a!==void 0?a:j(B,b.labelTextColor,b.labelInvertedTextColor),F=(g=l.paddingTop)!==null&&g!==void 0?g:DEFAULT_PRICE_LABEL_PADDING,x=(p=l.paddingBottom)!==null&&p!==void 0?p:DEFAULT_PRICE_LABEL_PADDING,L=(v=l.paddingEnd)!==null&&v!==void 0?v:DEFAULT_PRICE_LABEL_PADDING,i=G(D(f,o)/2),e=n-i-F,C=n+i+x-e;if((n<t.y+C/2||n>t.y+t.height-C/2)&&!R)return;o.save(),o.fillStyle=B,o.strokeStyle=B;const c=G(t.width/6),u=r==="right"?t.x:t.x+t.width,w=r==="right"?u+c:u-c,H=d.labelBoxMargin.end,k=H-L,T=t.width-c-k;z(o,w,e,u,e+G(C/2),w,e+C,T,(s=(h=d.typeConfig.badge)===null||h===void 0?void 0:h.rounded)!==null&&s!==void 0?s:!1,r),o.fillStyle=E,o.font=f;const I=r==="right"?t.x+t.width-X(m,o,f)-H:t.x+H;o.fillText(m,I,n+i-1),o.restore()}export function drawRectLabel(o,t,m,n,l,d,b,R=!1){var _,a,g,p,v,h,s,r,f,B,E;const F=d.align,x=(_=l.textFont)!==null&&_!==void 0?_:M(d),L=l.bgColor,i=(a=l.textColor)!==null&&a!==void 0?a:j(L,b.labelTextColor,b.labelInvertedTextColor),e=(g=d.typeConfig.rectangle)===null||g===void 0?void 0:g.paddings,W=(v=(p=l.paddingTop)!==null&&p!==void 0?p:e==null?void 0:e.top)!==null&&v!==void 0?v:DEFAULT_PRICE_LABEL_PADDING,C=(s=(h=l.paddingBottom)!==null&&h!==void 0?h:e==null?void 0:e.bottom)!==null&&s!==void 0?s:DEFAULT_PRICE_LABEL_PADDING,c=(f=(r=l.paddingEnd)!==null&&r!==void 0?r:e==null?void 0:e.end)!==null&&f!==void 0?f:DEFAULT_PRICE_LABEL_PADDING,u=l.paddingStart,w=D(x,o),H=n-w/2-W,T=n+w/2+C-H,I=(B=l.rounded)!==null&&B!==void 0?B:(E=d.typeConfig.rectangle)===null||E===void 0?void 0:E.rounded;if((n<t.y+T/2||n>t.y+t.height-T/2)&&!R)return;o.save(),o.fillStyle=L,o.strokeStyle=L;const y=d.labelBoxMargin.end;o.font=x;const O=X(m,o,x),P=y-c,S=u!==void 0?O+u+c:t.width-P,N=F==="right"?t.x+t.width-P-S:t.x+P,U=F==="right"?t.x+t.width-O-y:y;I?J(o,N,H,S,T,4,!0):o.fillRect(N,H,S,T),o.fillStyle=i,o.fillText(m,U,n+w/2-1),o.restore()}export function drawPlainLabel(o,t,m,n,l,d,b,R=!1,_){var a,g,p,v,h,s,r,f,B;const E=d.align,F=(a=l.textFont)!==null&&a!==void 0?a:M(d),x=l.bgColor,L=(g=l.textColor)!==null&&g!==void 0?g:j(x,b.labelTextColor,b.labelInvertedTextColor),i=(p=d.typeConfig.rectangle)===null||p===void 0?void 0:p.paddings,e=(h=(v=l.paddingTop)!==null&&v!==void 0?v:i==null?void 0:i.top)!==null&&h!==void 0?h:DEFAULT_PRICE_LABEL_PADDING,W=(r=(s=l.paddingBottom)!==null&&s!==void 0?s:i==null?void 0:i.bottom)!==null&&r!==void 0?r:DEFAULT_PRICE_LABEL_PADDING,C=(B=(f=l.paddingEnd)!==null&&f!==void 0?f:i==null?void 0:i.end)!==null&&B!==void 0?B:DEFAULT_PRICE_LABEL_PADDING,c=l.paddingStart,u=D(F,o),w=n-u/2-e,k=n+u/2+W-w;if((n<t.y+k/2||n>t.y+t.height-k/2)&&!R)return;o.save(),o.fillStyle=x,o.strokeStyle=x;const T=d.labelBoxMargin.end;o.font=F;const I=X(m,o,F),y=T-C,O=c!==void 0?I+c+C:t.width-y,P=E==="right"?t.x+t.width-y-O:t.x+y,S=E==="right"?t.x+t.width-I-T:T;_&&q(_,o,P,w,O,k),o.fillStyle=L,o.fillText(m,S,n+u/2-1),o.restore()}export function getLabelYOffset(o,t,m=DEFAULT_PRICE_LABEL_PADDING){return D(o,t)/2+m}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { CanvasBoundsContainer, HitBoundsTest } from '../../canvas/canvas-bounds-container';
|
|
8
|
+
import { ChartConfigComponentsYAxis } from '../../chart.config';
|
|
9
|
+
import EventBus from '../../events/event-bus';
|
|
10
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
11
|
+
import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
|
|
12
|
+
import { Pixel, Unit, ViewportModel } from '../../model/scaling/viewport.model';
|
|
13
|
+
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
14
|
+
/**
|
|
15
|
+
* Handles the mouse drag on Y axis - to zoom the viewport vertically.
|
|
16
|
+
* @doc-tags scaling,zoom,viewport
|
|
17
|
+
*/
|
|
18
|
+
export declare class YAxisScaleHandler extends ChartBaseElement {
|
|
19
|
+
private bus;
|
|
20
|
+
private viewportModel;
|
|
21
|
+
private canvasBoundsContainer;
|
|
22
|
+
private autoScaleCallback;
|
|
23
|
+
yAxisDragEndSubject: Subject<void>;
|
|
24
|
+
lastYStart: Unit;
|
|
25
|
+
lastYEnd: Unit;
|
|
26
|
+
lastYHeight: Unit;
|
|
27
|
+
lastYPxHeight: Pixel;
|
|
28
|
+
constructor(bus: EventBus, config: ChartConfigComponentsYAxis, chartPanComponent: ChartPanComponent, viewportModel: ViewportModel, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, hitTest: HitBoundsTest, autoScaleCallback: (auto: boolean) => void);
|
|
29
|
+
private onYDragStart;
|
|
30
|
+
private onYDragTick;
|
|
31
|
+
private onYDragEnd;
|
|
32
|
+
}
|
|
@@ -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 p}from"rxjs";import{CanvasElement as m}from"../../canvas/canvas-bounds-container";import{ChartBaseElement as E}from"../../model/chart-base-element";import{DragNDropYComponent as b}from"../dran-n-drop_helper/drag-n-drop-y.component";const d=10;export class YAxisScaleHandler extends E{constructor(i,t,Y,g,n,D,h,l){if(super(),this.bus=i,this.viewportModel=g,this.canvasBoundsContainer=D,this.autoScaleCallback=l,this.yAxisDragEndSubject=new p,this.lastYStart=0,this.lastYEnd=0,this.lastYHeight=0,this.lastYPxHeight=0,this.onYDragStart=()=>{this.lastYStart=this.viewportModel.yStart,this.lastYEnd=this.viewportModel.yEnd,this.lastYHeight=this.viewportModel.yEnd-this.viewportModel.yStart,this.lastYPxHeight=this.canvasBoundsContainer.getBounds(m.Y_AXIS).height},this.onYDragTick=s=>{const{delta:e}=s;let a;e<0?a=1/(1+-e/this.lastYPxHeight*(d-1)):a=1+e/this.lastYPxHeight*(d-1);const c=(this.lastYHeight*a-this.lastYHeight)/2,u=this.lastYStart-c,S=this.lastYEnd+c;this.autoScaleCallback(!1),this.viewportModel.setYScale(u,S),this.bus.fireDraw()},this.onYDragEnd=()=>{this.yAxisDragEndSubject.next()},t.customScale){const s=()=>t.type!=="percent",e=new b(h,{onDragTick:r(this.onYDragTick,s),onDragStart:r(this.onYDragStart,s),onDragEnd:r(this.onYDragEnd,s)},n,Y,{disableChartPanning:!1});this.addChildEntity(e),t.customScaleDblClick&&n.observeDbClick(h).subscribe(()=>{l(!0),this.bus.fireDraw()})}}}const r=(o,i)=>(...t)=>i()&&o(...t);
|
|
@@ -0,0 +1,158 @@
|
|
|
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 { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
8
|
+
import { CursorHandler } from '../../canvas/cursor.handler';
|
|
9
|
+
import { BarType, ChartConfigComponentsYAxis, FullChartColors, FullChartConfig, YAxisAlign, YAxisLabelAppearanceType, YAxisLabelMode, YAxisLabelType } from '../../chart.config';
|
|
10
|
+
import { CompositeDrawer } from '../../drawers/composite.drawer';
|
|
11
|
+
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
12
|
+
import EventBus from '../../events/event-bus';
|
|
13
|
+
import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
|
|
14
|
+
import { PriceMovement } from '../../model/candle-series.model';
|
|
15
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
16
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
17
|
+
import { DataSeriesType } from '../../model/data-series.config';
|
|
18
|
+
import { ScaleModel } from '../../model/scale.model';
|
|
19
|
+
import { ChartModel } from '../chart/chart.model';
|
|
20
|
+
import { PriceAxisType } from '../labels_generator/numeric-axis-labels.generator';
|
|
21
|
+
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
22
|
+
import { PaneManager } from '../pane/pane-manager.component';
|
|
23
|
+
import { VisualYAxisLabel, YAxisLabelsProvider } from './price_labels/y-axis-labels.model';
|
|
24
|
+
import { YAxisScaleHandler } from './y-axis-scale.handler';
|
|
25
|
+
import { YAxisModel } from './y-axis.model';
|
|
26
|
+
import { YAxisWidthContributor } from '../../canvas/y-axis-bounds.container';
|
|
27
|
+
export type LabelColorResolver = (priceMovement: PriceMovement, colors: FullChartColors) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Y axis component. Contains all Y axis related logic.
|
|
30
|
+
*/
|
|
31
|
+
export declare class YAxisComponent extends ChartBaseElement {
|
|
32
|
+
private eventBus;
|
|
33
|
+
private config;
|
|
34
|
+
private canvasModel;
|
|
35
|
+
private yAxisLabelsCanvasModel;
|
|
36
|
+
private backgroundCanvasModel;
|
|
37
|
+
private chartModel;
|
|
38
|
+
private scaleModel;
|
|
39
|
+
private canvasBoundsContainer;
|
|
40
|
+
private cursorHandler;
|
|
41
|
+
yAxisScaleHandler: YAxisScaleHandler;
|
|
42
|
+
yAxisModel: YAxisModel;
|
|
43
|
+
axisTypeSetSubject: Subject<PriceAxisType>;
|
|
44
|
+
readonly state: ChartConfigComponentsYAxis;
|
|
45
|
+
private labelsColorByChartTypeMap;
|
|
46
|
+
drawer: CompositeDrawer;
|
|
47
|
+
constructor(eventBus: EventBus, config: FullChartConfig, canvasModel: CanvasModel, yAxisLabelsCanvasModel: CanvasModel, backgroundCanvasModel: CanvasModel, chartModel: ChartModel, scaleModel: ScaleModel, canvasInputListeners: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, chartPanComponent: ChartPanComponent, paneManager: PaneManager, cursorHandler: CursorHandler);
|
|
48
|
+
private updateCursor;
|
|
49
|
+
/**
|
|
50
|
+
* Updates labels visual appearance on canvas
|
|
51
|
+
*/
|
|
52
|
+
updateOrderedLabels(adjustYAxisWidth?: boolean): void;
|
|
53
|
+
/**
|
|
54
|
+
* Calls the parent class's doActivate method
|
|
55
|
+
* @protected
|
|
56
|
+
* @returns {void}
|
|
57
|
+
*/
|
|
58
|
+
protected doActivate(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Registers default label color resolvers for different chart types.
|
|
61
|
+
* @private
|
|
62
|
+
* @function
|
|
63
|
+
* @name registerDefaultLabelColorResolver
|
|
64
|
+
* @returns {void}
|
|
65
|
+
*/
|
|
66
|
+
private registerDefaultLabelColorResolver;
|
|
67
|
+
/**
|
|
68
|
+
* You can add a custom labels provider for additional labels on YAxis (like for drawings, symbol last price, studies, etc..)
|
|
69
|
+
* @param groupName - a group in which labels position recalculation algorithm will be applied, usually it's subchart name
|
|
70
|
+
* @param provider
|
|
71
|
+
* @param id
|
|
72
|
+
*/
|
|
73
|
+
registerYAxisLabelsProvider(provider: YAxisLabelsProvider, groupName?: string, id?: string): string;
|
|
74
|
+
/**
|
|
75
|
+
* An easier way to manage custom y-axis labels, than y-axis labels providers.
|
|
76
|
+
* However, overlapping avoidance is not supported
|
|
77
|
+
* @param name
|
|
78
|
+
* @param label
|
|
79
|
+
*/
|
|
80
|
+
addSimpleYAxisLabel(name: string, label: VisualYAxisLabel): void;
|
|
81
|
+
/**
|
|
82
|
+
* @param name
|
|
83
|
+
*/
|
|
84
|
+
deleteSimpleYAxisLabel(name: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Unregister a Y axis labels provider from the specified group.
|
|
87
|
+
* @param {string} groupName - The name of the group from which to unregister the provider. Defaults to LabelsGroups.MAIN.
|
|
88
|
+
* @param {string} id - The ID of the provider to unregister.
|
|
89
|
+
* @returns {string} - The ID of the unregistered provider.
|
|
90
|
+
*/
|
|
91
|
+
unregisterYAxisLabelsProvider(groupName: string | undefined, id: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* If custom pane has y-axis it has to register width contributor to correctly calculate overall y-axis width.
|
|
94
|
+
* @param contributor
|
|
95
|
+
*/
|
|
96
|
+
registerYAxisWidthContributor(contributor: YAxisWidthContributor): void;
|
|
97
|
+
/**
|
|
98
|
+
* Sets the type of axis: percent, regular or logarithmic.
|
|
99
|
+
* @param type - the type of axis
|
|
100
|
+
*/
|
|
101
|
+
setAxisType(type: PriceAxisType): void;
|
|
102
|
+
/**
|
|
103
|
+
* Change YAxis position to left or to right
|
|
104
|
+
* @param align
|
|
105
|
+
*/
|
|
106
|
+
setYAxisAlign(align: YAxisAlign): void;
|
|
107
|
+
/**
|
|
108
|
+
* Controls visibility of the y-axis
|
|
109
|
+
*/
|
|
110
|
+
setVisible(isVisible: boolean): void;
|
|
111
|
+
/**
|
|
112
|
+
* If visible, when you can see the y-axis on the chart
|
|
113
|
+
*/
|
|
114
|
+
isVisible(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Controls lockPriceToBarRatio of the y-axis
|
|
117
|
+
*/
|
|
118
|
+
setLockPriceToBarRatio(value?: boolean): void;
|
|
119
|
+
/**
|
|
120
|
+
* Changes the visual type of particular label.
|
|
121
|
+
* @param type - label type
|
|
122
|
+
* @param mode - visual mode
|
|
123
|
+
*/
|
|
124
|
+
changeLabelMode(type: YAxisLabelType, mode: YAxisLabelMode): void;
|
|
125
|
+
/**
|
|
126
|
+
* Changes the visual type of particular label.
|
|
127
|
+
* @param type - label type
|
|
128
|
+
* @param mode - visual mode
|
|
129
|
+
*/
|
|
130
|
+
changeLabelAppearance(type: YAxisLabelType, mode: YAxisLabelAppearanceType): void;
|
|
131
|
+
/**
|
|
132
|
+
* Sets the inverse price scale mode. Inverts Y axis vertically.
|
|
133
|
+
* Inversion also works for candles, drawings and overlay studies.
|
|
134
|
+
* @param inverse - true or false
|
|
135
|
+
*/
|
|
136
|
+
togglePriceScaleInverse(inverse: boolean): void;
|
|
137
|
+
/**
|
|
138
|
+
* Changes the visibility of the labels' descriptions.
|
|
139
|
+
* @param {boolean} descVisibility - A boolean value indicating whether the descriptions should be visible or not.
|
|
140
|
+
* @returns {void}
|
|
141
|
+
*/
|
|
142
|
+
changeLabelsDescriptionVisibility(descVisibility: boolean): void;
|
|
143
|
+
/**
|
|
144
|
+
* Registers a label color resolver for a specific chart type.
|
|
145
|
+
*
|
|
146
|
+
* @param {BarType} chartType - The type of chart for which the label color resolver is being registered.
|
|
147
|
+
* @param {LabelColorResolver} resolver - The function that will be used to resolve the color of the labels for the specified chart type.
|
|
148
|
+
* @returns {void}
|
|
149
|
+
*/
|
|
150
|
+
registerLabelColorResolver(chartType: BarType, resolver: LabelColorResolver): void;
|
|
151
|
+
/**
|
|
152
|
+
* Returns a function that resolves the color for a label based on the type of data series.
|
|
153
|
+
* @param {DataSeriesType} candlesType - The type of data series.
|
|
154
|
+
* @returns {Function} - A function that resolves the color for a label.
|
|
155
|
+
* If there is no color mapping for the given data series type, it returns the default color resolver function.
|
|
156
|
+
*/
|
|
157
|
+
getLabelsColorResolver(candlesType: DataSeriesType): LabelColorResolver;
|
|
158
|
+
}
|
|
@@ -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 g}from"rxjs";import{CanvasElement as d,CHART_UUID as r}from"../../canvas/canvas-bounds-container";import{ClearCanvasDrawer as f}from"../../drawers/clear-canvas.drawer";import{CompositeDrawer as w}from"../../drawers/composite.drawer";import{ChartBaseElement as Y}from"../../model/chart-base-element";import{uuid as D}from"../../utils/uuid.utils";import{resolveColorForArea as S,resolveColorForBar as R,resolveColorForBaseLine as P,resolveColorForCandle as I,resolveColorForHistogram as B,resolveColorForLine as _,resolveColorForScatterPlot as T,resolveColorForTrendAndHollow as b,resolveDefaultColorForLabel as E}from"./label-color.functions";import{LastCandleLabelsProvider as F}from"./price_labels/last-candle-labels.provider";import{LabelsGroups as h}from"./price_labels/y-axis-labels.model";import{YAxisPriceLabelsDrawer as H}from"./price_labels/y-axis-price-labels.drawer";import{YAxisScaleHandler as U}from"./y-axis-scale.handler";import{YAxisDrawer as N}from"./y-axis.drawer";import{YAxisModel as X}from"./y-axis.model";export class YAxisComponent extends Y{constructor(e,s,t,A,x,l,a,C,i,c,L,n,p){super(),this.eventBus=e,this.config=s,this.canvasModel=t,this.yAxisLabelsCanvasModel=A,this.backgroundCanvasModel=x,this.chartModel=l,this.scaleModel=a,this.canvasBoundsContainer=i,this.cursorHandler=p,this.axisTypeSetSubject=new g,this.labelsColorByChartTypeMap={},this.state=s.components.yAxis;const o=new w;this.drawer=o;const y=new f(this.yAxisLabelsCanvasModel);o.addDrawer(y,"YAXIS_CLEAR"),this.registerDefaultLabelColorResolver(),c.addDrawer(o,"Y_AXIS"),this.yAxisScaleHandler=new U(e,this.state,L,a,C,i,i.getBoundsHitTest(d.PANE_UUID_Y_AXIS(r)),M=>a.autoScale(M)),this.addChildEntity(this.yAxisScaleHandler),this.yAxisModel=new X(n.paneComponents[r],e,this.config,i,t,l,a),this.addChildEntity(this.yAxisModel),n.paneComponents[r].yAxisLabelsGenerator=this.yAxisModel.yAxisLabelsGenerator;const u=new N(s,this.state,t,()=>this.yAxisModel.yAxisBaseLabelsModel.labels,()=>i.getBounds(d.Y_AXIS),()=>this.state.visible,l.pane.scaleModel.toY.bind(l.pane.scaleModel));o.addDrawer(u);const v=new H(()=>this.yAxisModel.yAxisLabelsModel.orderedLabels,this.yAxisLabelsCanvasModel,this.backgroundCanvasModel,this.state,this.canvasBoundsContainer,this.config.colors.yAxis,this.yAxisModel.yAxisLabelsModel.customLabels);o.addDrawer(v);const m=new F(this.chartModel,this.config,this.chartModel.lastCandleLabelsByChartType,this.getLabelsColorResolver.bind(this));this.registerYAxisLabelsProvider(m,h.MAIN),n.paneComponents[r].mainYExtentComponent.getAxisType=()=>this.state.type,this.updateCursor()}updateCursor(){this.state.type==="percent"?this.cursorHandler.setCursorForCanvasEl(d.PANE_UUID_Y_AXIS(r),this.config.components.yAxis.resizeDisabledCursor):this.cursorHandler.setCursorForCanvasEl(d.PANE_UUID_Y_AXIS(r),this.config.components.yAxis.cursor)}updateOrderedLabels(e=!1){this.yAxisModel.yAxisLabelsModel.updateLabels(e)}doActivate(){super.doActivate()}registerDefaultLabelColorResolver(){this.registerLabelColorResolver("candle",I),this.registerLabelColorResolver("bar",R),this.registerLabelColorResolver("line",_),this.registerLabelColorResolver("area",S),this.registerLabelColorResolver("scatterPlot",T),this.registerLabelColorResolver("histogram",B),this.registerLabelColorResolver("baseline",P),this.registerLabelColorResolver("trend",b),this.registerLabelColorResolver("hollow",b)}registerYAxisLabelsProvider(e,s=h.MAIN,t=D()){return this.yAxisModel.yAxisLabelsModel.registerYAxisLabelsProvider(s,e,t),t}addSimpleYAxisLabel(e,s){this.yAxisModel.yAxisLabelsModel.customLabels[e]=s,this.canvasModel.fireDraw()}deleteSimpleYAxisLabel(e){delete this.yAxisModel.yAxisLabelsModel.customLabels[e],this.canvasModel.fireDraw()}unregisterYAxisLabelsProvider(e=h.MAIN,s){return this.yAxisModel.yAxisLabelsModel.unregisterYAxisLabelsProvider(e,s),s}registerYAxisWidthContributor(e){this.canvasBoundsContainer.yAxisBoundsContainer.registerYAxisWidthContributor(e)}setAxisType(e){e!==this.state.type&&(this.state.type=e,this.axisTypeSetSubject.next(e),this.scaleModel.autoScale(!0),this.yAxisModel.yAxisLabelsModel.updateLabels(!0),this.updateCursor())}setYAxisAlign(e){this.state.align=e,this.canvasBoundsContainer.updateYAxisWidths(),this.eventBus.fireDraw()}setVisible(e){this.state.visible=e,this.eventBus.fireDraw()}isVisible(){return this.state.visible}setLockPriceToBarRatio(e=!1){this.scaleModel.setLockPriceToBarRatio(e)}changeLabelMode(e,s){this.state.labels.settings[e].mode=s,this.yAxisModel.yAxisLabelsModel.updateLabels()}changeLabelAppearance(e,s){this.state.labels.settings[e].type=s,this.yAxisModel.yAxisLabelsModel.updateLabels()}togglePriceScaleInverse(e){this.scaleModel.state.inverse=e,this.scaleModel.inverseY=e,this.scaleModel.scaleInversedSubject.next(e)}changeLabelsDescriptionVisibility(e){this.state.labels.descriptions=e,this.canvasModel.fireDraw()}registerLabelColorResolver(e,s){this.labelsColorByChartTypeMap[e]=s}getLabelsColorResolver(e){var s;return(s=this.labelsColorByChartTypeMap[e])!==null&&s!==void 0?s:E}}
|
|
@@ -0,0 +1,72 @@
|
|
|
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 { ChartConfigComponentsYAxis, FullChartConfig } from '../../chart.config';
|
|
7
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
8
|
+
import { NumericAxisLabel } from '../labels_generator/numeric-axis-labels.generator';
|
|
9
|
+
import { Drawer } from '../../drawers/drawing-manager';
|
|
10
|
+
import { Unit, ViewportModel } from '../../model/scaling/viewport.model';
|
|
11
|
+
import { Bounds, BoundsProvider } from '../../model/bounds.model';
|
|
12
|
+
export interface YAxisLabel {
|
|
13
|
+
readonly text: string;
|
|
14
|
+
readonly value: Unit;
|
|
15
|
+
}
|
|
16
|
+
export interface YAxisAnimationParameters {
|
|
17
|
+
readonly removed: YAxisLabel[];
|
|
18
|
+
readonly added: YAxisLabel[];
|
|
19
|
+
readonly stay: YAxisLabel[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Draws the Y_AXIS rectangle + it's base labels.
|
|
23
|
+
*/
|
|
24
|
+
export declare class YAxisDrawer implements Drawer {
|
|
25
|
+
private fullConfig;
|
|
26
|
+
private yAxisState;
|
|
27
|
+
private canvasModel;
|
|
28
|
+
private labelsProvider;
|
|
29
|
+
private axisBounds;
|
|
30
|
+
private drawPredicate;
|
|
31
|
+
private toY;
|
|
32
|
+
constructor(fullConfig: FullChartConfig, yAxisState: ChartConfigComponentsYAxis, canvasModel: CanvasModel, labelsProvider: () => Array<NumericAxisLabel>, axisBounds: BoundsProvider, drawPredicate: () => boolean, toY: ViewportModel['toY']);
|
|
33
|
+
/**
|
|
34
|
+
* Draws the axis on the canvas if the drawPredicate is true.
|
|
35
|
+
* It gets the labels from the labelsProvider and the bounds from the axisBounds.
|
|
36
|
+
* It sets the background color of the axis and fills the background rectangle.
|
|
37
|
+
* It gets the font from the yAxisState and calculates the font height.
|
|
38
|
+
* It saves the context, clips it to the bounds and draws the labels with the given font and text color.
|
|
39
|
+
* @function
|
|
40
|
+
*/
|
|
41
|
+
draw(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Draws labels on the Y-axis of a canvas chart.
|
|
44
|
+
* @param {CanvasRenderingContext2D} ctx - The 2D rendering context of the canvas.
|
|
45
|
+
* @param {YAxisLabel[]} labels - An array of objects containing the value and text of each label.
|
|
46
|
+
* @param {Bounds} axisBounds - An object containing the x, y, width, and height of the Y-axis.
|
|
47
|
+
* @param {number} fontHeight - The height of the font used for the labels.
|
|
48
|
+
* @param {string} font - The font used for the labels.
|
|
49
|
+
* @param {string} labelTextColor - The color of the label text.
|
|
50
|
+
*/
|
|
51
|
+
drawLabels(ctx: CanvasRenderingContext2D, labels: YAxisLabel[], axisBounds: Bounds, fontHeight: number, font: string, labelTextColor: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Returns an array of canvas IDs.
|
|
54
|
+
*
|
|
55
|
+
* @returns {Array<string>} An array containing the canvas ID.
|
|
56
|
+
*/
|
|
57
|
+
getCanvasIds(): Array<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the background color of the Y-axis.
|
|
60
|
+
*
|
|
61
|
+
* @protected
|
|
62
|
+
* @returns {string} The background color of the Y-axis.
|
|
63
|
+
*/
|
|
64
|
+
protected getBackgroundColor(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the color of the label text for the chart area axis.
|
|
67
|
+
*
|
|
68
|
+
* @protected
|
|
69
|
+
* @returns {string} The color of the label text.
|
|
70
|
+
*/
|
|
71
|
+
protected getLabelTextColor(): string;
|
|
72
|
+
}
|