@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,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { BehaviorSubject } from 'rxjs';
|
|
7
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
8
|
+
import { ScaleModel } from '../../model/scale.model';
|
|
9
|
+
import { HighLowProvider } from '../../model/scaling/auto-scale.model';
|
|
10
|
+
import { ChartComponent } from '../chart/chart.component';
|
|
11
|
+
export declare class VolumesModel extends ChartBaseElement {
|
|
12
|
+
private chartComponent;
|
|
13
|
+
private scaleModel;
|
|
14
|
+
volumeMax: BehaviorSubject<number>;
|
|
15
|
+
highLowProvider: HighLowProvider;
|
|
16
|
+
constructor(chartComponent: ChartComponent, scaleModel: ScaleModel);
|
|
17
|
+
protected doActivate(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Used for optimization when we have to update only the last candle
|
|
20
|
+
* Doesn't work for line chart types
|
|
21
|
+
* @doc-tags tricky
|
|
22
|
+
*/
|
|
23
|
+
private recalculateLastVisualVolume;
|
|
24
|
+
/**
|
|
25
|
+
* Updates the maximum volume value of the chart.
|
|
26
|
+
* @function
|
|
27
|
+
* @name updateVolumeMax
|
|
28
|
+
* @memberof ChartComponent
|
|
29
|
+
* @returns {void}
|
|
30
|
+
*/
|
|
31
|
+
updateVolumeMax(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import{BehaviorSubject as o,merge as i}from"rxjs";import{ChartBaseElement as s}from"../../model/chart-base-element";import{firstOf as l,maxMin as r}from"../../utils/array.utils";const h=r(t=>t.candle.volume);export class VolumesModel extends s{constructor(e,a){super(),this.chartComponent=e,this.scaleModel=a,this.volumeMax=new o(0),this.highLowProvider={calculateHighLow:()=>({high:this.volumeMax.getValue(),low:0}),isHighLowActive:()=>!0}}doActivate(){super.doActivate(),this.addRxSubscription(i(this.chartComponent.chartModel.observeCandlesChanged(),this.scaleModel.xChanged).subscribe(()=>this.updateVolumeMax())),this.addRxSubscription(this.chartComponent.chartModel.mainCandleSeries.observeLastVisualCandleChanged().subscribe(()=>this.recalculateLastVisualVolume()))}recalculateLastVisualVolume(){}updateVolumeMax(){var e;this.volumeMax.next((e=l(h(this.chartComponent.chartModel.mainCandleSeries.getSeriesInViewport().flat())))!==null&&e!==void 0?e:0)}}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
7
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
8
|
+
import { FullChartConfig } from '../../chart.config';
|
|
9
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
10
|
+
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
11
|
+
import EventBus from '../../events/event-bus';
|
|
12
|
+
import { ChartModel } from '../chart/chart.model';
|
|
13
|
+
import { PaneManager } from '../pane/pane-manager.component';
|
|
14
|
+
export interface WaterMarkConfig {
|
|
15
|
+
isVisible?: boolean;
|
|
16
|
+
fontFamily?: string;
|
|
17
|
+
firstRowFontSize?: number;
|
|
18
|
+
firstRowBottomPadding?: number;
|
|
19
|
+
secondRowFontSize?: number;
|
|
20
|
+
secondRowBottomPadding?: number;
|
|
21
|
+
thirdRowFontSize?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface WaterMarkData {
|
|
24
|
+
firstRow?: string;
|
|
25
|
+
secondRow?: string;
|
|
26
|
+
thirdRow?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class WaterMarkComponent extends ChartBaseElement {
|
|
29
|
+
private paneManager;
|
|
30
|
+
private chartModel;
|
|
31
|
+
eventBus: EventBus;
|
|
32
|
+
private config;
|
|
33
|
+
canvasModel: CanvasModel;
|
|
34
|
+
private waterMarkDrawer;
|
|
35
|
+
private waterMarkConfig;
|
|
36
|
+
private waterMarkData;
|
|
37
|
+
constructor(paneManager: PaneManager, chartModel: ChartModel, eventBus: EventBus, config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer, canvasModel: CanvasModel, drawingManager: DrawingManager);
|
|
38
|
+
/**
|
|
39
|
+
* Sets the visibility of the watermark component.
|
|
40
|
+
*
|
|
41
|
+
* @param {boolean} visible - A boolean indicating whether the watermark should be visible or not.
|
|
42
|
+
* @returns {void}
|
|
43
|
+
*/
|
|
44
|
+
setWaterMarkVisible(visible: boolean): void;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the watermark data to be used in the canvas.
|
|
47
|
+
* @param {WaterMarkData} watermarkData - The data to be used as watermark.
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
setWaterMarkData(watermarkData: WaterMarkData): void;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the water mark data object if it exists, otherwise returns an empty object.
|
|
53
|
+
* @returns {WaterMarkData} The water mark data object.
|
|
54
|
+
*/
|
|
55
|
+
private getWaterMarkData;
|
|
56
|
+
/**
|
|
57
|
+
* Sets the watermark configuration for the chart.
|
|
58
|
+
* @param {WaterMarkConfig} watermarkConfig - The configuration object for the watermark.
|
|
59
|
+
* @returns {void}
|
|
60
|
+
|
|
61
|
+
*/
|
|
62
|
+
setWaterMarkConfig(watermarkConfig: WaterMarkConfig): void;
|
|
63
|
+
/**
|
|
64
|
+
* Sets the logo image to be used as a watermark.
|
|
65
|
+
* @param {CanvasImageSource} img - The image to be used as a watermark.
|
|
66
|
+
*/
|
|
67
|
+
setLogoImage(img: CanvasImageSource): void;
|
|
68
|
+
/**
|
|
69
|
+
* Recalculates the watermark text size based on the chart's width and height.
|
|
70
|
+
* @param {number} chartWidth - The width of the chart.
|
|
71
|
+
* @param {number} chartHeight - The height of the chart.
|
|
72
|
+
* @returns {Object} - An object containing the updated watermark font sizes.
|
|
73
|
+
*/
|
|
74
|
+
private recalculateTextSize;
|
|
75
|
+
}
|
|
@@ -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 w,CanvasElement as f}from"../../canvas/canvas-bounds-container";import{ChartBaseElement as d}from"../../model/chart-base-element";import{merge as n}from"../../utils/merge.utils";import{WaterMarkDrawer as k}from"./water-mark.drawer";export class WaterMarkComponent extends d{constructor(t,e,c,h,a,i,o){super(),this.paneManager=t,this.chartModel=e,this.eventBus=c,this.config=h,this.canvasModel=i,this.waterMarkConfig=this.config.components.waterMark,this.waterMarkData=this.getWaterMarkData(),this.waterMarkDrawer=new k(this.config,a,i,()=>this.waterMarkConfig,()=>this.waterMarkData),this.addRxSubscription(n(a.observeBoundsChanged(f.PANE_UUID(w)),this.paneManager.panesChangedSubject).subscribe(r=>{this.waterMarkConfig=this.recalculateTextSize(r.width,r.height)})),this.addRxSubscription(this.chartModel.candlesSetSubject.subscribe(()=>{this.waterMarkData=this.getWaterMarkData()})),o.addDrawerAfter(this.waterMarkDrawer,"WATERMARK","DRAWINGS")}setWaterMarkVisible(t){this.config.components&&this.config.components.waterMark&&(this.config.components.waterMark.visible=t,this.canvasModel.fireDraw())}setWaterMarkData(t){this.waterMarkData=t,this.canvasModel.fireDraw()}getWaterMarkData(){return this.waterMarkData||{}}setWaterMarkConfig(t){if(!(!t||!this.config.components)){if(!this.config.components.waterMark)this.config.components.waterMark=JSON.parse(JSON.stringify(t));else{const e={};n(e,t),n(e,this.config.components.waterMark),this.config.components.waterMark=e}this.canvasModel.fireDraw()}}setLogoImage(t){this.waterMarkDrawer.setLogoImage(t)}recalculateTextSize(t,e){const a=g=>.15*Math.log(g)/Math.log(1.5)+1,i=a(t/1920),o=a(e/1080),r=Math.min(i,o),s=r>=0?r:0,M={firstRowFontSize:Math.round(this.config.components.waterMark.firstRowFontSize*s),secondRowFontSize:Math.round(this.config.components.waterMark.secondRowFontSize*s),thirdRowFontSize:Math.round(this.config.components.waterMark.thirdRowFontSize*s)};return Object.assign(Object.assign({},this.config.components.waterMark),M)}}
|
|
@@ -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 { Drawer } from '../../drawers/drawing-manager';
|
|
7
|
+
import { ChartConfigComponentsWaterMark, FullChartConfig } from '../../chart.config';
|
|
8
|
+
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
9
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
10
|
+
import { WaterMarkData } from './water-mark.component';
|
|
11
|
+
export type WaterMarkPositionType = 'center' | 'left-top' | 'left-bottom';
|
|
12
|
+
export declare class WaterMarkDrawer implements Drawer {
|
|
13
|
+
private config;
|
|
14
|
+
private canvasBoundsContainer;
|
|
15
|
+
private canvasModel;
|
|
16
|
+
private waterMarkConfigProvider;
|
|
17
|
+
private watermarkDataProvider;
|
|
18
|
+
private logoImage?;
|
|
19
|
+
constructor(config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer, canvasModel: CanvasModel, waterMarkConfigProvider: () => ChartConfigComponentsWaterMark, watermarkDataProvider: () => WaterMarkData);
|
|
20
|
+
/**
|
|
21
|
+
* Draws a watermark on the canvas if the watermark is visible and the colors are provided in the configuration.
|
|
22
|
+
* The watermark consists of three rows of text and an optional logo image.
|
|
23
|
+
* The height of each row is calculated based on the font size and the actual text height.
|
|
24
|
+
* The total height of the watermark is calculated by adding the heights of all rows and the logo image.
|
|
25
|
+
* The watermark is drawn using the drawWaterMark() method and the configuration is provided by the getConfig() method.
|
|
26
|
+
* The font size and color of each row are provided in the waterMarkConfig object.
|
|
27
|
+
* The logo image is drawn using the drawImage() method and its dimensions are provided in the waterMarkConfig object.
|
|
28
|
+
* @function
|
|
29
|
+
*/
|
|
30
|
+
draw(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Returns an array of canvas ids.
|
|
33
|
+
*
|
|
34
|
+
* @returns {Array<string>} An array of canvas ids.
|
|
35
|
+
*/
|
|
36
|
+
getCanvasIds(): Array<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the logo image to be displayed.
|
|
39
|
+
*
|
|
40
|
+
* @param {CanvasImageSource} img - The image to be set as the logo.
|
|
41
|
+
* @returns {void}
|
|
42
|
+
*/
|
|
43
|
+
setLogoImage(img: CanvasImageSource): void;
|
|
44
|
+
/**
|
|
45
|
+
* Draws a watermark on the canvas.
|
|
46
|
+
*
|
|
47
|
+
* @private
|
|
48
|
+
* @param {Object} config - The configuration object for the watermark.
|
|
49
|
+
* @param {string} config.text - The text to be displayed as the watermark.
|
|
50
|
+
* @param {string} config.font - The font to be used for the watermark.
|
|
51
|
+
* @param {string} config.color - The color to be used for the watermark.
|
|
52
|
+
* @param {number} config.x - The x-coordinate of the starting point of the watermark.
|
|
53
|
+
* @param {number} config.y - The y-coordinate of the starting point of the watermark.
|
|
54
|
+
* @returns {void}
|
|
55
|
+
*/
|
|
56
|
+
private drawWaterMark;
|
|
57
|
+
private getConfig;
|
|
58
|
+
/**
|
|
59
|
+
* A method that resets the state of an object to its initial values.
|
|
60
|
+
*
|
|
61
|
+
* @function
|
|
62
|
+
* @name reset
|
|
63
|
+
* @returns {void}
|
|
64
|
+
*/
|
|
65
|
+
reset(): void;
|
|
66
|
+
}
|
|
67
|
+
export declare const reCountingSize: (config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer, fontSize: number, fontWidth: number) => string;
|
|
68
|
+
export declare const setFont: (config: FullChartConfig, fontSize: 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
|
+
import{CHART_UUID as k,CanvasElement as B}from"../../canvas/canvas-bounds-container";export class WaterMarkDrawer{constructor(e,n,s,w,h){this.config=e,this.canvasBoundsContainer=n,this.canvasModel=s,this.waterMarkConfigProvider=w,this.watermarkDataProvider=h,this.getConfig=(d=0,r,l,g,R,t)=>{const i=this.canvasModel.ctx,o=this.canvasBoundsContainer.getBounds(B.PANE_UUID(k)),{position:u,offsetY:m,offsetX:x}=this.config.components.waterMark;let a;switch(t?a=t:(i.font=setFont(this.config,l),a=i.measureText(r).width,o.width-10<a&&(i.font=reCountingSize(this.config,this.canvasBoundsContainer,l,a),a=i.measureText(r).width)),u){case"left-top":return{x:x+o.x,y:m+d+o.y,font:i.font,text:r,color:g};case"left-bottom":return{x:x+o.x,y:o.height-R-m+d+o.y,font:i.font,text:r,color:g};case"center":return{x:o.width/2-a/2+o.x,y:(o.height-R)/2+d+o.y,font:i.font,text:r,color:g}}}}draw(){var e,n,s,w,h,d,r;if(!((e=this.config.components.waterMark)===null||e===void 0)&&e.visible&&this.config.colors){const{firstRow:l,secondRow:g,thirdRow:R}=this.watermarkDataProvider(),t=this.waterMarkConfigProvider(),i=this.config.colors.waterMarkTheme,o=this.canvasModel.ctx;let u=0,m=0,x=0,a=0,v=0;if(o.save(),t.firstRowFontSize&&l){o.font=setFont(this.config,t.firstRowFontSize);const c=o.measureText(l);u=c.actualBoundingBoxAscent+c.actualBoundingBoxDescent}if(t.secondRowFontSize&&g){o.font=setFont(this.config,t.secondRowFontSize);const c=o.measureText(g);m=c.actualBoundingBoxAscent+c.actualBoundingBoxDescent,x=(n=t.firstRowBottomPadding)!==null&&n!==void 0?n:0}if(t.thirdRowFontSize&&R){o.font=setFont(this.config,t.thirdRowFontSize);const c=o.measureText(R);a=c.actualBoundingBoxAscent+c.actualBoundingBoxDescent,v=(s=t.secondRowBottomPadding)!==null&&s!==void 0?s:0}const p=(w=t.thirdRowBottomPadding)!==null&&w!==void 0?w:0,C=(h=t.logoHeight)!==null&&h!==void 0?h:0,M=u+m+x+a+v+p+C;if(l&&this.drawWaterMark(this.getConfig(u,l,t.firstRowFontSize,i.firstRowColor,M)),g&&this.drawWaterMark(this.getConfig(u+x+m,g,t.secondRowFontSize,i.secondRowColor,M)),R&&this.drawWaterMark(this.getConfig(u+x+m+v+a,R,t.thirdRowFontSize,i.thirdRowColor,M)),this.logoImage){const c=this.getConfig(u+x+m+v+a+p,"",t.thirdRowFontSize,i.thirdRowColor,M,t.logoWidth);this.canvasModel.ctx.drawImage(this.logoImage,c.x,c.y,(d=t.logoWidth)!==null&&d!==void 0?d:0,(r=t.logoHeight)!==null&&r!==void 0?r:0)}o.restore()}}getCanvasIds(){return[this.canvasModel.canvasId]}setLogoImage(e){this.logoImage=e}drawWaterMark(e){const n=e.text;if(!n||!n.length)return;const s=this.canvasModel.ctx;s.font=e.font,s.fillStyle=e.color;const w=e.x,h=e.y;s.fillText(n,w,h)}reset(){}}export const reCountingSize=(f,e,n,s)=>{const h=((r,l)=>e.getBounds(B.CHART).width/l*r)(n,s);let d;return f.components&&f.components.waterMark&&(d=f.components.waterMark.fontFamily),h+"px "+d},setFont=(f,e)=>{let n;return f.components&&f.components.waterMark&&(n=f.components.waterMark.fontFamily),e+"px "+n};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { NumericAxisLabel, NumericAxisLabelsGenerator } from '../labels_generator/numeric-axis-labels.generator';
|
|
7
|
+
import { ViewportModel } from '../../model/scaling/viewport.model';
|
|
8
|
+
import { XAxisLabelsGenerator } from './x-axis-labels.generator';
|
|
9
|
+
/**
|
|
10
|
+
* Y axis labels generator for prices. Respects price increment from instrument.
|
|
11
|
+
*/
|
|
12
|
+
export declare class NumericXAxisLabelsGenerator extends NumericAxisLabelsGenerator implements XAxisLabelsGenerator {
|
|
13
|
+
constructor(viewportModel: ViewportModel, valueFormatter?: (value: number, precision?: number) => string);
|
|
14
|
+
get labels(): NumericAxisLabel[];
|
|
15
|
+
/**
|
|
16
|
+
* Recalculates the labels of the chart.
|
|
17
|
+
* Calls the generateNumericLabels method to generate new numeric labels.
|
|
18
|
+
*/
|
|
19
|
+
recalculateLabels(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Invalidates the labels cache and generates numeric labels.
|
|
22
|
+
* @returns {void}
|
|
23
|
+
*/
|
|
24
|
+
generateLabels(): void;
|
|
25
|
+
}
|
|
@@ -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{NumericAxisLabelsGenerator as s}from"../labels_generator/numeric-axis-labels.generator";export class NumericXAxisLabelsGenerator extends s{constructor(e,a=r=>`${r}`){super(null,()=>[e.yStart,e.yEnd],()=>e.getBounds().width,a,!1,()=>"regular",()=>0,void 0)}get labels(){return this.labelsCache.calculateOrGet()}recalculateLabels(){this.generateNumericLabels()}generateLabels(){this.labelsCache.invalidate(),this.generateNumericLabels()}}
|
|
@@ -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 { ParsedTimeFormat } from './time-formats.model';
|
|
7
|
+
/**
|
|
8
|
+
* {@link TimeFormatMatcher} is a function that controls does passed {@link Date} match the {@link ParsedTimeFormat}
|
|
9
|
+
* that matcher is responsible for.
|
|
10
|
+
* Moreover {@link TimeFormatMatcher} compares dates to prevent including the same date
|
|
11
|
+
* for a corresponding period twice.
|
|
12
|
+
* @see
|
|
13
|
+
* Basically you need to use {@link timeFormatMatcherFactory}, because it'll catch up the
|
|
14
|
+
* matcher for the given {@link ParsedTimeFormat} automatically
|
|
15
|
+
* @example
|
|
16
|
+
* // In examples we will test the `currentDate`
|
|
17
|
+
*
|
|
18
|
+
* const currentDate = new Date('Fri Feb 10 2023 14:50:10 GMT+0500');
|
|
19
|
+
* const prevDate = new Date('Fri Feb 09 2023 14:50:10 GMT+0500');
|
|
20
|
+
* // that `timeFormat` means, that we want to get only dates
|
|
21
|
+
* // that represents days that are divisible by 10 (10, 20, 30)
|
|
22
|
+
* const timeFormat: ParsedTimeFormat = {
|
|
23
|
+
* key: 'day',
|
|
24
|
+
* value: 10,
|
|
25
|
+
* exact: false
|
|
26
|
+
* };
|
|
27
|
+
* // `timeFormatMatcherFactory` will automatically get the matcher for a given `timeFormat`
|
|
28
|
+
* const matcher = timeFormatMatcherFactory(timeFormat)
|
|
29
|
+
*
|
|
30
|
+
* // `true`, because `Feb 10' is divisible by 10,
|
|
31
|
+
* // and the `previousDate` was not the same `day`
|
|
32
|
+
* const applicable = matcher(currentDate)(prevDate); // true
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* const currentDate = new Date('Fri Feb 10 2023 14:50:10 GMT+0500');
|
|
36
|
+
* const prevDate = new Date('Fri Feb 09 2023 14:50:10 GMT+0500');
|
|
37
|
+
* // that `timeFormat` means, that we want to get only dates
|
|
38
|
+
* // that represents months that are divisible by 3 (March, June etc.)
|
|
39
|
+
* const timeFormat: ParsedTimeFormat = {
|
|
40
|
+
* key: 'month',
|
|
41
|
+
* value: 3,
|
|
42
|
+
* exact: false
|
|
43
|
+
* };
|
|
44
|
+
* const matcher = timeFormatMatcherFactory(timeFormat)
|
|
45
|
+
* // `false`, because `Feb 02' i.e 2
|
|
46
|
+
* // is not divisible by 3, and the `previousDate` is `Feb` i.e the same `month`
|
|
47
|
+
* const applicable = matcher(currentDate)(prevDate); // false
|
|
48
|
+
*/
|
|
49
|
+
export type TimeFormatMatcher = (currentDate: Date, prevDate: Date) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Factory that return a {@link TimeFormatMatcher} function for a given {@link ParsedTimeFormats}
|
|
52
|
+
* @see
|
|
53
|
+
* Detailed explanation you can find here {@link TimeFormatMatcher}
|
|
54
|
+
*/
|
|
55
|
+
export declare const timeFormatMatcherFactory: <T extends ParsedTimeFormat>(timeFormat: T) => TimeFormatMatcher;
|
|
@@ -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{eachDayOfInterval as k,isSameDay as h,isMonday as M,isTuesday as f,isWednesday as i,isThursday as v,isFriday as w,isSaturday as T,isSunday as g,startOfMonth as S,endOfMonth as O}from"date-fns/esm";export const timeFormatMatcherFactory=e=>{switch(e.key){case"lessThanSecond":return N(e);case"month":return W(e);case"second":case"minute":case"hour":case"day":case"year":return B(e);case"week-weekday":return C(e);default:return()=>!1}};const r=(e,s)=>{switch(s){case"lessThanSecond":return e.getMilliseconds();case"month":return e.getMonth();case"second":return e.getSeconds();case"minute":return e.getMinutes();case"hour":return e.getHours();case"day":return e.getDate();case"year":return e.getFullYear();case"week-weekday":return e.getDate()}},o=e=>(s,n)=>{const c=r(s,e),t=r(n,e);return c!==t},p=e=>(s,n)=>{const c=r(s,e),t=r(n,e);return c>=t},x={1:M,2:f,3:i,4:v,5:w,6:T,7:g},I=(e,s,n)=>{var c;const t=k({start:S(e),end:O(e)}),u=(c=x[n])!==null&&c!==void 0?c:()=>!1;if(s==="$"){for(const a of t.reverse())if(u(a))return h(e,a)}else{let a=1;for(const y of t)if(u(y)){if(a===s)return h(e,y);a++}}return!1},l=(e,s)=>s===1?e===1:e/s===1,d=(e,s)=>s===1?!0:e%s===0,N=e=>(s,n)=>p(e.key)(s,n),W=e=>(s,n)=>{const c=o(e.key)(s,n),t=e.exact?l(r(s,e.key)+1,e.value):d(r(s,e.key)+1,e.value);return c&&t},B=e=>(s,n)=>{const c=o(e.key)(s,n),t=e.exact?l(r(s,e.key),e.value):d(r(s,e.key),e.value);return c&&t},C=e=>(s,n)=>{const c=o(e.key)(s,n),t=I(s,e.week,e.weekday);return c&&t};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { ParsedTimeFormat, TimeFormatWithDuration } from './time-formats.model';
|
|
7
|
+
/**
|
|
8
|
+
* Parses the {@link TimeFormatWithDuration}
|
|
9
|
+
* and returns {@link ParsedTimeFormat} for a successfil parsing and `null`
|
|
10
|
+
* if the {@link TimeFormatWithDuration} couldn't be parsed.
|
|
11
|
+
* @example
|
|
12
|
+
* const timeFormat = 'day_14!';
|
|
13
|
+
* const parsedTimeFormat = parseTimeFormatsFromKey(timeFormat); // { key: 'day', value: 14, exact: true }
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const timeFormat = 'week-weekday_3_5';
|
|
17
|
+
* const parsedTimeFormat = parseTimeFormatsFromKey(timeFormat); // { key: 'week-weekday', week: 3, weekday: 5 }
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const timeFormat = 'bla-bla_1234';
|
|
21
|
+
* const parsedTimeFormat = parseTimeFormatsFromKey(timeFormat); // null
|
|
22
|
+
*/
|
|
23
|
+
export declare const parseTimeFormatsFromKey: (format: TimeFormatWithDuration) => ParsedTimeFormat | null;
|
|
@@ -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{timeFormatConfirugableGuard as m,timeFormatNoNConfirugableGuard as p,weekWeekdayGuard as u}from"./time-formats.model";const c=r=>{const e={"!":!1,$:!1};return r.includes("!")&&(e["!"]=!0),r.includes("$")&&(e.$=!0),e},o=r=>parseInt(r,10);export const parseTimeFormatsFromKey=r=>{const[e,...n]=r.split("_");if(m(e)){const[t]=n,s=c(t),a=o(t);return{key:e,value:a,exact:s["!"]}}else if(u(e)){const[t,s]=n,a=c(t),l=o(t),i=o(s);return{key:e,week:a.$?"$":l,weekday:i}}else return p(e)?{key:e}:(console.warn(`${r} is not fit, check the documentation to see available formats https://webdev.prosp.devexperts.com:8095/docs/chart/x-axis`),null)};
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { ParsedTimeFormat } from './time-formats.model';
|
|
7
|
+
/**
|
|
8
|
+
* Validators are aimed to check if the `ParsedTimeFormat` is correct
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const timeFormat: ParsedTimeFormat = {
|
|
12
|
+
* key: 'day',
|
|
13
|
+
* value: 13,
|
|
14
|
+
* exact: true
|
|
15
|
+
* };
|
|
16
|
+
* // valid, because day should be between 1 and 31
|
|
17
|
+
* const valid = validateParsedTimeFormat(timeFormat); // true
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const timeFormat: ParsedTimeFormat = {
|
|
21
|
+
* key: 'minute',
|
|
22
|
+
* value: 255,
|
|
23
|
+
* exact: true
|
|
24
|
+
* };
|
|
25
|
+
* // INvalid, because minute should be between 1 and 60
|
|
26
|
+
* const valid = validateParsedTimeFormat(timeFormat); // false
|
|
27
|
+
*/
|
|
28
|
+
export declare const validateParsedTimeFormat: <T extends ParsedTimeFormat>(parsed: T) => 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
|
+
export const validateParsedTimeFormat=e=>{switch(e.key){case"second":case"minute":return a(e.value);case"hour":return o(e.value);case"day":return s(e.value);case"month":return u(e.value);case"year":return d(e.value);case"week-weekday":const r=c(e.week),n=i(e.weekday);return r&&n;case"lessThanSecond":return!0;default:return!1}};const a=e=>e>0&&e<=60,o=e=>e>0&&e<=24,s=e=>e>0&&e<=31,i=e=>t(e)?e>=1&&e<=7:!1,c=e=>e==="$"?!0:t(e)?e>=1&&e<=6:!1,u=e=>e>0&&e<=12,d=e=>e>0,t=e=>!isNaN(e)&&isFinite(e);
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
declare const weekWeekday: "week-weekday";
|
|
7
|
+
declare const timeFormatsConfirugable: readonly ["second", "minute", "hour", "day", "month", "year"];
|
|
8
|
+
declare const timeFormatsNoNConfirugable: readonly ["lessThanSecond"];
|
|
9
|
+
type TimeFormatWeekWeekdayType = typeof weekWeekday;
|
|
10
|
+
type TimeFormatConfirugableType = typeof timeFormatsConfirugable[number];
|
|
11
|
+
type TimeFormatNonConfirugableType = typeof timeFormatsNoNConfirugable[number];
|
|
12
|
+
export type TimeFormat = TimeFormatConfirugableType | TimeFormatNonConfirugableType | TimeFormatWeekWeekdayType;
|
|
13
|
+
type TimeFormatConfirugableWithDurationType = `${TimeFormatConfirugableType}_${number}` | `${TimeFormatConfirugableType}_${number}!` | `${TimeFormatWeekWeekdayType}_${number | '$'}_${number}`;
|
|
14
|
+
export type TimeFormatWithDuration = TimeFormatConfirugableWithDurationType | TimeFormatNonConfirugableType;
|
|
15
|
+
export interface ParsedCTimeFormat {
|
|
16
|
+
key: TimeFormatConfirugableType;
|
|
17
|
+
value: number;
|
|
18
|
+
exact: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ParsedWeekFormat {
|
|
21
|
+
key: TimeFormatWeekWeekdayType;
|
|
22
|
+
week: number | '$';
|
|
23
|
+
weekday: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ParsedNCTimeFormat {
|
|
26
|
+
key: TimeFormatNonConfirugableType;
|
|
27
|
+
}
|
|
28
|
+
export type ParsedTimeFormat = ParsedCTimeFormat | ParsedWeekFormat | ParsedNCTimeFormat;
|
|
29
|
+
export type SpecialSymbol = '!' | '$';
|
|
30
|
+
export declare const timeFormatConfirugableGuard: (key: string) => key is "second" | "minute" | "hour" | "day" | "month" | "year";
|
|
31
|
+
export declare const weekWeekdayGuard: (key: string) => key is "week-weekday";
|
|
32
|
+
export declare const timeFormatNoNConfirugableGuard: (key: string) => key is "lessThanSecond";
|
|
33
|
+
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
|
+
const a="week-weekday",r=["second","minute","hour","day","month","year"],t=["lessThanSecond"];export const timeFormatConfirugableGuard=e=>r.some(o=>o===e),weekWeekdayGuard=e=>e==="week-weekday",timeFormatNoNConfirugableGuard=e=>t.some(o=>o===e);
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
import { ScaleModel } from '../../../model/scale.model';
|
|
8
|
+
import { NumericAxisLabel } from '../../labels_generator/numeric-axis-labels.generator';
|
|
9
|
+
import { XAxisLabelWeighted } from '../x-axis-labels.generator';
|
|
10
|
+
import { ParsedTimeFormat } from './parser/time-formats.model';
|
|
11
|
+
/**
|
|
12
|
+
* Generates `weight` based on the {@link ParsedTimeFormat}
|
|
13
|
+
* @example
|
|
14
|
+
* const timeFormat: ParsedTimeFormat = {
|
|
15
|
+
* key: 'day',
|
|
16
|
+
* value: 15,
|
|
17
|
+
* exact: false
|
|
18
|
+
* }
|
|
19
|
+
* const weight = getWeightFromTimeFormat(timeFormat); // 415
|
|
20
|
+
*/
|
|
21
|
+
export declare const getWeightFromTimeFormat: (format: ParsedTimeFormat) => number;
|
|
22
|
+
/**
|
|
23
|
+
* Group {@link XAxisLabelWeighted} by `weight` in a `Record<number, XAxisLabelWeighted[]>`
|
|
24
|
+
* @example
|
|
25
|
+
* const groupedLabels = {
|
|
26
|
+
* 601: Array(359),
|
|
27
|
+
* 415: Array(1685),
|
|
28
|
+
* ...
|
|
29
|
+
* }
|
|
30
|
+
*/
|
|
31
|
+
export declare const groupLabelsByWeight: (weightedLabels: XAxisLabelWeighted[]) => Record<number, XAxisLabelWeighted[]>;
|
|
32
|
+
/**
|
|
33
|
+
* FilterMap grouped {@link XAxisLabelWeighted} labels by `coverUpLevel` value
|
|
34
|
+
*
|
|
35
|
+
* @see
|
|
36
|
+
* `coverUpLevel` - is a ratio, which tells us how much more space the widest label
|
|
37
|
+
* will take relative to the candle width
|
|
38
|
+
* @example
|
|
39
|
+
* const maxLabelWidthPx = 10;
|
|
40
|
+
* const meanCandleWidthPx = 5;
|
|
41
|
+
* const coverUpLevel = Math.round(10 / 5); // 2
|
|
42
|
+
*
|
|
43
|
+
* // `coverUpLebel = 2` means that label for a candle take `2x` more width
|
|
44
|
+
* // than the candle on the screen for that label.
|
|
45
|
+
* // That kind of fact give us a hint, that we can't draw labels for `i - 1` and `i + 1` candles,
|
|
46
|
+
* // because it wouldn't be enough space (`i` candle label will take all the place).
|
|
47
|
+
* // But we can draw labels for `i - 2` and `i + 2` candles.
|
|
48
|
+
* @see
|
|
49
|
+
* That algorightm do exactly that - it filters out labels (taking in mind its weight, weight is a priority) that couldn't be drawn
|
|
50
|
+
* because there's not enough space for them.
|
|
51
|
+
*/
|
|
52
|
+
export declare const filterMapGroupedLabelsByCoverUpLevel: (labelsGroupedByWeight: Record<number, XAxisLabelWeighted[]>, coverUpLevel: number) => XAxisLabelWeighted[];
|
|
53
|
+
/**
|
|
54
|
+
* The function compares 2 labels and checks if they overlap each other
|
|
55
|
+
* @param {CanvasRenderingContext2D} ctx - canvas context
|
|
56
|
+
* @param {FullChartConfig} config - chart config
|
|
57
|
+
* @param {NumericAxisLabel} label - first label to compare
|
|
58
|
+
* @param {NumericAxisLabel} nextLabel - second label to compare
|
|
59
|
+
* @param {ScaleModel} scaleModel - chart scale model
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
export declare const overlappingPredicate: (ctx: CanvasRenderingContext2D, config: FullChartConfig, label: NumericAxisLabel, nextLabel: NumericAxisLabel, scaleModel: ScaleModel, overlapingDistance: number) => 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{calculateTextWidth as w}from"../../../utils/canvas/canvas-font-measure-tool.utils";import{XAxisTimeLabelsDrawer as W}from"../x-axis-time-labels.drawer";const d={lessThanSecond:0,second:100,minute:200,hour:300,day:400,"week-weekday":500,month:600,year:1e4};export const getWeightFromTimeFormat=e=>{switch(e.key){case"second":case"minute":case"hour":case"day":case"month":case"year":return d[e.key]+e.value;case"lessThanSecond":return d[e.key];case"week-weekday":return d[e.key]+(e.week==="$"?9:e.week)+e.weekday*10}},groupLabelsByWeight=e=>{const s={};return e.forEach(n=>{const t=s[n.weight];t===void 0?s[n.weight]=[n]:t.push(n)}),s},filterMapGroupedLabelsByCoverUpLevel=(e,s)=>{const n=Object.keys(e).map(o=>parseInt(o,10)).sort((o,i)=>i-o);let t=[];for(const o of n){const i=e[o];if(!i)continue;const c=[...t];t=[];const a=c.length,l=i.length;let r=0,h=1/0,p=-1/0;for(let g=0;g<l;g++){const y=i[g],u=y.idx;for(;r<a;){const k=c[r],x=k.idx;if(u>x)r++,t.push(k),p=x,h=1/0;else{h=x;break}}h-u>=s&&u-p>=s&&(t.push(y),p=u)}for(;r<a;)t.push(c[r]),r++}return t},overlappingPredicate=(e,s,n,t,o,i)=>{const c=W.getFontFromConfig(s),a=w(n.text,e,c),l=w(t.text,e,c),r=o.toX(n.value)+a/2;return o.toX(t.value)-l/2-r<i};
|
|
@@ -0,0 +1,33 @@
|
|
|
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 VisualCandle from '../../../model/visual-candle';
|
|
7
|
+
import { TimeFormatMatcher } from './parser/time-formats-matchers.functions';
|
|
8
|
+
import { TimeFormatWithDuration } from './parser/time-formats.model';
|
|
9
|
+
export interface WeightedPoint {
|
|
10
|
+
weight: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Transforms {@link VisualCandle} to {@link WeightedPoint}
|
|
14
|
+
*/
|
|
15
|
+
export declare function mapCandlesToWeightedPoints(visualCandles: VisualCandle[], sortedWeights: [number, TimeFormatMatcher][], tzOffset: (time: number) => Date): WeightedPoint[];
|
|
16
|
+
/**
|
|
17
|
+
* Generates two maps for a given config.
|
|
18
|
+
* 1st map is { [weight]: [format] } to control which format should be used for a given weight;
|
|
19
|
+
* 2nd map is { [weight]: [Matcher] } to test a date for a match for a given weight;
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const config: Record<TimeFormatWithDuration, string> = {
|
|
23
|
+
* 'day_15': 'dd.MM',
|
|
24
|
+
* 'month_7!': 'MMM'
|
|
25
|
+
* }
|
|
26
|
+
* const { map1, map2 } = generateWeightsMapForConfig(config);
|
|
27
|
+
* // map1 = { 415: 'dd.MM', 607: 'MMM' };
|
|
28
|
+
* // map2 = { 415: DayMatcher, 607: MonthMatcher }
|
|
29
|
+
*/
|
|
30
|
+
export declare const generateWeightsMapForConfig: (config: Record<TimeFormatWithDuration, string>) => {
|
|
31
|
+
weightToTimeFormatsDict: Record<number, string>;
|
|
32
|
+
weightToTimeFormatMatcherDict: Record<number, TimeFormatMatcher>;
|
|
33
|
+
};
|
|
@@ -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{typedEntries_UNSAFE as g}from"../../../utils/object.utils";import{timeFormatMatcherFactory as f}from"./parser/time-formats-matchers.functions";import{parseTimeFormatsFromKey as h}from"./parser/time-formats-parser.functions";import{validateParsedTimeFormat as l}from"./parser/time-formats-validators.functions";import{getWeightFromTimeFormat as p}from"./x-axis-weights.functions";const F=(o,m,e,n)=>{var r,t;const a=n(o.getTime()),i=n(m.getTime());for(const[c,s]of e)if(s(a,i))return c;return(t=(r=e[e.length-1])===null||r===void 0?void 0:r[0])!==null&&t!==void 0?t:0};export function mapCandlesToWeightedPoints(o,m,e){const n=new Array(o.length);let r=new Date(0);for(let t=0;t<o.length;t++){const a=o[t],i=new Date(a.candle.timestamp),c={weight:F(i,r,m,e)};n[t]=c,r=i}return n}export const generateWeightsMapForConfig=o=>{const m={},e={};return g(o).forEach(([n,r])=>{const t=h(n),a=t===null?!1:l(t);if(t&&a){const i=p(t);m[i]=r,e[i]=f(t)}}),{weightToTimeFormatsDict:m,weightToTimeFormatMatcherDict:e}};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
7
|
+
import { FullChartConfig } from '../../chart.config';
|
|
8
|
+
import { XAxisLabel } from './x-axis-labels.model';
|
|
9
|
+
export type LabelAlign = 'start' | 'end' | 'middle';
|
|
10
|
+
/**
|
|
11
|
+
* Draws the label on X axis.
|
|
12
|
+
* @param ctx
|
|
13
|
+
* @param canvasBoundsContainer
|
|
14
|
+
* @param config
|
|
15
|
+
* @param label
|
|
16
|
+
*/
|
|
17
|
+
export declare function drawXAxisLabel(backgroundCtx: CanvasRenderingContext2D, ctx: CanvasRenderingContext2D, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig, label: XAxisLabel): 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{CanvasElement as A}from"../../canvas/canvas-bounds-container";import{redrawBackgroundArea as u}from"../../drawers/chart-background.drawer";const f={x:4,y:4};export function drawXAxisLabel(m,o,y,h,e){var i,r;const d=(i=e.alignType)!==null&&i!==void 0?i:"middle",{fontSize:l,fontFamily:p,padding:x}=h.components.xAxis,T=(r=x.top)!==null&&r!==void 0?r:0,t=y.getBounds(A.X_AXIS);o.save(),o.font=`bold ${l}px ${p}`;const a=o.measureText(e.text).width+f.x*2;let n=0;const s=e.x;switch(d){case"start":n=s-a;break;case"end":n=s;break;case"middle":default:n=s-a/2;break}u(m,o,n,t.y,a,t.height-1),d!=="middle"&&(o.strokeStyle=e.color,o.beginPath(),o.moveTo(s,t.y),o.lineTo(s,t.y+t.height),o.stroke()),o.fillStyle=e.color;const c=n+f.x,g=t.y+T+l;o.fillText(e.text,c,g),o.restore()}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2002 - 2023 Devexperts LLC
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
7
|
+
import { XAxisLabelsModel } from './x-axis-labels.model';
|
|
8
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
9
|
+
import { Drawer } from '../../drawers/drawing-manager';
|
|
10
|
+
import { FullChartConfig } from '../../chart.config';
|
|
11
|
+
/**
|
|
12
|
+
* This drawer draws custom labels for X Axis, using labels from XAxisLabelModel.
|
|
13
|
+
* By default labels for drawings are drawn by this drawer.
|
|
14
|
+
*/
|
|
15
|
+
export declare class XAxisLabelsDrawer implements Drawer {
|
|
16
|
+
private backgroundCanvasModel;
|
|
17
|
+
private config;
|
|
18
|
+
private canvasModel;
|
|
19
|
+
private canvasBoundsContainer;
|
|
20
|
+
private xAxisLabelsModel;
|
|
21
|
+
constructor(backgroundCanvasModel: CanvasModel, config: FullChartConfig, canvasModel: CanvasModel, canvasBoundsContainer: CanvasBoundsContainer, xAxisLabelsModel: XAxisLabelsModel);
|
|
22
|
+
/**
|
|
23
|
+
* Draws the X axis labels on the canvas.
|
|
24
|
+
* @function
|
|
25
|
+
* @name draw
|
|
26
|
+
* @memberof XAxisLabelsDrawer
|
|
27
|
+
* @returns {void}
|
|
28
|
+
*/
|
|
29
|
+
draw(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Draws a highlighted background between two labels with the same "subGroupId".
|
|
32
|
+
*
|
|
33
|
+
* @returns {void}
|
|
34
|
+
*/
|
|
35
|
+
drawHighlightedBackgroundBetweenLabels(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Returns an array with the ID of the canvas model.
|
|
38
|
+
*
|
|
39
|
+
* @returns {Array} An array with the ID of the canvas model.
|
|
40
|
+
*/
|
|
41
|
+
getCanvasIds(): string[];
|
|
42
|
+
}
|
|
@@ -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{drawXAxisLabel as i}from"./x-axis-draw.functions";import{CanvasElement as r}from"../../canvas/canvas-bounds-container";import*as d from"color";import{fillRect as l}from"../../utils/canvas/canvas-drawing-functions.utils";export class XAxisLabelsDrawer{constructor(a,e,n,o,s){this.backgroundCanvasModel=a,this.config=e,this.canvasModel=n,this.canvasBoundsContainer=o,this.xAxisLabelsModel=s}draw(){const a=this.canvasModel.ctx;this.drawHighlightedBackgroundBetweenLabels(),this.xAxisLabelsModel.labels.forEach(e=>{i(this.backgroundCanvasModel.ctx,a,this.canvasBoundsContainer,this.config,e)})}drawHighlightedBackgroundBetweenLabels(){const a=this.canvasModel.ctx,e={},n=this.xAxisLabelsModel.labels.reduce((o,s)=>{if(s.subGroupId!==void 0){let t=o[s.subGroupId];t||(t=[],o[s.subGroupId]=t),t.push(s)}return o},e);Object.keys(n).forEach(o=>{const s=n[o];if(s.length===2){const t=this.canvasBoundsContainer.getBounds(r.X_AXIS);a.fillStyle=d.rgb(s[0].color).alpha(.1).toString(),l(a,{x:s[0].x,y:t.y},{x:s[1].x,y:t.y+t.height})}})}getCanvasIds(){return[this.canvasModel.canvasId]}}
|