@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,193 @@
|
|
|
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 { CanvasAnimation } from '../../animation/canvas-animation';
|
|
7
|
+
import { CanvasBoundsContainer, HitBoundsTest } from '../../canvas/canvas-bounds-container';
|
|
8
|
+
import { CursorHandler } from '../../canvas/cursor.handler';
|
|
9
|
+
import { ChartConfigComponentsYAxis, FullChartConfig } from '../../chart.config';
|
|
10
|
+
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
11
|
+
import EventBus from '../../events/event-bus';
|
|
12
|
+
import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
|
|
13
|
+
import { Bounds } from '../../model/bounds.model';
|
|
14
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
15
|
+
import { ChartBaseElement, ChartEntity } from '../../model/chart-base-element';
|
|
16
|
+
import { DataSeriesModel } from '../../model/data-series.model';
|
|
17
|
+
import { ScaleModel } from '../../model/scale.model';
|
|
18
|
+
import { Unit } from '../../model/scaling/viewport.model';
|
|
19
|
+
import { Unsubscriber } from '../../utils/function.utils';
|
|
20
|
+
import { AtLeastOne } from '../../utils/object.utils';
|
|
21
|
+
import { ChartBaseModel } from '../chart/chart-base.model';
|
|
22
|
+
import { PriceAxisType } from '../labels_generator/numeric-axis-labels.generator';
|
|
23
|
+
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
24
|
+
import { NumericYAxisLabelsGenerator } from '../y_axis/numeric-y-axis-labels.generator';
|
|
25
|
+
import { YAxisScaleHandler } from '../y_axis/y-axis-scale.handler';
|
|
26
|
+
import { YAxisDrawer } from '../y_axis/y-axis.drawer';
|
|
27
|
+
import { YExtentComponent, YExtentCreationOptions } from './extent/y-extent-component';
|
|
28
|
+
import { PaneHitTestController } from './pane-hit-test.controller';
|
|
29
|
+
export interface ExtentYAxis {
|
|
30
|
+
labelsGenerator: NumericYAxisLabelsGenerator;
|
|
31
|
+
drawer: YAxisDrawer;
|
|
32
|
+
yAxisScaleHandler: YAxisScaleHandler;
|
|
33
|
+
state: ChartConfigComponentsYAxis;
|
|
34
|
+
unsub: Unsubscriber;
|
|
35
|
+
}
|
|
36
|
+
export declare class PaneComponent extends ChartBaseElement {
|
|
37
|
+
private chartBaseModel;
|
|
38
|
+
private hitTestController;
|
|
39
|
+
private config;
|
|
40
|
+
private mainScaleModel;
|
|
41
|
+
private drawingManager;
|
|
42
|
+
private chartPanComponent;
|
|
43
|
+
private mainCanvasModel;
|
|
44
|
+
private canvasInputListener;
|
|
45
|
+
private userInputListenerComponents;
|
|
46
|
+
private canvasAnimation;
|
|
47
|
+
private cursorHandler;
|
|
48
|
+
eventBus: EventBus;
|
|
49
|
+
private canvasBoundsContainer;
|
|
50
|
+
readonly uuid: string;
|
|
51
|
+
readonly dataSeriesCanvasModel: CanvasModel;
|
|
52
|
+
private _paneOrder;
|
|
53
|
+
/**
|
|
54
|
+
* Pane hit test (without Y-Axis and resizer)
|
|
55
|
+
*/
|
|
56
|
+
ht: HitBoundsTest;
|
|
57
|
+
yExtentComponents: YExtentComponent[];
|
|
58
|
+
get scaleModel(): ScaleModel;
|
|
59
|
+
get dataSeries(): DataSeriesModel<import("../../model/data-series.model").DataSeriesPoint, import("../../model/data-series.model").VisualSeriesPoint>[];
|
|
60
|
+
mainYExtentComponent: YExtentComponent;
|
|
61
|
+
constructor(chartBaseModel: ChartBaseModel<'candle'>, hitTestController: PaneHitTestController, config: FullChartConfig, mainScaleModel: ScaleModel, drawingManager: DrawingManager, chartPanComponent: ChartPanComponent, mainCanvasModel: CanvasModel, canvasInputListener: CanvasInputListenerComponent, userInputListenerComponents: ChartEntity[], canvasAnimation: CanvasAnimation, cursorHandler: CursorHandler, eventBus: EventBus, canvasBoundsContainer: CanvasBoundsContainer, uuid: string, dataSeriesCanvasModel: CanvasModel, options?: AtLeastOne<YExtentCreationOptions>);
|
|
62
|
+
/**
|
|
63
|
+
* Method that activates the canvas bounds container and recalculates the zoom Y of the scale model.
|
|
64
|
+
* @protected
|
|
65
|
+
* @function
|
|
66
|
+
* @returns {void}
|
|
67
|
+
*/
|
|
68
|
+
protected doActivate(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a Y-axis component for the chart.
|
|
71
|
+
* @private
|
|
72
|
+
* @param {string} uuid - The unique identifier of the chart pane.
|
|
73
|
+
* @param {ScaleModel} scaleModel - The scale model for the chart.
|
|
74
|
+
* @param {(value: number) => string} formatter - The function to format the Y-axis labels.
|
|
75
|
+
* @param {Unsubscriber[]} subs - The array of unsubscriber functions.
|
|
76
|
+
* @param {number | null} increment - The increment value for the Y-axis labels.
|
|
77
|
+
* @returns {[NumericYAxisLabelsGenerator, YAxisDrawer, YAxisScaleHandler]} - An array containing the Y-axis labels generator, Y-axis drawer, and Y-axis scale handler.
|
|
78
|
+
*/
|
|
79
|
+
private createYAxisComponent;
|
|
80
|
+
/**
|
|
81
|
+
* Creates a new GridComponent instance with the provided parameters.
|
|
82
|
+
* @param {string} uuid - The unique identifier of the pane.
|
|
83
|
+
* @param {ScaleModel} scaleModel - The scale model used to calculate the scale of the grid.
|
|
84
|
+
* @param {NumericYAxisLabelsGenerator} yAxisLabelsGenerator - The generator used to create the labels for the y-axis.
|
|
85
|
+
* @returns {GridComponent} - The newly created GridComponent instance.
|
|
86
|
+
*/
|
|
87
|
+
private createGridComponent;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a handler for Y-axis panning of the chart.
|
|
90
|
+
* @private
|
|
91
|
+
* @param {string} uuid - The unique identifier of the chart pane.
|
|
92
|
+
* @param {ScaleModel} scaleModel - The scale model of the chart.
|
|
93
|
+
* @returns {Unsubscriber}
|
|
94
|
+
*/
|
|
95
|
+
private createYPanHandler;
|
|
96
|
+
private addCursors;
|
|
97
|
+
createExtentComponent(options?: AtLeastOne<YExtentCreationOptions>): YExtentComponent;
|
|
98
|
+
removeExtentComponent(extentComponent: YExtentComponent): void;
|
|
99
|
+
/**
|
|
100
|
+
* This method updates the view by calling the doAutoScale method of the scaleModel and firing the Draw event using the eventBus.
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
updateView(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Merges all the y-axis extents on the pane into one.
|
|
106
|
+
*/
|
|
107
|
+
mergeYExtents(): void;
|
|
108
|
+
getYAxisBounds: () => Bounds;
|
|
109
|
+
/**
|
|
110
|
+
* Returns the bounds of the pane component.
|
|
111
|
+
*/
|
|
112
|
+
getBounds(): Bounds;
|
|
113
|
+
/**
|
|
114
|
+
* Hides the pane by removing its bounds from the canvasBoundsContainer and firing a draw event.
|
|
115
|
+
* @function
|
|
116
|
+
* @name hide
|
|
117
|
+
* @memberof PaneComponent
|
|
118
|
+
* @returns {void}
|
|
119
|
+
*/
|
|
120
|
+
hide(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Adds the bounds of the pane to the canvas bounds container and fires a draw event.
|
|
123
|
+
* @function
|
|
124
|
+
* @name show
|
|
125
|
+
* @memberof PaneComponent
|
|
126
|
+
* @returns {void}
|
|
127
|
+
*/
|
|
128
|
+
show(): void;
|
|
129
|
+
/**
|
|
130
|
+
* Creates a new DataSeriesModel object.
|
|
131
|
+
* @returns {DataSeriesModel} - The newly created DataSeriesModel object.
|
|
132
|
+
*/
|
|
133
|
+
createDataSeries(): DataSeriesModel;
|
|
134
|
+
/**
|
|
135
|
+
* Adds a new data series to the chart.
|
|
136
|
+
* @param {DataSeriesModel} series - The data series to be added.
|
|
137
|
+
* @returns {void}
|
|
138
|
+
*/
|
|
139
|
+
addDataSeries(series: DataSeriesModel): void;
|
|
140
|
+
/**
|
|
141
|
+
* Removes a data series from the chart.
|
|
142
|
+
*
|
|
143
|
+
* @param {DataSeriesModel} series - The data series to be removed.
|
|
144
|
+
* @returns {void}
|
|
145
|
+
*/
|
|
146
|
+
removeDataSeries(series: DataSeriesModel): void;
|
|
147
|
+
/**
|
|
148
|
+
* Returns the type of the y-axis component for the current pane.
|
|
149
|
+
*
|
|
150
|
+
* @returns {PriceAxisType} The 'regular' type of the y-axis component for the current pane.
|
|
151
|
+
*
|
|
152
|
+
*/
|
|
153
|
+
getAxisType(): PriceAxisType;
|
|
154
|
+
/**
|
|
155
|
+
* Moves the canvas bounds container up by calling the movePaneUp method with the uuid of the current object.
|
|
156
|
+
* @returns {void}
|
|
157
|
+
*/
|
|
158
|
+
moveUp(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Moves the canvas bounds container down by calling the movePaneDown method with the uuid of the current object.
|
|
161
|
+
* @returns {void}
|
|
162
|
+
*/
|
|
163
|
+
moveDown(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Checks if the current pane can move up.
|
|
166
|
+
* @returns {boolean} - Returns true if the current pane can move up, otherwise false.
|
|
167
|
+
*/
|
|
168
|
+
canMoveUp(): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Checks if the current pane can move down.
|
|
171
|
+
*
|
|
172
|
+
* @returns {boolean} - Returns true if the current pane is not the last one in the canvasBoundsContainer, otherwise returns false.
|
|
173
|
+
*/
|
|
174
|
+
canMoveDown(): boolean;
|
|
175
|
+
valueFormatter: (value: Unit, dataSeries?: DataSeriesModel) => string;
|
|
176
|
+
get regularFormatter(): (value: number) => string;
|
|
177
|
+
/**
|
|
178
|
+
* Sets the pane value formatters for the current instance.
|
|
179
|
+
* @param {YExtentFormatters} formatters - The pane value formatters to be set.
|
|
180
|
+
*/
|
|
181
|
+
setPaneValueFormatters(formatters: YExtentFormatters): void;
|
|
182
|
+
/**
|
|
183
|
+
* Returns the regular value from Y coordinate.
|
|
184
|
+
* @param {number} y - The Y coordinate.
|
|
185
|
+
* @returns {number} - The regular value.
|
|
186
|
+
*/
|
|
187
|
+
regularValueFromY(y: number): number;
|
|
188
|
+
}
|
|
189
|
+
export interface YExtentFormatters {
|
|
190
|
+
regular: (value: number) => string;
|
|
191
|
+
percent?: (value: number, dataSeries?: DataSeriesModel) => string;
|
|
192
|
+
logarithmic?: (value: number) => string;
|
|
193
|
+
}
|
|
@@ -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{distinctUntilChanged as E}from"rxjs/operators";import{areBoundsChanged as B,CanvasElement as d}from"../../canvas/canvas-bounds-container";import{ChartBaseElement as A}from"../../model/chart-base-element";import{defaultValueFormatter as Y}from"../../model/data-series.model";import{SyncedByXScaleModel as w}from"../../model/scale.model";import{firstOf as D,lastOf as y}from"../../utils/array.utils";import{cloneUnsafe as P}from"../../utils/object.utils";import{createCandlesOffsetProvider as _}from"../chart/data-series.high-low-provider";import{GridComponent as S}from"../grid/grid.component";import{NumericYAxisLabelsGenerator as b}from"../y_axis/numeric-y-axis-labels.generator";import{YAxisScaleHandler as U}from"../y_axis/y-axis-scale.handler";import{YAxisDrawer as M}from"../y_axis/y-axis.drawer";import{createDefaultYExtentHighLowProvider as H,YExtentComponent as I}from"./extent/y-extent-component";import{YAxisBaseLabelsModel as N}from"../y_axis/y-axis-base-labels.model";export class PaneComponent extends A{get scaleModel(){return this.mainYExtentComponent.scaleModel}get dataSeries(){return this.yExtentComponents.flatMap(t=>Array.from(t.dataSeries))}constructor(t,e,n,u,m,a,r,i,l,o,h,c,v,s,p,C){super(),this.chartBaseModel=t,this.hitTestController=e,this.config=n,this.mainScaleModel=u,this.drawingManager=m,this.chartPanComponent=a,this.mainCanvasModel=r,this.canvasInputListener=i,this.userInputListenerComponents=l,this.canvasAnimation=o,this.cursorHandler=h,this.eventBus=c,this.canvasBoundsContainer=v,this.uuid=s,this.dataSeriesCanvasModel=p,this._paneOrder=0,this.yExtentComponents=[],this.getYAxisBounds=()=>this.canvasBoundsContainer.getBounds(d.PANE_UUID_Y_AXIS(this.uuid)),this.valueFormatter=(x,f)=>this.mainYExtentComponent.valueFormatter(x,f);const g=this.createExtentComponent(C);this.mainYExtentComponent=g,this.ht=this.canvasBoundsContainer.getBoundsHitTest(d.PANE_UUID(s),{extensionY:-this.config.components.paneResizer.dragZone})}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasBoundsContainer.observeBoundsChanged(d.PANE_UUID(this.uuid)).pipe(E(B)).subscribe(()=>{this.yExtentComponents.forEach(t=>t.scaleModel.recalculateZoomY()),this.dataSeriesCanvasModel.fireDraw()}))}createYAxisComponent(t,e,n,u,m){const a=P(this.config.components.yAxis),r=new b(m,void 0,n,u,()=>"regular",()=>1,a.labelHeight),i=d.PANE_UUID_Y_AXIS(t,e),l=new M(this.config,a,this.mainCanvasModel,()=>r.generateNumericLabels(),()=>this.canvasBoundsContainer.getBounds(i),()=>this.config.components.yAxis.visible,n.toY.bind(n));this.drawingManager.addDrawerAfter(l,i,"Y_AXIS"),a.type="regular";const o=new U(this.eventBus,a,this.chartPanComponent,n,this.canvasInputListener,this.canvasBoundsContainer,this.canvasBoundsContainer.getBoundsHitTest(i),c=>n.autoScale(c)),h=new N(n,r,this.canvasBoundsContainer);return h.activate(),this.userInputListenerComponents.push(o),{labelsGenerator:r,drawer:l,yAxisScaleHandler:o,state:this.config.components.yAxis,unsub:()=>{this.drawingManager.removeDrawerByName(i),h.disable()}}}createGridComponent(t,e,n){return new S(this.mainCanvasModel,e,this.config,`PANE_${t}_grid_drawer`,this.drawingManager,()=>this.canvasBoundsContainer.getBounds(d.PANE_UUID(t)),()=>this.canvasBoundsContainer.getBounds(d.PANE_UUID(t)),()=>[],()=>n.generateNumericLabels())}createYPanHandler(t,e){const n=this.chartPanComponent.chartAreaPanHandler.registerChartYPanHandler(e,this.canvasBoundsContainer.getBoundsHitTest(d.PANE_UUID(t)));return[()=>{this.chartPanComponent.chartAreaPanHandler.removeChildEntity(n),n.disable()},n]}addCursors(t){const e=d.PANE_UUID_Y_AXIS(this.uuid,t);return this.cursorHandler.setCursorForCanvasEl(e,this.config.components.yAxis.cursor),()=>this.cursorHandler.removeCursorForCanvasEl(e)}createExtentComponent(t){var e,n,u,m,a,r;const i=this.yExtentComponents.length,l=()=>this.canvasBoundsContainer.getBounds(d.PANE_UUID(this.uuid)),o=(e=t==null?void 0:t.scaleModel)!==null&&e!==void 0?e:new w(this.mainScaleModel,this.config,l,this.canvasAnimation),h=!((n=t==null?void 0:t.useDefaultYAxis)!==null&&n!==void 0)||n?this.createYAxisComponent(this.uuid,i,o,(m=(u=t==null?void 0:t.paneFormatters)===null||u===void 0?void 0:u.regular)!==null&&m!==void 0?m:Y,(a=t==null?void 0:t.increment)!==null&&a!==void 0?a:null):void 0,[c,v]=this.createYPanHandler(this.uuid,o),s=new I(this.uuid,i,this,this.chartBaseModel,this.canvasBoundsContainer,this.hitTestController,this.dataSeriesCanvasModel,o,h,v);if(s.addSubscription(c),s.addSubscription(this.addCursors(i)),t!=null&&t.paneFormatters&&s.setValueFormatters(t.paneFormatters),((r=t==null?void 0:t.useDefaultHighLow)!==null&&r!==void 0?r:!0)&&o.autoScaleModel.setHighLowProvider("default",_(()=>({top:10,bottom:10,left:0,right:0,visible:!0}),H(s))),h){const C=this.createGridComponent(this.uuid,o,h.labelsGenerator);s.addChildEntity(C)}return s.activate(),this.yExtentComponents.push(s),this.canvasBoundsContainer.updateYAxisWidths(),s}removeExtentComponent(t){t.disable(),this.yExtentComponents.splice(t.idx,1),this.yExtentComponents.forEach((e,n)=>e.idx=n),this.canvasBoundsContainer.updateYAxisWidths()}updateView(){this.yExtentComponents.forEach(t=>{var e;t.scaleModel.doAutoScale(),(e=t.yAxisComponent)===null||e===void 0||e.labelsGenerator.generateNumericLabels()}),this.canvasBoundsContainer.updateYAxisWidths(),this.eventBus.fireDraw()}mergeYExtents(){for(let t=1;t<this.yExtentComponents.length;t++){const e=this.yExtentComponents[t];e.dataSeries.forEach(n=>n.moveToExtent(this.mainYExtentComponent)),e.disable()}this.canvasBoundsContainer.updateYAxisWidths(),this.yExtentComponents=[this.mainYExtentComponent]}getBounds(){return this.mainYExtentComponent.getBounds()}hide(){this._paneOrder=this.canvasBoundsContainer.panesOrder.indexOf(this.uuid),this.canvasBoundsContainer.removedPaneBounds(this.uuid),this.eventBus.fireDraw()}show(){this.canvasBoundsContainer.addPaneBounds(this.uuid,this._paneOrder),this.eventBus.fireDraw()}createDataSeries(){var t;return(t=this.mainYExtentComponent)===null||t===void 0?void 0:t.createDataSeries()}addDataSeries(t){this.mainYExtentComponent.addDataSeries(t),this.updateView()}removeDataSeries(t){this.mainYExtentComponent.removeDataSeries(t),this.updateView()}getAxisType(){return"regular"}moveUp(){this.canvasBoundsContainer.movePaneUp(this.uuid)}moveDown(){this.canvasBoundsContainer.movePaneDown(this.uuid)}canMoveUp(){const t=D(this.canvasBoundsContainer.panesOrder);return this.uuid!==t}canMoveDown(){const t=y(this.canvasBoundsContainer.panesOrder);return this.uuid!==t}get regularFormatter(){return this.mainYExtentComponent.formatters.regular}setPaneValueFormatters(t){this.mainYExtentComponent.setValueFormatters(t)}regularValueFromY(t){return this.mainYExtentComponent.regularValueFromY(t)}}
|
|
@@ -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 { Subject } from 'rxjs';
|
|
7
|
+
import { CanvasAnimation } from '../../animation/canvas-animation';
|
|
8
|
+
import { CanvasBoundsContainer, HitBoundsTest } from '../../canvas/canvas-bounds-container';
|
|
9
|
+
import { FullChartConfig } from '../../chart.config';
|
|
10
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
11
|
+
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
12
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
13
|
+
import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
|
|
14
|
+
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
15
|
+
import { BoundsProvider } from '../../model/bounds.model';
|
|
16
|
+
/**
|
|
17
|
+
* Bar separator between panes.
|
|
18
|
+
* Used to resize the areas height or just draw a fixed line.
|
|
19
|
+
* Supports hover animation.
|
|
20
|
+
*
|
|
21
|
+
* @doc-tags chart-core,resizer
|
|
22
|
+
*/
|
|
23
|
+
export declare class BarResizerComponent extends ChartBaseElement {
|
|
24
|
+
private id;
|
|
25
|
+
private boundsProvider;
|
|
26
|
+
private hitTest;
|
|
27
|
+
private dragTickCb;
|
|
28
|
+
private chartPanComponent;
|
|
29
|
+
private canvasModel;
|
|
30
|
+
private drawingManager;
|
|
31
|
+
private canvasInputListener;
|
|
32
|
+
private canvasAnimation;
|
|
33
|
+
private config;
|
|
34
|
+
private canvasBoundsContainer;
|
|
35
|
+
animationId: string;
|
|
36
|
+
initialY: number;
|
|
37
|
+
resizeEvent$: Subject<void>;
|
|
38
|
+
constructor(id: string, boundsProvider: BoundsProvider, hitTest: HitBoundsTest, dragTickCb: (yDelta: number) => void, chartPanComponent: ChartPanComponent, canvasModel: CanvasModel, drawingManager: DrawingManager, canvasInputListener: CanvasInputListenerComponent, canvasAnimation: CanvasAnimation, config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer);
|
|
39
|
+
/**
|
|
40
|
+
* This method activates the pane resizer component.
|
|
41
|
+
* It calls the parent class's doActivate method and then checks if the fixedMode property is set to false in the config object.
|
|
42
|
+
* If it is false, it creates a new DragNDropYComponent and adds it to the component list.
|
|
43
|
+
* It also adds a subscription to the canvasInputListener to observe mouse enter events and
|
|
44
|
+
* handle hover animations if the animation is enabled in the config object.
|
|
45
|
+
* Finally, it creates a new BarResizerDrawer and adds it to the drawing manager as a DynamicDrawerType.paneResizer with the current id.
|
|
46
|
+
* It also adds a subscription to remove the drawer when the component is deactivated.
|
|
47
|
+
* @protected
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
protected doActivate(): void;
|
|
51
|
+
private onYDragStart;
|
|
52
|
+
private onYDragEnd;
|
|
53
|
+
private onYDragTick;
|
|
54
|
+
/**
|
|
55
|
+
* This method is called when the component is being deactivated.
|
|
56
|
+
* It calls the parent method doDeactivate() and then completes the resizeEvent$ observable.
|
|
57
|
+
* @protected
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
protected doDeactivate(): void;
|
|
61
|
+
/**
|
|
62
|
+
* This function handles the hover animation of a pane resizer. It takes a type parameter which can be either 'fading' or 'appearing'.
|
|
63
|
+
* If the background mode is enabled, it gets the color alpha animation from the canvasAnimation and starts the color alpha animation
|
|
64
|
+
* with the given animationId and the color and type provided in the parameter. If the background mode is not enabled, it gets the color transition
|
|
65
|
+
* animation from the canvasAnimation and starts the color transition animation with the given animationId, startColor, endColor and type
|
|
66
|
+
* provided in the parameter and the duration from the config. If there is an animation in progress, it reverts it.
|
|
67
|
+
*
|
|
68
|
+
* @param {string} type - The type of animation, can be either 'fading' or 'appearing'.
|
|
69
|
+
* @returns {void}
|
|
70
|
+
*/
|
|
71
|
+
handleHoverAnimation(type: 'fading' | 'appearing'): void;
|
|
72
|
+
}
|
|
@@ -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 v}from"rxjs";import{distinctUntilChanged as f,skip as u,startWith as C}from"rxjs/operators";import{DynamicDrawerType as s}from"../../drawers/drawing-manager";import{ChartBaseElement as b}from"../../model/chart-base-element";import{DragNDropYComponent as D}from"../dran-n-drop_helper/drag-n-drop-y.component";import{BarResizerDrawer as A}from"./bar-resizer.drawer";export class BarResizerComponent extends b{constructor(t,i,n,a,o,e,r,h,d,c,m){super(),this.id=t,this.boundsProvider=i,this.hitTest=n,this.dragTickCb=a,this.chartPanComponent=o,this.canvasModel=e,this.drawingManager=r,this.canvasInputListener=h,this.canvasAnimation=d,this.config=c,this.canvasBoundsContainer=m,this.initialY=0,this.resizeEvent$=new v,this.onYDragStart=()=>{this.config.components.crossTool.type="none",this.initialY=this.boundsProvider().y},this.onYDragEnd=()=>{this.config.components.crossTool.type="cross-and-labels",this.initialY=this.boundsProvider().y,this.canvasBoundsContainer.graphsHeightRatioChangedSubject.next(this.canvasBoundsContainer.graphsHeightRatio)},this.onYDragTick=g=>{const{delta:p,draggedPixels:l}=g;Math.abs(this.initialY-this.boundsProvider().y+l)>=0&&(this.dragTickCb(p),this.resizeEvent$.next())},this.animationId=`${this.id}_RESIZER`}doActivate(){if(super.doActivate(),!this.config.components.paneResizer.fixedMode){const n=new D(this.hitTest,{onDragTick:this.onYDragTick,onDragStart:this.onYDragStart,onDragEnd:this.onYDragEnd},this.canvasInputListener,this.chartPanComponent);this.addChildEntity(n),this.config.animation.paneResizer.enabled&&this.addRxSubscription(this.canvasInputListener.observeMouseEnter(this.hitTest,!0).pipe(C(!1),f(),u(1)).subscribe(a=>{a?this.handleHoverAnimation("appearing"):this.handleHoverAnimation("fading")}))}const i=new A(this.config,this.boundsProvider,this.canvasModel,this.canvasAnimation,this.animationId);this.drawingManager.addDrawer(i,s.paneResizer(this.id)),this.addSubscription(()=>this.drawingManager.removeDrawerByName(s.paneResizer(this.id)))}doDeactivate(){super.doDeactivate(),this.resizeEvent$.complete()}handleHoverAnimation(t){let i;this.config.animation.paneResizer.bgMode?(i=this.canvasAnimation.getColorAlphaAnimation(this.animationId),(!i||!i.animationInProgress)&&this.canvasAnimation.startColorAlphaAnimation(this.animationId,[{color:this.config.colors.paneResizer.bgHoverColor,type:t}])):(i=this.canvasAnimation.getColorTransitionAnimation(this.animationId),(!i||!i.animationInProgress)&&this.canvasAnimation.startColorTransitionAnimation(this.animationId,[{startColor:this.config.colors.paneResizer.bgColor,endColor:this.config.colors.paneResizer.bgHoverColor,type:t}],this.config.animation.paneResizer.duration)),i&&i.animationInProgress&&i.revert()}}
|
|
@@ -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 { CanvasAnimation } from '../../animation/canvas-animation';
|
|
7
|
+
import { FullChartConfig } from '../../chart.config';
|
|
8
|
+
import { Drawer } from '../../drawers/drawing-manager';
|
|
9
|
+
import { BoundsProvider } from '../../model/bounds.model';
|
|
10
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
11
|
+
export declare class BarResizerDrawer implements Drawer {
|
|
12
|
+
private config;
|
|
13
|
+
private boundsProvider;
|
|
14
|
+
private canvasModel;
|
|
15
|
+
private canvasAnimation;
|
|
16
|
+
private animationId;
|
|
17
|
+
constructor(config: FullChartConfig, boundsProvider: BoundsProvider, canvasModel: CanvasModel, canvasAnimation: CanvasAnimation, animationId: string);
|
|
18
|
+
/**
|
|
19
|
+
* Draws the pane resizer on the canvas if it is visible.
|
|
20
|
+
* The resizer is drawn with a fixed mode or with an animation.
|
|
21
|
+
* The resizer's position and size are determined by the bounds provider.
|
|
22
|
+
* The yAxisWidth is calculated based on the canvas bounds container.
|
|
23
|
+
* The resizerXOffset and resizerWidthOffset are calculated based on the yAxis alignment.
|
|
24
|
+
* The resizer is filled with a color based on the animation or the config colors.
|
|
25
|
+
* If the bgMode is true, the resizer is filled without the drag zone, otherwise it is filled with the drag zone.
|
|
26
|
+
*/
|
|
27
|
+
draw(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Returns an array of canvas IDs.
|
|
30
|
+
*
|
|
31
|
+
* @returns {Array<string>} An array containing the ID of the canvas model.
|
|
32
|
+
*/
|
|
33
|
+
getCanvasIds(): Array<string>;
|
|
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
|
+
export class BarResizerDrawer{constructor(o,i,e,n,t){this.config=o,this.boundsProvider=i,this.canvasModel=e,this.canvasAnimation=n,this.animationId=t}draw(){if(this.config.components.paneResizer.visible){const o=this.config.components.paneResizer.fixedMode,i=this.boundsProvider(),e=this.canvasModel.ctx,n=this.canvasAnimation.getColorAlphaAnimation(this.animationId),t=this.config.components.paneResizer.dragZone;!o&&n&&(e.fillStyle=n.getColor(0),e.fillRect(i.x,i.y-t,i.width,i.height+2*t)),e.fillStyle=this.config.colors.paneResizer.lineColor,this.config.animation.paneResizer.bgMode?e.fillRect(i.x,i.y,i.width,i.height):e.fillRect(i.x,i.y-t,i.width,i.height+2*t)}}getCanvasIds(){return[this.canvasModel.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 { ChartBaseElement } from '../../model/chart-base-element';
|
|
7
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
8
|
+
import { ValidatedChartElements } from '../../canvas/chart-elements';
|
|
9
|
+
/**
|
|
10
|
+
* Snapshot Component.
|
|
11
|
+
* Allows to copy, download and share snapshot
|
|
12
|
+
*/
|
|
13
|
+
export declare class SnapshotComponent extends ChartBaseElement {
|
|
14
|
+
private elements;
|
|
15
|
+
private canvasModel;
|
|
16
|
+
constructor(elements: ValidatedChartElements, canvasModel: CanvasModel);
|
|
17
|
+
/**
|
|
18
|
+
* Implements doActivate method.
|
|
19
|
+
* @protected
|
|
20
|
+
* @returns {void}
|
|
21
|
+
*/
|
|
22
|
+
protected doActivate(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a snapshot of the canvas and returns it as a Promise of Blob object.
|
|
25
|
+
* @param {function} userDrawCallback - Optional callback function that takes a CanvasRenderingContext2D object
|
|
26
|
+
* as a parameter and allows the user to draw on the canvas before taking the snapshot.
|
|
27
|
+
* @returns {Promise<Blob>} - A Promise that resolves with a Blob object representing the snapshot of the canvas.
|
|
28
|
+
* @throws {Error} - If the snapshot isn't supported, an error is thrown.
|
|
29
|
+
*/
|
|
30
|
+
createSnapshot(userDrawCallback?: (ctx: CanvasRenderingContext2D) => void): Promise<Blob>;
|
|
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{ChartBaseElement as h}from"../../model/chart-base-element";export class SnapshotComponent extends h{constructor(n,a){super(),this.elements=n,this.canvasModel=a}doActivate(){super.doActivate()}createSnapshot(n){const a=this.canvasModel.canvas,e=this.canvasModel.ctx;if(e){e.clearRect(0,0,a.width,a.height);const t=a.width/window.devicePixelRatio,s=a.height/window.devicePixelRatio;return e.drawImage(this.elements.backgroundCanvas,0,0,t,s),e.drawImage(this.elements.mainCanvas,0,0,t,s),e.drawImage(this.elements.staticDrawingCanvas,0,0,t,s),e.drawImage(this.elements.dataSeriesCanvas,0,0,t,s),e.drawImage(this.elements.overDataSeriesCanvas,0,0,t,s),e.drawImage(this.elements.dynamicDrawingCanvas,0,0,t,s),e.drawImage(this.elements.crossToolCanvas,0,0,t,s),n&&n(e),new Promise((o,r)=>this.elements.snapshotCanvas.toBlob(i=>i?o(i):r("Blob is null")))}else return console.error("Snapshot isn't supported"),Promise.reject()}}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
7
|
+
import { BarType, FullChartConfig } from '../../chart.config';
|
|
8
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
9
|
+
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
10
|
+
import { ScaleModel } from '../../model/scale.model';
|
|
11
|
+
import { Pixel, Unit } from '../../model/scaling/viewport.model';
|
|
12
|
+
import { ChartComponent } from '../chart/chart.component';
|
|
13
|
+
import { PaneManager } from '../pane/pane-manager.component';
|
|
14
|
+
import { VolumeColorResolver } from './volumes.component';
|
|
15
|
+
import { VolumesModel } from './volumes.model';
|
|
16
|
+
export declare class SeparateVolumesComponent extends ChartBaseElement {
|
|
17
|
+
private canvasModel;
|
|
18
|
+
private chartComponent;
|
|
19
|
+
private drawingManager;
|
|
20
|
+
private config;
|
|
21
|
+
private volumesModel;
|
|
22
|
+
private readonly volumesColorByChartTypeMap;
|
|
23
|
+
private paneManager;
|
|
24
|
+
static UUID: string;
|
|
25
|
+
scaleModel: ScaleModel | undefined;
|
|
26
|
+
constructor(canvasModel: CanvasModel, chartComponent: ChartComponent, drawingManager: DrawingManager, config: FullChartConfig, volumesModel: VolumesModel, volumesColorByChartTypeMap: Partial<Record<BarType, VolumeColorResolver>>, paneManager: PaneManager);
|
|
27
|
+
protected doActivate(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Activates the separate volumes feature.
|
|
30
|
+
* If the pane component for separate volumes does not exist, it creates a new pane with the specified UUID and options.
|
|
31
|
+
* It then sets the high-low provider for the volumes scale model and does an auto scale.
|
|
32
|
+
* A new VolumesDrawer is created and added to the drawing manager with the specified parameters.
|
|
33
|
+
*/
|
|
34
|
+
activateSeparateVolumes(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Deactivates the separate volumes feature by removing the separate volumes pane, deleting the scale model, and removing the underlay volumes area drawer.
|
|
37
|
+
*/
|
|
38
|
+
deactiveSeparateVolumes(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Converts a pixel value from the Y-axis of the scale model to the corresponding data value.
|
|
41
|
+
* @param {Pixel} y - The pixel value to convert.
|
|
42
|
+
* @returns {Unit} - The corresponding data value.
|
|
43
|
+
*/
|
|
44
|
+
fromY(y: Pixel): Unit;
|
|
45
|
+
}
|
|
@@ -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 n}from"../../model/chart-base-element";import{createCandlesOffsetProvider as d}from"../chart/data-series.high-low-provider";import{VolumesDrawer as h}from"./volumes.drawer";import{volumeFormatter as u}from"./volumes.formatter";class a extends n{constructor(o,e,t,s,r,i,l){super(),this.canvasModel=o,this.chartComponent=e,this.drawingManager=t,this.config=s,this.volumesModel=r,this.volumesColorByChartTypeMap=i,this.paneManager=l,s.components.volumes.showSeparately&&this.activateSeparateVolumes()}doActivate(){super.doActivate(),this.addRxSubscription(this.chartComponent.chartModel.candlesUpdatedSubject.subscribe(()=>{var o,e;return!(!((o=this.scaleModel)===null||o===void 0)&&o.isViewportValid())&&((e=this.scaleModel)===null||e===void 0?void 0:e.doAutoScale(!0))})),this.addRxSubscription(this.volumesModel.volumeMax.subscribe(()=>{var o;return(o=this.scaleModel)===null||o===void 0?void 0:o.doAutoScale()}))}activateSeparateVolumes(){if(this.paneManager.paneComponents[a.UUID]===void 0){const o=this.paneManager.createPane(a.UUID,{paneFormatters:{regular:u},useDefaultHighLow:!1,increment:1}),{scaleModel:e}=o,t=d(()=>({top:10,bottom:0,left:0,right:0,visible:!0}),this.volumesModel.highLowProvider);e.autoScaleModel.setHighLowProvider("volumes",t),e.doAutoScale(!0),this.scaleModel=e;const s=new h(this.canvasModel,this.config,this.volumesModel,this.chartComponent.chartModel,e,this.volumesColorByChartTypeMap,()=>this.config.components.volumes.showSeparately);this.drawingManager.addDrawer(s,"UNDERLAY_VOLUMES_AREA")}}deactiveSeparateVolumes(){this.paneManager.removePane(a.UUID),delete this.scaleModel,this.drawingManager.removeDrawerByName("UNDERLAY_VOLUMES_AREA")}fromY(o){var e,t;return(t=(e=this.scaleModel)===null||e===void 0?void 0:e.fromY(o))!==null&&t!==void 0?t:0}}a.UUID="volumes";export{a as SeparateVolumesComponent};
|
|
@@ -0,0 +1,11 @@
|
|
|
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 { VolumeColorResolver } from './volumes.component';
|
|
7
|
+
export declare const VOLUMES_COLOR_OPACITY = 0.3;
|
|
8
|
+
export declare const resolveColorForBar: VolumeColorResolver;
|
|
9
|
+
export declare const resolveColorUsingConfig: VolumeColorResolver;
|
|
10
|
+
export declare const resolveColorForLine: VolumeColorResolver;
|
|
11
|
+
export declare const resolveColorForCandle: VolumeColorResolver;
|
|
@@ -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 t from"color";export const VOLUMES_COLOR_OPACITY=.3,resolveColorForBar=(o,r)=>{const e=r.barTheme[`${o}Color`];return t(e).alpha(VOLUMES_COLOR_OPACITY).toString()},resolveColorUsingConfig=(o,r)=>{const e=r.volume[`${o}BarColor`];return t(e).alpha(VOLUMES_COLOR_OPACITY).toString()},resolveColorForLine=(o,r)=>{const e=r.lineTheme[`${o}Color`];return t(e).alpha(VOLUMES_COLOR_OPACITY).toString()},resolveColorForCandle=(o,r)=>{const e=r.candleTheme[`${o}Color`];return t(e).alpha(VOLUMES_COLOR_OPACITY).toString()};
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { BarType, FullChartColors, FullChartConfig } from '../../chart.config';
|
|
9
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
10
|
+
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
11
|
+
import { PriceMovement } from '../../model/candle-series.model';
|
|
12
|
+
import { ScaleModel } from '../../model/scale.model';
|
|
13
|
+
import { ChartComponent } from '../chart/chart.component';
|
|
14
|
+
import { PaneManager } from '../pane/pane-manager.component';
|
|
15
|
+
import { SeparateVolumesComponent } from './separate-volumes.component';
|
|
16
|
+
import { VolumesModel } from './volumes.model';
|
|
17
|
+
import { YAxisComponent } from '../y_axis/y-axis.component';
|
|
18
|
+
import { BehaviorSubject } from 'rxjs';
|
|
19
|
+
export type VolumeColorResolver = (priceMovement: PriceMovement, colors: FullChartColors) => string;
|
|
20
|
+
export declare class VolumesComponent extends ChartBaseElement {
|
|
21
|
+
private canvasModel;
|
|
22
|
+
private canvasBoundsContainer;
|
|
23
|
+
private config;
|
|
24
|
+
separateVolumes: SeparateVolumesComponent;
|
|
25
|
+
private volumesColorByChartTypeMap;
|
|
26
|
+
volumesModel: VolumesModel;
|
|
27
|
+
yAxisComponent: YAxisComponent;
|
|
28
|
+
volumeSettingChangedSubject: BehaviorSubject<boolean>;
|
|
29
|
+
constructor(canvasModel: CanvasModel, chartComponent: ChartComponent, scaleModel: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, config: FullChartConfig, paneManager: PaneManager, yAxisComponent: YAxisComponent);
|
|
30
|
+
/**
|
|
31
|
+
* Registers default volume color resolvers for candle, line and bar charts
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
private registerDefaultVolumeColorResolvers;
|
|
35
|
+
/**
|
|
36
|
+
* Sets whether the volumes should be shown separately or not.
|
|
37
|
+
*
|
|
38
|
+
* @param {boolean} separate - A boolean value indicating whether the volumes should be shown separately or not.
|
|
39
|
+
* @returns {void}
|
|
40
|
+
*/
|
|
41
|
+
setShowVolumesSeparatly(separate: boolean): void;
|
|
42
|
+
/**
|
|
43
|
+
* This method deactivates the current component by calling the superclass doDeactivate method and setting the visibility of the component to false.
|
|
44
|
+
* @returns {void}
|
|
45
|
+
*/
|
|
46
|
+
protected doDeactivate(): void;
|
|
47
|
+
/**
|
|
48
|
+
* You can use this method to determine volumes' color for specified chart type.
|
|
49
|
+
* @param chartType
|
|
50
|
+
* @param resolver
|
|
51
|
+
*/
|
|
52
|
+
registerVolumeColorResolver(chartType: BarType, resolver: VolumeColorResolver): void;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the visibility of the volumes component and updates the canvas accordingly.
|
|
55
|
+
* @param {boolean} visible - Whether the volumes component should be visible or not. Default is true.
|
|
56
|
+
* @returns {void}
|
|
57
|
+
*/
|
|
58
|
+
setVisible(visible?: boolean): void;
|
|
59
|
+
}
|
|
@@ -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 n}from"../../model/chart-base-element";import{SeparateVolumesComponent as p}from"./separate-volumes.component";import{resolveColorForBar as v,resolveColorForCandle as r,resolveColorForLine as C}from"./volume-color-resolvers.functions";import{VolumesDrawer as V}from"./volumes.drawer";import{VolumesModel as c}from"./volumes.model";import{BehaviorSubject as d}from"rxjs";export class VolumesComponent extends n{constructor(e,o,l,a,i,s,m,u){super(),this.canvasModel=e,this.canvasBoundsContainer=a,this.config=s,this.volumesColorByChartTypeMap={},this.volumeSettingChangedSubject=new d(!1);const t=new c(o,l);this.volumesModel=t,this.yAxisComponent=u,this.addChildEntity(t),this.separateVolumes=new p(e,o,i,s,t,this.volumesColorByChartTypeMap,m),this.addChildEntity(this.separateVolumes);const h=new V(e,s,t,o.chartModel,l,this.volumesColorByChartTypeMap,()=>!s.components.volumes.showSeparately);i.addDrawer(h,"VOLUMES"),this.registerDefaultVolumeColorResolvers(),this.volumeSettingChangedSubject.next(s.components.volumes.visible)}registerDefaultVolumeColorResolvers(){this.registerVolumeColorResolver("candle",r),this.registerVolumeColorResolver("trend",r),this.registerVolumeColorResolver("hollow",r),this.registerVolumeColorResolver("line",C),this.registerVolumeColorResolver("bar",v)}setShowVolumesSeparatly(e){this.config.components.volumes.showSeparately!==e&&(this.config.components.volumes.showSeparately=e,e?this.separateVolumes.activateSeparateVolumes():this.separateVolumes.deactiveSeparateVolumes())}doDeactivate(){super.doDeactivate(),this.setVisible(!1)}registerVolumeColorResolver(e,o){this.volumesColorByChartTypeMap[e]=o}setVisible(e=!0){this.config.components.volumes.visible=e,this.volumeSettingChangedSubject.next(e),this.config.components.volumes.showSeparately===!0&&(e?this.separateVolumes.activateSeparateVolumes():this.separateVolumes.deactiveSeparateVolumes()),this.canvasBoundsContainer.recalculatePanesHeightRatios(),this.canvasModel.fireDraw()}}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { BarType, FullChartConfig } from '../../chart.config';
|
|
7
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
8
|
+
import { Drawer } from '../../drawers/drawing-manager';
|
|
9
|
+
import { ViewportModel } from '../../model/scaling/viewport.model';
|
|
10
|
+
import { ChartModel } from '../chart/chart.model';
|
|
11
|
+
import { VolumeColorResolver } from './volumes.component';
|
|
12
|
+
import { VolumesModel } from './volumes.model';
|
|
13
|
+
export declare class VolumesDrawer implements Drawer {
|
|
14
|
+
private canvasModel;
|
|
15
|
+
private config;
|
|
16
|
+
private volumesModel;
|
|
17
|
+
private chartModel;
|
|
18
|
+
private viewportModel;
|
|
19
|
+
private volumesColorByChartTypeMap;
|
|
20
|
+
private drawPredicate;
|
|
21
|
+
private readonly volumeBarColors;
|
|
22
|
+
constructor(canvasModel: CanvasModel, config: FullChartConfig, volumesModel: VolumesModel, chartModel: ChartModel, viewportModel: ViewportModel, volumesColorByChartTypeMap: Partial<Record<BarType, VolumeColorResolver>>, drawPredicate: () => boolean);
|
|
23
|
+
/**
|
|
24
|
+
* This function is used to calculate the colors for each volume bar. It is an optimization to avoid calculating the color for each volume, which can be expensive.
|
|
25
|
+
* @param {BarType} barType - The type of bar to calculate the color for.
|
|
26
|
+
* @returns {void}
|
|
27
|
+
*/
|
|
28
|
+
private calculateColors;
|
|
29
|
+
/**
|
|
30
|
+
* Draws the volumes on the chart canvas if the volumes are visible and the drawPredicate is true.
|
|
31
|
+
* Calculates the colors based on the chart type and saves the canvas context.
|
|
32
|
+
* Clips the canvas to the viewport bounds and draws the volumes.
|
|
33
|
+
* Restores the canvas context.
|
|
34
|
+
* @returns {void}
|
|
35
|
+
*/
|
|
36
|
+
draw(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Draws the last bar of the chart if the volumes component is visible.
|
|
39
|
+
* TODO: Rework the function.
|
|
40
|
+
*
|
|
41
|
+
* @returns {void}
|
|
42
|
+
*/
|
|
43
|
+
drawLastBar(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Draws volumes on the chart based on the data provided by the volumesModel and chartModel.
|
|
46
|
+
* If the volumeMax is 0, the function will return without drawing anything.
|
|
47
|
+
* The function loops through all the candles in the viewport and calculates the x, y, width and height of each volume bar.
|
|
48
|
+
* If the config.components.volumes.showSeparately is true, the function will draw each volume bar separately.
|
|
49
|
+
* Otherwise, it will calculate the zoomY based on the volumeMax and the fullVHeight, and draw all the volume bars together.
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
private drawVolumes;
|
|
53
|
+
/**
|
|
54
|
+
* Draws a volume bar on the canvas.
|
|
55
|
+
*
|
|
56
|
+
* @private
|
|
57
|
+
* @param {VisualCandle} vCandle - The visual candle object.
|
|
58
|
+
* @param {Pixel} x - The x coordinate of the top-left corner of the volume bar.
|
|
59
|
+
* @param {Pixel} y - The y coordinate of the top-left corner of the volume bar.
|
|
60
|
+
* @param {Pixel} width - The width of the volume bar.
|
|
61
|
+
* @param {Pixel} height - The height of the volume bar.
|
|
62
|
+
* @returns {void}
|
|
63
|
+
*/
|
|
64
|
+
private drawVolume;
|
|
65
|
+
/**
|
|
66
|
+
* Returns an array of canvas ids.
|
|
67
|
+
*
|
|
68
|
+
* @returns {Array<string>} An array containing the canvas id.
|
|
69
|
+
*/
|
|
70
|
+
getCanvasIds(): Array<string>;
|
|
71
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{clipToBounds as f}from"../../drawers/data-series.drawer";import{unitToPixels as m}from"../../model/scaling/viewport.model";import{ceilToDPR as u,floorToDPR as n}from"../../utils/device/device-pixel-ratio.utils";import{resolveColorUsingConfig as p}from"./volume-color-resolvers.functions";import{flat as M}from"../../utils/array.utils";const w=3;export class VolumesDrawer{constructor(e,t,o,i,l,s,r){this.canvasModel=e,this.config=t,this.volumesModel=o,this.chartModel=i,this.viewportModel=l,this.volumesColorByChartTypeMap=s,this.drawPredicate=r,this.volumeBarColors={down:"#FF00FF",up:"#FF00FF",none:"#FF00FF"}}calculateColors(e){var t;const o=(t=this.volumesColorByChartTypeMap[e])!==null&&t!==void 0?t:p;this.volumeBarColors.down=o("down",this.config.colors),this.volumeBarColors.up=o("up",this.config.colors),this.volumeBarColors.none=o("none",this.config.colors)}draw(){if(this.config.components.volumes.visible&&this.drawPredicate()){this.calculateColors(this.config.components.chart.type);const e=this.canvasModel.ctx;e.save();const t=this.viewportModel.getBounds();f(e,t),this.drawVolumes(),e.restore()}}drawLastBar(){this.config.components.volumes.visible}drawVolumes(){const e=this.volumesModel.volumeMax.getValue();if(e===0)return;const t=M(this.chartModel.mainCandleSeries.getSeriesInViewport(this.chartModel.scaleModel.xStart-1,this.chartModel.scaleModel.xEnd+1));t.forEach((o,i)=>{if(o.candle.volume){const l=this.viewportModel.getBounds(),s=l.height,r=t[i+1]!==void 0?n(this.viewportModel.toX(t[i+1].startUnit)):void 0,c=n(this.viewportModel.toX(o.startUnit)),a=r!==void 0?r-c:n(m(o.width,this.viewportModel.zoomX));if(this.config.components.volumes.showSeparately){const h=n(this.viewportModel.toY(o.candle.volume)),d=n(this.viewportModel.toY(0))-h;this.drawVolume(o,c,h,a,d)}else{const h=e/(s/w),d=Math.max(m(o.candle.volume,h),2),v=n(l.y+s-d);this.drawVolume(o,c,v,a,d)}}})}drawVolume(e,t,o,i,l){const s=this.canvasModel.ctx,r=o,c=o+l,a=e.name;s.fillStyle=this.volumeBarColors[a],s.strokeStyle=this.volumeBarColors[a],i===0?(s.beginPath(),s.moveTo(t,r),s.lineTo(t,u(c)),s.stroke()):s.fillRect(t,o,i,u(l))}getCanvasIds(){return[this.canvasModel.canvasId]}}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
export declare const volumeFormatter: (value: number) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
const c=5,_=1e-10,s=/\.?0+$/,E=/(\.[1-9]*)0+$/;export const volumeFormatter=t=>{const r=(I,e)=>{const o=Math.pow(10,5),n=Math.round(I*o)/o;return n<1&&n>=1e-10?n.toFixed(5).replace(s,"").replace(E,""):(n+"").replace(E,"")+(e||"")};return Math.abs(t)>999999999?(t=Math.round(t/1e6)*1e6,r(t/1e9,"B")):Math.abs(t)>999999?(t=1e3*Math.round(t/1e3),r(t/1e6,"M")):Math.abs(t)>9999?r(t/1e3,"K"):r(t)};
|