@devexperts/dxcharts-lite 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +151 -0
- package/README.md +184 -0
- package/dist/chart/animation/canvas-animation.d.ts +96 -0
- package/dist/chart/animation/canvas-animation.js +6 -0
- package/dist/chart/animation/types/animation.d.ts +35 -0
- package/dist/chart/animation/types/animation.js +6 -0
- package/dist/chart/animation/types/color-alpha-animation.d.ts +43 -0
- package/dist/chart/animation/types/color-alpha-animation.js +6 -0
- package/dist/chart/animation/types/color-transition-animation.d.ts +59 -0
- package/dist/chart/animation/types/color-transition-animation.js +6 -0
- package/dist/chart/animation/types/viewport-movement-animation.d.ts +44 -0
- package/dist/chart/animation/types/viewport-movement-animation.js +6 -0
- package/dist/chart/animation/viewport-model-animation.d.ts +15 -0
- package/dist/chart/animation/viewport-model-animation.js +6 -0
- package/dist/chart/bootstrap.d.ts +266 -0
- package/dist/chart/bootstrap.js +6 -0
- package/dist/chart/canvas/canvas-bounds-container.d.ts +347 -0
- package/dist/chart/canvas/canvas-bounds-container.js +6 -0
- package/dist/chart/canvas/canvas-chart-html.d.ts +7 -0
- package/dist/chart/canvas/canvas-chart-html.js +23 -0
- package/dist/chart/canvas/chart-elements.d.ts +22 -0
- package/dist/chart/canvas/chart-elements.js +6 -0
- package/dist/chart/canvas/cursor.handler.d.ts +71 -0
- package/dist/chart/canvas/cursor.handler.js +6 -0
- package/dist/chart/canvas/layout-creator.d.ts +20 -0
- package/dist/chart/canvas/layout-creator.js +6 -0
- package/dist/chart/canvas/y-axis-bounds.container.d.ts +54 -0
- package/dist/chart/canvas/y-axis-bounds.container.js +6 -0
- package/dist/chart/chart-container.d.ts +18 -0
- package/dist/chart/chart-container.js +6 -0
- package/dist/chart/chart.config.d.ts +774 -0
- package/dist/chart/chart.config.js +6 -0
- package/dist/chart/components/chart/basic-scale.d.ts +22 -0
- package/dist/chart/components/chart/basic-scale.js +6 -0
- package/dist/chart/components/chart/candle-transformer.functions.d.ts +11 -0
- package/dist/chart/components/chart/candle-transformer.functions.js +6 -0
- package/dist/chart/components/chart/candle-width-calculator.functions.d.ts +7 -0
- package/dist/chart/components/chart/candle-width-calculator.functions.js +6 -0
- package/dist/chart/components/chart/candle.functions.d.ts +19 -0
- package/dist/chart/components/chart/candle.functions.js +6 -0
- package/dist/chart/components/chart/chart-area-pan.handler.d.ts +88 -0
- package/dist/chart/components/chart/chart-area-pan.handler.js +6 -0
- package/dist/chart/components/chart/chart-base.model.d.ts +55 -0
- package/dist/chart/components/chart/chart-base.model.js +6 -0
- package/dist/chart/components/chart/chart.component.d.ts +251 -0
- package/dist/chart/components/chart/chart.component.js +6 -0
- package/dist/chart/components/chart/chart.model.d.ts +448 -0
- package/dist/chart/components/chart/chart.model.js +6 -0
- package/dist/chart/components/chart/data-series.high-low-provider.d.ts +25 -0
- package/dist/chart/components/chart/data-series.high-low-provider.js +6 -0
- package/dist/chart/components/chart/fake-candles.d.ts +18 -0
- package/dist/chart/components/chart/fake-candles.js +6 -0
- package/dist/chart/components/chart/price.formatter.d.ts +12 -0
- package/dist/chart/components/chart/price.formatter.js +6 -0
- package/dist/chart/components/chart/secondary-chart-colors-pool.d.ts +43 -0
- package/dist/chart/components/chart/secondary-chart-colors-pool.js +6 -0
- package/dist/chart/components/cross_tool/cross-tool.component.d.ts +69 -0
- package/dist/chart/components/cross_tool/cross-tool.component.js +6 -0
- package/dist/chart/components/cross_tool/cross-tool.drawer.d.ts +32 -0
- package/dist/chart/components/cross_tool/cross-tool.drawer.js +6 -0
- package/dist/chart/components/cross_tool/cross-tool.model.d.ts +63 -0
- package/dist/chart/components/cross_tool/cross-tool.model.js +6 -0
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.d.ts +44 -0
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +6 -0
- package/dist/chart/components/cross_tool/types/none.drawer.d.ts +9 -0
- package/dist/chart/components/cross_tool/types/none.drawer.js +6 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.d.ts +27 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +6 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.d.ts +23 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +6 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.d.ts +46 -0
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +6 -0
- package/dist/chart/components/events/events-hit-test.drawer.d.ts +34 -0
- package/dist/chart/components/events/events-hit-test.drawer.js +6 -0
- package/dist/chart/components/events/events.component.d.ts +45 -0
- package/dist/chart/components/events/events.component.js +6 -0
- package/dist/chart/components/events/events.drawer.d.ts +87 -0
- package/dist/chart/components/events/events.drawer.js +6 -0
- package/dist/chart/components/events/events.model.d.ts +64 -0
- package/dist/chart/components/events/events.model.js +6 -0
- package/dist/chart/components/grid/grid.component.d.ts +34 -0
- package/dist/chart/components/grid/grid.component.js +6 -0
- package/dist/chart/components/grid/grid.drawer.d.ts +55 -0
- package/dist/chart/components/grid/grid.drawer.js +6 -0
- package/dist/chart/components/high_low/high-low.component.d.ts +17 -0
- package/dist/chart/components/high_low/high-low.component.js +6 -0
- package/dist/chart/components/high_low/high-low.drawer.d.ts +69 -0
- package/dist/chart/components/high_low/high-low.drawer.js +6 -0
- package/dist/chart/components/highlights/highlights.component.d.ts +42 -0
- package/dist/chart/components/highlights/highlights.component.js +6 -0
- package/dist/chart/components/highlights/highlights.drawer.d.ts +56 -0
- package/dist/chart/components/highlights/highlights.drawer.js +6 -0
- package/dist/chart/components/highlights/highlights.model.d.ts +66 -0
- package/dist/chart/components/highlights/highlights.model.js +6 -0
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.d.ts +63 -0
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.js +6 -0
- package/dist/chart/components/navigation_map/navigation-map-move.handler.d.ts +36 -0
- package/dist/chart/components/navigation_map/navigation-map-move.handler.js +6 -0
- package/dist/chart/components/navigation_map/navigation-map.component.d.ts +52 -0
- package/dist/chart/components/navigation_map/navigation-map.component.js +6 -0
- package/dist/chart/components/navigation_map/navigation-map.drawer.d.ts +96 -0
- package/dist/chart/components/navigation_map/navigation-map.drawer.js +6 -0
- package/dist/chart/components/navigation_map/navigation-map.model.d.ts +25 -0
- package/dist/chart/components/navigation_map/navigation-map.model.js +7 -0
- package/dist/chart/components/pan/chart-pan.component.d.ts +52 -0
- package/dist/chart/components/pan/chart-pan.component.js +6 -0
- package/dist/chart/components/pane/extent/y-extent-component.d.ts +91 -0
- package/dist/chart/components/pane/extent/y-extent-component.js +6 -0
- package/dist/chart/components/pane/pane-hit-test.controller.d.ts +39 -0
- package/dist/chart/components/pane/pane-hit-test.controller.js +6 -0
- package/dist/chart/components/pane/pane-manager.component.d.ts +87 -0
- package/dist/chart/components/pane/pane-manager.component.js +6 -0
- package/dist/chart/components/pane/pane.component.d.ts +193 -0
- package/dist/chart/components/pane/pane.component.js +6 -0
- package/dist/chart/components/resizer/bar-resizer.component.d.ts +72 -0
- package/dist/chart/components/resizer/bar-resizer.component.js +6 -0
- package/dist/chart/components/resizer/bar-resizer.drawer.d.ts +34 -0
- package/dist/chart/components/resizer/bar-resizer.drawer.js +6 -0
- package/dist/chart/components/snapshot/snapshot.component.d.ts +31 -0
- package/dist/chart/components/snapshot/snapshot.component.js +6 -0
- package/dist/chart/components/volumes/separate-volumes.component.d.ts +45 -0
- package/dist/chart/components/volumes/separate-volumes.component.js +6 -0
- package/dist/chart/components/volumes/volume-color-resolvers.functions.d.ts +11 -0
- package/dist/chart/components/volumes/volume-color-resolvers.functions.js +6 -0
- package/dist/chart/components/volumes/volumes.component.d.ts +59 -0
- package/dist/chart/components/volumes/volumes.component.js +6 -0
- package/dist/chart/components/volumes/volumes.drawer.d.ts +71 -0
- package/dist/chart/components/volumes/volumes.drawer.js +6 -0
- package/dist/chart/components/volumes/volumes.formatter.d.ts +6 -0
- package/dist/chart/components/volumes/volumes.formatter.js +6 -0
- package/dist/chart/components/volumes/volumes.model.d.ts +32 -0
- package/dist/chart/components/volumes/volumes.model.js +6 -0
- package/dist/chart/components/watermark/water-mark.component.d.ts +75 -0
- package/dist/chart/components/watermark/water-mark.component.js +6 -0
- package/dist/chart/components/watermark/water-mark.drawer.d.ts +68 -0
- package/dist/chart/components/watermark/water-mark.drawer.js +6 -0
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.d.ts +25 -0
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.js +6 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.d.ts +55 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.js +6 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.d.ts +23 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.js +6 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.d.ts +28 -0
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.js +6 -0
- package/dist/chart/components/x_axis/time/parser/time-formats.model.d.ts +33 -0
- package/dist/chart/components/x_axis/time/parser/time-formats.model.js +6 -0
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.d.ts +62 -0
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.js +6 -0
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.d.ts +33 -0
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.js +6 -0
- package/dist/chart/components/x_axis/x-axis-draw.functions.d.ts +17 -0
- package/dist/chart/components/x_axis/x-axis-draw.functions.js +6 -0
- package/dist/chart/components/x_axis/x-axis-labels.drawer.d.ts +42 -0
- package/dist/chart/components/x_axis/x-axis-labels.drawer.js +6 -0
- package/dist/chart/components/x_axis/x-axis-labels.generator.d.ts +141 -0
- package/dist/chart/components/x_axis/x-axis-labels.generator.js +6 -0
- package/dist/chart/components/x_axis/x-axis-labels.model.d.ts +39 -0
- package/dist/chart/components/x_axis/x-axis-labels.model.js +6 -0
- package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +38 -0
- package/dist/chart/components/x_axis/x-axis-scale.handler.js +6 -0
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.d.ts +54 -0
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +6 -0
- package/dist/chart/components/x_axis/x-axis.component.d.ts +73 -0
- package/dist/chart/components/x_axis/x-axis.component.js +6 -0
- package/dist/chart/components/y_axis/label-color.functions.d.ts +18 -0
- package/dist/chart/components/y_axis/label-color.functions.js +6 -0
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.d.ts +22 -0
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.js +6 -0
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +33 -0
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +6 -0
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.d.ts +27 -0
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +6 -0
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.d.ts +35 -0
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +6 -0
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +23 -0
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +6 -0
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +159 -0
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +6 -0
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +23 -0
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +6 -0
- package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +31 -0
- package/dist/chart/components/y_axis/y-axis-base-labels.model.js +6 -0
- package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +70 -0
- package/dist/chart/components/y_axis/y-axis-labels.drawer.js +6 -0
- package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +32 -0
- package/dist/chart/components/y_axis/y-axis-scale.handler.js +6 -0
- package/dist/chart/components/y_axis/y-axis.component.d.ts +158 -0
- package/dist/chart/components/y_axis/y-axis.component.js +6 -0
- package/dist/chart/components/y_axis/y-axis.drawer.d.ts +72 -0
- package/dist/chart/components/y_axis/y-axis.drawer.js +6 -0
- package/dist/chart/components/y_axis/y-axis.model.d.ts +33 -0
- package/dist/chart/components/y_axis/y-axis.model.js +6 -0
- package/dist/chart/drawers/chart-background.drawer.d.ts +19 -0
- package/dist/chart/drawers/chart-background.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/area.drawer.d.ts +13 -0
- package/dist/chart/drawers/chart-type-drawers/area.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.d.ts +14 -0
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.d.ts +15 -0
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.d.ts +25 -0
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.d.ts +13 -0
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/line.drawer.d.ts +13 -0
- package/dist/chart/drawers/chart-type-drawers/line.drawer.js +6 -0
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.d.ts +13 -0
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +6 -0
- package/dist/chart/drawers/clear-canvas.drawer.d.ts +16 -0
- package/dist/chart/drawers/clear-canvas.drawer.js +6 -0
- package/dist/chart/drawers/composite.drawer.d.ts +25 -0
- package/dist/chart/drawers/composite.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.d.ts +23 -0
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +6 -0
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.d.ts +17 -0
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.d.ts +8 -0
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.js +6 -0
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.d.ts +21 -0
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.d.ts +11 -0
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/linear.drawer.d.ts +12 -0
- package/dist/chart/drawers/data-series-drawers/linear.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/points.drawer.d.ts +11 -0
- package/dist/chart/drawers/data-series-drawers/points.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.d.ts +9 -0
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/text.drawer.d.ts +13 -0
- package/dist/chart/drawers/data-series-drawers/text.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.d.ts +12 -0
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +6 -0
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.d.ts +12 -0
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +6 -0
- package/dist/chart/drawers/data-series.drawer.d.ts +39 -0
- package/dist/chart/drawers/data-series.drawer.js +6 -0
- package/dist/chart/drawers/drawing-manager.d.ts +61 -0
- package/dist/chart/drawers/drawing-manager.js +6 -0
- package/dist/chart/drawers/ht-data-series.drawer.d.ts +22 -0
- package/dist/chart/drawers/ht-data-series.drawer.js +6 -0
- package/dist/chart/events/event-bus.d.ts +48 -0
- package/dist/chart/events/event-bus.js +6 -0
- package/dist/chart/events/events.d.ts +8 -0
- package/dist/chart/events/events.js +6 -0
- package/dist/chart/inputhandlers/candle-tap.handler.d.ts +27 -0
- package/dist/chart/inputhandlers/candle-tap.handler.js +6 -0
- package/dist/chart/inputhandlers/chart-resize.handler.d.ts +67 -0
- package/dist/chart/inputhandlers/chart-resize.handler.js +6 -0
- package/dist/chart/inputhandlers/cross-event-producer.component.d.ts +44 -0
- package/dist/chart/inputhandlers/cross-event-producer.component.js +6 -0
- package/dist/chart/inputhandlers/hover-producer.component.d.ts +140 -0
- package/dist/chart/inputhandlers/hover-producer.component.js +6 -0
- package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +54 -0
- package/dist/chart/inputhandlers/main-canvas-touch.handler.js +6 -0
- package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +311 -0
- package/dist/chart/inputlisteners/canvas-input-listener.component.js +6 -0
- package/dist/chart/model/baseline.model.d.ts +54 -0
- package/dist/chart/model/baseline.model.js +6 -0
- package/dist/chart/model/bounds.model.d.ts +16 -0
- package/dist/chart/model/bounds.model.js +6 -0
- package/dist/chart/model/candle-hover.d.ts +35 -0
- package/dist/chart/model/candle-hover.js +6 -0
- package/dist/chart/model/candle-series-high-low.provider.d.ts +20 -0
- package/dist/chart/model/candle-series-high-low.provider.js +6 -0
- package/dist/chart/model/candle-series.model.d.ts +150 -0
- package/dist/chart/model/candle-series.model.js +6 -0
- package/dist/chart/model/candle.model.d.ts +46 -0
- package/dist/chart/model/candle.model.js +6 -0
- package/dist/chart/model/canvas.model.d.ts +131 -0
- package/dist/chart/model/canvas.model.js +6 -0
- package/dist/chart/model/chart-base-element.d.ts +103 -0
- package/dist/chart/model/chart-base-element.js +6 -0
- package/dist/chart/model/compare-series-hover.d.ts +22 -0
- package/dist/chart/model/compare-series-hover.js +6 -0
- package/dist/chart/model/data-series-view.d.ts +58 -0
- package/dist/chart/model/data-series-view.js +6 -0
- package/dist/chart/model/data-series.config.d.ts +31 -0
- package/dist/chart/model/data-series.config.js +6 -0
- package/dist/chart/model/data-series.model.d.ts +172 -0
- package/dist/chart/model/data-series.model.js +6 -0
- package/dist/chart/model/date-time.formatter.d.ts +23 -0
- package/dist/chart/model/date-time.formatter.js +6 -0
- package/dist/chart/model/hit-test-canvas.model.d.ts +128 -0
- package/dist/chart/model/hit-test-canvas.model.js +6 -0
- package/dist/chart/model/main-candle-series.model.d.ts +27 -0
- package/dist/chart/model/main-candle-series.model.js +6 -0
- package/dist/chart/model/scale.model.d.ts +180 -0
- package/dist/chart/model/scale.model.js +6 -0
- package/dist/chart/model/scaling/auto-scale.model.d.ts +79 -0
- package/dist/chart/model/scaling/auto-scale.model.js +6 -0
- package/dist/chart/model/scaling/constrait.functions.d.ts +43 -0
- package/dist/chart/model/scaling/constrait.functions.js +6 -0
- package/dist/chart/model/scaling/lock-ratio.model.d.ts +16 -0
- package/dist/chart/model/scaling/lock-ratio.model.js +6 -0
- package/dist/chart/model/scaling/move-chart.functions.d.ts +20 -0
- package/dist/chart/model/scaling/move-chart.functions.js +6 -0
- package/dist/chart/model/scaling/viewport.model.d.ts +223 -0
- package/dist/chart/model/scaling/viewport.model.js +6 -0
- package/dist/chart/model/scaling/x-zooming.functions.d.ts +26 -0
- package/dist/chart/model/scaling/x-zooming.functions.js +6 -0
- package/dist/chart/model/time-zone.model.d.ts +65 -0
- package/dist/chart/model/time-zone.model.js +6 -0
- package/dist/chart/model/visual-candle.d.ts +106 -0
- package/dist/chart/model/visual-candle.js +6 -0
- package/dist/chart/utils/__tests__/array.utils.test.d.ts +6 -0
- package/dist/chart/utils/__tests__/array.utils.test.js +6 -0
- package/dist/chart/utils/__tests__/object.utils.test.d.ts +6 -0
- package/dist/chart/utils/__tests__/object.utils.test.js +6 -0
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.d.ts +6 -0
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.js +6 -0
- package/dist/chart/utils/array.utils.d.ts +101 -0
- package/dist/chart/utils/array.utils.js +6 -0
- package/dist/chart/utils/auto-period-detector.utils.d.ts +16 -0
- package/dist/chart/utils/auto-period-detector.utils.js +6 -0
- package/dist/chart/utils/candles-generator-ts.utils.d.ts +41 -0
- package/dist/chart/utils/candles-generator-ts.utils.js +6 -0
- package/dist/chart/utils/candles-generator.utils.d.ts +13 -0
- package/dist/chart/utils/candles-generator.utils.js +6 -0
- package/dist/chart/utils/candles.utils.d.ts +8 -0
- package/dist/chart/utils/candles.utils.js +6 -0
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.d.ts +68 -0
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.js +6 -0
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.d.ts +20 -0
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.js +6 -0
- package/dist/chart/utils/canvas/canvas-text-functions.utils.d.ts +76 -0
- package/dist/chart/utils/canvas/canvas-text-functions.utils.js +6 -0
- package/dist/chart/utils/color.utils.d.ts +6 -0
- package/dist/chart/utils/color.utils.js +6 -0
- package/dist/chart/utils/device/browser.utils.d.ts +9 -0
- package/dist/chart/utils/device/browser.utils.js +6 -0
- package/dist/chart/utils/device/device-detector.utils.d.ts +12 -0
- package/dist/chart/utils/device/device-detector.utils.js +6 -0
- package/dist/chart/utils/device/device-pixel-ratio.utils.d.ts +16 -0
- package/dist/chart/utils/device/device-pixel-ratio.utils.js +6 -0
- package/dist/chart/utils/device/touchpad.utils.d.ts +30 -0
- package/dist/chart/utils/device/touchpad.utils.js +6 -0
- package/dist/chart/utils/dom.utils.d.ts +13 -0
- package/dist/chart/utils/dom.utils.js +6 -0
- package/dist/chart/utils/function.utils.d.ts +13 -0
- package/dist/chart/utils/function.utils.js +6 -0
- package/dist/chart/utils/math.utils.d.ts +40 -0
- package/dist/chart/utils/math.utils.js +6 -0
- package/dist/chart/utils/merge.utils.d.ts +27 -0
- package/dist/chart/utils/merge.utils.js +6 -0
- package/dist/chart/utils/object.utils.d.ts +46 -0
- package/dist/chart/utils/object.utils.js +6 -0
- package/dist/chart/utils/perfomance/animation-frame-cache.utils.d.ts +53 -0
- package/dist/chart/utils/perfomance/animation-frame-cache.utils.js +6 -0
- package/dist/chart/utils/perfomance/debounce.utils.d.ts +6 -0
- package/dist/chart/utils/perfomance/debounce.utils.js +6 -0
- package/dist/chart/utils/perfomance/memoize.utils.d.ts +21 -0
- package/dist/chart/utils/perfomance/memoize.utils.js +6 -0
- package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.d.ts +15 -0
- package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.js +6 -0
- package/dist/chart/utils/perfomance/throttle.utils.d.ts +15 -0
- package/dist/chart/utils/perfomance/throttle.utils.js +6 -0
- package/dist/chart/utils/price-increments.utils.d.ts +44 -0
- package/dist/chart/utils/price-increments.utils.js +6 -0
- package/dist/chart/utils/uuid.utils.d.ts +6 -0
- package/dist/chart/utils/uuid.utils.js +6 -0
- package/dist/dxchart.min.js +26 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +6 -0
- package/package.json +103 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{DEFAULT_MERGE_OPTIONS as n,merge as i}from"./utils/merge.utils";export const MAIN_FONT="Open Sans Semibold, sans-serif",LastBarRedrawableBarTypes=["candle","bar","scatterPlot","trend","hollow","histogram"],availableBarTypes=["candle","line","area","bar","scatterPlot","trend","hollow","histogram","baseline"],isLastBarRedrawAvailable=r=>LastBarRedrawableBarTypes.find(o=>o===r)!==void 0,getDefaultConfig=()=>({devexpertsPromoLink:!0,useUTCTimeOverride:!1,shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rtl:!1,scale:{keepZoomXOnYAxisChange:!0,auto:!0,zoomToCursor:!1,lockPriceToBarRatio:!1,autoScaleOnCandles:!0,autoScaleDisableOnDrag:{enabled:!0,edgeAngle:Math.PI/15,yDiff:80},inverse:!1,zoomSensitivity:.25,defaultViewportItems:100},timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,components:{chart:{type:"candle",showCandlesBorder:!0,showActiveCandlesBorder:!0,showWicks:!0,candleLineWidth:1,lineWidth:1,areaLineWidth:1,barLineWidth:1,minWidth:.5,minCandles:10,candlePaddingPercent:.25,highlightActiveCandle:!0,cursor:"default",selectedWidth:3,minCandlesOffset:2,defaultZoomCandleWidth:7,zoomStep:0,histogram:{barCapSize:1}},yAxis:{type:"regular",visible:!0,labelHeight:23,zeroPercentLine:!0,customScale:!0,customScaleDblClick:!0,align:"right",fontSize:12,fontFamily:MAIN_FONT,cursor:"ns-resize",resizeDisabledCursor:"default",labelBoxMargin:{top:4,bottom:4,end:8,start:10},typeConfig:{badge:{rounded:!0,paddings:{top:4,bottom:4,end:4,start:4}},plain:{},rectangle:{rounded:!1,paddings:{top:4,bottom:4,end:4,start:4}}},labels:{descriptions:!1,settings:{lastPrice:{mode:"label",type:"badge"},countdownToBarClose:{mode:"none",type:"rectangle"}}}},xAxis:{visible:!0,formatsForLabelsConfig:{lessThanSecond:"HH:mm:ss",second_1:"HH:mm:ss",minute_1:"HH:mm",minute_5:"HH:mm",minute_30:"HH:mm",hour_1:"HH:mm",day_1:"dd.MM",month_1:"MMM",year_1:"YYYY"},fontSize:12,fontFamily:MAIN_FONT,cursor:"ew-resize",padding:{top:8,bottom:16},fontStyle:""},events:{visible:!1,eventsVisibility:{"conference-calls":!0,dividends:!0,splits:!0,earnings:!0},height:20,cursor:"default",xAxisLabelFormat:[{format:"d MMM"}],icons:{earnings:{normal:'<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.06066 6.5L6.5 1.06066L11.9393 6.5L6.5 11.9393L1.06066 6.5Z" stroke="#D92C40" stroke-width="1.5"/></svg>',hover:'<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.06066 6.5L6.5 1.06066L11.9393 6.5L6.5 11.9393L1.06066 6.5Z" fill="#D92C40" stroke="#D92C40" stroke-width="1.5"/></svg>'}}},offsets:{visible:!0,right:10,top:10,bottom:20,left:0},waterMark:{visible:!1,fontFamily:"Open Sans, sans-serif",firstRowFontSize:80,firstRowBottomPadding:10,secondRowFontSize:40,secondRowBottomPadding:25,thirdRowFontSize:40,thirdRowBottomPadding:15,position:"center",offsetX:20,offsetY:20,logoWidth:20,logoHeight:20},highLow:{visible:!1,font:"12px sans-serif"},highlights:{visible:!1,fontFamily:"Open Sans",fontSize:13,border:{width:1,dash:[8,4]}},crossTool:{type:"cross-and-labels",discrete:!1,magnetTarget:"none",lineDash:[4,6],xAxisLabelFormat:[{format:"dd.MM.YYYY",showWhen:{periodMoreThen:846e5}},{format:"dd.MM.YYYY HH:mm",showWhen:{periodLessThen:846e5,periodMoreThen:6e3}},{format:"dd.MM.YYYY HH:mm:ss",showWhen:{periodLessThen:6e3}}],xLabel:{padding:{top:4,bottom:4,right:8,left:8},margin:{top:4}},yLabel:{padding:{top:4,bottom:4,end:4,start:4},type:"badge"}},grid:{visible:!0,horizontal:!1,vertical:!0,width:1,dash:[0,0],color:"#FFFFFF"},volumes:{visible:!0,showSeparately:!1,valueLines:15,barCapSize:1,volumeBarSpace:0,volumeFillColor:"#FFFFFF"},navigationMap:{visible:!1,allCandlesHistory:!0,timeLabels:{visible:!1,dateFormat:"dd.MM.YYYY HH:mm",fontFamily:"Open Sans",fontSize:13,padding:{x:10,y:1}},minSliderWindowWidth:10,cursors:{chart:"default",buttonLeft:"pointer",buttonRight:"pointer",leftResizer:"ew-resize",rightResizer:"ew-resize",slider:"grab"},knots:{height:35,width:7,border:0,lineWidth:1}},baseline:{cursor:"ns-resize",dragZone:3,height:1},paneResizer:{cursor:"ns-resize",height:1,visible:!0,fixedMode:!1,dragZone:3}},colors:{candleTheme:{upColor:"rgba(77,153,83,1)",downColor:"rgba(217,44,64,1)",noneColor:"rgba(255,255,255,1)",upWickColor:"rgba(77,153,83,1)",downWickColor:"rgba(217,44,64,1)",noneWickColor:"rgba(255,255,255,1)",borderOpacity:1},barTheme:{upColor:"rgba(77,153,83,1)",downColor:"rgba(217,44,64,1)",noneColor:"rgba(255,255,255,1)"},lineTheme:{upColor:"rgba(77,153,83,1)",downColor:"rgba(217,44,64,1)",noneColor:"rgba(255,255,255,1)"},chartAreaTheme:{backgroundMode:"regular",backgroundColor:"rgba(20,20,19,1)",backgroundGradientTopColor:"red",backgroundGradientBottomColor:"blue",axisColor:"rgba(128,128,128,1)",gridColor:"rgba(37,37,36,1)"},scatterPlot:{mainColor:"rgba(255,255,255,1)"},areaTheme:{lineColor:"rgba(127,120,214,1)",startColor:"rgba(169,38,251,1)",stopColor:"rgba(169,38,251,0.8)"},baseLineTheme:{lowerSectionStrokeColor:"rgba(217,44,64,1)",upperSectionStrokeColor:"rgba(77,153,83,1)",lowerSectionFillColor:"rgba(217, 44, 64, 0.07)",upperSectionFillColor:"rgba(77, 153, 83, 0.07)",baselineColor:"rgba(55,55,54,1)"},histogram:{upCap:"rgba(77,153,83,1)",upBottom:"rgba(77,153,83,0.1)",upBright:"rgba(77,153,83,0.4)",downCap:"rgba(217,44,64,1)",downBottom:"rgba(217,44,64,0.1)",downBright:"rgba(217,44,64,0.4)",noneCap:"rgba(255,255,255,1)",noneBottom:"rgba(255,255,255,0.1)",noneBright:"rgba(255,255,255,0.4)"},crossTool:{lineColor:"rgba(107,96,86,1)",labelBoxColor:"rgba(107,96,86,1)",labelTextColor:"rgba(255,255,255,1)"},waterMarkTheme:{firstRowColor:"rgba(255,255,255,0.2)",secondRowColor:"rgba(255,255,255,0.2)",thirdRowColor:"rgba(255,255,255,0.2)"},highlights:{NO_TRADING:{border:"rgba(107,96,86,1)",background:"transparent",label:"transparent"},AFTER_MARKET:{border:"rgba(107,96,86,1)",background:"rgba(38, 251, 149, 0.05)",label:"transparent"},PRE_MARKET:{border:"rgba(107,96,86,1)",background:"rgba(255, 170, 0, 0.05)",label:"transparent"},REGULAR:{border:"rgba(107,96,86,1)",background:"transparent",label:"transparent"}},activeCandleTheme:{upColor:"rgba(98,201,93,1)",downColor:"rgba(255,47,47,1)",noneColor:"rgba(255,255,255,1)",upWickColor:"rgba(98,201,93,1)",downWickColor:"rgba(255,47,47,1)",noneWickColor:"rgba(255,255,255,1)",borderOpacity:.5},volume:{downBarColor:"rgba(99,30,37,1)",upBarColor:"rgba(42,72,44,1)",noneBarColor:"rgba(255,255,255,0.4)",upCapColor:"rgba(42,72,44,1)",downCapColor:"rgba(99,30,37,1)",noneCapColor:"rgba(255,255,255,0.4)"},highLowTheme:{highColor:"rgba(223,222,223,1)",lowColor:"rgba(223,222,223,1)"},instrumentInfo:{textColor:"#aeb1b3"},paneResizer:{lineColor:"rgba(55,55,54,1)",bgColor:"rgba(20,20,19,1)",bgHoverColor:"rgba(55,55,54,0.6)"},events:{earnings:{color:"rgba(217,44,64,1)"},dividends:{color:"rgba(169,38,251,1)"},splits:{color:"rgba(244,187,63,1)"},"conference-calls":{color:"rgba(48,194,97,1)"}},secondaryChartTheme:[{lineTheme:{upColor:"rgba(226,61,25,1)",downColor:"rgba(226,61,25,1)",noneColor:"rgba(226,61,25,1)"},areaTheme:{lineColor:"rgba(226,61,25,1)",startColor:"rgba(226,61,25,0.8)",stopColor:"rgba(226,61,25,0)"}},{lineTheme:{upColor:"rgba(250,191,64,1)",downColor:"rgba(250,191,64,1)",noneColor:"rgba(250,191,64,1)"},areaTheme:{lineColor:"rgba(250,191,64,1)",startColor:"rgba(250,191,64,0.8)",stopColor:"rgba(250,191,64,0)"}},{lineTheme:{upColor:"rgba(169,38,251,1)",downColor:"rgba(169,38,251,1)",noneColor:"rgba(169,38,251,1)"},areaTheme:{lineColor:"rgba(169,38,251,1)",startColor:"rgba(169,38,251,0.8)",stopColor:"rgba(169,38,251,0)"}},{lineTheme:{upColor:"rgba(77,211,240,1)",downColor:"rgba(77,211,240,1)",noneColor:"rgba(77,211,240,1)"},areaTheme:{lineColor:"rgba(77,211,240,1)",startColor:"rgba(77,211,240,0.8)",stopColor:"rgba(77,211,240,0)"}},{lineTheme:{upColor:"rgba(59,203,91,1)",downColor:"rgba(59,203,91,1)",noneColor:"rgba(59,203,91,1)"},areaTheme:{lineColor:"rgba(59,203,91,1)",startColor:"rgba(59,203,91,0.8)",stopColor:"rgba(59,203,91,0)"}}],yAxis:{backgroundColor:"transparent",backgroundHoverColor:"rgba(20,20,19,1)",labelBoxColor:"rgba(20,20,19,1)",labelTextColor:"rgba(128,128,128,1)",labelInvertedTextColor:"rgba(20,20,19,1)",rectLabelTextColor:"rgba(255,255,255,1)",rectLabelInvertedTextColor:"rgba(20,20,19,1)",zeroPercentLine:"rgba(55,55,54,1)"},labels:{lastPrice:{textNegative:"rgba(255,255,255,1)",textPositive:"rgba(255,255,255,1)",textSelected:"rgba(0,0,0,1)",boxNegative:"rgba(217,44,64,1)",boxPositive:"rgba(77,153,83,1)",boxSelected:"rgba(255,255,255,1)"},countdownToBarClose:{textNegative:"rgba(255,255,255,1)",textPositive:"rgba(255,255,255,1)",textSelected:"rgba(255,255,255,1)",boxNegative:"rgba(217,44,64,1)",boxPositive:"rgba(77,153,83,1)",boxSelected:"rgba(255,255,255,1)"},highLow:{high:{boxColor:"rgba(107,96,86,1)",textColor:"rgba(255,255,255,1)",descriptionText:"High"},low:{boxColor:"rgba(107,96,86,1)",textColor:"rgba(255,255,255,1)",descriptionText:"Low"}},bidAsk:{bid:{boxColor:"rgba(77,153,83,1)",textColor:"rgba(255,255,255,1)",descriptionText:"Bid"},ask:{boxColor:"rgba(217,44,64,1)",textColor:"rgba(255,255,255,1)",descriptionText:"Ask"}},prePostMarket:{post:{boxColor:"rgba(38,251,149,1)",textColor:"rgba(20,20,19,1)",descriptionText:"Post"},pre:{boxColor:"rgba(255,170,0,1)",textColor:"rgba(20,20,19,1)",descriptionText:"Pre"}},prevDayClose:{boxColor:"rgba(107,96,86,1)",textColor:"rgba(255,255,255,1)"}},xAxis:{backgroundColor:"transparent",labelTextColor:"rgba(128,128,128,1)"},navigationMap:{backgroundColor:"transparent",buttonColor:"rgba(255,255,255,0.1)",buttonArrowColor:"rgba(212,212,211,1)",knotColor:"rgba(255,255,255,0.1)",knotLineColor:"rgba(212,212,211,1)",sliderColor:"rgba(255,255,255,0.08)",knotBorderColor:"#0b0d1a",timeLabelsTextColor:"rgba(128,128,128,1)",mapColor:"rgba(255,255,255,0.1)",mapFillColor:"rgba(255,255,255,0.1)",mapGradientTopColor:"rgba(255,255,255,0.1)",mapGradientBottomColor:"rgba(255,255,255,0.1)"}},animation:{moveDuration:1e3,candleDuration:200,paneResizer:{bgMode:!0,enabled:!0,duration:40},yAxis:{background:{enabled:!1,duration:40}}},drawingOrder:["OVER_SERIES_CLEAR","MAIN_CLEAR","SERIES_CLEAR","GRID","X_AXIS","Y_AXIS","UNDERLAY_VOLUMES_AREA","VOLUMES","DATA_SERIES","DRAWINGS","WATERMARK","N_MAP_CHART","EVENTS"]});export function mergeWithDefaultConfig(r,o=getDefaultConfig()){return i(r,o,n),r}export function mergeWithDefaultConfigCopy(r,o=getDefaultConfig()){const e=Object.assign({},r);return i(e,o,n),e}export function rewrite(r,o){Object.keys(r).forEach(e=>delete r[e]),Object.keys(o).forEach(e=>r[e]=o[e])}function s(r){return typeof r=="object"&&r!==null}function b(r,o){return[...r].map(a=>l(a,o))}const g=r=>Array.isArray(r);function l(r,o){if(!s(r))return r;if(g(r))return b(r,o);{const e=immutableMerge({},r,o);return Object.setPrototypeOf(e,Object.getPrototypeOf(r)),e}}export function immutableMerge(r,o,e){if(!s(r))return e.overrideExisting?o:r;if(Array.isArray(r)&&Array.isArray(o)){const t=e.overrideExisting?o:r;return b(t,e)}const a=Object.create(Object.getPrototypeOf(r));return Object.keys(r).forEach(t=>a[t]=l(r[t],e)),Object.keys(o).forEach(t=>{t in r?a[t]=immutableMerge(r[t],o[t],e):e.addIfMissing&&(a[t]=l(o[t],e))}),a}export const getFontFromConfig=r=>`${r.fontSize}px ${r.fontFamily}`;
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { ScaleModel } from '../../model/scale.model';
|
|
7
|
+
import VisualCandle from '../../model/visual-candle';
|
|
8
|
+
import { Timestamp } from '../../model/scaling/viewport.model';
|
|
9
|
+
import { ChartModel } from './chart.model';
|
|
10
|
+
/**
|
|
11
|
+
* Calculates the initial viewport.
|
|
12
|
+
* @param scaleModel
|
|
13
|
+
* @doc-tags scaling,viewport
|
|
14
|
+
*/
|
|
15
|
+
export declare const createBasicScaleViewportTransformer: (scaleModel: ScaleModel) => (visualCandleSource: VisualCandle[]) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Moves the viewport between 2 timestamps.
|
|
18
|
+
* @param scaleModel
|
|
19
|
+
* @param chartModel
|
|
20
|
+
* @param canvasAnimationContainer
|
|
21
|
+
*/
|
|
22
|
+
export declare const createTimeFrameViewportTransformer: (scaleModel: ScaleModel, chartModel: ChartModel) => (timeframe: [Timestamp, Timestamp], zoomIn?: boolean | null) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
export const createBasicScaleViewportTransformer=t=>n=>{if(n.length!==0){const a=n.slice(Math.max(n.length-t.state.defaultViewportItems,0)),e=a[0],i=a[a.length-1];t.setXScale(e.startUnit,i.startUnit+i.width+t.offsets.right),t.doAutoScale(!0),t.recalculateZoomXYRatio(),t.fireChanged()}},createTimeFrameViewportTransformer=(t,n)=>(a,e=null)=>{const[i,o]=a,r=n.candleFromTimestamp(i).startUnit,m=n.candleFromTimestamp(o).startUnit,s=e===null?0:n.mainCandleSeries.meanCandleWidth*2,c=e?r-s:r+s,f=e?m+s:m-s;t.setXScale(c,f)};
|
|
@@ -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 { VisualCandleCalculator } from './chart.model';
|
|
7
|
+
import { Candle } from '../../model/candle.model';
|
|
8
|
+
export declare const defaultCandleTransformer: VisualCandleCalculator;
|
|
9
|
+
export declare const hollowCandleTransformer: VisualCandleCalculator;
|
|
10
|
+
export declare const trendCandleTransformer: VisualCandleCalculator;
|
|
11
|
+
export declare const getCandleIsActive: (candle: Candle, activeCandle?: Candle) => boolean;
|
|
@@ -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{hollowDirection as p,nameDirection as m}from"../../model/candle.model";import u from"../../model/visual-candle";export const defaultCandleTransformer=(o,{x:s,width:r,activeCandle:e})=>new u(s,r,o.open,o.close,o.hi,o.lo,m(o.open,o.close),o,!0,getCandleIsActive(o,e)),hollowCandleTransformer=(o,{x:s,width:r,activeCandle:e,prevCandle:t})=>{var i;return new u(s,r,o.open,o.close,o.hi,o.lo,p((i=t==null?void 0:t.close)!==null&&i!==void 0?i:o.close,o.close),o,!0,getCandleIsActive(o,e),o.close>o.open)},trendCandleTransformer=(o,{x:s,width:r,activeCandle:e,prevCandle:t})=>{var i;return new u(s,r,o.open,o.close,o.hi,o.lo,m((i=t==null?void 0:t.close)!==null&&i!==void 0?i:o.close,o.close),o,!0,getCandleIsActive(o,e),o.close>o.open)},getCandleIsActive=(o,s)=>{const r=s&&s.idx===o.idx;return r!=null?r:!1};
|
|
@@ -0,0 +1,7 @@
|
|
|
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 { CandleWidthCalculator } from './chart.model';
|
|
7
|
+
export declare const calculateCandleWidth: CandleWidthCalculator;
|
|
@@ -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{BASIC_CANDLE_WIDTH as t}from"../../model/candle.model";export const calculateCandleWidth=()=>t;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { Candle } from '../../model/candle.model';
|
|
7
|
+
import { PartialCandle } from './chart.component';
|
|
8
|
+
/**
|
|
9
|
+
* In the early days of Futures contract there is no much trading,
|
|
10
|
+
* so there is not enough information to build a candle: only Open/Close value available.
|
|
11
|
+
* In this case Daily candle, which we receive, must be completed to full OHLC with equal values.
|
|
12
|
+
*/
|
|
13
|
+
export declare const prepareCandle: (candle: PartialCandle) => Candle;
|
|
14
|
+
/**
|
|
15
|
+
* Adds index to candles according to their array index.
|
|
16
|
+
* @param candles
|
|
17
|
+
*/
|
|
18
|
+
export declare const reindexCandles: (candles: Array<Candle>) => void;
|
|
19
|
+
export declare const deleteCandlesIndex: (candles: Array<Candle>) => void;
|
|
@@ -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{finite as t}from"../../utils/math.utils";export const prepareCandle=e=>{var o;const i=t(e.close,e.open,e.hi,e.lo);if(!isFinite(i))throw new Error("Received candle without any price");const p=t(e.hi,Math.max(e.open,e.close),i),r=t(e.lo,Math.min(e.open,e.close),i),s=t(e.open,e.lo,i),n=t(e.close,e.hi,i);return{hi:p,lo:r,open:s,close:n,timestamp:e.timestamp,volume:(o=e.volume)!==null&&o!==void 0?o:0,expansion:e.expansion,idx:e.idx,impVolatility:e.impVolatility}},reindexCandles=e=>{for(let o=0;o<e.length;++o)e[o].idx=o},deleteCandlesIndex=e=>{e.forEach(o=>{o.idx=void 0})};
|
|
@@ -0,0 +1,88 @@
|
|
|
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 { AutoScaleDisableOnDrag, FullChartConfig } from '../../chart.config';
|
|
9
|
+
import EventBus from '../../events/event-bus';
|
|
10
|
+
import { CanvasInputListenerComponent, Point } from '../../inputlisteners/canvas-input-listener.component';
|
|
11
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
12
|
+
import { ScaleModel } from '../../model/scale.model';
|
|
13
|
+
import { DragNDropYComponent } from '../dran-n-drop_helper/drag-n-drop-y.component';
|
|
14
|
+
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
15
|
+
export interface ChartWheelEvent {
|
|
16
|
+
readonly originalEvent: WheelEvent;
|
|
17
|
+
readonly candleIdx: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* ChartAreaPanHandler is a class that handles the panning and zooming of the chart area.
|
|
21
|
+
* It extends the ChartBaseElement class and has the following properties:
|
|
22
|
+
* @property {MainCanvasTouchHandler} touchHandler - An instance of the MainCanvasTouchHandler class.
|
|
23
|
+
* @property {Point} currentPoint - An object that represents the current point of the chart area.
|
|
24
|
+
* @property {number} xDraggedCandlesDelta - A number that represents the number of candles delta changed during X dragging.
|
|
25
|
+
* @property {number} lastXStart - A number that represents the last X start position.
|
|
26
|
+
* @property {number} lastYStart - A number that represents the last Y start position.
|
|
27
|
+
* @property {number} wheelTrottleTime - A number that represents the time in ms for the wheel throttle.
|
|
28
|
+
* @constructor
|
|
29
|
+
* @param {EventBus} bus - An instance of the EventBus class.
|
|
30
|
+
* @param {FullChartConfig} config - An instance of the FullChartConfig class.
|
|
31
|
+
* @param {ScaleModel} scaleModel - An instance of the ScaleModel class.
|
|
32
|
+
* @param {Element} mainCanvasParent - The parent element of the main canvas.
|
|
33
|
+
* @param {CanvasInputListenerComponent} canvasInputListener - An instance of the CanvasInputListenerComponent class.
|
|
34
|
+
* @param {CanvasBoundsContainer} canvasBoundsContainer - An instance of the CanvasBoundsContainer class.
|
|
35
|
+
* @param {CanvasAnimation} canvasAnimation - An instance of the CanvasAnimation class.
|
|
36
|
+
* @param {ChartPanComponent} chartPanComponent - An instance of the ChartPanComponent class.
|
|
37
|
+
|
|
38
|
+
*/
|
|
39
|
+
export declare class ChartAreaPanHandler extends ChartBaseElement {
|
|
40
|
+
private bus;
|
|
41
|
+
private config;
|
|
42
|
+
private scaleModel;
|
|
43
|
+
private mainCanvasParent;
|
|
44
|
+
private canvasInputListener;
|
|
45
|
+
private canvasBoundsContainer;
|
|
46
|
+
private canvasAnimation;
|
|
47
|
+
private chartPanComponent;
|
|
48
|
+
private readonly touchHandler;
|
|
49
|
+
private currentPoint;
|
|
50
|
+
xDraggedCandlesDelta: number;
|
|
51
|
+
lastXStart: number;
|
|
52
|
+
wheelTrottleTime: number;
|
|
53
|
+
constructor(bus: EventBus, config: FullChartConfig, scaleModel: ScaleModel, mainCanvasParent: Element, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, canvasAnimation: CanvasAnimation, chartPanComponent: ChartPanComponent);
|
|
54
|
+
/**
|
|
55
|
+
* It observes the wheel event on all panes of the canvas and throttles it to the specified time.
|
|
56
|
+
* It then calculates the zoom sensitivity based on whether the event was triggered by a touchpad or not.
|
|
57
|
+
* If the zoomToCursor configuration is set to true, it calculates the viewport percentage based on the zoomCanvasOffset and canvas width.
|
|
58
|
+
* It then calls the zoomXToPercent method of the scaleModel to zoom in or out based on the zoomIn parameter.
|
|
59
|
+
* If the zoomToCursor configuration is set to false, it calls the zoomXToEnd method of the scaleModel to zoom in or out based on the zoomIn parameter.
|
|
60
|
+
* Finally, it fires the draw event of the bus to redraw the canvas.
|
|
61
|
+
* @param {WheelEvent} e - Wheel event
|
|
62
|
+
* @returns {void}
|
|
63
|
+
*/
|
|
64
|
+
private zoomXHandler;
|
|
65
|
+
/**
|
|
66
|
+
* This method is used to activate the zoom functionality of the canvas. It extends the doActivate method of the parent class.
|
|
67
|
+
* @protected
|
|
68
|
+
* @returns {void}
|
|
69
|
+
*/
|
|
70
|
+
protected doActivate(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Registers a handler for panning the chart along the Y-axis.
|
|
73
|
+
* @param {ScaleModel} scaleModel - The scale model of the extent.
|
|
74
|
+
* @param {HitBoundsTest} hitTest - The hit test of the pane.
|
|
75
|
+
* @returns {DragNDropYComponent} - The drag and drop component for panning the chart along the Y-axis.
|
|
76
|
+
*/
|
|
77
|
+
registerChartYPanHandler(scaleModel: ScaleModel, hitTest: HitBoundsTest): DragNDropYComponent;
|
|
78
|
+
private onXDragStart;
|
|
79
|
+
private onXDragTick;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* This function calculates angle between current point and point(0, 0), and compares the result with config values
|
|
83
|
+
* @param point
|
|
84
|
+
* @param config
|
|
85
|
+
*
|
|
86
|
+
* @doc-tags chart-core,auto-scale,y-axis
|
|
87
|
+
*/
|
|
88
|
+
export declare const shouldDisableAutoScale: (point: Point, config: Required<AutoScaleDisableOnDrag>) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{merge as C}from"rxjs";import{throttleTime as b}from"rxjs/operators";import{VIEWPORT_ANIMATION_ID as v}from"../../animation/canvas-animation";import{CanvasElement as m}from"../../canvas/canvas-bounds-container";import{MainCanvasTouchHandler as P}from"../../inputhandlers/main-canvas-touch.handler";import{ChartBaseElement as T}from"../../model/chart-base-element";import{pixelsToUnits as p}from"../../model/scaling/viewport.model";import{deviceDetector as X}from"../../utils/device/device-detector.utils";import{getTouchpadSensitivity as A,touchpadDetector as M}from"../../utils/device/touchpad.utils";import{DragNDropXComponent as x}from"../dran-n-drop_helper/drag-n-drop-x.component";import{DragNDropYComponent as w}from"../dran-n-drop_helper/drag-n-drop-y.component";export class ChartAreaPanHandler extends T{constructor(t,a,e,i,s,n,o,r){super(),this.bus=t,this.config=a,this.scaleModel=e,this.mainCanvasParent=i,this.canvasInputListener=s,this.canvasBoundsContainer=n,this.canvasAnimation=o,this.chartPanComponent=r,this.currentPoint={x:0,y:0},this.xDraggedCandlesDelta=0,this.lastXStart=0,this.wheelTrottleTime=15,this.zoomXHandler=h=>{const c=M(h),l=h.deltaY<0,f=c?A(this.config):this.config.scale.zoomSensitivity;if(this.config.scale.zoomToCursor){const D=this.canvasBoundsContainer.getBounds(m.CANVAS).width,S=h.offsetX/D;this.scaleModel.zoomXToPercent(S,l,!1,f)}else this.scaleModel.zoomXToEnd(l,f);this.bus.fireDraw()},this.onXDragStart=()=>{this.canvasAnimation.forceStopAnimation(v),this.xDraggedCandlesDelta=0,this.lastXStart=this.scaleModel.xStart},this.onXDragTick=h=>{const{delta:c}=h;this.currentPoint.x=c;const l=p(c,this.scaleModel.zoomX);this.scaleModel.moveXStart(this.lastXStart-l),this.bus.fireDraw()},this.touchHandler=new P(this.scaleModel,this.canvasInputListener,this.mainCanvasParent);const u=this.canvasBoundsContainer.getBoundsHitTest(m.ALL_PANES),g=new x(u,{onDragStart:this.onXDragStart,onDragTick:this.onXDragTick},this.canvasInputListener,this.chartPanComponent,{disableChartPanning:!1});this.addChildEntity(g)}doActivate(){super.doActivate();const t=this.canvasBoundsContainer.getBoundsHitTest(m.ALL_PANES);this.addRxSubscription(C(this.canvasInputListener.observeWheel(t),this.canvasInputListener.observePinch(t)).pipe(b(this.wheelTrottleTime,void 0,{trailing:!0,leading:!0})).subscribe(this.zoomXHandler)),this.addRxSubscription(this.canvasInputListener.observeScrollGesture().pipe(b(this.wheelTrottleTime,void 0,{trailing:!0,leading:!0})).subscribe(a=>{let e=-1;const i=X();(i==="apple"||i==="mobile")&&(e=1);let s=0,n=0;if(s+=a.deltaX*e,n+=a.deltaY*-e,s!==0&&Math.abs(s)>Math.abs(n)){const o=p(s,this.scaleModel.zoomX);this.scaleModel.moveXStart(this.scaleModel.xStart-o)}else n!==0&&Math.abs(n)>Math.abs(s)&&this.zoomXHandler(a);this.bus.fireDraw()})),this.addRxSubscription(this.chartPanComponent.chartBaseModel.dataPrependSubject.asObservable().subscribe(({prependedCandlesWidth:a})=>{this.lastXStart+=a})),this.touchHandler.activate(),this.addSubscription(this.touchHandler.deactivate.bind(this.touchHandler))}registerChartYPanHandler(t,a){let e=t.yStart;const i=()=>{this.canvasAnimation.forceStopAnimation(v),this.currentPoint={x:0,y:0},e=t.yStart},s=o=>{const{delta:r}=o;if(this.currentPoint.y=r,t.state.auto)shouldDisableAutoScale(this.currentPoint,t.state.autoScaleDisableOnDrag)&&t.autoScale(!1);else{const u=p(t.state.inverse?-r:r,t.zoomY);t.moveYStart(e+u)}},n=new w(a,{onDragTick:s,onDragStart:i},this.canvasInputListener,this.chartPanComponent,{disableChartPanning:!1});return this.addChildEntity(n),n}}export const shouldDisableAutoScale=(d,t)=>{if(!t.enabled)return!1;const a=Math.abs(d.y),e=Math.pow(Math.pow(Math.abs(d.x),2)+Math.pow(a,2),.5),i=Math.abs(Math.acos(a/e));return a>t.yDiff&&i<t.edgeAngle};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { Subject } from 'rxjs';
|
|
7
|
+
import { Candle } from '../../model/candle.model';
|
|
8
|
+
import { DataSeriesPoint, VisualSeriesPoint } from '../../model/data-series.model';
|
|
9
|
+
import { Index, Timestamp } from '../../model/scaling/viewport.model';
|
|
10
|
+
import VisualCandle from '../../model/visual-candle';
|
|
11
|
+
export type BaseType = 'candle' | 'point';
|
|
12
|
+
type DataPoint<T extends BaseType> = T extends 'candle' ? Candle : DataSeriesPoint;
|
|
13
|
+
type VisualPoint<T extends BaseType> = T extends 'candle' ? VisualCandle : VisualSeriesPoint;
|
|
14
|
+
export interface PrependedCandlesData {
|
|
15
|
+
prependedCandlesWidth: number;
|
|
16
|
+
preparedCandles: Candle[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This model is an abstraction which describes manipulations tied to the main data series.
|
|
20
|
+
* For example, all x-scale is based on the main data series. If we add a new data series, we need to match its coordinates to the main data series.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ChartBaseModel<T extends BaseType = 'point'> {
|
|
23
|
+
type: T;
|
|
24
|
+
mainDataPoints: DataPoint<T>[];
|
|
25
|
+
mainVisualPoints: VisualPoint<T>[];
|
|
26
|
+
readonly dataUpdatedSubject: Subject<void>;
|
|
27
|
+
readonly dataSetSubject: Subject<void>;
|
|
28
|
+
readonly dataRemovedSubject: Subject<void>;
|
|
29
|
+
readonly dataPrependSubject: Subject<PrependedCandlesData>;
|
|
30
|
+
/**
|
|
31
|
+
* Mean data point width in abstract units.
|
|
32
|
+
*/
|
|
33
|
+
meanDataWidth: number;
|
|
34
|
+
/**
|
|
35
|
+
* Candles aggregation period in ms. Required for future candles calculation.
|
|
36
|
+
*/
|
|
37
|
+
period: number;
|
|
38
|
+
constructor(type: T);
|
|
39
|
+
/**
|
|
40
|
+
* For given timestamp finds the closest candle in dataset.
|
|
41
|
+
* @param timestamp
|
|
42
|
+
*/
|
|
43
|
+
dataFromTimestamp(timestamp: Timestamp, shouldExtrapolate?: boolean): VisualPoint<T>;
|
|
44
|
+
/**
|
|
45
|
+
* Recalculates the period of the main candle series based on the data points.
|
|
46
|
+
* If a period is detected, it is set as the new period.
|
|
47
|
+
*/
|
|
48
|
+
recalculatePeriod(): void;
|
|
49
|
+
/**
|
|
50
|
+
* For given index returns the closest visual candle, or fake candle with correct X coordinate.
|
|
51
|
+
* @param idx - index of candle
|
|
52
|
+
*/
|
|
53
|
+
dataFromIdx(idx: Index): VisualPoint<T>;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{Subject as a}from"rxjs";import{autoDetectPeriod as s}from"../../utils/auto-period-detector.utils";import{searchCandleIndex as n}from"../../utils/candles.utils";import{fakeVisualCandle as o,fakeVisualPoint as r}from"./fake-candles";export class ChartBaseModel{constructor(t){this.type=t,this.mainDataPoints=[],this.mainVisualPoints=[],this.dataUpdatedSubject=new a,this.dataSetSubject=new a,this.dataRemovedSubject=new a,this.dataPrependSubject=new a,this.meanDataWidth=1,this.period=1}dataFromTimestamp(t,i=!0){const e=n(t,i,this.mainDataPoints,this.period);return this.dataFromIdx(e.index)}recalculatePeriod(){const t=s(this.mainDataPoints);t&&(this.period=t)}dataFromIdx(t){const i=this.mainVisualPoints[t];return i||(this.type==="candle"?o(this.mainDataPoints,this.mainVisualPoints,this.meanDataWidth,t,this.period):r(this.mainDataPoints,this.mainVisualPoints,this.meanDataWidth,t,this.period))}}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
8
|
+
import { CursorHandler } from '../../canvas/cursor.handler';
|
|
9
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
10
|
+
import { BarType, ChartConfigComponentsOffsets, FullChartConfig } from '../../chart.config';
|
|
11
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
12
|
+
import { SeriesDrawer } from '../../drawers/data-series.drawer';
|
|
13
|
+
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
14
|
+
import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
|
|
15
|
+
import { BaselineModel } from '../../model/baseline.model';
|
|
16
|
+
import { CandleSeriesModel } from '../../model/candle-series.model';
|
|
17
|
+
import { Candle } from '../../model/candle.model';
|
|
18
|
+
import { DataSeriesType } from '../../model/data-series.config';
|
|
19
|
+
import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
|
|
20
|
+
import { ScaleModel } from '../../model/scale.model';
|
|
21
|
+
import { Timestamp, Unit } from '../../model/scaling/viewport.model';
|
|
22
|
+
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
23
|
+
import { PaneManager } from '../pane/pane-manager.component';
|
|
24
|
+
import { CandleWidthCalculator, ChartModel, LastCandleLabelHandler, VisualCandleCalculator } from './chart.model';
|
|
25
|
+
import { PrependedCandlesData } from './chart-base.model';
|
|
26
|
+
/**
|
|
27
|
+
* Represents a financial instrument to be displayed on a chart
|
|
28
|
+
* @class
|
|
29
|
+
* @property {string} symbol - The symbol of the instrument
|
|
30
|
+
* @property {string} [description] - The description of the instrument
|
|
31
|
+
* @property {Array<number>} [priceIncrements=[0.01]] - An array of possible price step values on the price axis
|
|
32
|
+
* @property {boolean} [bondFraction] - A flag indicating whether the instrument is a bond fraction or not
|
|
33
|
+
*/
|
|
34
|
+
export declare class ChartInstrument {
|
|
35
|
+
symbol: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
/**
|
|
38
|
+
* defines possible price step values on price axis
|
|
39
|
+
*/
|
|
40
|
+
priceIncrements?: Array<number>;
|
|
41
|
+
}
|
|
42
|
+
export type PartialCandle = Partial<Candle> & {
|
|
43
|
+
timestamp: Timestamp;
|
|
44
|
+
close: number;
|
|
45
|
+
};
|
|
46
|
+
export interface CandleSeries {
|
|
47
|
+
candles: PartialCandle[];
|
|
48
|
+
instrument?: ChartInstrument;
|
|
49
|
+
}
|
|
50
|
+
export declare class ChartComponent extends ChartBaseElement {
|
|
51
|
+
readonly chartModel: ChartModel;
|
|
52
|
+
canvasModel: CanvasModel;
|
|
53
|
+
private config;
|
|
54
|
+
private scaleModel;
|
|
55
|
+
private canvasBoundsContainer;
|
|
56
|
+
private drawingManager;
|
|
57
|
+
private hitTestCanvasModel;
|
|
58
|
+
private canvasInputListener;
|
|
59
|
+
readonly baselineModel: BaselineModel;
|
|
60
|
+
private readonly backgroundDrawer;
|
|
61
|
+
private readonly dataSeriesDrawers;
|
|
62
|
+
private readonly dataSeriesDrawer;
|
|
63
|
+
constructor(chartModel: ChartModel, canvasModel: CanvasModel, config: FullChartConfig, scaleModel: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, hitTestCanvasModel: HitTestCanvasModel, canvasInputListener: CanvasInputListenerComponent, backgroundCanvasModel: CanvasModel, chartPanComponent: ChartPanComponent, paneManager: PaneManager, cursorHandler: CursorHandler);
|
|
64
|
+
/**
|
|
65
|
+
* This method overrides the doActivate method of the parent class and calls it.
|
|
66
|
+
* It does not take any parameters and does not return anything.
|
|
67
|
+
* @protected
|
|
68
|
+
* @returns {void}
|
|
69
|
+
*/
|
|
70
|
+
protected doActivate(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Registers default candle transformers.
|
|
73
|
+
* @private
|
|
74
|
+
* @function
|
|
75
|
+
* @returns {void}
|
|
76
|
+
*/
|
|
77
|
+
private registerDefaultCandlesTransformers;
|
|
78
|
+
get barTypeValues(): Array<BarType>;
|
|
79
|
+
strToBarType: (str: string) => BarType;
|
|
80
|
+
/**
|
|
81
|
+
* You can use this method to determine logic of visual candle transformation for specified chart type.
|
|
82
|
+
* @param chartType
|
|
83
|
+
* @param transformer
|
|
84
|
+
*/
|
|
85
|
+
registerCandlesTransformer(chartType: BarType, transformer: VisualCandleCalculator): void;
|
|
86
|
+
/**
|
|
87
|
+
* You can use this method to modify labels for last candle.
|
|
88
|
+
* @param chartType
|
|
89
|
+
* @param handler
|
|
90
|
+
*/
|
|
91
|
+
registerLastCandleLabelHandler(chartType: BarType, handler: LastCandleLabelHandler): void;
|
|
92
|
+
/**
|
|
93
|
+
* You can use this method to determine chart width calculation for specified chart type.
|
|
94
|
+
* @param chartType
|
|
95
|
+
* @param calculator
|
|
96
|
+
*/
|
|
97
|
+
registerCandlesWidthCalculator(chartType: BarType, calculator: CandleWidthCalculator): void;
|
|
98
|
+
/**
|
|
99
|
+
* In future this drawers should have same type as main series
|
|
100
|
+
*/
|
|
101
|
+
private registerDefaultDataSeriesDrawers;
|
|
102
|
+
/**
|
|
103
|
+
* Sets the chart type of main candle series.
|
|
104
|
+
* @param type - new type
|
|
105
|
+
*/
|
|
106
|
+
setChartType(type: BarType): void;
|
|
107
|
+
/**
|
|
108
|
+
* Resets chart scale to default according to config.components.chart.defaultZoomCandleWidth.
|
|
109
|
+
*/
|
|
110
|
+
resetChartScale(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Sets the timestamp range of the chart by setting the x-axis scale.
|
|
113
|
+
* @param {Timestamp} start - The start timestamp of the range.
|
|
114
|
+
* @param {Timestamp} end - The end timestamp of the range.
|
|
115
|
+
* @returns {void}
|
|
116
|
+
*/
|
|
117
|
+
setTimestampRange(start: Timestamp, end: Timestamp): void;
|
|
118
|
+
/**
|
|
119
|
+
* Moves the viewport to exactly xStart..xEnd place.
|
|
120
|
+
* @param xStart - viewport start in units
|
|
121
|
+
* @param xEnd - viewport end in units
|
|
122
|
+
*/
|
|
123
|
+
setXScale(xStart: Unit, xEnd: Unit): void;
|
|
124
|
+
/**
|
|
125
|
+
* Sets the visibility of the wicks in the chart.
|
|
126
|
+
* @param {boolean} isShow - A boolean value indicating whether to show or hide the wicks.
|
|
127
|
+
* @returns {void}
|
|
128
|
+
*/
|
|
129
|
+
setShowWicks(isShow: boolean): void;
|
|
130
|
+
/**
|
|
131
|
+
* Used to set the main series to chart.
|
|
132
|
+
* @param series
|
|
133
|
+
*/
|
|
134
|
+
setMainSeries(series: CandleSeries): void;
|
|
135
|
+
/**
|
|
136
|
+
* Adds new secondary chart series.
|
|
137
|
+
* @param series
|
|
138
|
+
*/
|
|
139
|
+
setSecondarySeries(series: CandleSeries): CandleSeriesModel | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Sets the main and secondary series in one bulk operation.
|
|
142
|
+
* Reindexing and visual rerender happens at the same time.
|
|
143
|
+
* @param mainSeries
|
|
144
|
+
* @param secondarySeries
|
|
145
|
+
*/
|
|
146
|
+
setAllSeries(mainSeries: CandleSeries, secondarySeries?: CandleSeries[]): void;
|
|
147
|
+
/**
|
|
148
|
+
* Converts candle index to chart x coordinate
|
|
149
|
+
*/
|
|
150
|
+
toXFromCandleIndex(idx: number): number;
|
|
151
|
+
/**
|
|
152
|
+
* Converts timestamp to chart x coordinate
|
|
153
|
+
*/
|
|
154
|
+
toXFromTimestamp(timestamp: number): number;
|
|
155
|
+
/**
|
|
156
|
+
* Converts price to chart y coordinate
|
|
157
|
+
*/
|
|
158
|
+
toY(price: number): number;
|
|
159
|
+
/**
|
|
160
|
+
* Updates the main and secondary series in one bulk operation.
|
|
161
|
+
* Reindexing and visual rerender happens at the same time.
|
|
162
|
+
* @param mainSeries {CandleSeries}
|
|
163
|
+
* @param secondarySeries {CandleSeries[]}
|
|
164
|
+
*/
|
|
165
|
+
updateAllSeries(mainSeries: CandleSeries, secondarySeries?: CandleSeries[]): void;
|
|
166
|
+
/**
|
|
167
|
+
* Removes all data points from the main candle series that are newer than the given timestamp.
|
|
168
|
+
* Can be useful for data replay.
|
|
169
|
+
* @param startTimestamp
|
|
170
|
+
*/
|
|
171
|
+
removeDataFrom(timestamp: Timestamp): void;
|
|
172
|
+
/**
|
|
173
|
+
* Removes chart candles series.
|
|
174
|
+
* @param instrument
|
|
175
|
+
*/
|
|
176
|
+
removeSecondarySeries(series: CandleSeriesModel): void;
|
|
177
|
+
/**
|
|
178
|
+
* Adds new candles array to the existing one at the start, mostly used in lazy loading
|
|
179
|
+
* @param target - initial candles array
|
|
180
|
+
* @param prependUpdate - additional candles array, which will be added to the target array
|
|
181
|
+
*/
|
|
182
|
+
prependCandles(target: Candle[], prependUpdate: Candle[]): void;
|
|
183
|
+
/**
|
|
184
|
+
* Adds new candle to the chart
|
|
185
|
+
* @param candle - new candle
|
|
186
|
+
* @param instrument - name of the instrument to update
|
|
187
|
+
*/
|
|
188
|
+
addLastCandle(candle: Candle, instrumentSymbol?: string): void;
|
|
189
|
+
/**
|
|
190
|
+
* Updates last candle value
|
|
191
|
+
* @param candle - updated candle
|
|
192
|
+
* @param instrument - name of the instrument to update
|
|
193
|
+
*/
|
|
194
|
+
updateLastCandle(candle: Candle, instrumentSymbol?: string): void;
|
|
195
|
+
/**
|
|
196
|
+
* Updates candle series for instrument. By default takes main instrument.
|
|
197
|
+
* @param candles
|
|
198
|
+
* @param instrument
|
|
199
|
+
*/
|
|
200
|
+
updateCandles(candles: Array<Candle>, instrumentSymbol?: string): void;
|
|
201
|
+
/**
|
|
202
|
+
* Sets offsets to viewport.
|
|
203
|
+
* @param offsets - new offsets
|
|
204
|
+
*/
|
|
205
|
+
setOffsets(offsets: Partial<ChartConfigComponentsOffsets>): void;
|
|
206
|
+
/**
|
|
207
|
+
* Returns a SeriesDrawer object based on the provided drawerType.
|
|
208
|
+
* @param {BarType} drawerType - The type of the drawer to be returned.
|
|
209
|
+
* @returns {SeriesDrawer | undefined} - The SeriesDrawer object corresponding to the provided drawerType or undefined if not found.
|
|
210
|
+
*/
|
|
211
|
+
getDataSeriesDrawer(drawerType: BarType): SeriesDrawer | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Registers a new chart type drawer or overrides default drawer if drawerType is {BarType}.
|
|
214
|
+
* @param drawerType {string} - a unique name for the drawer, could be {BarType} - in this case will override default drawer for the type
|
|
215
|
+
* @param drawer {ChartTypeDrawer} - an implementation of the drawer
|
|
216
|
+
*/
|
|
217
|
+
registerDataSeriesTypeDrawer(drawerType: DataSeriesType, drawer: SeriesDrawer): void;
|
|
218
|
+
/**
|
|
219
|
+
* Updates the price increments of a given instrument if they are not valid or not defined.
|
|
220
|
+
* If the price increments are not valid or not defined, it will set them to a default value.
|
|
221
|
+
* @param {ChartInstrument} instrument - The instrument to update the price increments for.
|
|
222
|
+
*/
|
|
223
|
+
private updatePriceIncrementsIfNeeded;
|
|
224
|
+
/**
|
|
225
|
+
* Returns an Observable that emits a void value whenever the offsetsChanged event is triggered.
|
|
226
|
+
* @returns {Observable<void>} An Observable that emits a void value whenever the offsetsChanged event is triggered.
|
|
227
|
+
*/
|
|
228
|
+
observeOffsetsChanged(): Observable<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Returns an Observable that emits the BarType whenever the chart type is changed.
|
|
231
|
+
* @returns {Observable<BarType>} An Observable that emits the BarType whenever the chart type is changed.
|
|
232
|
+
*/
|
|
233
|
+
observeChartTypeChanged(): Observable<BarType>;
|
|
234
|
+
/**
|
|
235
|
+
* Returns an Observable that emits a void value when the candles in the chart model change.
|
|
236
|
+
* The Observable is obtained by calling the observeCandlesChanged method of the chartModel object.
|
|
237
|
+
* @returns {Observable<void>} An Observable that emits a void value when the candles in the chart model change.
|
|
238
|
+
*/
|
|
239
|
+
observeCandlesChanged(): Observable<void>;
|
|
240
|
+
/**
|
|
241
|
+
* Returns an Observable that emits a void value when the candles are updated in the chart model.
|
|
242
|
+
* The Observable is obtained from the candlesUpdatedSubject of the chartModel.
|
|
243
|
+
* @returns {Observable<void>} Observable that emits a void value when the candles are updated.
|
|
244
|
+
*/
|
|
245
|
+
observeCandlesUpdated(): Observable<void>;
|
|
246
|
+
/**
|
|
247
|
+
* Returns an Observable that emits a void value whenever the candlesPrependSubject is triggered.
|
|
248
|
+
* @returns {Observable<PrependedCandlesData>} An Observable that emits a PrependedCandlesData whenever the candles are added to the end.
|
|
249
|
+
*/
|
|
250
|
+
observeCandlesPrepended(): Observable<PrependedCandlesData>;
|
|
251
|
+
}
|
|
@@ -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{CHART_UUID as l,CanvasElement as c}from"../../canvas/canvas-bounds-container";import{ChartBaseElement as g}from"../../model/chart-base-element";import{BackgroundDrawer as T}from"../../drawers/chart-background.drawer";import{AreaDrawer as M}from"../../drawers/chart-type-drawers/area.drawer";import{BarDrawer as v}from"../../drawers/chart-type-drawers/bar.drawer";import{BaselineDrawer as I}from"../../drawers/chart-type-drawers/baseline.drawer";import{CandleDrawer as y}from"../../drawers/chart-type-drawers/candle.drawer";import{HistogramDrawer as E}from"../../drawers/chart-type-drawers/histogram.drawer";import{LineDrawer as b}from"../../drawers/chart-type-drawers/line.drawer";import{ScatterPlotDrawer as A}from"../../drawers/chart-type-drawers/scatter-plot.drawer";import{CandleSeriesWrapper as P}from"../../drawers/data-series-drawers/candle-series-wrapper";import{ColorCandleDrawer as _}from"../../drawers/data-series-drawers/color-candle.drawer";import{DifferenceCloudDrawer as L}from"../../drawers/data-series-drawers/difference-cloud.drawer";import{HistogramDrawer as N}from"../../drawers/data-series-drawers/histogram.drawer";import{LinearDrawer as B}from"../../drawers/data-series-drawers/linear.drawer";import{PointsDrawer as R}from"../../drawers/data-series-drawers/points.drawer";import{TextDrawer as O}from"../../drawers/data-series-drawers/text.drawer";import{TriangleDrawer as H}from"../../drawers/data-series-drawers/triangle.drawer";import{DataSeriesDrawer as x}from"../../drawers/data-series.drawer";import{HIT_TEST_PREFIX as U}from"../../drawers/drawing-manager";import{HTDataSeriesDrawer as F}from"../../drawers/ht-data-series.drawer";import{BaselineModel as X}from"../../model/baseline.model";import{keys as k}from"../../utils/object.utils";import{PriceIncrementsUtils as m}from"../../utils/price-increments.utils";import{defaultCandleTransformer as V,hollowCandleTransformer as W,trendCandleTransformer as G}from"./candle-transformer.functions";import{deleteCandlesIndex as j}from"./candle.functions";import{TrendHistogramDrawer as K}from"../../drawers/data-series-drawers/trend-histogram.drawer";export class ChartInstrument{constructor(){this.symbol="MOCK",this.priceIncrements=[.01]}}export class ChartComponent extends g{constructor(e,r,t,a,i,s,n,D,C,w,d,h){super(),this.chartModel=e,this.canvasModel=r,this.config=t,this.scaleModel=a,this.canvasBoundsContainer=i,this.drawingManager=s,this.hitTestCanvasModel=n,this.canvasInputListener=D,this.dataSeriesDrawers={},this.strToBarType=f=>{var o;return(o=this.barTypeValues.find(S=>S===f))!==null&&o!==void 0?o:"candle"},this.addChildEntity(this.chartModel),this.registerDefaultCandlesTransformers(),this.baselineModel=new X(this.chartModel,w,this.canvasModel,this.canvasInputListener,this.config,this.canvasBoundsContainer,h),this.addChildEntity(this.baselineModel);const u=new F(this.dataSeriesDrawers,this.hitTestCanvasModel,d);this.drawingManager.addDrawerBefore(u,U+"DATA_SERIES","HIT_TEST_EVENTS"),this.dataSeriesDrawer=new x(d,r,this.dataSeriesDrawers),this.drawingManager.addDrawer(this.dataSeriesDrawer,"DATA_SERIES"),this.registerDefaultDataSeriesDrawers(),this.backgroundDrawer=new T(C,this.config),s.addDrawer(this.backgroundDrawer,"MAIN_BACKGROUND"),h.setCursorForCanvasEl(c.PANE_UUID(l),t.components.chart.cursor)}doActivate(){super.doActivate()}registerDefaultCandlesTransformers(){this.registerCandlesTransformer("candle",V),this.registerCandlesTransformer("trend",G),this.registerCandlesTransformer("hollow",W)}get barTypeValues(){return k(this.dataSeriesDrawers)}registerCandlesTransformer(e,r){this.chartModel.registerCandlesTransformer(e,r)}registerLastCandleLabelHandler(e,r){this.chartModel.registerLastCandleLabelHandler(e,r)}registerCandlesWidthCalculator(e,r){this.chartModel.registerCandlesWidthCalculator(e,r)}registerDefaultDataSeriesDrawers(){const e=new y(this.config.components.chart);this.registerDataSeriesTypeDrawer("candle",e),this.registerDataSeriesTypeDrawer("trend",e),this.registerDataSeriesTypeDrawer("hollow",e),this.registerDataSeriesTypeDrawer("bar",new v(this.config.components.chart)),this.registerDataSeriesTypeDrawer("line",new b(this.config.components.chart)),this.registerDataSeriesTypeDrawer("scatterPlot",new A(this.config.colors.scatterPlot)),this.registerDataSeriesTypeDrawer("area",new M(this.config.components.chart)),this.registerDataSeriesTypeDrawer("baseline",new I(this.baselineModel,this.canvasBoundsContainer)),this.registerDataSeriesTypeDrawer("histogram",new E(this.config.components.chart.histogram));const r=()=>this.canvasBoundsContainer.getBounds(c.PANE_UUID(l));this.registerDataSeriesTypeDrawer("LINEAR",new B),this.registerDataSeriesTypeDrawer("HISTOGRAM",new N),this.registerDataSeriesTypeDrawer("TREND_HISTOGRAM",new K),this.registerDataSeriesTypeDrawer("POINTS",new R),this.registerDataSeriesTypeDrawer("COLOR_CANDLE",new P(new _(this.chartModel),this.config,r)),this.registerDataSeriesTypeDrawer("TEXT",new O(this.config)),this.registerDataSeriesTypeDrawer("TRIANGLE",new H),this.registerDataSeriesTypeDrawer("DIFFERENCE",new L)}setChartType(e){this.config.components.chart.type=e,this.chartModel.rememberCurrentTimeframe(),this.chartModel.mainCandleSeries.setType(e),this.chartModel.mainCandleSeries.updateCandleSeriesColors(Object.assign({},this.config.colors)),this.chartModel.mainCandleSeries.recalculateVisualPoints(),this.chartModel.chartTypeChanged.next(e)}resetChartScale(){this.chartModel.doBasicScale()}setTimestampRange(e,r){return this.chartModel.setTimestampRange(e,r)}setXScale(e,r){return this.scaleModel.setXScale(e,r)}setShowWicks(e){this.config.components.chart.showWicks=e,this.canvasModel.fireDraw()}setMainSeries(e){var r;const t=(r=e.instrument)!==null&&r!==void 0?r:this.chartModel.mainCandleSeries.instrument;this.chartModel.mainCandleSeries.instrument=t,this.chartModel.setAllSeries({candles:e.candles,instrument:t},this.chartModel.getSecondarySeries().map(a=>{var i;const s=(i=a.instrument)!==null&&i!==void 0?i:this.chartModel.mainCandleSeries.instrument,n=a.dataPoints;return j(n),{candles:n,instrument:s}})),this.updatePriceIncrementsIfNeeded(t)}setSecondarySeries(e){var r;const t=(r=e.instrument)!==null&&r!==void 0?r:this.chartModel.mainCandleSeries.instrument,a=this.chartModel.setSecondaryCandleSeries(e.candles,t);if(this.updatePriceIncrementsIfNeeded(t),a)return a}setAllSeries(e,r=[]){var t;const a=(t=e.instrument)!==null&&t!==void 0?t:this.chartModel.mainCandleSeries.instrument;this.updatePriceIncrementsIfNeeded(a),r.forEach(i=>{var s;const n=(s=i.instrument)!==null&&s!==void 0?s:this.chartModel.mainCandleSeries.instrument;this.updatePriceIncrementsIfNeeded(n)}),this.chartModel.setAllSeries(e,r)}toXFromCandleIndex(e){return this.chartModel.toX(e)}toXFromTimestamp(e){return this.chartModel.candleFromTimestamp(e).xCenter(this.chartModel.scaleModel)}toY(e){return this.chartModel.toY(e)}updateAllSeries(e,r=[]){this.chartModel.updateAllSeries(e,r),this.canvasModel.fireDraw()}removeDataFrom(e){this.chartModel.removeDataFrom(e)}removeSecondarySeries(e){this.chartModel.removeSecondaryCandleSeries(e)}prependCandles(e,r){this.chartModel.prependCandles(e,r)}addLastCandle(e,r){this.chartModel.addLastCandle(e,r)}updateLastCandle(e,r){this.chartModel.updateLastCandle(e,r)}updateCandles(e,r){this.chartModel.updateCandles(e,r)}setOffsets(e){this.chartModel.setOffsets(e)}getDataSeriesDrawer(e){return this.dataSeriesDrawers[e]}registerDataSeriesTypeDrawer(e,r){this.dataSeriesDrawers[e]=r}updatePriceIncrementsIfNeeded(e){(!e.priceIncrements||!m.validatePriceIncrementsOrPrecisions(e.priceIncrements))&&(e.priceIncrements=[m.autoDetectIncrementOfValueRange(this.scaleModel.yEnd-this.scaleModel.yStart)])}observeOffsetsChanged(){return this.chartModel.offsetsChanged}observeChartTypeChanged(){return this.chartModel.chartTypeChanged}observeCandlesChanged(){return this.chartModel.observeCandlesChanged()}observeCandlesUpdated(){return this.chartModel.candlesUpdatedSubject}observeCandlesPrepended(){return this.chartModel.candlesPrependSubject}}
|