@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{moveInArrayMutable as c,reorderArray as a,slice2DArray as s,arrayIntersect as n,eqeqeq as l}from"../array.utils";describe("array functions",()=>{describe("Intersection of arrays",()=>{it("Intersection of [1, 2, 3, 1] and [1, 2, 4, 5, 6] should be [1, 2]",()=>{const r=n([1,2,3,1],[1,2,4,5,6]);expect(r).toEqual([1,2])}),it("Intersection of [1, 2, 3] and [4, 5, 6] should be an empty array",()=>{const r=n([1,2,3],[4,5,6]);expect(r).toEqual([])}),it("Intersection of [1, 2, 2, 3] and [1, 1, 2, 2, 4, 5] with duplicates should be [1, 2, 2]",()=>{const r=n([1,2,2,3],[1,1,2,2,4,5],l,!1);expect(r).toEqual([1,2,2])}),it("Intersection of [] and [1, 1, 2] should be []",()=>{const r=n([],[1,1,2]);expect(r).toEqual([])}),it("Intersection of [1, 1, 2] and [] should be []",()=>{const r=n([1,1,2],[]);expect(r).toEqual([])}),it("Intersection with custom comparison function",()=>{const o=n([{id:1},{id:2},{id:3}],[{id:2},{id:4},{id:6}],(i,u)=>i.id===u.id);expect(o).toEqual([{id:2}])}),it("Intersection of arrays of strings",()=>{const r=n(["apple","banana","orange","pear"],["banana","orange","grape","kiwi"]);expect(r).toEqual(["banana","orange"])})}),describe("slice 2D array",()=>{it("should correctly slice arrays with correct indexes",()=>{const t=[[1,2],[3,4]],e=s(t,1,2);expect(e.toString()).toBe([[2],[3]].toString());const r=s(t,0,1);expect(r.toString()).toBe([[1,2]].toString());const o=s(t,2,3);expect(o.toString()).toBe([[3,4]].toString());const i=s(t,0,3);expect(i.toString()).toBe([[1,2],[3,4]].toString())}),it("should corrercly slice arrays with exceeding indexes",()=>{const t=[[1,2],[3,4]],e=s(t,-2,0);expect(e.toString()).toBe([[1]].toString());const r=s(t,3,4);expect(r.toString()).toBe([[4]].toString());const o=s(t,-2,4);expect(o.toString()).toBe([[1,2],[3,4]].toString())})}),describe("reorder array",()=>{it("Reorders source array according to newOrder",()=>{const t=["1","2","3"],e=a(t,["3","1"]);expect(e.toString()).toBe(["3","2","1"].toString());const r=a(t,["3","1","2"]);expect(r.toString()).toBe(["3","1","2"].toString());const o=a(t,["3"]);expect(o.toString()).toBe(["1","2","3"].toString())}),it("should return the reordered array even if newOrder contains duplicates",()=>{const t=["1","2","3"],e=["2","1","2"];expect(a(t,e)).toEqual(["2","1","3"])}),it("should return the reordered array even if newOrder contains extra elements",()=>{const t=["1","2","3"],e=["6","2","1","5"];expect(a(t,e)).toEqual(["2","1","3"])})}),describe("moveInArrayMutable",()=>{it("should move an item from start to end",()=>{const e=c([1,2,3,4,5],1,3);expect(e).toEqual([1,3,4,2,5])}),it("should move an item from end to start",()=>{const e=c([1,2,3,4,5],4,1);expect(e).toEqual([1,5,2,3,4])}),it("should move an item to the same position",()=>{const e=c([1,2,3,4,5],2,2);expect(e).toEqual([1,2,3,4,5])}),it("should clamp from and to if start and end are out of bounds",()=>{const e=c([1,2,3,4,5],-1,6);expect(e).toEqual([2,3,4,5,1])}),it("should return the same array if start and end are the same",()=>{const e=c([1,2,3,4,5],2,2);expect(e).toEqual([1,2,3,4,5])}),it("should return the same array if we try to move first element outside left bound",()=>{const e=c([1,2,3,4,5],0,-1);expect(e).toEqual([1,2,3,4,5])})})});
|
|
@@ -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{deepEqual as e}from"../object.utils";describe("object",()=>{describe("deepEqual",()=>{it("should deeply compare objects",()=>{expect(e({},{})).toBeTruthy(),expect(e({a:{foo:1}},{a:{foo:1}})).toBeTruthy(),expect(e({a:{foo:1}},{a:{foo:2}})).toBeFalsy(),expect(e({a:{foo:1}},{a:{bar:1}})).toBeFalsy()})})});
|
|
@@ -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{PriceIncrementsUtils as t}from"../price-increments.utils";describe("PriceIncrementsUtils",()=>{describe("autoDetectIncrementOfValueRange",()=>{it("should return increment=0.01 for range=0",()=>{const e=t.autoDetectIncrementOfValueRange(0);expect(e).toBeCloseTo(.01,10)}),it("should return increment=10 for range=6300.02931",()=>{const e=t.autoDetectIncrementOfValueRange(6300.02931);expect(e).toBeCloseTo(10,10)}),it("should return increment=1 for range=124.14",()=>{const e=t.autoDetectIncrementOfValueRange(124.14);expect(e).toBeCloseTo(1,10)}),it("should return increment=0.01 for range=5",()=>{const e=t.autoDetectIncrementOfValueRange(5);expect(e).toBeCloseTo(.01,10)}),it("should return increment=0.001 for range=0.5",()=>{const e=t.autoDetectIncrementOfValueRange(.5);expect(e).toBeCloseTo(.001,10)}),it("should return increment=0.00001 for range=0.0018",()=>{const e=t.autoDetectIncrementOfValueRange(.0018);expect(e).toBeCloseTo(1e-5,10)})})});
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* Intersects 2 arrays.
|
|
8
|
+
* Example:
|
|
9
|
+
* source: [1, 2, 3, 1]
|
|
10
|
+
* target: [1, 2, 4, 5, 6]
|
|
11
|
+
* result: [1, 2]
|
|
12
|
+
* result (with duplicates): [1, 1, 2]
|
|
13
|
+
* @param source
|
|
14
|
+
* @param target
|
|
15
|
+
* @param compareFn
|
|
16
|
+
* @param removeDuplicates
|
|
17
|
+
* @doc-tags fp,utility
|
|
18
|
+
*/
|
|
19
|
+
export declare function arrayIntersect<T>(source: T[], target: T[], compareFn?: (a: T, b: T) => boolean, removeDuplicates?: boolean): T[];
|
|
20
|
+
/**
|
|
21
|
+
* Reorders source array according to newOrder.
|
|
22
|
+
* Returns a reorder copy of the source array.
|
|
23
|
+
* Example:
|
|
24
|
+
* source: ['1', '2', '3']
|
|
25
|
+
* newOrder: ['3', '1']
|
|
26
|
+
* result: ['3', '2', '1']
|
|
27
|
+
*/
|
|
28
|
+
export declare const reorderArray: <T>(source: T[], newOrder: T[]) => T[];
|
|
29
|
+
export declare const eqeqeq: <T>(a: T, b: T) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Subtracts target from source array.
|
|
32
|
+
* Example:
|
|
33
|
+
* source: [1, 2, 3, 4]
|
|
34
|
+
* target: [2, 4, 6]
|
|
35
|
+
* result: [1, 3]
|
|
36
|
+
* @param source
|
|
37
|
+
* @param target
|
|
38
|
+
* @param compareFn
|
|
39
|
+
*/
|
|
40
|
+
export declare const arraySubtract: <T>(source: T[], target: T[], compareFn: (a: T, b: T) => boolean) => T[];
|
|
41
|
+
export declare const arrayCompare: <T>(source: T[], target: T[], compareFn?: (a: T, b: T) => boolean) => boolean;
|
|
42
|
+
export declare function moveInArray<T>(arr: Array<T>, from: number, to: number): Array<T>;
|
|
43
|
+
export declare function moveInArrayMutable<T>(arr: Array<T>, _from: number, _to: number): Array<T>;
|
|
44
|
+
type ItemFinder<T> = (item: T) => boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Replaces item in array with another one.
|
|
47
|
+
* @param arr
|
|
48
|
+
* @param itemFinder - predicate to find item
|
|
49
|
+
* @param replace - item to replace
|
|
50
|
+
*/
|
|
51
|
+
export declare function replaceInArray<T>(arr: Array<T>, itemFinder: ItemFinder<T>, replace: T): T[];
|
|
52
|
+
export declare const uniqueArray: <T extends string | number>(arr: T[]) => T[];
|
|
53
|
+
export declare const groupBy: <T, KT extends T[keyof T] extends string | number ? T[keyof T] : never>(array: T[], key: keyof T) => Record<KT, T[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Inserts *something* between every two elements in the source array
|
|
56
|
+
* Example: interleave(['first', 'second', 'third'], 'bar') => ['first', 'bar', 'second', 'bar', 'third']
|
|
57
|
+
* @param arr
|
|
58
|
+
* @param something
|
|
59
|
+
*/
|
|
60
|
+
export declare const interleave: <T>(arr: T[], something: T) => T[];
|
|
61
|
+
export declare const isTwoDimArray: <T>(arr: T[] | T[][]) => boolean;
|
|
62
|
+
export declare const create2DArray: <T>(arr: T[] | T[][]) => T[][];
|
|
63
|
+
export declare const slice2DArray: <T>(arr: T[][], startIdx: number, endIdx: number) => T[][];
|
|
64
|
+
export declare const at: <T>(idx: number, arr: T[]) => T;
|
|
65
|
+
export declare const flat: <T>(arr: T[][]) => T[];
|
|
66
|
+
export declare const flatMap: <T, U>(arr: T[], callback: (value: T, index: number, array: T[]) => U[]) => U[];
|
|
67
|
+
export interface BinarySearchResult {
|
|
68
|
+
index: number;
|
|
69
|
+
exact: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Performs binary search over numbers array.
|
|
73
|
+
* Works very fast - tested.
|
|
74
|
+
* @param array
|
|
75
|
+
* @param what
|
|
76
|
+
* @doc-tags tricky,math,utility
|
|
77
|
+
*/
|
|
78
|
+
export declare function binarySearch(array: Array<number>, what: number): BinarySearchResult;
|
|
79
|
+
export declare function binarySearch<Item>(array: Array<Item>, what: number, transform: (item: Item) => number): BinarySearchResult;
|
|
80
|
+
export declare function lastOf<T>(arr?: ArrayLike<T>): T | undefined;
|
|
81
|
+
export declare function arrayRemove<T>(this: Array<T>, element: T): T[];
|
|
82
|
+
export declare function arrayRemove2<A>(array: Array<A>, element: A): void;
|
|
83
|
+
export declare function firstOf<T>(arr?: ArrayLike<T>): T | undefined;
|
|
84
|
+
/**
|
|
85
|
+
@param {Function} gather - get the comparing value from the array
|
|
86
|
+
*/
|
|
87
|
+
export declare function maxMin<B>(gather: (b: B) => number | null | undefined): (arr: B[]) => [number, number];
|
|
88
|
+
/**
|
|
89
|
+
* Finds and returns elements from the array in the given range
|
|
90
|
+
* Uses modified version of binary search under the hood, so the complexity is log(N)
|
|
91
|
+
*
|
|
92
|
+
* @param {Item[]} array of the elements in a ASC ORDER
|
|
93
|
+
* @param {number} leftBound left bound of the range
|
|
94
|
+
* @param {number} rightBound right bounds of the range
|
|
95
|
+
* @param {function(Item):number} transform function to transform the elements of the array if the array is not of a number type
|
|
96
|
+
*
|
|
97
|
+
* @returns {Item[]} array of items which fall within the range
|
|
98
|
+
*/
|
|
99
|
+
export declare function getElementsInRange(array: number[], leftBound: number, rightBound: number): number[];
|
|
100
|
+
export declare function getElementsInRange<Item>(array: Item[], leftBound: number, rightBound: number, transform: (item: Item) => number): Item[];
|
|
101
|
+
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{identity as x}from"./function.utils";import{clamp as d,shiftRight as a}from"./math.utils";export function arrayIntersect(t,e,r=eqeqeq,n=!0){const i=t.filter(o=>e.some(c=>r(o,c)));return n?i.filter((o,c,u)=>u.indexOf(o)===c):i}export const reorderArray=(t,e)=>{const r=e.slice().filter(n=>t.find(i=>i===n));return t.map(n=>{var i;return e.indexOf(n)>=0&&(i=r.shift())!==null&&i!==void 0?i:n})},eqeqeq=(t,e)=>t===e,arraySubtract=(t,e,r)=>t.filter(n=>e.filter(i=>r(n,i)).length===0);const m=(t,e)=>t===e;export const arrayCompare=(t,e,r=m)=>t.length===e.length&&t.every((n,i)=>r(n,e[i]));export function moveInArray(t,e,r){const n=t.slice(),i=n[e];return n.splice(e,1),n.splice(r,0,i),n}export function moveInArrayMutable(t,e,r){const n=t.length,i=d(e,0,n-1),o=d(r,0,n-1),c=t[i];return t.splice(i,1),t.splice(o,0,c),t}export function replaceInArray(t,e,r){const n=t.slice(),i=n.findIndex(e);return i!==-1&&(n.splice(i,1),n.splice(i,0,r)),n}export const uniqueArray=t=>{const e={};return t.filter(r=>e[r]?!1:e[r]=!0)},groupBy=(t,e)=>t.reduce((r,n)=>((r[n[e]]=r[n[e]]||[]).push(n),r),{}),interleave=(t,e)=>[].concat(...t.map(r=>[r,e])).slice(0,-1),isTwoDimArray=t=>Array.isArray(t[0]),create2DArray=t=>Array.isArray(t[0])?t:[t],slice2DArray=(t,e,r)=>{const n=[];let i=0;for(const o of t){const c=Math.max(e-i,0),u=Math.max(r-i,-1),s=o.slice(c,u+1);s.length>0&&n.push(s),i+=o.length}return n},at=(t,e)=>t>=0?e[t]:e[e.length+t],flat=t=>Array.prototype.flat?t.flat():flatMap(t,x),flatMap=(t,e)=>{if(Array.prototype.flatMap)return t.flatMap(e);const r=[];for(let n=0;n<t.length;n++){const i=t[n];r.push(...e(i,n,t))}return r};export function binarySearch(t,e,r){const n=r!=null?r:x;return!t.length||e!==e?{index:-1,exact:!0}:p(t,e,0,t.length,n)}function p(t,e,r,n,i){const o=a(r+n,1),c=i(t[o]);return e===c?{index:o,exact:!0}:r===o?{index:r,exact:!1}:e<c?p(t,e,r,o,i):p(t,e,o,n,i)}export function lastOf(t){if(t&&t.length)return t[t.length-1]}export function arrayRemove(t){const e=this.indexOf(t);return e!==-1&&this.splice(e,1),this}export function arrayRemove2(t,e){if(!t)return;const r=t.indexOf(e);r!==-1&&t.splice(r,1)}export function firstOf(t){if(t)return t[0]}export function maxMin(t){function e(r,n){const i=t(n);return i==null||!isFinite(i)?r:[Math.max(r[0],i),Math.min(r[1],i)]}return function(r){const n=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];return r?r.reduce(e,n):n}}export function getElementsInRange(t,e,r,n=()=>0){const i=(c,u)=>{let s=0,l=c.length-1;for(;l>=s;){const f=Math.ceil((s+l)/2);n(c[f])<=u?s=f+1:l=f-1}return l},o=(c,u)=>{let s=0,l=c.length-1;for(;l>=s;){const f=Math.ceil((s+l)/2);n(c[f])>=u?l=f-1:s=f+1}return s};return t.slice(o(t,e),i(t,r)+1)}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { DataSeriesPoint } from '../model/data-series.model';
|
|
7
|
+
/**
|
|
8
|
+
* Automatically detect period of candle source.
|
|
9
|
+
* Cannot just take first-second candles distance because of non-trading hours.
|
|
10
|
+
* Naive approach:
|
|
11
|
+
* 1. get all time distances between candles
|
|
12
|
+
* 2. the most frequent distance = period
|
|
13
|
+
* @param candles
|
|
14
|
+
* @doc-tags tricky,period
|
|
15
|
+
*/
|
|
16
|
+
export declare function autoDetectPeriod(candles: Array<DataSeriesPoint>): number | undefined;
|
|
@@ -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 function autoDetectPeriod(i){if(i.length>1){const f=i.reduce((t,e,o)=>{if(o!==i.length-1){const n=i[o+1].timestamp-e.timestamp;t[n]?t[n]++:t[n]=1}return t},{});let p=0,r;for(const t of Object.keys(f)){const e=parseInt(t,10),o=f[e];o>p&&e>0&&(p=o,r=e)}if(r)return r}}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 interface GenerateCandlesDataConfig {
|
|
7
|
+
quantity?: number;
|
|
8
|
+
startY?: number;
|
|
9
|
+
avgCandleSize?: number;
|
|
10
|
+
avgTrendLength?: {
|
|
11
|
+
sw?: number;
|
|
12
|
+
down?: number;
|
|
13
|
+
up?: number;
|
|
14
|
+
};
|
|
15
|
+
withVolume?: boolean;
|
|
16
|
+
period?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generated mock candles data.
|
|
20
|
+
*
|
|
21
|
+
* @param config
|
|
22
|
+
* quantity - avg number of candles
|
|
23
|
+
* startY - avg candle Y to start generation with
|
|
24
|
+
* avgCandleSize - avg size of candle
|
|
25
|
+
* avgTrendLength:
|
|
26
|
+
* sw - avg length of SIDEWAYS trend
|
|
27
|
+
* down - avg length of DOWN trend
|
|
28
|
+
* up - avg length of UP trend
|
|
29
|
+
* withVolume - add random volumes or not
|
|
30
|
+
* period - specify distance between candles (60 for 1m, 3600 for 1h, 84600 for 1d)
|
|
31
|
+
* @return Array<Candle>
|
|
32
|
+
* @doc-tags tricky
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateCandlesDataTS(config?: GenerateCandlesDataConfig): {
|
|
35
|
+
hi: number;
|
|
36
|
+
lo: number;
|
|
37
|
+
open: any;
|
|
38
|
+
close: any;
|
|
39
|
+
timestamp: number;
|
|
40
|
+
volume: number;
|
|
41
|
+
}[];
|
|
@@ -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 a from"./candles-generator.utils.js";export function generateCandlesDataTS(e){return a(e)}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 default function generateCandlesData(config: any): {
|
|
7
|
+
hi: number;
|
|
8
|
+
lo: number;
|
|
9
|
+
open: any;
|
|
10
|
+
close: any;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
volume: number;
|
|
13
|
+
}[];
|
|
@@ -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
|
+
"use strict";export default function p(r){r=r||{},r.quantity=r.quantity||200,r.startY=r.startY||50,r.avgCandleSize=r.avgCandleSize||2,r.avgTrendLength=r.avgTrendLength||{},r.avgTrendLength.sw=r.avgTrendLength.sw||10,r.avgTrendLength.down=r.avgTrendLength.down||10,r.avgTrendLength.up=r.avgTrendLength.up||10,r.withVolume=r.withVolume===!0||!1,r.period=r.period||3600;var a=[],n=r.quantity||200,m=10,u=10,h=10;r.avgTrendLength&&(m=r.avgTrendLength.sw||10,u=r.avgTrendLength.down||10,h=r.avgTrendLength.up||10);var t=r.startY||50,e=r.avgCandleSize||2,v=t-e,o=t+e,w=T(v,o,e);for(a.push(w);a.length<n;){var d=Math.random()*10;d>6?a=a.concat(b(a[a.length-1],e,m)):d>3?a=a.concat(L(a[a.length-1],e,h)):a=a.concat(i(a[a.length-1],e,u))}a=a.slice(0,r.quantity);let s=Math.round(new Date().getTime()/3e5)*3e5;s-=n*1e3*r.period;for(let M=0;M<a.length;M++){const l=a[M];Object.assign(l,{timestamp:s,isVisible:!0}),s+=1e3*r.period,r.withVolume&&(l.volume=Math.ceil(Math.random()*1e3+200))}return a}function T(r,a,n,m){var u=Math.random()*(a-r)+r,h;if(m&&m==="bull"||!m&&Math.random()>.5){var t=u+n;h=t<a?t:a}else{var e=u-n;h=e>r?e:r}var v=Math.max(u,h)+Math.random()*n*.2,o=Math.min(u,h)-Math.random()*n*.2;return{hi:v,lo:o,open:u,close:h,timestamp:0,volume:0}}function L(r,a,n){for(var m=[],u=Math.random()*n+n/2,h=r.lo,t=r.hi+a*1.2,e=0;e<u;e++){var v=Math.random()>.9?"bear":"bull",o=T(h,t,a,v);h=o.lo-a*(Math.random()*.1+.1),t=o.hi+a*(Math.random()*1.3+.1),Math.random()>.9&&(t=o.hi+a),m.push(o)}return m}function i(r,a,n){for(var m=[],u=Math.random()*n+n/2,h=r.hi-a*1.2,t=r.hi,e=0;e<u;e++){var v=Math.random()<.9?"bear":"bull",o=T(h,t,a,v);h=o.lo-a*(Math.random()*.3+.1),t=o.hi-a*(Math.random()*.1+.1),Math.random()>.9&&(t=o.lo-a),m.push(o)}return m}function b(r,a,n){var m=[],u=Math.random()*n+n/2;function h(s){var M,l;return Math.random()>.5?(M=s.lo-a*.2,l=s.hi+a*1.2):(M=s.lo-a*1.2,l=s.hi+a*.2),{from:M,to:l}}for(var t=h(r),e=t.from,v=t.to,o=0;o<u;o++){var w=Math.random()<.5?"bear":"bull",d=T(e,v,a,w);t=h(d),e=t.from,v=t.to,Math.random()>.9&&(Math.random()>.5?e=d.lo-a:v=d.hi+a),m.push(d)}return m}window.DXChart=Object.assign(Object.assign({},window.DXChart),{generateCandlesData:p});
|
|
@@ -0,0 +1,8 @@
|
|
|
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 { DataSeriesPoint } from '../model/data-series.model';
|
|
7
|
+
import { BinarySearchResult } from './array.utils';
|
|
8
|
+
export declare const searchCandleIndex: (timestamp: number, shouldExtrapolate: boolean, candles: DataSeriesPoint[], periodMs?: number) => BinarySearchResult;
|
|
@@ -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{binarySearch as c,firstOf as d,lastOf as s}from"./array.utils";import{floor as v}from"./math.utils";export const searchCandleIndex=(e,o,r,u=1e3)=>{var t,i,n,l;const f=(i=(t=d(r))===null||t===void 0?void 0:t.timestamp)!==null&&i!==void 0?i:0,x=(l=(n=s(r))===null||n===void 0?void 0:n.timestamp)!==null&&l!==void 0?l:0;return e>x?o?{index:r.length-1+Math.ceil((e-x)/u),exact:!0}:{index:r.length-1,exact:!0}:e<f?o?{index:v((e-f)/u),exact:!0}:{index:-1,exact:!0}:c(r,e,a=>a.timestamp)};
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { YAxisAlign } from '../../chart.config';
|
|
7
|
+
/**
|
|
8
|
+
* Draws a rounded rectangle on a canvas context
|
|
9
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on
|
|
10
|
+
* @param {number} x - The x-coordinate of the top-left corner of the rectangle
|
|
11
|
+
* @param {number} y - The y-coordinate of the top-left corner of the rectangle
|
|
12
|
+
* @param {number} width - The width of the rectangle
|
|
13
|
+
* @param {number} height - The height of the rectangle
|
|
14
|
+
* @param {number} [radius=4] - The radius of the corners of the rectangle
|
|
15
|
+
* @param {boolean} [fill=true] - Whether or not to fill the rectangle
|
|
16
|
+
* @param {boolean} [stroke=false] - Whether or not to stroke the rectangle
|
|
17
|
+
*/
|
|
18
|
+
export declare function drawRoundedRect(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius?: number, fill?: boolean, stroke?: boolean): void;
|
|
19
|
+
/**
|
|
20
|
+
* Draws a price label on a canvas context.
|
|
21
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
22
|
+
* @param {number} x0 - The x-coordinate of the starting point of the label.
|
|
23
|
+
* @param {number} y0 - The y-coordinate of the starting point of the label.
|
|
24
|
+
* @param {number} x1 - The x-coordinate of the middle point of the label.
|
|
25
|
+
* @param {number} y1 - The y-coordinate of the middle point of the label.
|
|
26
|
+
* @param {number} x2 - The x-coordinate of the ending point of the label.
|
|
27
|
+
* @param {number} y2 - The y-coordinate of the ending point of the label.
|
|
28
|
+
* @param {number} _width - The width of the label.
|
|
29
|
+
* @param {boolean} rounded - Whether the label should have rounded corners.
|
|
30
|
+
* @param {string} align - The alignment of the label on the y-axis. Can be 'left' or 'right'.
|
|
31
|
+
* @param {number} radius - The radius of the rounded corners of the label.
|
|
32
|
+
* @param {boolean} fill - Whether the label should be filled with color.
|
|
33
|
+
* @param {boolean} stroke - Whether the label should have a stroke.
|
|
34
|
+
*/
|
|
35
|
+
export declare function drawPriceLabel(ctx: CanvasRenderingContext2D, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, _width: number, rounded: boolean, align: YAxisAlign, radius?: number, fill?: boolean, stroke?: boolean): void;
|
|
36
|
+
/**
|
|
37
|
+
* Draws a line on a canvas context with the specified thickness.
|
|
38
|
+
*
|
|
39
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
40
|
+
* @param {number} x0 - The x-coordinate of the starting point of the line.
|
|
41
|
+
* @param {number} y0 - The y-coordinate of the starting point of the line.
|
|
42
|
+
* @param {number} x1 - The x-coordinate of the ending point of the line.
|
|
43
|
+
* @param {number} y1 - The y-coordinate of the ending point of the line.
|
|
44
|
+
* @param {number} [thickness=1] - The thickness of the line. Default is 1.
|
|
45
|
+
*
|
|
46
|
+
* @returns {void}
|
|
47
|
+
*/
|
|
48
|
+
export declare function drawLine(ctx: CanvasRenderingContext2D, x0: number, y0: number, x1: number, y1: number, thickness?: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* Try to avoid anti-aliasing
|
|
51
|
+
*/
|
|
52
|
+
export declare function avoidAntialiasing(ctx: CanvasRenderingContext2D, draw: () => void): void;
|
|
53
|
+
/**
|
|
54
|
+
* Draws a filled rectangle on a canvas context.
|
|
55
|
+
*
|
|
56
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
57
|
+
* @param {{x: number, y: number}} a - The first point of the rectangle.
|
|
58
|
+
* @param {{x: number, y: number}} b - The second point of the rectangle.
|
|
59
|
+
* @returns {void}
|
|
60
|
+
|
|
61
|
+
*/
|
|
62
|
+
export declare function fillRect(ctx: CanvasRenderingContext2D, a: {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
}, b: {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
}): 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 function drawRoundedRect(e,i,o,l,a,n=4,r=!0,v=!1){e.save(),e.beginPath(),e.moveTo(i+n,o),e.lineTo(i+l-n,o),e.quadraticCurveTo(i+l,o,i+l,o+n),e.lineTo(i+l,o+a-n),e.quadraticCurveTo(i+l,o+a,i+l-n,o+a),e.lineTo(i+n,o+a),e.quadraticCurveTo(i,o+a,i,o+a-n),e.lineTo(i,o+n),e.quadraticCurveTo(i,o,i+n,o),e.closePath(),r&&e.fill(),v&&e.stroke(),e.restore()}export function drawPriceLabel(e,i,o,l,a,n,r,v,u,C,q=4,P=!0,m=!1){const s=C==="right"?v:-v,T=C==="right"?q:-q,f=q;e.save(),e.beginPath(),u?e.moveTo(n+T,r):e.moveTo(n,r),u?(e.lineTo(n+s-T,r),e.quadraticCurveTo(n+s,r,n+s,r-f),e.lineTo(n+s,o+f),e.quadraticCurveTo(n+s,o,n+s-T,o),e.lineTo(i+T,o)):(e.lineTo(n+s,r),e.lineTo(n+s,o),e.lineTo(i,o)),u?(e.quadraticCurveTo(i,o,i-T/3,o+f/3),e.lineTo(l+T/3,a-f/3),e.quadraticCurveTo(l,a,l+T/3,a+f/3),e.lineTo(n-T/3,r-f/3),e.quadraticCurveTo(n,r,n+T/3,r)):(e.lineTo(l,a),e.lineTo(n,r)),e.closePath(),P&&e.fill(),m&&e.stroke(),e.restore()}export function drawLine(e,i,o,l,a,n=1){e.save(),e.lineWidth=n,e.beginPath(),e.moveTo(i,o),e.lineTo(l,a),e.stroke(),e.closePath(),e.restore()}export function avoidAntialiasing(e,i){e.save(),e.lineWidth%2&&e.translate(.5,.5),i(),e.restore()}export function fillRect(e,i,o){const l=Math.min(i.x,o.x)+.5,a=Math.min(i.y,o.y),n=Math.abs(i.x-o.x),r=Math.abs(i.y-o.y);e.fillRect(l,a,n,r)}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* Calculates the height of a symbol for a given font using a CanvasRenderingContext2D.
|
|
8
|
+
* @param {string} font - The font to calculate the symbol height for.
|
|
9
|
+
* @param {CanvasRenderingContext2D} ctx - The CanvasRenderingContext2D to use for the calculation.
|
|
10
|
+
* @returns {number} - The height of the symbol.
|
|
11
|
+
*/
|
|
12
|
+
export declare function calculateSymbolHeight(font: string, ctx: CanvasRenderingContext2D): number;
|
|
13
|
+
/**
|
|
14
|
+
* Calculates the width of a given text using the provided font and canvas rendering context.
|
|
15
|
+
* @param {string} text - The text to calculate the width of.
|
|
16
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas rendering context to use for measuring the text width.
|
|
17
|
+
* @param {string} font - The font to use for measuring the text width.
|
|
18
|
+
* @returns {number} - The width of the text in pixels.
|
|
19
|
+
*/
|
|
20
|
+
export declare function calculateTextWidth(text: string, ctx: CanvasRenderingContext2D, font: string): number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
const u={};export function calculateSymbolHeight(r,e){let t=u[r];return t!==void 0||(e.save(),e.font=r,t=e.measureText("M").width,u[r]=t,e.restore()),t}const a=new Map;export function calculateTextWidth(r,e,t){const n=t+r;let s=a.get(n);return s||(e.save(),e.font=t,s=e.measureText(r).width,a.set(n,s),e.restore()),s}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 type CanvasTextAlignment = 'right' | 'left';
|
|
7
|
+
export interface CanvasTextProperties {
|
|
8
|
+
textStyle?: {
|
|
9
|
+
italic?: boolean;
|
|
10
|
+
bold?: boolean;
|
|
11
|
+
underline?: boolean;
|
|
12
|
+
};
|
|
13
|
+
textSize?: string;
|
|
14
|
+
textFontFamily?: string;
|
|
15
|
+
textFill?: string;
|
|
16
|
+
textAlign?: CanvasTextAlignment;
|
|
17
|
+
rtl?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Sets the font, fill style and text alignment of a canvas context based on the provided properties.
|
|
21
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to modify.
|
|
22
|
+
* @param {CanvasTextProperties} properties - An object containing the properties to apply to the canvas context.
|
|
23
|
+
* @param {string} properties.textStyle - The style of the text. Can be 'italic', 'bold' or both.
|
|
24
|
+
* @param {number} properties.textSize - The size of the text in pixels.
|
|
25
|
+
* @param {string} properties.textFontFamily - The font family of the text.
|
|
26
|
+
* @param {string} properties.textFill - The fill style of the text.
|
|
27
|
+
* @param {boolean} properties.rtl - Whether the text should be aligned to the right or to the left.
|
|
28
|
+
*/
|
|
29
|
+
export declare function prepareTextForFill(ctx: CanvasRenderingContext2D, properties: CanvasTextProperties): void;
|
|
30
|
+
/**
|
|
31
|
+
* Calculates the line height of a text based on the font size of the provided CanvasRenderingContext2D.
|
|
32
|
+
* @param {CanvasRenderingContext2D} ctx - The CanvasRenderingContext2D object used to draw the text.
|
|
33
|
+
* @returns {number} The calculated line height of the text.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getTextLineHeight(ctx: CanvasRenderingContext2D): number;
|
|
36
|
+
/**
|
|
37
|
+
* Calculates text bounds [textWidth, textHeight, lineHeight]
|
|
38
|
+
* @param ctx
|
|
39
|
+
* @param lines
|
|
40
|
+
* @param properties
|
|
41
|
+
*/
|
|
42
|
+
export declare function getTextBounds(ctx: CanvasRenderingContext2D, lines: string[], properties: CanvasTextProperties): [number, number, number];
|
|
43
|
+
/**
|
|
44
|
+
* Splits multiline text to array of lines
|
|
45
|
+
* @param text
|
|
46
|
+
*/
|
|
47
|
+
export declare function getTextLines(text: string): string[];
|
|
48
|
+
/**
|
|
49
|
+
* Draws multiple lines of text on a canvas context at a given position.
|
|
50
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
51
|
+
* @param {string[]} lines - An array of strings representing the lines of text to draw.
|
|
52
|
+
* @param {number} x - The x-coordinate of the starting position of the text.
|
|
53
|
+
* @param {number} y - The y-coordinate of the starting position of the text.
|
|
54
|
+
* @param {CanvasTextProperties} properties - An object containing properties for the text, such as font size, style, and alignment.
|
|
55
|
+
* @returns {void}
|
|
56
|
+
|
|
57
|
+
*/
|
|
58
|
+
export declare function drawText(ctx: CanvasRenderingContext2D, lines: string[], x: number, y: number, properties: CanvasTextProperties): void;
|
|
59
|
+
/**
|
|
60
|
+
* Draws an underline below the given text on a canvas context.
|
|
61
|
+
* @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
|
|
62
|
+
* @param {string} text - The text to underline.
|
|
63
|
+
* @param {number} x - The x-coordinate of the starting point of the text.
|
|
64
|
+
* @param {number} y - The y-coordinate of the starting point of the text.
|
|
65
|
+
* @param {string} color - The color of the underline.
|
|
66
|
+
* @param {string} textSize - The size of the text in pixels.
|
|
67
|
+
*/
|
|
68
|
+
export declare function underlineText(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, color: string, textSize: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Returns a string with the font size in pixels.
|
|
71
|
+
*
|
|
72
|
+
* @param {number} fontSize - The font size in points.
|
|
73
|
+
* @returns {string} The font size in pixels as a string.
|
|
74
|
+
*/
|
|
75
|
+
export declare function getFontSizeInPx(fontSize: number): string;
|
|
76
|
+
export declare function getLabelTextColorByBackgroundColor(bgColor: string, textColor: string, invertedTextColor: string): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import*as g from"color";export function prepareTextForFill(t,e){let n="";e.textStyle&&(e.textStyle.italic&&(n+="italic "),e.textStyle.bold&&(n+="bold ")),t.font=n+(e.textSize||12)+" "+(e.textFontFamily||"monospace"),t.fillStyle=e.textFill||"#FFFFFF",e.rtl?t.textAlign="right":t.textAlign="start"}export function getTextLineHeight(t){const e=t.font.match(/(\d+.)?\d+(px|pt)/gi);let n="10px";return e&&e.length&&(e[0].includes("pt")?n=+e[0].slice(0,e[0].indexOf("pt"))*96/72+"px":n=e[0]),parseInt(n,10)*1.33}export function getTextBounds(t,e,n){t.save(),prepareTextForFill(t,n);const i=Math.ceil(Math.max.apply(Math,e.map(o=>t.measureText(o).width))),l=getTextLineHeight(t),r=l*e.length;return t.restore(),[i,r,l]}export function getTextLines(t){return(t||"").split(/\r\n|\r|\n/)}export function drawText(t,e,n,i,l){t.save();const[r,,o]=getTextBounds(t,e,l);e.forEach((s,d)=>{var u,x,a;const h=t.measureText(s).width,f=c(n,r,h,(u=l.textAlign)!==null&&u!==void 0?u:"left");l.textStyle&&l.textStyle.underline&&underlineText(t,s,f,i+o*d,(x=l.textFill)!==null&&x!==void 0?x:"",(a=l.textSize)!==null&&a!==void 0?a:""),t.fillText(s,f,i+o*d)}),t.restore()}function c(t,e,n,i){switch(i){case"left":return t;case"right":return t+e-n;default:return t}}export function underlineText(t,e,n,i,l,r){t.save();const o=t.measureText(e).width,s=n,d=n+o,u=i+2,x=u;let a=parseInt(r,10)/15;a<1&&(a=1),t.beginPath(),t.strokeStyle=l,t.lineWidth=a,t.moveTo(s,u),t.lineTo(d,x),t.stroke(),t.restore()}export function getFontSizeInPx(t){return`${t}px`}export function getLabelTextColorByBackgroundColor(t,e,n){const i=g.rgb(t).array(),l=i[0],r=i[1],o=i[2];return(l*299+r*587+o*114)/1e3<128?e:n}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toRGBA(color: string, alpha: number): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
const c=/^(#)([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,o=/^\s*(rgba?)\s*[(]\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?[)]\s*$/i;function i(n){const t=c.exec(n)||o.exec(n);let s=[];return t&&(s=t.slice(2,5),t[1]==="#")?s.map(function(e){return parseInt(e,16)}):s}const r={};export function toRGBA(n,t){let s=r[n+t];if(!s){const e=i(n);s=e&&"rgba("+e.join(",")+","+t+")",r[n+t]=s}return s}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* @doc-tags utility,mobile
|
|
8
|
+
*/
|
|
9
|
+
export declare const isMobile: () => 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
|
+
let e;export const isMobile=()=>(e||(e=!!navigator.userAgent.match(/Android|iPhone|Opera Mini/)||!1),e);
|
|
@@ -0,0 +1,12 @@
|
|
|
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 type Devices = 'apple' | 'mobile' | 'other';
|
|
7
|
+
/**
|
|
8
|
+
* Detects the user device. Naive approach.
|
|
9
|
+
* @doc-tags tricky,mobile
|
|
10
|
+
*/
|
|
11
|
+
export declare const deviceDetector: () => Devices;
|
|
12
|
+
export declare const multiplyZoomByDevice: (device: Devices, defaultValue: number) => number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
export const deviceDetector=()=>{const e=/Mac|iPod|iPhone|iPad/i.test(navigator.userAgent),i=[/Android/i,/webOS/i,/BlackBerry/i,/Windows Phone/i].some(o=>navigator.userAgent.match(o));return e?"apple":i?"mobile":"other"},multiplyZoomByDevice=(e,t)=>e==="apple"||e==="mobile"?3:t;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
export declare let dpr: number;
|
|
7
|
+
export declare const getDPR: () => number;
|
|
8
|
+
/**
|
|
9
|
+
* Rounds a given number according to the inverse of current DPR.
|
|
10
|
+
* For example, DPR = 2, num = 2, res => 2; DPR = 2, num = 2.5, res => 2.5; DPR = 2, num = 2.333, res => 2.5
|
|
11
|
+
* @param num
|
|
12
|
+
* @doc-tags chart-core,math,dpr
|
|
13
|
+
*/
|
|
14
|
+
export declare const roundToDPR: (num: number) => number;
|
|
15
|
+
export declare const floorToDPR: (num: number) => number;
|
|
16
|
+
export declare const ceilToDPR: (num: number) => number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{ceil as t,floor as n,round as d}from"../math.utils";export let dpr=window.devicePixelRatio;let o=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);const i=()=>{o.removeEventListener("change",i),dpr=window.devicePixelRatio,o=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`),o.addEventListener("change",i)};o.addEventListener("change",i);export const getDPR=()=>dpr,roundToDPR=e=>d(dpr*e)/dpr,floorToDPR=e=>n(dpr*e)/dpr,ceilToDPR=e=>t(dpr*e)/dpr;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { FullChartConfig } from '../../chart.config';
|
|
7
|
+
export declare const isFirefox: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* this function determines whether the event was triggered with the mouse or the touchpad
|
|
10
|
+
*
|
|
11
|
+
* This works because wheelDeltaY measures the physical distance that the actual hardware mouse wheel has travelled,
|
|
12
|
+
* while deltaY measures the amount of scrolling produced on screen.
|
|
13
|
+
* A conventional mouse typically has a much lower "scroll resolution" than a trackpad.
|
|
14
|
+
* The wheelDeltaY is exactly 3x the deltaY value(in most browsers)
|
|
15
|
+
* This function consist a lot of empiric if statements for some cases in different browsers and systems
|
|
16
|
+
* @param {WheelEvent} e
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*
|
|
19
|
+
* @doc-tags chart-core, utility,
|
|
20
|
+
*/
|
|
21
|
+
export declare const touchpadDetector: (e: WheelEvent) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* this function returns different ящщь sensitivity for the percent axis and the others
|
|
24
|
+
* @param config
|
|
25
|
+
* @param isTouchpad
|
|
26
|
+
* @returns {number}
|
|
27
|
+
*
|
|
28
|
+
* @doc-tags chart-core, zoom
|
|
29
|
+
*/
|
|
30
|
+
export declare const getTouchpadSensitivity: (config: FullChartConfig) => number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
const o=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),l=!!window.chrome;export const isFirefox=typeof InstallTrigger!="undefined";const d=navigator.platform.indexOf("Win")>-1;export const touchpadDetector=t=>{let i=!1;const{wheelDeltaY:a,wheelDeltaX:s}=t;if(a||s){let e;if(o)e=a===t.deltaY*-3||Math.abs(a+Math.sign(a))===Math.abs(Math.round(t.deltaY)*3)||Math.abs(a-Math.sign(a))===Math.abs(Math.round(t.deltaY)*3);else if(l){if(e=a+Math.sign(a)===t.deltaY*-3?a+Math.sign(a)===t.deltaY*-3:a===t.deltaY*-3,d){const n=Math.round(t.deltaY)===a||Math.abs(Math.round(t.deltaY)+Math.sign(t.deltaY))===Math.abs(a)||Math.abs(Math.round(t.deltaY)-Math.sign(t.deltaY))===Math.abs(a);e=Math.abs(a)===Math.abs(t.deltaY)||n}}else isFirefox?Math.abs(t.deltaY)>Math.abs(t.deltaX)?e=!1:e=s===t.deltaX*-3:e=a===t.deltaY*-3;e&&(i=!0)}else t.deltaMode===0&&(i=!0);return isFirefox&&t.deltaY>=16&&Math.abs(t.deltaY)%16===0&&(i=!1),t.ctrlKey&&(i=!0),i},getTouchpadSensitivity=t=>t.components.yAxis.type==="percent"?t.scale.zoomSensitivity/4:t.scale.zoomSensitivity;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* @param {Element} element
|
|
8
|
+
* @param {function} listener
|
|
9
|
+
* @param {string} eventType
|
|
10
|
+
* @param {boolean?} useCapture
|
|
11
|
+
* @return {Function}
|
|
12
|
+
*/
|
|
13
|
+
export declare function subscribeListener<K extends keyof GlobalEventHandlersEventMap>(element: EventTarget, listener: (e: GlobalEventHandlersEventMap[K]) => void, eventType: K, useCapture?: boolean): () => void;
|