@devexperts/dxcharts-lite 1.0.1 → 2.0.0
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/README.md +4 -4
- package/dist/chart/animation/canvas-animation.d.ts +1 -1
- package/dist/chart/animation/canvas-animation.js +135 -2
- package/dist/chart/animation/types/animation.d.ts +1 -1
- package/dist/chart/animation/types/animation.js +44 -2
- package/dist/chart/animation/types/color-alpha-animation.d.ts +2 -2
- package/dist/chart/animation/types/color-alpha-animation.js +61 -2
- package/dist/chart/animation/types/color-transition-animation.d.ts +2 -2
- package/dist/chart/animation/types/color-transition-animation.js +87 -2
- package/dist/chart/animation/types/viewport-movement-animation.d.ts +1 -1
- package/dist/chart/animation/types/viewport-movement-animation.js +64 -2
- package/dist/chart/animation/viewport-model-animation.d.ts +1 -1
- package/dist/chart/animation/viewport-model-animation.js +21 -2
- package/dist/chart/bootstrap.d.ts +52 -49
- package/dist/chart/bootstrap.js +450 -2
- package/dist/chart/canvas/canvas-bounds-container.d.ts +1 -6
- package/dist/chart/canvas/canvas-bounds-container.js +816 -2
- package/dist/chart/canvas/canvas-chart-html.d.ts +1 -1
- package/dist/chart/canvas/canvas-chart-html.js +17 -19
- package/dist/chart/canvas/chart-elements.d.ts +2 -5
- package/dist/chart/canvas/chart-elements.js +23 -2
- package/dist/chart/canvas/cursor.handler.d.ts +1 -1
- package/dist/chart/canvas/cursor.handler.js +123 -2
- package/dist/chart/canvas/layout-creator.d.ts +1 -1
- package/dist/chart/canvas/layout-creator.js +35 -2
- package/dist/chart/canvas/y-axis-bounds.container.d.ts +3 -3
- package/dist/chart/canvas/y-axis-bounds.container.js +68 -2
- package/dist/chart/chart-container.d.ts +1 -1
- package/dist/chart/chart-container.js +2 -2
- package/dist/chart/chart.config.d.ts +5 -6
- package/dist/chart/chart.config.js +646 -2
- package/dist/chart/chart.d.ts +62 -0
- package/dist/chart/chart.js +106 -0
- package/dist/chart/components/chart/basic-scale.d.ts +3 -3
- package/dist/chart/components/chart/basic-scale.js +32 -2
- package/dist/chart/components/chart/candle-transformer.functions.d.ts +1 -1
- package/dist/chart/components/chart/candle-transformer.functions.js +16 -2
- package/dist/chart/components/chart/candle-width-calculator.functions.d.ts +1 -1
- package/dist/chart/components/chart/candle-width-calculator.functions.js +3 -2
- package/dist/chart/components/chart/candle.functions.d.ts +1 -1
- package/dist/chart/components/chart/candle.functions.js +45 -2
- package/dist/chart/components/chart/chart-area-pan.handler.d.ts +4 -4
- package/dist/chart/components/chart/chart-area-pan.handler.js +198 -2
- package/dist/chart/components/chart/chart-base.model.d.ts +1 -1
- package/dist/chart/components/chart/chart-base.model.js +67 -2
- package/dist/chart/components/chart/chart.component.d.ts +8 -4
- package/dist/chart/components/chart/chart.component.js +409 -2
- package/dist/chart/components/chart/chart.model.d.ts +5 -12
- package/dist/chart/components/chart/chart.model.js +955 -2
- package/dist/chart/components/chart/data-series.high-low-provider.d.ts +1 -1
- package/dist/chart/components/chart/data-series.high-low-provider.js +35 -2
- package/dist/chart/components/chart/fake-candles.d.ts +1 -1
- package/dist/chart/components/chart/fake-candles.js +98 -2
- package/dist/chart/components/chart/price.formatter.d.ts +1 -1
- package/dist/chart/components/chart/price.formatter.js +36 -2
- package/dist/chart/components/chart/secondary-chart-colors-pool.d.ts +1 -1
- package/dist/chart/components/chart/secondary-chart-colors-pool.js +69 -2
- package/dist/chart/components/cross_tool/cross-tool.component.d.ts +1 -1
- package/dist/chart/components/cross_tool/cross-tool.component.js +86 -2
- package/dist/chart/components/cross_tool/cross-tool.drawer.d.ts +1 -1
- package/dist/chart/components/cross_tool/cross-tool.drawer.js +33 -2
- package/dist/chart/components/cross_tool/cross-tool.model.d.ts +1 -1
- package/dist/chart/components/cross_tool/cross-tool.model.js +108 -2
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.d.ts +1 -1
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +138 -2
- package/dist/chart/components/cross_tool/types/none.drawer.d.ts +1 -1
- package/dist/chart/components/cross_tool/types/none.drawer.js +4 -2
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.d.ts +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +29 -2
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.d.ts +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +25 -2
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.d.ts +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +54 -2
- package/dist/chart/components/dynamic-objects/dynamic-objects.component.d.ts +13 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.component.js +20 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.d.ts +18 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.js +23 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.model.d.ts +63 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.model.js +136 -0
- package/dist/chart/components/events/events-hit-test.drawer.d.ts +1 -1
- package/dist/chart/components/events/events-hit-test.drawer.js +64 -2
- package/dist/chart/components/events/events.component.d.ts +1 -1
- package/dist/chart/components/events/events.component.js +62 -2
- package/dist/chart/components/events/events.drawer.d.ts +1 -1
- package/dist/chart/components/events/events.drawer.js +196 -2
- package/dist/chart/components/events/events.model.d.ts +1 -1
- package/dist/chart/components/events/events.model.js +70 -2
- package/dist/chart/components/grid/grid.component.d.ts +3 -3
- package/dist/chart/components/grid/grid.component.js +32 -2
- package/dist/chart/components/grid/grid.drawer.d.ts +5 -4
- package/dist/chart/components/grid/grid.drawer.js +107 -2
- package/dist/chart/components/high_low/high-low.component.d.ts +1 -1
- package/dist/chart/components/high_low/high-low.component.js +13 -2
- package/dist/chart/components/high_low/high-low.drawer.d.ts +1 -1
- package/dist/chart/components/high_low/high-low.drawer.js +127 -2
- package/dist/chart/components/highlights/highlights.component.d.ts +1 -1
- package/dist/chart/components/highlights/highlights.component.js +47 -2
- package/dist/chart/components/highlights/highlights.drawer.d.ts +1 -1
- package/dist/chart/components/highlights/highlights.drawer.js +155 -2
- package/dist/chart/components/highlights/highlights.model.d.ts +1 -1
- package/dist/chart/components/highlights/highlights.model.js +76 -2
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.d.ts +2 -2
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.js +200 -2
- package/dist/chart/components/navigation_map/navigation-map-move.handler.d.ts +3 -3
- package/dist/chart/components/navigation_map/navigation-map-move.handler.js +109 -2
- package/dist/chart/components/navigation_map/navigation-map.component.d.ts +1 -1
- package/dist/chart/components/navigation_map/navigation-map.component.js +113 -2
- package/dist/chart/components/navigation_map/navigation-map.drawer.d.ts +1 -1
- package/dist/chart/components/navigation_map/navigation-map.drawer.js +245 -2
- package/dist/chart/components/navigation_map/navigation-map.model.d.ts +1 -1
- package/dist/chart/components/navigation_map/navigation-map.model.js +34 -3
- package/dist/chart/components/pan/chart-pan.component.d.ts +3 -3
- package/dist/chart/components/pan/chart-pan.component.js +52 -2
- package/dist/chart/components/pane/extent/y-extent-component.d.ts +13 -19
- package/dist/chart/components/pane/extent/y-extent-component.js +121 -2
- package/dist/chart/components/pane/pane-hit-test.controller.d.ts +1 -1
- package/dist/chart/components/pane/pane-hit-test.controller.js +56 -2
- package/dist/chart/components/pane/pane-manager.component.d.ts +11 -6
- package/dist/chart/components/pane/pane-manager.component.js +149 -2
- package/dist/chart/components/pane/pane.component.d.ts +18 -34
- package/dist/chart/components/pane/pane.component.js +279 -2
- package/dist/chart/components/resizer/bar-resizer.component.d.ts +1 -1
- package/dist/chart/components/resizer/bar-resizer.component.js +140 -2
- package/dist/chart/components/resizer/bar-resizer.drawer.d.ts +1 -1
- package/dist/chart/components/resizer/bar-resizer.drawer.js +47 -2
- package/dist/chart/components/snapshot/snapshot.component.d.ts +1 -1
- package/dist/chart/components/snapshot/snapshot.component.js +49 -2
- package/dist/chart/components/volumes/separate-volumes.component.d.ts +7 -11
- package/dist/chart/components/volumes/separate-volumes.component.js +64 -2
- package/dist/chart/components/volumes/volume-color-resolvers.functions.d.ts +1 -1
- package/dist/chart/components/volumes/volume-color-resolvers.functions.js +19 -2
- package/dist/chart/components/volumes/volumes.component.d.ts +9 -9
- package/dist/chart/components/volumes/volumes.component.js +95 -2
- package/dist/chart/components/volumes/volumes.drawer.d.ts +6 -13
- package/dist/chart/components/volumes/volumes.drawer.js +141 -2
- package/dist/chart/components/volumes/volumes.formatter.d.ts +1 -1
- package/dist/chart/components/volumes/volumes.formatter.js +32 -2
- package/dist/chart/components/volumes/volumes.model.d.ts +3 -3
- package/dist/chart/components/volumes/volumes.model.js +44 -2
- package/dist/chart/components/watermark/water-mark.component.d.ts +1 -1
- package/dist/chart/components/watermark/water-mark.component.js +104 -2
- package/dist/chart/components/watermark/water-mark.drawer.d.ts +1 -1
- package/dist/chart/components/watermark/water-mark.drawer.js +188 -2
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.d.ts +1 -1
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.js +28 -2
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.js +188 -2
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.js +77 -2
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.js +80 -2
- package/dist/chart/components/x_axis/time/parser/time-formats.model.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats.model.js +15 -2
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.d.ts +2 -2
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.js +144 -2
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.d.ts +1 -1
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.js +74 -2
- package/dist/chart/components/x_axis/x-axis-draw.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-draw.functions.js +50 -2
- package/dist/chart/components/x_axis/x-axis-labels.drawer.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-labels.drawer.js +71 -2
- package/dist/chart/components/x_axis/x-axis-labels.generator.d.ts +3 -3
- package/dist/chart/components/x_axis/x-axis-labels.generator.js +333 -2
- package/dist/chart/components/x_axis/x-axis-labels.model.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-labels.model.js +36 -2
- package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +3 -3
- package/dist/chart/components/x_axis/x-axis-scale.handler.js +61 -2
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +83 -2
- package/dist/chart/components/x_axis/x-axis.component.d.ts +3 -3
- package/dist/chart/components/x_axis/x-axis.component.js +120 -2
- package/dist/chart/components/y_axis/label-color.functions.d.ts +1 -1
- package/dist/chart/components/y_axis/label-color.functions.js +54 -2
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.d.ts +5 -5
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.js +34 -2
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +4 -4
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +68 -2
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.d.ts +1 -1
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +57 -2
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.d.ts +1 -1
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +96 -2
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +3 -3
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +120 -2
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +10 -9
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +202 -2
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +7 -8
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +59 -2
- package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +7 -5
- package/dist/chart/components/y_axis/y-axis-base-labels.model.js +48 -2
- package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +5 -5
- package/dist/chart/components/y_axis/y-axis-labels.drawer.js +162 -2
- package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +3 -3
- package/dist/chart/components/y_axis/y-axis-scale.handler.js +73 -2
- package/dist/chart/components/y_axis/y-axis.component.d.ts +33 -42
- package/dist/chart/components/y_axis/y-axis.component.js +221 -2
- package/dist/chart/components/y_axis/y-axis.drawer.d.ts +10 -13
- package/dist/chart/components/y_axis/y-axis.drawer.js +97 -2
- package/dist/chart/components/y_axis/y-axis.model.d.ts +10 -18
- package/dist/chart/components/y_axis/y-axis.model.js +34 -2
- package/dist/chart/drawers/chart-background.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-background.drawer.js +70 -2
- package/dist/chart/drawers/chart-type-drawers/area.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/area.drawer.js +70 -2
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +58 -2
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +85 -2
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +163 -2
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +58 -2
- package/dist/chart/drawers/chart-type-drawers/line.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/line.drawer.js +39 -2
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +20 -2
- package/dist/chart/drawers/clear-canvas.drawer.d.ts +1 -1
- package/dist/chart/drawers/clear-canvas.drawer.js +15 -2
- package/dist/chart/drawers/composite.drawer.d.ts +1 -1
- package/dist/chart/drawers/composite.drawer.js +68 -2
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +51 -2
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +36 -2
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.js +17 -2
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +107 -2
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +24 -2
- package/dist/chart/drawers/data-series-drawers/linear.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/linear.drawer.js +20 -2
- package/dist/chart/drawers/data-series-drawers/points.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/points.drawer.js +20 -2
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.js +8 -2
- package/dist/chart/drawers/data-series-drawers/text.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/text.drawer.js +26 -2
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +36 -2
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +23 -2
- package/dist/chart/drawers/data-series.drawer.d.ts +6 -8
- package/dist/chart/drawers/data-series.drawer.js +57 -2
- package/dist/chart/drawers/drawing-manager.d.ts +2 -2
- package/dist/chart/drawers/drawing-manager.js +178 -2
- package/dist/chart/drawers/ht-data-series.drawer.d.ts +1 -1
- package/dist/chart/drawers/ht-data-series.drawer.js +38 -2
- package/dist/chart/events/event-bus.d.ts +1 -1
- package/dist/chart/events/event-bus.js +74 -2
- package/dist/chart/events/events.d.ts +1 -1
- package/dist/chart/events/events.js +4 -2
- package/dist/chart/inputhandlers/candle-tap.handler.d.ts +1 -1
- package/dist/chart/inputhandlers/candle-tap.handler.js +47 -2
- package/dist/chart/inputhandlers/chart-resize.handler.d.ts +1 -1
- package/dist/chart/inputhandlers/chart-resize.handler.js +99 -2
- package/dist/chart/inputhandlers/cross-event-producer.component.d.ts +1 -1
- package/dist/chart/inputhandlers/cross-event-producer.component.js +68 -2
- package/dist/chart/inputhandlers/hover-producer.component.d.ts +3 -3
- package/dist/chart/inputhandlers/hover-producer.component.js +229 -2
- package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +3 -3
- package/dist/chart/inputhandlers/main-canvas-touch.handler.js +81 -2
- package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +1 -1
- package/dist/chart/inputlisteners/canvas-input-listener.component.js +630 -2
- package/dist/chart/model/baseline.model.d.ts +1 -1
- package/dist/chart/model/baseline.model.js +89 -2
- package/dist/chart/model/bounds.model.d.ts +1 -1
- package/dist/chart/model/bounds.model.js +2 -2
- package/dist/chart/model/candle-hover.d.ts +1 -1
- package/dist/chart/model/candle-hover.js +71 -2
- package/dist/chart/model/candle-series-high-low.provider.d.ts +1 -1
- package/dist/chart/model/candle-series-high-low.provider.js +46 -2
- package/dist/chart/model/candle-series.model.d.ts +4 -4
- package/dist/chart/model/candle-series.model.js +246 -2
- package/dist/chart/model/candle.model.d.ts +1 -1
- package/dist/chart/model/candle.model.js +70 -2
- package/dist/chart/model/canvas.model.d.ts +1 -1
- package/dist/chart/model/canvas.model.js +229 -2
- package/dist/chart/model/chart-base-element.d.ts +1 -1
- package/dist/chart/model/chart-base-element.js +130 -2
- package/dist/chart/model/compare-series-hover.d.ts +1 -1
- package/dist/chart/model/compare-series-hover.js +26 -2
- package/dist/chart/model/data-series-view.d.ts +6 -6
- package/dist/chart/model/data-series-view.js +112 -2
- package/dist/chart/model/data-series.config.d.ts +1 -1
- package/dist/chart/model/data-series.config.js +15 -2
- package/dist/chart/model/data-series.model.d.ts +5 -5
- package/dist/chart/model/data-series.model.js +282 -2
- package/dist/chart/model/date-time.formatter.d.ts +1 -1
- package/dist/chart/model/date-time.formatter.js +152 -2
- package/dist/chart/model/hit-test-canvas.model.d.ts +2 -2
- package/dist/chart/model/hit-test-canvas.model.js +257 -2
- package/dist/chart/model/main-candle-series.model.d.ts +2 -2
- package/dist/chart/model/main-candle-series.model.js +30 -2
- package/dist/chart/model/scale.model.d.ts +3 -2
- package/dist/chart/model/scale.model.js +317 -2
- package/dist/chart/model/scaling/auto-scale.model.d.ts +1 -1
- package/dist/chart/model/scaling/auto-scale.model.js +98 -2
- package/dist/chart/model/scaling/constrait.functions.d.ts +1 -1
- package/dist/chart/model/scaling/constrait.functions.js +62 -2
- package/dist/chart/model/scaling/lock-ratio.model.d.ts +1 -1
- package/dist/chart/model/scaling/lock-ratio.model.js +18 -2
- package/dist/chart/model/scaling/move-chart.functions.d.ts +1 -1
- package/dist/chart/model/scaling/move-chart.functions.js +23 -2
- package/dist/chart/model/scaling/viewport.model.d.ts +3 -3
- package/dist/chart/model/scaling/viewport.model.js +280 -2
- package/dist/chart/model/scaling/x-zooming.functions.d.ts +1 -1
- package/dist/chart/model/scaling/x-zooming.functions.js +36 -2
- package/dist/chart/model/time-zone.model.d.ts +1 -1
- package/dist/chart/model/time-zone.model.js +110 -2
- package/dist/chart/model/visual-candle.d.ts +1 -1
- package/dist/chart/model/visual-candle.js +135 -2
- package/dist/chart/utils/__tests__/array.utils.test.d.ts +1 -1
- package/dist/chart/utils/__tests__/array.utils.test.js +136 -2
- package/dist/chart/utils/{perfomance/debounce.utils.js → __tests__/math.utils.test.d.ts} +2 -2
- package/dist/chart/utils/__tests__/math.utils.test.js +19 -0
- package/dist/chart/utils/__tests__/object.utils.test.d.ts +1 -1
- package/dist/chart/utils/__tests__/object.utils.test.js +12 -2
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.d.ts +1 -1
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.js +30 -2
- package/dist/chart/utils/array.utils.d.ts +2 -2
- package/dist/chart/utils/array.utils.js +270 -2
- package/dist/chart/utils/auto-period-detector.utils.d.ts +1 -1
- package/dist/chart/utils/auto-period-detector.utils.js +40 -2
- package/dist/chart/utils/candles-generator-ts.utils.d.ts +1 -1
- package/dist/chart/utils/candles-generator-ts.utils.js +21 -2
- package/dist/chart/utils/candles-generator.utils.d.ts +1 -1
- package/dist/chart/utils/candles-generator.utils.js +162 -2
- package/dist/chart/utils/candles.utils.d.ts +1 -1
- package/dist/chart/utils/candles.utils.js +43 -2
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.d.ts +1 -1
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.js +145 -2
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.d.ts +1 -1
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.js +52 -2
- package/dist/chart/utils/canvas/canvas-text-functions.utils.d.ts +1 -1
- package/dist/chart/utils/canvas/canvas-text-functions.utils.js +157 -2
- package/dist/chart/utils/color.utils.d.ts +1 -1
- package/dist/chart/utils/color.utils.js +32 -2
- package/dist/chart/utils/device/browser.utils.d.ts +1 -1
- package/dist/chart/utils/device/browser.utils.js +11 -2
- package/dist/chart/utils/device/device-detector.utils.d.ts +1 -1
- package/dist/chart/utils/device/device-detector.utils.js +25 -2
- package/dist/chart/utils/device/device-pixel-ratio.utils.d.ts +1 -1
- package/dist/chart/utils/device/device-pixel-ratio.utils.js +22 -2
- package/dist/chart/utils/device/touchpad.utils.d.ts +1 -1
- package/dist/chart/utils/device/touchpad.utils.js +92 -2
- package/dist/chart/utils/dom.utils.d.ts +1 -1
- package/dist/chart/utils/dom.utils.js +16 -2
- package/dist/chart/utils/function.utils.d.ts +1 -1
- package/dist/chart/utils/function.utils.js +17 -2
- package/dist/chart/utils/linkedList.utils.d.ts +28 -0
- package/dist/chart/utils/linkedList.utils.js +138 -0
- package/dist/chart/utils/math.utils.d.ts +1 -1
- package/dist/chart/utils/math.utils.js +116 -2
- package/dist/chart/utils/merge.utils.d.ts +1 -1
- package/dist/chart/utils/merge.utils.js +57 -2
- package/dist/chart/utils/object.utils.d.ts +1 -1
- package/dist/chart/utils/object.utils.js +44 -2
- package/dist/chart/utils/{perfomance → performance}/animation-frame-cache.utils.d.ts +1 -1
- package/dist/chart/utils/performance/animation-frame-cache.utils.js +77 -0
- package/dist/chart/utils/{perfomance → performance}/debounce.utils.d.ts +1 -1
- package/dist/chart/utils/performance/debounce.utils.js +12 -0
- package/dist/chart/utils/{perfomance → performance}/memoize.utils.d.ts +1 -1
- package/dist/chart/utils/performance/memoize.utils.js +74 -0
- package/dist/chart/utils/{perfomance → performance}/request-animation-frame-throttle.utils.d.ts +1 -1
- package/dist/chart/utils/performance/request-animation-frame-throttle.utils.js +43 -0
- package/dist/chart/utils/{perfomance → performance}/throttle.utils.d.ts +1 -1
- package/dist/chart/utils/performance/throttle.utils.js +26 -0
- package/dist/chart/utils/price-increments.utils.d.ts +2 -1
- package/dist/chart/utils/price-increments.utils.js +128 -2
- package/dist/chart/utils/uuid.utils.d.ts +1 -1
- package/dist/chart/utils/uuid.utils.js +5 -2
- package/dist/dxchart.min.js +10 -13
- package/dist/index.d.ts +4 -4
- package/dist/index.js +21 -2
- package/package.json +4 -4
- package/dist/chart/utils/perfomance/animation-frame-cache.utils.js +0 -6
- package/dist/chart/utils/perfomance/memoize.utils.js +0 -6
- package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.js +0 -6
- package/dist/chart/utils/perfomance/throttle.utils.js +0 -6
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
6
|
-
import{ChartBaseElement
|
|
6
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
7
|
+
import { createCandlesOffsetProvider } from '../chart/data-series.high-low-provider';
|
|
8
|
+
import { volumeFormatter } from './volumes.formatter';
|
|
9
|
+
class SeparateVolumesComponent extends ChartBaseElement {
|
|
10
|
+
constructor(chartComponent, drawingManager, config, volumesModel, paneManager) {
|
|
11
|
+
super();
|
|
12
|
+
this.chartComponent = chartComponent;
|
|
13
|
+
this.drawingManager = drawingManager;
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.volumesModel = volumesModel;
|
|
16
|
+
this.paneManager = paneManager;
|
|
17
|
+
if (config.components.volumes.showSeparately) {
|
|
18
|
+
this.activateSeparateVolumes();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
doActivate() {
|
|
22
|
+
super.doActivate();
|
|
23
|
+
this.addRxSubscription(this.chartComponent.chartModel.candlesUpdatedSubject.subscribe(() => { var _a, _b; return !((_a = this.pane) === null || _a === void 0 ? void 0 : _a.scale.isViewportValid()) && ((_b = this.pane) === null || _b === void 0 ? void 0 : _b.scale.doAutoScale(true)); }));
|
|
24
|
+
this.addRxSubscription(this.volumesModel.volumeMax.subscribe(() => { var _a; return (_a = this.pane) === null || _a === void 0 ? void 0 : _a.scale.doAutoScale(); }));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Activates the separate volumes feature.
|
|
28
|
+
* If the pane component for separate volumes does not exist, it creates a new pane with the specified UUID and options.
|
|
29
|
+
* It then sets the high-low provider for the volumes scale model and does an auto scale.
|
|
30
|
+
* A new VolumesDrawer is created and added to the drawing manager with the specified parameters.
|
|
31
|
+
*/
|
|
32
|
+
activateSeparateVolumes() {
|
|
33
|
+
if (this.paneManager.panes[SeparateVolumesComponent.UUID] === undefined) {
|
|
34
|
+
const volumePane = this.paneManager.createPane(SeparateVolumesComponent.UUID, {
|
|
35
|
+
paneFormatters: {
|
|
36
|
+
regular: volumeFormatter,
|
|
37
|
+
},
|
|
38
|
+
useDefaultHighLow: false,
|
|
39
|
+
increment: 1,
|
|
40
|
+
});
|
|
41
|
+
this.pane = volumePane;
|
|
42
|
+
volumePane.mainExtent.yAxis.setAxisType('regular');
|
|
43
|
+
const { scale: scaleModel } = volumePane;
|
|
44
|
+
const volumesHighLowProvider = createCandlesOffsetProvider(() => ({ top: 10, bottom: 0, left: 0, right: 0, visible: true }), this.volumesModel.highLowProvider);
|
|
45
|
+
scaleModel.autoScaleModel.setHighLowProvider('volumes', volumesHighLowProvider);
|
|
46
|
+
scaleModel.doAutoScale(true);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Deactivates the separate volumes feature by removing the separate volumes pane, deleting the scale model, and removing the underlay volumes area drawer.
|
|
51
|
+
*/
|
|
52
|
+
deactiveSeparateVolumes() {
|
|
53
|
+
this.paneManager.removePane(SeparateVolumesComponent.UUID);
|
|
54
|
+
delete this.pane;
|
|
55
|
+
this.drawingManager.removeDrawerByName('UNDERLAY_VOLUMES_AREA');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Converts a pixel value from the Y-axis of the scale model to the corresponding data value.
|
|
59
|
+
* @param {Pixel} y - The pixel value to convert.
|
|
60
|
+
* @returns {Unit} - The corresponding data value.
|
|
61
|
+
*/
|
|
62
|
+
fromY(y) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
return (_b = (_a = this.pane) === null || _a === void 0 ? void 0 : _a.scale.fromY(y)) !== null && _b !== void 0 ? _b : 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
SeparateVolumesComponent.UUID = 'volumes';
|
|
68
|
+
export { SeparateVolumesComponent };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import Color from 'color';
|
|
7
|
+
export const VOLUMES_COLOR_OPACITY = 0.3;
|
|
8
|
+
export const resolveColorForBar = (priceMovement, colors) => {
|
|
9
|
+
const color = colors.barTheme[`${priceMovement}Color`];
|
|
10
|
+
return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString();
|
|
11
|
+
};
|
|
12
|
+
export const resolveColorUsingConfig = (priceMovement, colors) => {
|
|
13
|
+
const color = colors.volume[`${priceMovement}BarColor`];
|
|
14
|
+
return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString();
|
|
15
|
+
};
|
|
16
|
+
export const resolveColorForLine = (priceMovement, colors) => {
|
|
17
|
+
const color = colors.lineTheme[`${priceMovement}Color`];
|
|
18
|
+
return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString();
|
|
19
|
+
};
|
|
20
|
+
export const resolveColorForCandle = (priceMovement, colors) => {
|
|
21
|
+
const color = colors.candleTheme[`${priceMovement}Color`];
|
|
22
|
+
return Color(color).alpha(VOLUMES_COLOR_OPACITY).toString();
|
|
23
|
+
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
6
|
+
import { BehaviorSubject } from 'rxjs';
|
|
6
7
|
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
7
|
-
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
8
8
|
import { BarType, FullChartColors, FullChartConfig } from '../../chart.config';
|
|
9
|
-
import { CanvasModel } from '../../model/canvas.model';
|
|
10
9
|
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
11
10
|
import { PriceMovement } from '../../model/candle-series.model';
|
|
11
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
12
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
12
13
|
import { ScaleModel } from '../../model/scale.model';
|
|
13
14
|
import { ChartComponent } from '../chart/chart.component';
|
|
15
|
+
import { DynamicObjectsComponent } from '../dynamic-objects/dynamic-objects.component';
|
|
14
16
|
import { PaneManager } from '../pane/pane-manager.component';
|
|
15
17
|
import { SeparateVolumesComponent } from './separate-volumes.component';
|
|
16
18
|
import { VolumesModel } from './volumes.model';
|
|
17
|
-
import { YAxisComponent } from '../y_axis/y-axis.component';
|
|
18
|
-
import { BehaviorSubject } from 'rxjs';
|
|
19
19
|
export type VolumeColorResolver = (priceMovement: PriceMovement, colors: FullChartColors) => string;
|
|
20
20
|
export declare class VolumesComponent extends ChartBaseElement {
|
|
21
21
|
private canvasModel;
|
|
22
22
|
private canvasBoundsContainer;
|
|
23
23
|
private config;
|
|
24
24
|
separateVolumes: SeparateVolumesComponent;
|
|
25
|
-
|
|
25
|
+
volumesColorByChartTypeMap: Partial<Record<BarType, VolumeColorResolver>>;
|
|
26
26
|
volumesModel: VolumesModel;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
constructor(canvasModel: CanvasModel, chartComponent: ChartComponent,
|
|
27
|
+
volumeVisibilityChangedSubject: BehaviorSubject<boolean>;
|
|
28
|
+
volumeIsSeparateModeChangedSubject: BehaviorSubject<boolean>;
|
|
29
|
+
constructor(canvasModel: CanvasModel, chartComponent: ChartComponent, scale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, config: FullChartConfig, paneManager: PaneManager, dynamicObjectsComponent: DynamicObjectsComponent);
|
|
30
30
|
/**
|
|
31
31
|
* Registers default volume color resolvers for candle, line and bar charts
|
|
32
32
|
* @private
|
|
@@ -1,6 +1,99 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import { BehaviorSubject } from 'rxjs';
|
|
7
|
+
import { CHART_UUID } from '../../canvas/canvas-bounds-container';
|
|
8
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
9
|
+
import { SeparateVolumesComponent } from './separate-volumes.component';
|
|
10
|
+
import { resolveColorForBar, resolveColorForCandle, resolveColorForLine } from './volume-color-resolvers.functions';
|
|
11
|
+
import { VolumesDrawer } from './volumes.drawer';
|
|
12
|
+
import { VolumesModel } from './volumes.model';
|
|
13
|
+
export class VolumesComponent extends ChartBaseElement {
|
|
14
|
+
constructor(canvasModel, chartComponent, scale, canvasBoundsContainer, drawingManager, config, paneManager, dynamicObjectsComponent) {
|
|
15
|
+
super();
|
|
16
|
+
this.canvasModel = canvasModel;
|
|
17
|
+
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.volumesColorByChartTypeMap = {};
|
|
20
|
+
this.volumeVisibilityChangedSubject = new BehaviorSubject(false);
|
|
21
|
+
this.volumeIsSeparateModeChangedSubject = new BehaviorSubject(false);
|
|
22
|
+
const volumesModel = new VolumesModel(chartComponent, scale);
|
|
23
|
+
this.volumesModel = volumesModel;
|
|
24
|
+
this.addChildEntity(volumesModel);
|
|
25
|
+
this.separateVolumes = new SeparateVolumesComponent(chartComponent, drawingManager, config, volumesModel, paneManager);
|
|
26
|
+
const volumesDrawer = new VolumesDrawer(config, this.volumesModel, chartComponent.chartModel, () => { var _a, _b; return (this.config.components.volumes.showSeparately ? (_b = (_a = this.separateVolumes.pane) === null || _a === void 0 ? void 0 : _a.scale) !== null && _b !== void 0 ? _b : scale : scale); }, this.volumesColorByChartTypeMap, () => true);
|
|
27
|
+
dynamicObjectsComponent.model.addObject({ drawer: volumesDrawer, model: volumesModel }, CHART_UUID);
|
|
28
|
+
this.addChildEntity(this.separateVolumes);
|
|
29
|
+
this.registerDefaultVolumeColorResolvers();
|
|
30
|
+
this.volumeVisibilityChangedSubject.next(config.components.volumes.visible);
|
|
31
|
+
this.volumeIsSeparateModeChangedSubject.next(config.components.volumes.showSeparately);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Registers default volume color resolvers for candle, line and bar charts
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
registerDefaultVolumeColorResolvers() {
|
|
38
|
+
this.registerVolumeColorResolver('candle', resolveColorForCandle);
|
|
39
|
+
this.registerVolumeColorResolver('trend', resolveColorForCandle);
|
|
40
|
+
this.registerVolumeColorResolver('hollow', resolveColorForCandle);
|
|
41
|
+
this.registerVolumeColorResolver('line', resolveColorForLine);
|
|
42
|
+
this.registerVolumeColorResolver('bar', resolveColorForBar);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sets whether the volumes should be shown separately or not.
|
|
46
|
+
*
|
|
47
|
+
* @param {boolean} separate - A boolean value indicating whether the volumes should be shown separately or not.
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
setShowVolumesSeparatly(separate) {
|
|
51
|
+
if (this.config.components.volumes.showSeparately !== separate) {
|
|
52
|
+
this.config.components.volumes.showSeparately = separate;
|
|
53
|
+
if (separate) {
|
|
54
|
+
this.separateVolumes.activateSeparateVolumes();
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.separateVolumes.deactiveSeparateVolumes();
|
|
58
|
+
}
|
|
59
|
+
this.volumeIsSeparateModeChangedSubject.next(separate);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* This method deactivates the current component by calling the superclass doDeactivate method and setting the visibility of the component to false.
|
|
64
|
+
* @returns {void}
|
|
65
|
+
*/
|
|
66
|
+
doDeactivate() {
|
|
67
|
+
super.doDeactivate();
|
|
68
|
+
this.setVisible(false);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* You can use this method to determine volumes' color for specified chart type.
|
|
72
|
+
* @param chartType
|
|
73
|
+
* @param resolver
|
|
74
|
+
*/
|
|
75
|
+
registerVolumeColorResolver(chartType, resolver) {
|
|
76
|
+
this.volumesColorByChartTypeMap[chartType] = resolver;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Sets the visibility of the volumes component and updates the canvas accordingly.
|
|
80
|
+
* @param {boolean} visible - Whether the volumes component should be visible or not. Default is true.
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
setVisible(visible = true) {
|
|
84
|
+
this.config.components.volumes.visible = visible;
|
|
85
|
+
this.volumeVisibilityChangedSubject.next(visible);
|
|
86
|
+
if (this.config.components.volumes.showSeparately === true) {
|
|
87
|
+
if (visible) {
|
|
88
|
+
this.separateVolumes.activateSeparateVolumes();
|
|
89
|
+
this.volumeIsSeparateModeChangedSubject.next(true);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.separateVolumes.deactiveSeparateVolumes();
|
|
93
|
+
this.volumeIsSeparateModeChangedSubject.next(false);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
this.canvasBoundsContainer.recalculatePanesHeightRatios();
|
|
97
|
+
this.canvasModel.fireDraw();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
6
6
|
import { BarType, FullChartConfig } from '../../chart.config';
|
|
7
7
|
import { CanvasModel } from '../../model/canvas.model';
|
|
8
|
-
import { Drawer } from '../../drawers/drawing-manager';
|
|
9
8
|
import { ViewportModel } from '../../model/scaling/viewport.model';
|
|
10
9
|
import { ChartModel } from '../chart/chart.model';
|
|
10
|
+
import { DynamicModelDrawer } from '../dynamic-objects/dynamic-objects.drawer';
|
|
11
11
|
import { VolumeColorResolver } from './volumes.component';
|
|
12
12
|
import { VolumesModel } from './volumes.model';
|
|
13
|
-
export declare class VolumesDrawer implements
|
|
14
|
-
private canvasModel;
|
|
13
|
+
export declare class VolumesDrawer implements DynamicModelDrawer<VolumesModel> {
|
|
15
14
|
private config;
|
|
16
15
|
private volumesModel;
|
|
17
16
|
private chartModel;
|
|
18
|
-
|
|
17
|
+
getViewportModel: () => ViewportModel;
|
|
19
18
|
private volumesColorByChartTypeMap;
|
|
20
19
|
private drawPredicate;
|
|
21
20
|
private readonly volumeBarColors;
|
|
22
|
-
constructor(
|
|
21
|
+
constructor(config: FullChartConfig, volumesModel: VolumesModel, chartModel: ChartModel, getViewportModel: () => ViewportModel, volumesColorByChartTypeMap: Partial<Record<BarType, VolumeColorResolver>>, drawPredicate: () => boolean);
|
|
23
22
|
/**
|
|
24
23
|
* 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
24
|
* @param {BarType} barType - The type of bar to calculate the color for.
|
|
@@ -33,7 +32,7 @@ export declare class VolumesDrawer implements Drawer {
|
|
|
33
32
|
* Restores the canvas context.
|
|
34
33
|
* @returns {void}
|
|
35
34
|
*/
|
|
36
|
-
draw(): void;
|
|
35
|
+
draw(canvasModel: CanvasModel): void;
|
|
37
36
|
/**
|
|
38
37
|
* Draws the last bar of the chart if the volumes component is visible.
|
|
39
38
|
* TODO: Rework the function.
|
|
@@ -62,10 +61,4 @@ export declare class VolumesDrawer implements Drawer {
|
|
|
62
61
|
* @returns {void}
|
|
63
62
|
*/
|
|
64
63
|
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
64
|
}
|
|
@@ -1,6 +1,145 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
6
|
-
import{clipToBounds
|
|
6
|
+
import { clipToBounds } from '../../drawers/data-series.drawer';
|
|
7
|
+
import { unitToPixels } from '../../model/scaling/viewport.model';
|
|
8
|
+
import { flat } from '../../utils/array.utils';
|
|
9
|
+
import { ceilToDPR, floorToDPR } from '../../utils/device/device-pixel-ratio.utils';
|
|
10
|
+
import { resolveColorUsingConfig } from './volume-color-resolvers.functions';
|
|
11
|
+
// ratio of CHART bounds height which is for overlay volumes
|
|
12
|
+
const OVERLAY_VOLUME_TOTAL_HEIGHT_DIVISOR = 3;
|
|
13
|
+
export class VolumesDrawer {
|
|
14
|
+
constructor(config, volumesModel, chartModel, getViewportModel, volumesColorByChartTypeMap, drawPredicate) {
|
|
15
|
+
this.config = config;
|
|
16
|
+
this.volumesModel = volumesModel;
|
|
17
|
+
this.chartModel = chartModel;
|
|
18
|
+
this.getViewportModel = getViewportModel;
|
|
19
|
+
this.volumesColorByChartTypeMap = volumesColorByChartTypeMap;
|
|
20
|
+
this.drawPredicate = drawPredicate;
|
|
21
|
+
this.volumeBarColors = {
|
|
22
|
+
down: '#FF00FF',
|
|
23
|
+
up: '#FF00FF',
|
|
24
|
+
none: '#FF00FF',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 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.
|
|
29
|
+
* @param {BarType} barType - The type of bar to calculate the color for.
|
|
30
|
+
* @returns {void}
|
|
31
|
+
*/
|
|
32
|
+
calculateColors(barType) {
|
|
33
|
+
var _a;
|
|
34
|
+
const getVolumeBarColor = (_a = this.volumesColorByChartTypeMap[barType]) !== null && _a !== void 0 ? _a : resolveColorUsingConfig;
|
|
35
|
+
this.volumeBarColors['down'] = getVolumeBarColor('down', this.config.colors);
|
|
36
|
+
this.volumeBarColors['up'] = getVolumeBarColor('up', this.config.colors);
|
|
37
|
+
this.volumeBarColors['none'] = getVolumeBarColor('none', this.config.colors);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Draws the volumes on the chart canvas if the volumes are visible and the drawPredicate is true.
|
|
41
|
+
* Calculates the colors based on the chart type and saves the canvas context.
|
|
42
|
+
* Clips the canvas to the viewport bounds and draws the volumes.
|
|
43
|
+
* Restores the canvas context.
|
|
44
|
+
* @returns {void}
|
|
45
|
+
*/
|
|
46
|
+
draw(canvasModel) {
|
|
47
|
+
if (this.config.components.volumes.visible && this.drawPredicate()) {
|
|
48
|
+
this.calculateColors(this.config.components.chart.type);
|
|
49
|
+
const ctx = canvasModel.ctx;
|
|
50
|
+
ctx.save();
|
|
51
|
+
const bounds = this.getViewportModel().getBounds();
|
|
52
|
+
clipToBounds(ctx, bounds);
|
|
53
|
+
this.drawVolumes(canvasModel);
|
|
54
|
+
ctx.restore();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Draws the last bar of the chart if the volumes component is visible.
|
|
59
|
+
* TODO: Rework the function.
|
|
60
|
+
*
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
drawLastBar() {
|
|
64
|
+
if (this.config.components.volumes.visible) {
|
|
65
|
+
// TODO rework
|
|
66
|
+
// this.calculateColors(this.config.components.chart.type);
|
|
67
|
+
// const ctx = this.canvasModel.ctx;
|
|
68
|
+
// const lastVolume = lastOf(this.volumes.data);
|
|
69
|
+
// if (lastVolume) {
|
|
70
|
+
// ctx.fillStyle = this.volumeBarColors[lastVolume.direction];
|
|
71
|
+
// const { width, height, x, y } = lastVolume;
|
|
72
|
+
// ctx.fillRect(x, y, width, height);
|
|
73
|
+
// }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Draws volumes on the chart based on the data provided by the volumesModel and chartModel.
|
|
78
|
+
* If the volumeMax is 0, the function will return without drawing anything.
|
|
79
|
+
* The function loops through all the candles in the viewport and calculates the x, y, width and height of each volume bar.
|
|
80
|
+
* If the config.components.volumes.showSeparately is true, the function will draw each volume bar separately.
|
|
81
|
+
* Otherwise, it will calculate the zoomY based on the volumeMax and the fullVHeight, and draw all the volume bars together.
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
drawVolumes(canvasModel) {
|
|
85
|
+
const volumeMax = this.volumesModel.volumeMax.getValue();
|
|
86
|
+
if (volumeMax === 0) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const candles = flat(this.chartModel.mainCandleSeries
|
|
90
|
+
// TODO volumes drawer should be a part of data series drawer
|
|
91
|
+
.getSeriesInViewport(this.chartModel.scale.xStart - 1, this.chartModel.scale.xEnd + 1));
|
|
92
|
+
const viewportModel = this.getViewportModel();
|
|
93
|
+
candles.forEach((vCandle, idx) => {
|
|
94
|
+
if (vCandle.candle.volume) {
|
|
95
|
+
const bounds = viewportModel.getBounds();
|
|
96
|
+
const fullVHeight = bounds.height;
|
|
97
|
+
const nextX = candles[idx + 1] !== undefined
|
|
98
|
+
? floorToDPR(viewportModel.toX(candles[idx + 1].startUnit))
|
|
99
|
+
: undefined;
|
|
100
|
+
const x = floorToDPR(viewportModel.toX(vCandle.startUnit));
|
|
101
|
+
const width = nextX !== undefined ? nextX - x : floorToDPR(unitToPixels(vCandle.width, viewportModel.zoomX));
|
|
102
|
+
if (this.config.components.volumes.showSeparately) {
|
|
103
|
+
const y = floorToDPR(viewportModel.toY(vCandle.candle.volume));
|
|
104
|
+
const height = floorToDPR(viewportModel.toY(0)) - y;
|
|
105
|
+
this.drawVolume(canvasModel, vCandle, x, y, width, height);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const zoomY = volumeMax / (fullVHeight / OVERLAY_VOLUME_TOTAL_HEIGHT_DIVISOR);
|
|
109
|
+
const height = Math.max(unitToPixels(vCandle.candle.volume, zoomY), 2);
|
|
110
|
+
const y = floorToDPR(bounds.y + fullVHeight - height);
|
|
111
|
+
this.drawVolume(canvasModel, vCandle, x, y, width, height);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Draws a volume bar on the canvas.
|
|
118
|
+
*
|
|
119
|
+
* @private
|
|
120
|
+
* @param {VisualCandle} vCandle - The visual candle object.
|
|
121
|
+
* @param {Pixel} x - The x coordinate of the top-left corner of the volume bar.
|
|
122
|
+
* @param {Pixel} y - The y coordinate of the top-left corner of the volume bar.
|
|
123
|
+
* @param {Pixel} width - The width of the volume bar.
|
|
124
|
+
* @param {Pixel} height - The height of the volume bar.
|
|
125
|
+
* @returns {void}
|
|
126
|
+
*/
|
|
127
|
+
drawVolume(canvasModel, vCandle, x, y, width, height) {
|
|
128
|
+
const ctx = canvasModel.ctx;
|
|
129
|
+
const yStart = y;
|
|
130
|
+
const yEnd = y + height;
|
|
131
|
+
const direction = vCandle.name;
|
|
132
|
+
ctx.fillStyle = this.volumeBarColors[direction];
|
|
133
|
+
ctx.strokeStyle = this.volumeBarColors[direction];
|
|
134
|
+
if (width === 0) {
|
|
135
|
+
// just draw a vertical line
|
|
136
|
+
ctx.beginPath();
|
|
137
|
+
ctx.moveTo(x, yStart);
|
|
138
|
+
ctx.lineTo(x, ceilToDPR(yEnd));
|
|
139
|
+
ctx.stroke();
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
ctx.fillRect(x, y, width, ceilToDPR(height));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
6
|
-
const
|
|
6
|
+
const DEFAULT_PRECISION = 5;
|
|
7
|
+
const MIN_VALUE = 0.0000000001;
|
|
8
|
+
const TRAILLING_ZEROES_REGEXP = /\.?0+$/;
|
|
9
|
+
const TRAILLING_FRACTION_WITH_ZEROES_REGEXP = /(\.[1-9]*)0+$/;
|
|
10
|
+
export const volumeFormatter = (value) => {
|
|
11
|
+
const formatValue = (value, amountToCut) => {
|
|
12
|
+
const rounder = Math.pow(10, DEFAULT_PRECISION);
|
|
13
|
+
const roundedValue = Math.round(value * rounder) / rounder;
|
|
14
|
+
if (roundedValue < 1 && roundedValue >= MIN_VALUE) {
|
|
15
|
+
return roundedValue
|
|
16
|
+
.toFixed(DEFAULT_PRECISION)
|
|
17
|
+
.replace(TRAILLING_ZEROES_REGEXP, '')
|
|
18
|
+
.replace(TRAILLING_FRACTION_WITH_ZEROES_REGEXP, '');
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return (roundedValue + '').replace(TRAILLING_FRACTION_WITH_ZEROES_REGEXP, '') + (amountToCut || '');
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
if (Math.abs(value) > 999999999) {
|
|
25
|
+
value = Math.round(value / 1000000) * 1000000;
|
|
26
|
+
return formatValue(value / 1000000000, 'B');
|
|
27
|
+
}
|
|
28
|
+
if (Math.abs(value) > 999999) {
|
|
29
|
+
value = 1000 * Math.round(value / 1000);
|
|
30
|
+
return formatValue(value / 1000000, 'M');
|
|
31
|
+
}
|
|
32
|
+
if (Math.abs(value) > 9999) {
|
|
33
|
+
return formatValue(value / 1000, 'K');
|
|
34
|
+
}
|
|
35
|
+
return formatValue(value);
|
|
36
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
@@ -10,10 +10,10 @@ import { HighLowProvider } from '../../model/scaling/auto-scale.model';
|
|
|
10
10
|
import { ChartComponent } from '../chart/chart.component';
|
|
11
11
|
export declare class VolumesModel extends ChartBaseElement {
|
|
12
12
|
private chartComponent;
|
|
13
|
-
private
|
|
13
|
+
private scale;
|
|
14
14
|
volumeMax: BehaviorSubject<number>;
|
|
15
15
|
highLowProvider: HighLowProvider;
|
|
16
|
-
constructor(chartComponent: ChartComponent,
|
|
16
|
+
constructor(chartComponent: ChartComponent, scale: ScaleModel);
|
|
17
17
|
protected doActivate(): void;
|
|
18
18
|
/**
|
|
19
19
|
* Used for optimization when we have to update only the last candle
|
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|
|
6
|
-
import{BehaviorSubject
|
|
6
|
+
import { BehaviorSubject, merge } from 'rxjs';
|
|
7
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
8
|
+
import { firstOf, maxMin } from '../../utils/array.utils';
|
|
9
|
+
const volumeMaxMinFn = maxMin(candle => candle.candle.volume);
|
|
10
|
+
export class VolumesModel extends ChartBaseElement {
|
|
11
|
+
constructor(chartComponent, scale) {
|
|
12
|
+
super();
|
|
13
|
+
this.chartComponent = chartComponent;
|
|
14
|
+
this.scale = scale;
|
|
15
|
+
// max volume in all data series
|
|
16
|
+
this.volumeMax = new BehaviorSubject(0);
|
|
17
|
+
this.highLowProvider = {
|
|
18
|
+
calculateHighLow: () => ({ high: this.volumeMax.getValue(), low: 0 }),
|
|
19
|
+
isHighLowActive: () => true,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
doActivate() {
|
|
23
|
+
super.doActivate();
|
|
24
|
+
this.addRxSubscription(merge(this.chartComponent.chartModel.observeCandlesChanged(), this.scale.xChanged).subscribe(() => this.updateVolumeMax()));
|
|
25
|
+
this.addRxSubscription(this.chartComponent.chartModel.mainCandleSeries
|
|
26
|
+
.observeLastVisualCandleChanged()
|
|
27
|
+
.subscribe(() => this.recalculateLastVisualVolume()));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Used for optimization when we have to update only the last candle
|
|
31
|
+
* Doesn't work for line chart types
|
|
32
|
+
* @doc-tags tricky
|
|
33
|
+
*/
|
|
34
|
+
recalculateLastVisualVolume() {
|
|
35
|
+
// TODO rework, move this logic to drawer
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Updates the maximum volume value of the chart.
|
|
39
|
+
* @function
|
|
40
|
+
* @name updateVolumeMax
|
|
41
|
+
* @memberof ChartComponent
|
|
42
|
+
* @returns {void}
|
|
43
|
+
*/
|
|
44
|
+
updateVolumeMax() {
|
|
45
|
+
var _a;
|
|
46
|
+
this.volumeMax.next((_a = firstOf(volumeMaxMinFn(this.chartComponent.chartModel.mainCandleSeries.getSeriesInViewport().flat()))) !== null && _a !== void 0 ? _a : 0);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
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
5
|
*/
|