@devexperts/dxcharts-lite 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/chart/animation/canvas-animation.js +134 -1
- package/dist/chart/animation/types/animation.js +43 -1
- package/dist/chart/animation/types/color-alpha-animation.d.ts +1 -1
- package/dist/chart/animation/types/color-alpha-animation.js +60 -1
- package/dist/chart/animation/types/color-transition-animation.d.ts +1 -1
- package/dist/chart/animation/types/color-transition-animation.js +86 -1
- package/dist/chart/animation/types/viewport-movement-animation.js +63 -1
- package/dist/chart/animation/viewport-model-animation.js +20 -1
- package/dist/chart/bootstrap.d.ts +51 -48
- package/dist/chart/bootstrap.js +449 -1
- package/dist/chart/canvas/canvas-bounds-container.d.ts +0 -5
- package/dist/chart/canvas/canvas-bounds-container.js +815 -1
- package/dist/chart/canvas/canvas-chart-html.js +16 -18
- package/dist/chart/canvas/chart-elements.d.ts +1 -4
- package/dist/chart/canvas/chart-elements.js +22 -1
- package/dist/chart/canvas/cursor.handler.js +122 -1
- package/dist/chart/canvas/layout-creator.js +34 -1
- package/dist/chart/canvas/y-axis-bounds.container.d.ts +2 -2
- package/dist/chart/canvas/y-axis-bounds.container.js +67 -1
- package/dist/chart/chart-container.js +1 -1
- package/dist/chart/chart.config.d.ts +4 -5
- package/dist/chart/chart.config.js +645 -1
- package/dist/chart/chart.d.ts +62 -0
- package/dist/chart/chart.js +106 -0
- package/dist/chart/components/chart/basic-scale.d.ts +2 -2
- package/dist/chart/components/chart/basic-scale.js +31 -1
- package/dist/chart/components/chart/candle-transformer.functions.js +15 -1
- package/dist/chart/components/chart/candle-width-calculator.functions.js +2 -1
- package/dist/chart/components/chart/candle.functions.js +44 -1
- package/dist/chart/components/chart/chart-area-pan.handler.d.ts +3 -3
- package/dist/chart/components/chart/chart-area-pan.handler.js +197 -1
- package/dist/chart/components/chart/chart-base.model.js +66 -1
- package/dist/chart/components/chart/chart.component.d.ts +7 -3
- package/dist/chart/components/chart/chart.component.js +408 -1
- package/dist/chart/components/chart/chart.model.d.ts +4 -11
- package/dist/chart/components/chart/chart.model.js +954 -1
- package/dist/chart/components/chart/data-series.high-low-provider.js +34 -1
- package/dist/chart/components/chart/fake-candles.js +97 -1
- package/dist/chart/components/chart/price.formatter.js +35 -1
- package/dist/chart/components/chart/secondary-chart-colors-pool.js +68 -1
- package/dist/chart/components/cross_tool/cross-tool.component.js +85 -1
- package/dist/chart/components/cross_tool/cross-tool.drawer.js +32 -1
- package/dist/chart/components/cross_tool/cross-tool.model.js +107 -1
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +137 -1
- package/dist/chart/components/cross_tool/types/none.drawer.js +3 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +28 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +24 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +53 -1
- package/dist/chart/components/dynamic-objects/dynamic-objects.component.d.ts +13 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.component.js +20 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.d.ts +18 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.drawer.js +23 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.model.d.ts +63 -0
- package/dist/chart/components/dynamic-objects/dynamic-objects.model.js +136 -0
- package/dist/chart/components/events/events-hit-test.drawer.js +63 -1
- package/dist/chart/components/events/events.component.js +61 -1
- package/dist/chart/components/events/events.drawer.js +195 -1
- package/dist/chart/components/events/events.model.js +69 -1
- package/dist/chart/components/grid/grid.component.d.ts +2 -2
- package/dist/chart/components/grid/grid.component.js +31 -1
- package/dist/chart/components/grid/grid.drawer.d.ts +4 -3
- package/dist/chart/components/grid/grid.drawer.js +106 -1
- package/dist/chart/components/high_low/high-low.component.js +12 -1
- package/dist/chart/components/high_low/high-low.drawer.js +126 -1
- package/dist/chart/components/highlights/highlights.component.js +46 -1
- package/dist/chart/components/highlights/highlights.drawer.js +154 -1
- package/dist/chart/components/highlights/highlights.model.js +75 -1
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.d.ts +1 -1
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.js +199 -1
- package/dist/chart/components/navigation_map/navigation-map-move.handler.d.ts +2 -2
- package/dist/chart/components/navigation_map/navigation-map-move.handler.js +108 -1
- package/dist/chart/components/navigation_map/navigation-map.component.js +112 -1
- package/dist/chart/components/navigation_map/navigation-map.drawer.js +244 -1
- package/dist/chart/components/navigation_map/navigation-map.model.js +33 -2
- package/dist/chart/components/pan/chart-pan.component.d.ts +2 -2
- package/dist/chart/components/pan/chart-pan.component.js +51 -1
- package/dist/chart/components/pane/extent/y-extent-component.d.ts +12 -18
- package/dist/chart/components/pane/extent/y-extent-component.js +120 -1
- package/dist/chart/components/pane/pane-hit-test.controller.js +55 -1
- package/dist/chart/components/pane/pane-manager.component.d.ts +10 -5
- package/dist/chart/components/pane/pane-manager.component.js +148 -1
- package/dist/chart/components/pane/pane.component.d.ts +16 -32
- package/dist/chart/components/pane/pane.component.js +278 -1
- package/dist/chart/components/resizer/bar-resizer.component.js +139 -1
- package/dist/chart/components/resizer/bar-resizer.drawer.js +46 -1
- package/dist/chart/components/snapshot/snapshot.component.js +48 -1
- package/dist/chart/components/volumes/separate-volumes.component.d.ts +6 -10
- package/dist/chart/components/volumes/separate-volumes.component.js +63 -1
- package/dist/chart/components/volumes/volume-color-resolvers.functions.js +18 -1
- package/dist/chart/components/volumes/volumes.component.d.ts +6 -7
- package/dist/chart/components/volumes/volumes.component.js +94 -1
- package/dist/chart/components/volumes/volumes.drawer.d.ts +5 -12
- package/dist/chart/components/volumes/volumes.drawer.js +140 -1
- package/dist/chart/components/volumes/volumes.formatter.js +31 -1
- package/dist/chart/components/volumes/volumes.model.d.ts +2 -2
- package/dist/chart/components/volumes/volumes.model.js +43 -1
- package/dist/chart/components/watermark/water-mark.component.js +103 -1
- package/dist/chart/components/watermark/water-mark.drawer.js +187 -1
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.js +27 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.js +187 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.js +76 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.js +79 -1
- package/dist/chart/components/x_axis/time/parser/time-formats.model.js +14 -1
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.js +143 -1
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.js +73 -1
- package/dist/chart/components/x_axis/x-axis-draw.functions.js +49 -1
- package/dist/chart/components/x_axis/x-axis-labels.drawer.js +70 -1
- package/dist/chart/components/x_axis/x-axis-labels.generator.d.ts +2 -2
- package/dist/chart/components/x_axis/x-axis-labels.generator.js +332 -1
- package/dist/chart/components/x_axis/x-axis-labels.model.js +35 -1
- package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +2 -2
- package/dist/chart/components/x_axis/x-axis-scale.handler.js +60 -1
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +82 -1
- package/dist/chart/components/x_axis/x-axis.component.d.ts +2 -2
- package/dist/chart/components/x_axis/x-axis.component.js +119 -1
- package/dist/chart/components/y_axis/label-color.functions.js +53 -1
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.d.ts +4 -4
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.js +33 -1
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +3 -3
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +67 -1
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +56 -1
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +95 -1
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +2 -2
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +119 -1
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +9 -8
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +201 -1
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +6 -7
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +58 -1
- package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +6 -4
- package/dist/chart/components/y_axis/y-axis-base-labels.model.js +47 -1
- package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +4 -4
- package/dist/chart/components/y_axis/y-axis-labels.drawer.js +161 -1
- package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +2 -2
- package/dist/chart/components/y_axis/y-axis-scale.handler.js +72 -1
- package/dist/chart/components/y_axis/y-axis.component.d.ts +32 -41
- package/dist/chart/components/y_axis/y-axis.component.js +220 -1
- package/dist/chart/components/y_axis/y-axis.drawer.d.ts +9 -12
- package/dist/chart/components/y_axis/y-axis.drawer.js +96 -1
- package/dist/chart/components/y_axis/y-axis.model.d.ts +9 -17
- package/dist/chart/components/y_axis/y-axis.model.js +33 -1
- package/dist/chart/drawers/chart-background.drawer.js +69 -1
- package/dist/chart/drawers/chart-type-drawers/area.drawer.js +69 -1
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +57 -1
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +84 -1
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +162 -1
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +57 -1
- package/dist/chart/drawers/chart-type-drawers/line.drawer.js +38 -1
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +19 -1
- package/dist/chart/drawers/clear-canvas.drawer.js +14 -1
- package/dist/chart/drawers/composite.drawer.js +67 -1
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +50 -1
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +35 -1
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.js +16 -1
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +106 -1
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +23 -1
- package/dist/chart/drawers/data-series-drawers/linear.drawer.js +19 -1
- package/dist/chart/drawers/data-series-drawers/points.drawer.js +19 -1
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.js +7 -1
- package/dist/chart/drawers/data-series-drawers/text.drawer.js +25 -1
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +35 -1
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +22 -1
- package/dist/chart/drawers/data-series.drawer.d.ts +5 -7
- package/dist/chart/drawers/data-series.drawer.js +56 -1
- package/dist/chart/drawers/drawing-manager.d.ts +1 -1
- package/dist/chart/drawers/drawing-manager.js +177 -1
- package/dist/chart/drawers/ht-data-series.drawer.js +37 -1
- package/dist/chart/events/event-bus.js +73 -1
- package/dist/chart/events/events.js +3 -1
- package/dist/chart/inputhandlers/candle-tap.handler.js +46 -1
- package/dist/chart/inputhandlers/chart-resize.handler.js +98 -1
- package/dist/chart/inputhandlers/cross-event-producer.component.js +67 -1
- package/dist/chart/inputhandlers/hover-producer.component.d.ts +2 -2
- package/dist/chart/inputhandlers/hover-producer.component.js +228 -1
- package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +2 -2
- package/dist/chart/inputhandlers/main-canvas-touch.handler.js +80 -1
- package/dist/chart/inputlisteners/canvas-input-listener.component.js +629 -1
- package/dist/chart/model/baseline.model.js +88 -1
- package/dist/chart/model/bounds.model.js +1 -1
- package/dist/chart/model/candle-hover.js +70 -1
- package/dist/chart/model/candle-series-high-low.provider.js +45 -1
- package/dist/chart/model/candle-series.model.d.ts +3 -3
- package/dist/chart/model/candle-series.model.js +245 -1
- package/dist/chart/model/candle.model.js +69 -1
- package/dist/chart/model/canvas.model.js +228 -1
- package/dist/chart/model/chart-base-element.js +129 -1
- package/dist/chart/model/compare-series-hover.js +25 -1
- package/dist/chart/model/data-series-view.d.ts +5 -5
- package/dist/chart/model/data-series-view.js +111 -1
- package/dist/chart/model/data-series.config.js +14 -1
- package/dist/chart/model/data-series.model.d.ts +4 -4
- package/dist/chart/model/data-series.model.js +281 -1
- package/dist/chart/model/date-time.formatter.js +151 -1
- package/dist/chart/model/hit-test-canvas.model.d.ts +1 -1
- package/dist/chart/model/hit-test-canvas.model.js +256 -1
- package/dist/chart/model/main-candle-series.model.d.ts +1 -1
- package/dist/chart/model/main-candle-series.model.js +29 -1
- package/dist/chart/model/scale.model.d.ts +2 -1
- package/dist/chart/model/scale.model.js +316 -1
- package/dist/chart/model/scaling/auto-scale.model.js +97 -1
- package/dist/chart/model/scaling/constrait.functions.js +61 -1
- package/dist/chart/model/scaling/lock-ratio.model.js +17 -1
- package/dist/chart/model/scaling/move-chart.functions.js +22 -1
- package/dist/chart/model/scaling/viewport.model.d.ts +2 -2
- package/dist/chart/model/scaling/viewport.model.js +279 -1
- package/dist/chart/model/scaling/x-zooming.functions.js +35 -1
- package/dist/chart/model/time-zone.model.js +109 -1
- package/dist/chart/model/visual-candle.js +134 -1
- package/dist/chart/utils/__tests__/array.utils.test.js +135 -1
- package/dist/chart/utils/__tests__/math.utils.test.js +14 -1
- package/dist/chart/utils/__tests__/object.utils.test.js +11 -1
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.js +29 -1
- package/dist/chart/utils/array.utils.d.ts +1 -1
- package/dist/chart/utils/array.utils.js +269 -1
- package/dist/chart/utils/auto-period-detector.utils.js +39 -1
- package/dist/chart/utils/candles-generator-ts.utils.js +20 -1
- package/dist/chart/utils/candles-generator.utils.js +161 -1
- package/dist/chart/utils/candles.utils.js +42 -1
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.js +144 -1
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.js +51 -1
- package/dist/chart/utils/canvas/canvas-text-functions.utils.js +156 -1
- package/dist/chart/utils/color.utils.js +31 -1
- package/dist/chart/utils/device/browser.utils.js +10 -1
- package/dist/chart/utils/device/device-detector.utils.js +24 -1
- package/dist/chart/utils/device/device-pixel-ratio.utils.js +21 -1
- package/dist/chart/utils/device/touchpad.utils.js +91 -1
- package/dist/chart/utils/dom.utils.js +15 -1
- package/dist/chart/utils/function.utils.js +16 -1
- package/dist/chart/utils/linkedList.utils.d.ts +28 -0
- package/dist/chart/utils/linkedList.utils.js +138 -0
- package/dist/chart/utils/math.utils.js +115 -1
- package/dist/chart/utils/merge.utils.js +56 -1
- package/dist/chart/utils/object.utils.js +43 -1
- package/dist/chart/utils/performance/animation-frame-cache.utils.js +77 -0
- package/dist/chart/utils/{perfomance → performance}/debounce.utils.js +7 -1
- package/dist/chart/utils/performance/memoize.utils.js +74 -0
- package/dist/chart/utils/performance/request-animation-frame-throttle.utils.js +43 -0
- package/dist/chart/utils/performance/throttle.utils.js +26 -0
- package/dist/chart/utils/price-increments.utils.d.ts +1 -0
- package/dist/chart/utils/price-increments.utils.js +127 -1
- package/dist/chart/utils/uuid.utils.js +4 -1
- package/dist/dxchart.min.js +9 -12
- package/dist/index.d.ts +3 -3
- package/dist/index.js +20 -1
- package/package.json +4 -4
- package/dist/chart/utils/perfomance/animation-frame-cache.utils.js +0 -6
- package/dist/chart/utils/perfomance/memoize.utils.js +0 -6
- package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.js +0 -6
- package/dist/chart/utils/perfomance/throttle.utils.js +0 -6
- /package/dist/chart/utils/{perfomance → performance}/animation-frame-cache.utils.d.ts +0 -0
- /package/dist/chart/utils/{perfomance → performance}/debounce.utils.d.ts +0 -0
- /package/dist/chart/utils/{perfomance → performance}/memoize.utils.d.ts +0 -0
- /package/dist/chart/utils/{perfomance → performance}/request-animation-frame-throttle.utils.d.ts +0 -0
- /package/dist/chart/utils/{perfomance → performance}/throttle.utils.d.ts +0 -0
|
@@ -3,4 +3,31 @@
|
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
-
import{defaultDragComponentOptions
|
|
6
|
+
import { defaultDragComponentOptions, DragNDropComponent, } from './drag-n-drop.component';
|
|
7
|
+
export class DragNDropXComponent extends DragNDropComponent {
|
|
8
|
+
constructor(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions = defaultDragComponentOptions) {
|
|
9
|
+
super(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* This method is used to activate the component and add the necessary subscriptions to the canvasInputListener.
|
|
13
|
+
* It calls the super method doActivate() and then adds the following subscriptions:
|
|
14
|
+
* - observeXDragStart() subscription with hitTest() as parameter and onDragStart() as callback function
|
|
15
|
+
* - observeXDrag() subscription with onDragTick() as callback function
|
|
16
|
+
* - observeXDragEnd() subscription with onDragEnd() as callback function
|
|
17
|
+
* @returns {void}
|
|
18
|
+
*/
|
|
19
|
+
doActivate() {
|
|
20
|
+
super.doActivate();
|
|
21
|
+
this.addRxSubscription(this.canvasInputListener.observeXDragStart(this.hitTest).subscribe(this.onDragStart));
|
|
22
|
+
this.addRxSubscription(this.canvasInputListener.observeXDrag().subscribe(this.onDragTick));
|
|
23
|
+
this.addRxSubscription(this.canvasInputListener.observeXDragEnd().subscribe(this.onDragEnd));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* This method overrides the doDeactivate method of the parent class and calls it using the super keyword.
|
|
27
|
+
* It is used to deactivate the current object and perform any necessary cleanup operations.
|
|
28
|
+
* @protected
|
|
29
|
+
*/
|
|
30
|
+
doDeactivate() {
|
|
31
|
+
super.doDeactivate();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -3,4 +3,27 @@
|
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
-
import{defaultDragComponentOptions
|
|
6
|
+
import { defaultDragComponentOptions, DragNDropComponent, } from './drag-n-drop.component';
|
|
7
|
+
export class DragNDropYComponent extends DragNDropComponent {
|
|
8
|
+
constructor(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions = defaultDragComponentOptions) {
|
|
9
|
+
super(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* This method activates the component and adds subscriptions to the canvasInputListener.
|
|
13
|
+
* @protected
|
|
14
|
+
* @returns {void}
|
|
15
|
+
*/
|
|
16
|
+
doActivate() {
|
|
17
|
+
super.doActivate();
|
|
18
|
+
this.addRxSubscription(this.canvasInputListener.observeYDragStart(this.hitTest).subscribe(this.onDragStart));
|
|
19
|
+
this.addRxSubscription(this.canvasInputListener.observeYDrag().subscribe(this.onDragTick));
|
|
20
|
+
this.addRxSubscription(this.canvasInputListener.observeYDragEnd().subscribe(this.onDragEnd));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This method overrides the doDeactivate method of the parent class and calls the parent method before executing its own code.
|
|
24
|
+
* It is a protected method, which means it can only be accessed within the class and its subclasses.
|
|
25
|
+
*/
|
|
26
|
+
doDeactivate() {
|
|
27
|
+
super.doDeactivate();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -3,4 +3,56 @@
|
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
-
import{ChartBaseElement
|
|
6
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
7
|
+
export const defaultDragComponentOptions = {
|
|
8
|
+
disableChartPanning: true,
|
|
9
|
+
};
|
|
10
|
+
export class DragNDropComponent extends ChartBaseElement {
|
|
11
|
+
constructor(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions) {
|
|
12
|
+
super();
|
|
13
|
+
this.hitTest = hitTest;
|
|
14
|
+
this.dragCallbacks = dragCallbacks;
|
|
15
|
+
this.canvasInputListener = canvasInputListener;
|
|
16
|
+
this.chartPanComponent = chartPanComponent;
|
|
17
|
+
this.dragComponentOptions = dragComponentOptions;
|
|
18
|
+
this.dragging = false;
|
|
19
|
+
this.draggedPixels = 0;
|
|
20
|
+
this.onDragStart = (point) => {
|
|
21
|
+
this.dragging = true;
|
|
22
|
+
this.draggedPixels = 0;
|
|
23
|
+
this.dragCallbacks.onDragStart && this.dragCallbacks.onDragStart(point);
|
|
24
|
+
this.dragComponentOptions.disableChartPanning && this.chartPanComponent.deactivatePanHandlers();
|
|
25
|
+
};
|
|
26
|
+
this.onDragTick = (yDelta) => {
|
|
27
|
+
if (this.dragging) {
|
|
28
|
+
this.draggedPixels += yDelta;
|
|
29
|
+
this.dragCallbacks.onDragTick({
|
|
30
|
+
delta: yDelta,
|
|
31
|
+
draggedPixels: this.draggedPixels,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
this.onDragEnd = () => {
|
|
36
|
+
if (this.dragging) {
|
|
37
|
+
this.dragging = false;
|
|
38
|
+
this.dragCallbacks.onDragEnd && this.dragCallbacks.onDragEnd(this.draggedPixels);
|
|
39
|
+
this.dragComponentOptions.disableChartPanning && this.chartPanComponent.activateChartPanHandlers();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Calls the parent class's doActivate method and performs any additional activation logic.
|
|
45
|
+
* This method is protected and can only be accessed by the class itself and its subclasses.
|
|
46
|
+
*/
|
|
47
|
+
doActivate() {
|
|
48
|
+
super.doActivate();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* This method overrides the doDeactivate method of the parent class and calls it using the super keyword.
|
|
52
|
+
* It is a protected method that can only be accessed within the class and its subclasses.
|
|
53
|
+
* This method is responsible for deactivating the current object.
|
|
54
|
+
*/
|
|
55
|
+
doDeactivate() {
|
|
56
|
+
super.doDeactivate();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
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 { DrawingManager } from '../../drawers/drawing-manager';
|
|
7
|
+
import { CanvasModel } from '../../model/canvas.model';
|
|
8
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
9
|
+
import { DynamicObjectsModel } from './dynamic-objects.model';
|
|
10
|
+
export declare class DynamicObjectsComponent extends ChartBaseElement {
|
|
11
|
+
model: DynamicObjectsModel;
|
|
12
|
+
constructor(canvasModel: CanvasModel, drawingManager: DrawingManager);
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
7
|
+
import { DynamicObjectsDrawer } from './dynamic-objects.drawer';
|
|
8
|
+
import { DynamicObjectsModel } from './dynamic-objects.model';
|
|
9
|
+
export class DynamicObjectsComponent extends ChartBaseElement {
|
|
10
|
+
constructor(canvasModel, drawingManager) {
|
|
11
|
+
super();
|
|
12
|
+
// model
|
|
13
|
+
const dynamicObjectsModel = new DynamicObjectsModel();
|
|
14
|
+
this.model = dynamicObjectsModel;
|
|
15
|
+
this.addChildEntity(dynamicObjectsModel);
|
|
16
|
+
// drawer
|
|
17
|
+
const dynamicObjectsDrawer = new DynamicObjectsDrawer(dynamicObjectsModel, canvasModel);
|
|
18
|
+
drawingManager.addDrawer(dynamicObjectsDrawer, 'DYNAMIC_OBJECTS');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
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 { CanvasModel } from '../../model/canvas.model';
|
|
8
|
+
import { DynamicObjectsModel } from './dynamic-objects.model';
|
|
9
|
+
export interface DynamicModelDrawer<T> {
|
|
10
|
+
draw(canvasModel: CanvasModel, model: T, paneUUID?: string): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class DynamicObjectsDrawer implements Drawer {
|
|
13
|
+
private dynamicObjectsModel;
|
|
14
|
+
private canvasModel;
|
|
15
|
+
constructor(dynamicObjectsModel: DynamicObjectsModel, canvasModel: CanvasModel);
|
|
16
|
+
draw(): void;
|
|
17
|
+
getCanvasIds(): string[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
export class DynamicObjectsDrawer {
|
|
7
|
+
constructor(dynamicObjectsModel, canvasModel) {
|
|
8
|
+
this.dynamicObjectsModel = dynamicObjectsModel;
|
|
9
|
+
this.canvasModel = canvasModel;
|
|
10
|
+
}
|
|
11
|
+
draw() {
|
|
12
|
+
const objects = this.dynamicObjectsModel.objects;
|
|
13
|
+
Object.entries(objects).forEach(([paneUUID, list]) => {
|
|
14
|
+
for (const obj of list) {
|
|
15
|
+
const { model, drawer } = obj;
|
|
16
|
+
drawer.draw(this.canvasModel, model, paneUUID);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
getCanvasIds() {
|
|
21
|
+
return [this.canvasModel.canvasId];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
|
+
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
7
|
+
import { LinkedList, ListNode } from '../../utils/linkedList.utils';
|
|
8
|
+
import { DynamicModelDrawer } from './dynamic-objects.drawer';
|
|
9
|
+
export type PaneId = string;
|
|
10
|
+
export interface DynamicObject<T = unknown> {
|
|
11
|
+
readonly drawer: DynamicModelDrawer<T>;
|
|
12
|
+
readonly model: T;
|
|
13
|
+
}
|
|
14
|
+
export declare class DynamicObjectsModel extends ChartBaseElement {
|
|
15
|
+
private _objects;
|
|
16
|
+
private modelToObjectMap;
|
|
17
|
+
constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Adds an object from outside chart-core into model
|
|
20
|
+
* @param obj
|
|
21
|
+
* @param paneId
|
|
22
|
+
*/
|
|
23
|
+
addObject(obj: DynamicObject, paneId: PaneId): void;
|
|
24
|
+
/**
|
|
25
|
+
* Removes an object from model
|
|
26
|
+
* @param model
|
|
27
|
+
* @param paneId
|
|
28
|
+
*/
|
|
29
|
+
removeObject(model: unknown, paneId: PaneId): void;
|
|
30
|
+
/**
|
|
31
|
+
* Moves the object inside the drawing order so it's being drawn before the other elements
|
|
32
|
+
* @param paneId
|
|
33
|
+
* @param listNode
|
|
34
|
+
*/
|
|
35
|
+
bringToFront(paneId: PaneId, listNode: ListNode<DynamicObject>): void;
|
|
36
|
+
/**
|
|
37
|
+
* Moves the object inside the drawing order so it's being drawn after the other elements
|
|
38
|
+
* @param paneId
|
|
39
|
+
* @param listNode
|
|
40
|
+
*/
|
|
41
|
+
bringToBack(paneId: PaneId, listNode: ListNode<DynamicObject>): void;
|
|
42
|
+
/**
|
|
43
|
+
* Moves the object inside the drawing order so it's being drawn one layer ahead
|
|
44
|
+
* @param obj
|
|
45
|
+
* @param paneId
|
|
46
|
+
*/
|
|
47
|
+
moveForward(paneId: PaneId, listNode: ListNode<DynamicObject>): void;
|
|
48
|
+
/**
|
|
49
|
+
* Moves the object inside the drawing order so it's being drawn one layer closer to the back
|
|
50
|
+
* @param obj
|
|
51
|
+
* @param paneId
|
|
52
|
+
*/
|
|
53
|
+
moveBackwards(paneId: PaneId, listNode: ListNode<DynamicObject>): void;
|
|
54
|
+
/**
|
|
55
|
+
* Getter for the objects
|
|
56
|
+
*/
|
|
57
|
+
get objects(): Record<string, LinkedList<DynamicObject<unknown>>>;
|
|
58
|
+
/**
|
|
59
|
+
* Sets the objects
|
|
60
|
+
* @param objects
|
|
61
|
+
*/
|
|
62
|
+
setDynamicObjects(objects: Record<PaneId, LinkedList<DynamicObject>>): void;
|
|
63
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
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 { LinkedList, ListNode } from '../../utils/linkedList.utils';
|
|
9
|
+
export class DynamicObjectsModel extends ChartBaseElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.modelToObjectMap = new Map();
|
|
13
|
+
this._objects = new BehaviorSubject({});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Adds an object from outside chart-core into model
|
|
17
|
+
* @param obj
|
|
18
|
+
* @param paneId
|
|
19
|
+
*/
|
|
20
|
+
addObject(obj, paneId) {
|
|
21
|
+
var _a;
|
|
22
|
+
const objects = this.objects;
|
|
23
|
+
const paneList = (_a = objects[paneId]) !== null && _a !== void 0 ? _a : new LinkedList();
|
|
24
|
+
if (!Object.keys(objects).find(pane => pane === paneId)) {
|
|
25
|
+
objects[paneId] = paneList;
|
|
26
|
+
}
|
|
27
|
+
paneList.insertAtEnd(obj);
|
|
28
|
+
this.modelToObjectMap.set(obj.model, obj);
|
|
29
|
+
this.setDynamicObjects(objects);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Removes an object from model
|
|
33
|
+
* @param model
|
|
34
|
+
* @param paneId
|
|
35
|
+
*/
|
|
36
|
+
removeObject(model, paneId) {
|
|
37
|
+
const objects = this.objects;
|
|
38
|
+
const paneList = objects[paneId];
|
|
39
|
+
const obj = this.modelToObjectMap.get(model);
|
|
40
|
+
if (paneList && obj) {
|
|
41
|
+
const targetNode = new ListNode(obj);
|
|
42
|
+
const targetPos = paneList.getNodePosition(targetNode);
|
|
43
|
+
paneList.removeAt(targetPos);
|
|
44
|
+
this.modelToObjectMap.delete(model);
|
|
45
|
+
if (paneList.size() === 0) {
|
|
46
|
+
delete objects[paneId];
|
|
47
|
+
}
|
|
48
|
+
this.setDynamicObjects(objects);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Moves the object inside the drawing order so it's being drawn before the other elements
|
|
53
|
+
* @param paneId
|
|
54
|
+
* @param listNode
|
|
55
|
+
*/
|
|
56
|
+
bringToFront(paneId, listNode) {
|
|
57
|
+
const list = this.objects[paneId];
|
|
58
|
+
if (list) {
|
|
59
|
+
const targetPos = list.getNodePosition(listNode);
|
|
60
|
+
if (targetPos >= 0 && targetPos < list.size()) {
|
|
61
|
+
const nodeToReplace = list.removeAt(targetPos);
|
|
62
|
+
if (nodeToReplace) {
|
|
63
|
+
list.insertAtEnd(nodeToReplace.data);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this.setDynamicObjects(this.objects);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Moves the object inside the drawing order so it's being drawn after the other elements
|
|
71
|
+
* @param paneId
|
|
72
|
+
* @param listNode
|
|
73
|
+
*/
|
|
74
|
+
bringToBack(paneId, listNode) {
|
|
75
|
+
const list = this.objects[paneId];
|
|
76
|
+
if (list) {
|
|
77
|
+
const targetPos = list.getNodePosition(listNode);
|
|
78
|
+
if (targetPos > 0 && targetPos <= list.size()) {
|
|
79
|
+
const nodeToReplace = list.removeAt(targetPos);
|
|
80
|
+
if (nodeToReplace) {
|
|
81
|
+
list.insertAt(0, nodeToReplace === null || nodeToReplace === void 0 ? void 0 : nodeToReplace.data);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
this.setDynamicObjects(this.objects);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Moves the object inside the drawing order so it's being drawn one layer ahead
|
|
89
|
+
* @param obj
|
|
90
|
+
* @param paneId
|
|
91
|
+
*/
|
|
92
|
+
moveForward(paneId, listNode) {
|
|
93
|
+
const list = this.objects[paneId];
|
|
94
|
+
if (list) {
|
|
95
|
+
const targetPos = list.getNodePosition(listNode);
|
|
96
|
+
if (targetPos >= 0 && targetPos < list.size()) {
|
|
97
|
+
const nodeToReplace = list.removeAt(targetPos);
|
|
98
|
+
if (nodeToReplace) {
|
|
99
|
+
list.insertAt(targetPos + 1, nodeToReplace.data);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
this.setDynamicObjects(this.objects);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Moves the object inside the drawing order so it's being drawn one layer closer to the back
|
|
107
|
+
* @param obj
|
|
108
|
+
* @param paneId
|
|
109
|
+
*/
|
|
110
|
+
moveBackwards(paneId, listNode) {
|
|
111
|
+
const list = this.objects[paneId];
|
|
112
|
+
if (list) {
|
|
113
|
+
const targetPos = list.getNodePosition(listNode);
|
|
114
|
+
if (targetPos > 0 && targetPos <= list.size()) {
|
|
115
|
+
const nodeToReplace = list.removeAt(targetPos);
|
|
116
|
+
if (nodeToReplace) {
|
|
117
|
+
list.insertAt(targetPos - 1, nodeToReplace === null || nodeToReplace === void 0 ? void 0 : nodeToReplace.data);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
this.setDynamicObjects(this.objects);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Getter for the objects
|
|
125
|
+
*/
|
|
126
|
+
get objects() {
|
|
127
|
+
return this._objects.getValue();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Sets the objects
|
|
131
|
+
* @param objects
|
|
132
|
+
*/
|
|
133
|
+
setDynamicObjects(objects) {
|
|
134
|
+
this._objects.next(objects);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -3,4 +3,66 @@
|
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
-
import{CanvasElement
|
|
6
|
+
import { CanvasElement } from '../../canvas/canvas-bounds-container';
|
|
7
|
+
import { getEventSize } from './events.drawer';
|
|
8
|
+
const hoverExtendedAreaPixels = 5;
|
|
9
|
+
export class EventsHitTestDrawer {
|
|
10
|
+
constructor(hitTestCanvasModel, chartModel, config, canvasBoundsContainer, model) {
|
|
11
|
+
this.hitTestCanvasModel = hitTestCanvasModel;
|
|
12
|
+
this.chartModel = chartModel;
|
|
13
|
+
this.config = config;
|
|
14
|
+
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
15
|
+
this.model = model;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Draws events on the hit test canvas.
|
|
19
|
+
* @function
|
|
20
|
+
* @name draw
|
|
21
|
+
* @memberof CanvasElement.EVENTS
|
|
22
|
+
* @instance
|
|
23
|
+
* @returns {void}
|
|
24
|
+
|
|
25
|
+
*/
|
|
26
|
+
draw() {
|
|
27
|
+
const ctx = this.hitTestCanvasModel.ctx;
|
|
28
|
+
const bounds = this.canvasBoundsContainer.getBounds(CanvasElement.EVENTS);
|
|
29
|
+
ctx.save();
|
|
30
|
+
this.model.events.forEach((event, idx) => {
|
|
31
|
+
const prevEvent = this.model.events[idx - 1];
|
|
32
|
+
const prevX = prevEvent &&
|
|
33
|
+
this.chartModel.candleFromTimestamp(prevEvent.timestamp).xCenter(this.chartModel.scale);
|
|
34
|
+
const x = this.chartModel.candleFromTimestamp(event.timestamp).xCenter(this.chartModel.scale);
|
|
35
|
+
if (x > bounds.x && x < bounds.x + bounds.width) {
|
|
36
|
+
const color = this.config.colors.events[event.type].color;
|
|
37
|
+
ctx.strokeStyle = color;
|
|
38
|
+
ctx.fillStyle = color;
|
|
39
|
+
const size = getEventSize(event);
|
|
40
|
+
// draw hit test
|
|
41
|
+
ctx.fillStyle = this.hitTestCanvasModel.idToColor(event.id);
|
|
42
|
+
const hoverSize = (size + hoverExtendedAreaPixels) * 2;
|
|
43
|
+
if (prevX !== undefined) {
|
|
44
|
+
const prevSize = getEventSize(prevEvent);
|
|
45
|
+
const isIntersectsWithPrev = prevX + prevSize > x - hoverSize / 2;
|
|
46
|
+
if (isIntersectsWithPrev) {
|
|
47
|
+
const hoverSize = size * 2 + hoverExtendedAreaPixels;
|
|
48
|
+
ctx.fillRect(prevX + prevSize, bounds.y, hoverSize, bounds.height);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
ctx.fillRect(x - size - hoverExtendedAreaPixels, bounds.y, hoverSize, bounds.height);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
ctx.fillRect(x - size - hoverExtendedAreaPixels, bounds.y, hoverSize, bounds.height);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
ctx.restore();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Returns an array of string containing the canvas ID of the hitTestCanvasModel.
|
|
63
|
+
* @returns {Array<string>} An array of string containing the canvas ID of the hitTestCanvasModel.
|
|
64
|
+
*/
|
|
65
|
+
getCanvasIds() {
|
|
66
|
+
return [this.hitTestCanvasModel.canvasId];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -3,4 +3,64 @@
|
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
-
import{CanvasElement
|
|
6
|
+
import { CanvasElement } from '../../canvas/canvas-bounds-container';
|
|
7
|
+
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
8
|
+
import { recalculateXFormatter } from '../../model/date-time.formatter';
|
|
9
|
+
import { merge } from '../../utils/merge.utils';
|
|
10
|
+
import { EventsHitTestDrawer } from './events-hit-test.drawer';
|
|
11
|
+
import { EventsDrawer } from './events.drawer';
|
|
12
|
+
import { EventsModel } from './events.model';
|
|
13
|
+
export class EventsComponent extends ChartBaseElement {
|
|
14
|
+
constructor(config, canvasModel, hitTestCanvasModel, chartModel, canvasBoundsContainer, drawingManager, formatterFactory, cursorHandler, backgroundCanvasModel) {
|
|
15
|
+
super();
|
|
16
|
+
this.config = config;
|
|
17
|
+
this.canvasModel = canvasModel;
|
|
18
|
+
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
19
|
+
this.drawingManager = drawingManager;
|
|
20
|
+
this.formatterFactory = formatterFactory;
|
|
21
|
+
this.eventsXAxisLabelFormatterProvider = () => recalculateXFormatter(this.config.components.events.xAxisLabelFormat, chartModel.getPeriod(), this.formatterFactory);
|
|
22
|
+
const eventsModel = new EventsModel(canvasModel);
|
|
23
|
+
this.eventsModel = eventsModel;
|
|
24
|
+
this.addChildEntity(eventsModel);
|
|
25
|
+
hitTestCanvasModel.addSubscriber(eventsModel);
|
|
26
|
+
const eventsDrawer = new EventsDrawer(backgroundCanvasModel, canvasModel, chartModel, config, canvasBoundsContainer, eventsModel, this.eventsXAxisLabelFormatterProvider);
|
|
27
|
+
this.drawingManager.addDrawer(eventsDrawer, 'EVENTS');
|
|
28
|
+
const eventsHitTestDrawer = new EventsHitTestDrawer(hitTestCanvasModel, chartModel, config, canvasBoundsContainer, eventsModel);
|
|
29
|
+
this.drawingManager.addDrawerBefore(eventsHitTestDrawer, 'HIT_TEST_EVENTS', 'HIT_TEST_DRAWINGS');
|
|
30
|
+
cursorHandler.setCursorForCanvasEl(CanvasElement.EVENTS, config.components.events.cursor);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Sets the new event list.
|
|
34
|
+
* @param events
|
|
35
|
+
*/
|
|
36
|
+
setEvents(events) {
|
|
37
|
+
this.eventsModel.setEvents(events);
|
|
38
|
+
this.canvasModel.fireDraw();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Changes the component visibility.
|
|
42
|
+
* @param visible
|
|
43
|
+
*/
|
|
44
|
+
setVisible(visible) {
|
|
45
|
+
this.config.components.events.visible = visible;
|
|
46
|
+
this.canvasBoundsContainer.recalculateBounds();
|
|
47
|
+
this.canvasModel.fireDraw();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Changes visibility for the specific event type.
|
|
51
|
+
* For example, to turn off dividends visibility you can call this method with { dividends: false } argument
|
|
52
|
+
*/
|
|
53
|
+
setEventTypeVisible(eventsVisibility) {
|
|
54
|
+
merge(this.config.components.events.eventsVisibility, eventsVisibility, {
|
|
55
|
+
overrideExisting: true,
|
|
56
|
+
addIfMissing: false,
|
|
57
|
+
});
|
|
58
|
+
this.canvasModel.fireDraw();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Observes hovered event when mouse moves in, and provides null when mouse moves out.
|
|
62
|
+
*/
|
|
63
|
+
observeEventHovered() {
|
|
64
|
+
return this.eventsModel.hoveredEvent.asObservable();
|
|
65
|
+
}
|
|
66
|
+
}
|