@devexperts/dxcharts-lite 2.4.5 → 2.5.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.
Files changed (59) hide show
  1. package/dist/chart/__tests__/model/date-time.formatter.test.d.ts +6 -0
  2. package/dist/chart/__tests__/model/date-time.formatter.test.js +30 -0
  3. package/dist/chart/bootstrap.js +1 -1
  4. package/dist/chart/canvas/canvas-bounds-container.d.ts +7 -3
  5. package/dist/chart/canvas/canvas-bounds-container.js +149 -105
  6. package/dist/chart/canvas/y-axis-bounds.container.js +4 -0
  7. package/dist/chart/chart.config.d.ts +4 -10
  8. package/dist/chart/chart.config.js +4 -6
  9. package/dist/chart/components/chart/chart-area-pan.handler.d.ts +9 -6
  10. package/dist/chart/components/chart/chart-area-pan.handler.js +41 -38
  11. package/dist/chart/components/chart/chart.model.d.ts +0 -1
  12. package/dist/chart/components/chart/chart.model.js +0 -1
  13. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.d.ts +0 -6
  14. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +0 -8
  15. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.d.ts +0 -5
  16. package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +0 -7
  17. package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.d.ts +1 -12
  18. package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +19 -30
  19. package/dist/chart/components/dynamic-objects/dynamic-objects.model.d.ts +6 -3
  20. package/dist/chart/components/dynamic-objects/dynamic-objects.model.js +14 -3
  21. package/dist/chart/components/hit-test/hit-test.component.d.ts +3 -1
  22. package/dist/chart/components/hit-test/hit-test.component.js +6 -1
  23. package/dist/chart/components/pan/chart-pan.component.d.ts +4 -14
  24. package/dist/chart/components/pan/chart-pan.component.js +10 -21
  25. package/dist/chart/components/pane/extent/y-extent-component.d.ts +2 -0
  26. package/dist/chart/components/pane/pane-manager.component.d.ts +29 -0
  27. package/dist/chart/components/pane/pane-manager.component.js +71 -8
  28. package/dist/chart/components/pane/pane.component.d.ts +5 -17
  29. package/dist/chart/components/pane/pane.component.js +13 -29
  30. package/dist/chart/components/resizer/bar-resizer.component.d.ts +1 -1
  31. package/dist/chart/components/resizer/bar-resizer.component.js +8 -5
  32. package/dist/chart/components/x_axis/x-axis-scale.handler.js +1 -1
  33. package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +1 -3
  34. package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +1 -3
  35. package/dist/chart/components/y_axis/y-axis-scale.handler.js +6 -8
  36. package/dist/chart/components/y_axis/y-axis.component.d.ts +1 -1
  37. package/dist/chart/components/y_axis/y-axis.component.js +7 -4
  38. package/dist/chart/inputhandlers/hover-producer.component.d.ts +1 -1
  39. package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +11 -7
  40. package/dist/chart/inputhandlers/main-canvas-touch.handler.js +34 -7
  41. package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +0 -14
  42. package/dist/chart/inputlisteners/canvas-input-listener.component.js +1 -35
  43. package/dist/chart/model/baseline.model.d.ts +3 -0
  44. package/dist/chart/model/baseline.model.js +5 -0
  45. package/dist/chart/model/candle-series.model.d.ts +10 -1
  46. package/dist/chart/model/candle-series.model.js +20 -2
  47. package/dist/chart/model/chart-base-element.d.ts +2 -0
  48. package/dist/chart/model/chart-base-element.js +2 -0
  49. package/dist/chart/model/data-series.model.js +5 -3
  50. package/dist/chart/model/date-time.formatter.d.ts +20 -3
  51. package/dist/chart/model/date-time.formatter.js +62 -14
  52. package/dist/chart/model/scale.model.d.ts +5 -0
  53. package/dist/chart/model/scale.model.js +9 -1
  54. package/dist/chart/model/scaling/constrait.functions.d.ts +5 -7
  55. package/dist/chart/model/scaling/constrait.functions.js +3 -3
  56. package/dist/chart/model/time-zone.model.js +3 -1
  57. package/dist/chart/utils/timezone.utils.js +3 -3
  58. package/dist/dxchart.min.js +4 -4
  59. package/package.json +1 -1
@@ -3,21 +3,19 @@
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 { merge, animationFrameScheduler } from 'rxjs';
7
- import { throttleTime } from 'rxjs/operators';
6
+ import { animationFrameScheduler } from 'rxjs';
7
+ import { throttleTime, filter } from 'rxjs/operators';
8
8
  import { VIEWPORT_ANIMATION_ID } from '../../animation/canvas-animation';
9
9
  import { CanvasElement } from '../../canvas/canvas-bounds-container';
10
- import { MainCanvasTouchHandler } from '../../inputhandlers/main-canvas-touch.handler';
11
10
  import { ChartBaseElement } from '../../model/chart-base-element';
12
11
  import { pixelsToUnits } from '../../model/scaling/viewport.model';
13
12
  import { deviceDetector } from '../../utils/device/device-detector.utils';
14
- import { getTouchpadSensitivity, touchpadDetector } from '../../utils/device/touchpad.utils';
13
+ import { getTouchpadSensitivity } from '../../utils/device/touchpad.utils';
15
14
  import { DragNDropXComponent } from '../dran-n-drop_helper/drag-n-drop-x.component';
16
15
  import { DragNDropYComponent } from '../dran-n-drop_helper/drag-n-drop-y.component';
17
16
  /**
18
17
  * ChartAreaPanHandler is a class that handles the panning and zooming of the chart area.
19
18
  * It extends the ChartBaseElement class and has the following properties:
20
- * @property {MainCanvasTouchHandler} touchHandler - An instance of the MainCanvasTouchHandler class.
21
19
  * @property {Point} currentPoint - An object that represents the current point of the chart area.
22
20
  * @property {number} xDraggedCandlesDelta - A number that represents the number of candles delta changed during X dragging.
23
21
  * @property {number} lastXStart - A number that represents the last X start position.
@@ -27,7 +25,6 @@ import { DragNDropYComponent } from '../dran-n-drop_helper/drag-n-drop-y.compone
27
25
  * @param {EventBus} bus - An instance of the EventBus class.
28
26
  * @param {FullChartConfig} config - An instance of the FullChartConfig class.
29
27
  * @param {ScaleModel} scaleModel - An instance of the ScaleModel class.
30
- * @param {Element} mainCanvasParent - The parent element of the main canvas.
31
28
  * @param {CanvasInputListenerComponent} canvasInputListener - An instance of the CanvasInputListenerComponent class.
32
29
  * @param {CanvasBoundsContainer} canvasBoundsContainer - An instance of the CanvasBoundsContainer class.
33
30
  * @param {CanvasAnimation} canvasAnimation - An instance of the CanvasAnimation class.
@@ -35,12 +32,11 @@ import { DragNDropYComponent } from '../dran-n-drop_helper/drag-n-drop-y.compone
35
32
 
36
33
  */
37
34
  export class ChartAreaPanHandler extends ChartBaseElement {
38
- constructor(bus, config, scale, mainCanvasParent, canvasInputListener, canvasBoundsContainer, canvasAnimation, chartPanComponent, hitTestCanvasModel) {
35
+ constructor(bus, config, scale, canvasInputListener, canvasBoundsContainer, canvasAnimation, chartPanComponent, hitTestCanvasModel) {
39
36
  super();
40
37
  this.bus = bus;
41
38
  this.config = config;
42
39
  this.scale = scale;
43
- this.mainCanvasParent = mainCanvasParent;
44
40
  this.canvasInputListener = canvasInputListener;
45
41
  this.canvasBoundsContainer = canvasBoundsContainer;
46
42
  this.canvasAnimation = canvasAnimation;
@@ -50,7 +46,8 @@ export class ChartAreaPanHandler extends ChartBaseElement {
50
46
  // number of candles delta changed during X dragging: 1, 5 or -3 for ex.
51
47
  this.xDraggedCandlesDelta = 0;
52
48
  this.lastXStart = 0;
53
- this.wheelTrottleTime = 15; // in ms
49
+ this.wheelThrottleTime = 15; // in ms
50
+ this.chartPanningOptions = { horizontal: true, vertical: true };
54
51
  /**
55
52
  * It observes the wheel event on all panes of the canvas and throttles it to the specified time.
56
53
  * It then calculates the zoom sensitivity based on whether the event was triggered by a touchpad or not.
@@ -96,7 +93,6 @@ export class ChartAreaPanHandler extends ChartBaseElement {
96
93
  // Continue redrawing hit test
97
94
  this.hitTestCanvasModel.hitTestDrawersPredicateSubject.next(true);
98
95
  };
99
- this.touchHandler = new MainCanvasTouchHandler(this.scale, this.canvasInputListener, this.mainCanvasParent);
100
96
  const allPanesHitTest = this.canvasBoundsContainer.getBoundsHitTest(CanvasElement.ALL_PANES);
101
97
  //#region drag-n-drop logic
102
98
  const dragNDropXComponent = new DragNDropXComponent(allPanesHitTest, {
@@ -104,7 +100,7 @@ export class ChartAreaPanHandler extends ChartBaseElement {
104
100
  onDragTick: this.onXDragTick,
105
101
  onDragEnd: this.onXDragEnd,
106
102
  }, this.canvasInputListener, this.chartPanComponent, {
107
- disableChartPanning: false,
103
+ dragPredicate: () => this.chartPanningOptions.horizontal,
108
104
  });
109
105
  this.addChildEntity(dragNDropXComponent);
110
106
  //#endregion
@@ -119,45 +115,50 @@ export class ChartAreaPanHandler extends ChartBaseElement {
119
115
  //#region hit tests
120
116
  const allPanesHitTest = this.canvasBoundsContainer.getBoundsHitTest(CanvasElement.ALL_PANES);
121
117
  //#endregion
122
- this.addRxSubscription(merge(this.canvasInputListener.observeWheel(allPanesHitTest), this.canvasInputListener.observePinch(allPanesHitTest))
123
- .pipe(throttleTime(this.wheelTrottleTime, animationFrameScheduler, { trailing: true, leading: true }))
124
- .subscribe(e => {
125
- const isTouchpad = touchpadDetector(e);
126
- const zoomSensitivity = isTouchpad
127
- ? getTouchpadSensitivity(this.config.components.yAxis.type, this.config.scale.zoomSensitivity.pinch)
128
- : this.config.scale.zoomSensitivity.wheel;
129
- this.zoomXHandler(e, zoomSensitivity);
130
- }));
131
118
  this.addRxSubscription(this.canvasInputListener
132
- .observeScrollGesture()
133
- .pipe(throttleTime(this.wheelTrottleTime, animationFrameScheduler, { trailing: true, leading: true }))
134
- .subscribe((e) => {
135
- let direction = -1;
119
+ .observeWheel(allPanesHitTest)
120
+ .pipe(filter(() => this.chartPanningOptions.horizontal && this.chartPanningOptions.vertical), throttleTime(this.wheelThrottleTime, animationFrameScheduler, { trailing: true, leading: true }))
121
+ .subscribe(e => {
136
122
  const device = deviceDetector();
137
- if (device === 'apple' || device === 'mobile') {
138
- direction = 1;
123
+ const direction = device === 'apple' || device === 'mobile' ? 1 : -1;
124
+ const deltaX = 0 + e.deltaX * direction;
125
+ const deltaY = 0 + e.deltaY * -direction;
126
+ if (e.ctrlKey) {
127
+ const zoomSensitivity = this.calculateDynamicSesitivity(e, this.config.scale.zoomSensitivity.wheel);
128
+ this.zoomXHandler(e, zoomSensitivity);
129
+ this.bus.fireDraw();
130
+ return;
131
+ }
132
+ // also works for geasture touchpad vertical case
133
+ if (deltaY !== 0 && Math.abs(deltaY) > Math.abs(deltaX)) {
134
+ const zoomSensitivity = this.calculateDynamicSesitivity(e, this.config.scale.zoomSensitivity.wheel);
135
+ this.zoomXHandler(e, zoomSensitivity);
136
+ this.bus.fireDraw();
139
137
  }
140
- let deltaX = 0;
141
- let deltaY = 0;
142
- deltaX += e.deltaX * direction;
143
- deltaY += e.deltaY * -direction;
138
+ // also works for geasture touchpad horizontal case
144
139
  if (deltaX !== 0 && Math.abs(deltaX) > Math.abs(deltaY)) {
145
140
  const unitsDelta = pixelsToUnits(deltaX, this.scale.zoomX);
146
141
  this.scale.moveXStart(this.scale.xStart - unitsDelta);
142
+ this.bus.fireDraw();
143
+ return;
147
144
  }
148
- else if (deltaY !== 0 && Math.abs(deltaY) > Math.abs(deltaX)) {
149
- const zoomSensitivity = getTouchpadSensitivity(this.config.components.yAxis.type, this.config.scale.zoomSensitivity.glide);
150
- this.zoomXHandler(e, zoomSensitivity);
151
- }
152
- this.bus.fireDraw();
153
145
  }));
154
146
  this.addRxSubscription(this.chartPanComponent.chartBaseModel.dataPrependSubject
155
147
  .asObservable()
156
148
  .subscribe(({ prependedCandlesWidth }) => {
157
149
  this.lastXStart += prependedCandlesWidth;
158
150
  }));
159
- this.touchHandler.activate();
160
- this.addSubscription(this.touchHandler.deactivate.bind(this.touchHandler));
151
+ }
152
+ calculateDynamicSesitivity(e, maxSensitivity) {
153
+ // max delta distance that touchpad can provide
154
+ const MAX_POSSIBLE_DELTA = 100;
155
+ // get max delta
156
+ const delta = Math.max(Math.abs(e.deltaY), Math.abs(e.deltaX));
157
+ // calculate sensitivity for max delta based on touchpad it's distance
158
+ const caclulatedSensitivity = (maxSensitivity * delta) / MAX_POSSIBLE_DELTA;
159
+ // adjust sencitivity for percent axis type
160
+ const zoomSensitivity = getTouchpadSensitivity(this.config.components.yAxis.type, caclulatedSensitivity);
161
+ return zoomSensitivity;
161
162
  }
162
163
  /**
163
164
  * Registers a handler for panning the chart along the Y-axis.
@@ -173,6 +174,8 @@ export class ChartAreaPanHandler extends ChartBaseElement {
173
174
  this.canvasAnimation.forceStopAnimation(VIEWPORT_ANIMATION_ID);
174
175
  this.currentPoint = { x: 0, y: 0 };
175
176
  lastYStart = scale.yStart;
177
+ // Stop redrawing hit test
178
+ this.hitTestCanvasModel.hitTestDrawersPredicateSubject.next(false);
176
179
  };
177
180
  const onYDragTick = (dragInfo) => {
178
181
  const { delta: absoluteDelta } = dragInfo;
@@ -196,7 +199,7 @@ export class ChartAreaPanHandler extends ChartBaseElement {
196
199
  onDragStart: onYDragStart,
197
200
  onDragEnd: onYDragEnd,
198
201
  }, this.canvasInputListener, this.chartPanComponent, {
199
- disableChartPanning: false,
202
+ dragPredicate: () => this.chartPanningOptions.vertical,
200
203
  });
201
204
  this.addChildEntity(dragNDropYComponent);
202
205
  return dragNDropYComponent;
@@ -46,7 +46,6 @@ export declare class ChartModel extends ChartBaseElement {
46
46
  candleSeries: Array<CandleSeriesModel>;
47
47
  get mainCandleSeries(): CandleSeriesModel;
48
48
  get secondaryCandleSeries(): Array<CandleSeriesModel>;
49
- readonly nextCandleTimeStampSubject: Subject<void>;
50
49
  readonly chartTypeChanged: Subject<BarType>;
51
50
  readonly mainInstrumentChangedSubject: Subject<ChartInstrument>;
52
51
  readonly offsetsChanged: Subject<void>;
@@ -47,7 +47,6 @@ export class ChartModel extends ChartBaseElement {
47
47
  this.prevChartWidth = 0;
48
48
  this.prevYWidth = 0;
49
49
  this.candleSeries = [];
50
- this.nextCandleTimeStampSubject = new Subject();
51
50
  this.chartTypeChanged = new Subject();
52
51
  this.mainInstrumentChangedSubject = new Subject();
53
52
  this.offsetsChanged = new Subject();
@@ -18,10 +18,4 @@ export declare class DragNDropXComponent extends DragNDropComponent {
18
18
  * @returns {void}
19
19
  */
20
20
  protected doActivate(): void;
21
- /**
22
- * This method overrides the doDeactivate method of the parent class and calls it using the super keyword.
23
- * It is used to deactivate the current object and perform any necessary cleanup operations.
24
- * @protected
25
- */
26
- protected doDeactivate(): void;
27
21
  }
@@ -22,12 +22,4 @@ export class DragNDropXComponent extends DragNDropComponent {
22
22
  this.addRxSubscription(this.canvasInputListener.observeXDrag().subscribe(this.onDragTick));
23
23
  this.addRxSubscription(this.canvasInputListener.observeXDragEnd().subscribe(this.onDragEnd));
24
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
25
  }
@@ -15,9 +15,4 @@ export declare class DragNDropYComponent extends DragNDropComponent {
15
15
  * @returns {void}
16
16
  */
17
17
  protected doActivate(): void;
18
- /**
19
- * This method overrides the doDeactivate method of the parent class and calls the parent method before executing its own code.
20
- * It is a protected method, which means it can only be accessed within the class and its subclasses.
21
- */
22
- protected doDeactivate(): void;
23
18
  }
@@ -19,11 +19,4 @@ export class DragNDropYComponent extends DragNDropComponent {
19
19
  this.addRxSubscription(this.canvasInputListener.observeYDrag().subscribe(this.onDragTick));
20
20
  this.addRxSubscription(this.canvasInputListener.observeYDragEnd().subscribe(this.onDragEnd));
21
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
22
  }
@@ -12,7 +12,7 @@ export interface DragInfo {
12
12
  draggedPixels: number;
13
13
  }
14
14
  export interface DragComponentOptions {
15
- disableChartPanning: boolean;
15
+ dragPredicate: () => boolean;
16
16
  }
17
17
  export interface DragNDropComponentCallbacks {
18
18
  onDragStart?: (point: Point) => void;
@@ -29,17 +29,6 @@ export declare class DragNDropComponent extends ChartBaseElement {
29
29
  dragging: boolean;
30
30
  draggedPixels: number;
31
31
  constructor(hitTest: HitBoundsTest, dragCallbacks: DragNDropComponentCallbacks, canvasInputListener: CanvasInputListenerComponent, chartPanComponent: ChartPanComponent, dragComponentOptions: DragComponentOptions);
32
- /**
33
- * Calls the parent class's doActivate method and performs any additional activation logic.
34
- * This method is protected and can only be accessed by the class itself and its subclasses.
35
- */
36
- protected doActivate(): void;
37
- /**
38
- * This method overrides the doDeactivate method of the parent class and calls it using the super keyword.
39
- * It is a protected method that can only be accessed within the class and its subclasses.
40
- * This method is responsible for deactivating the current object.
41
- */
42
- protected doDeactivate(): void;
43
32
  protected onDragStart: (point: Point) => void;
44
33
  protected onDragTick: (yDelta: number) => void;
45
34
  protected onDragEnd: () => void;
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { ChartBaseElement } from '../../model/chart-base-element';
7
7
  export const defaultDragComponentOptions = {
8
- disableChartPanning: true,
8
+ dragPredicate: () => true,
9
9
  };
10
10
  export class DragNDropComponent extends ChartBaseElement {
11
11
  constructor(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions) {
@@ -18,41 +18,30 @@ export class DragNDropComponent extends ChartBaseElement {
18
18
  this.dragging = false;
19
19
  this.draggedPixels = 0;
20
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();
21
+ if (this.dragComponentOptions.dragPredicate()) {
22
+ this.dragging = true;
23
+ this.draggedPixels = 0;
24
+ this.dragCallbacks.onDragStart && this.dragCallbacks.onDragStart(point);
25
+ }
25
26
  };
26
27
  this.onDragTick = (yDelta) => {
27
- if (this.dragging) {
28
- this.draggedPixels += yDelta;
29
- this.dragCallbacks.onDragTick({
30
- delta: yDelta,
31
- draggedPixels: this.draggedPixels,
32
- });
28
+ if (this.dragComponentOptions.dragPredicate()) {
29
+ if (this.dragging) {
30
+ this.draggedPixels += yDelta;
31
+ this.dragCallbacks.onDragTick({
32
+ delta: yDelta,
33
+ draggedPixels: this.draggedPixels,
34
+ });
35
+ }
33
36
  }
34
37
  };
35
38
  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();
39
+ if (this.dragComponentOptions.dragPredicate()) {
40
+ if (this.dragging) {
41
+ this.dragging = false;
42
+ this.dragCallbacks.onDragEnd && this.dragCallbacks.onDragEnd(this.draggedPixels);
43
+ }
40
44
  }
41
45
  };
42
46
  }
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
47
  }
@@ -34,15 +34,18 @@ export declare class DynamicObjectsModel extends ChartBaseElement {
34
34
  /**
35
35
  * Adds an object from outside chart-core into model
36
36
  * @param obj
37
- * @param paneId
38
37
  */
39
38
  addObject(obj: DynamicObject): void;
40
39
  /**
41
40
  * Removes an object from model
42
- * @param model
43
- * @param paneId
41
+ * @param id
44
42
  */
45
43
  removeObject(id: DynamicObjectId): void;
44
+ /**
45
+ * Updates an object
46
+ * @param obj
47
+ */
48
+ updateObject(obj: DynamicObject): void;
46
49
  /**
47
50
  * Moves the object inside the associated LinkedList to the specified position
48
51
  */
@@ -47,7 +47,6 @@ export class DynamicObjectsModel extends ChartBaseElement {
47
47
  /**
48
48
  * Adds an object from outside chart-core into model
49
49
  * @param obj
50
- * @param paneId
51
50
  */
52
51
  addObject(obj) {
53
52
  var _a;
@@ -63,8 +62,7 @@ export class DynamicObjectsModel extends ChartBaseElement {
63
62
  }
64
63
  /**
65
64
  * Removes an object from model
66
- * @param model
67
- * @param paneId
65
+ * @param id
68
66
  */
69
67
  removeObject(id) {
70
68
  const objInfo = this.getObjectInfoById(id);
@@ -81,6 +79,19 @@ export class DynamicObjectsModel extends ChartBaseElement {
81
79
  }
82
80
  this.setDynamicObjects(this.objects);
83
81
  }
82
+ /**
83
+ * Updates an object
84
+ * @param obj
85
+ */
86
+ updateObject(obj) {
87
+ const objInfo = this.getObjectInfoById(obj.id);
88
+ if (!objInfo) {
89
+ return;
90
+ }
91
+ const [oldObj] = objInfo;
92
+ this.removeObject(oldObj.id);
93
+ this.addObject(obj);
94
+ }
84
95
  /**
85
96
  * Moves the object inside the associated LinkedList to the specified position
86
97
  */
@@ -4,11 +4,13 @@
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
6
  import { CanvasAnimation } from '../../animation/canvas-animation';
7
+ import EventBus from '../../events/event-bus';
7
8
  import { ChartBaseElement } from '../../model/chart-base-element';
8
9
  import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
9
10
  export declare class HitTestComponent extends ChartBaseElement {
10
11
  private hitTestCanvasModel;
11
12
  private canvasAnimation;
12
- constructor(hitTestCanvasModel: HitTestCanvasModel, canvasAnimation: CanvasAnimation);
13
+ private eventBus;
14
+ constructor(hitTestCanvasModel: HitTestCanvasModel, canvasAnimation: CanvasAnimation, eventBus: EventBus);
13
15
  protected doActivate(): void;
14
16
  }
@@ -3,12 +3,14 @@
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 { distinctUntilChanged } from 'rxjs/operators';
6
7
  import { ChartBaseElement } from '../../model/chart-base-element';
7
8
  export class HitTestComponent extends ChartBaseElement {
8
- constructor(hitTestCanvasModel, canvasAnimation) {
9
+ constructor(hitTestCanvasModel, canvasAnimation, eventBus) {
9
10
  super();
10
11
  this.hitTestCanvasModel = hitTestCanvasModel;
11
12
  this.canvasAnimation = canvasAnimation;
13
+ this.eventBus = eventBus;
12
14
  }
13
15
  doActivate() {
14
16
  super.doActivate();
@@ -16,5 +18,8 @@ export class HitTestComponent extends ChartBaseElement {
16
18
  const animationInProgress = this.canvasAnimation.animationInProgressSubject.getValue();
17
19
  this.hitTestCanvasModel.hitTestDrawersPredicateSubject.next(!animationInProgress);
18
20
  }));
21
+ this.addRxSubscription(this.hitTestCanvasModel.hitTestDrawersPredicateSubject
22
+ .pipe(distinctUntilChanged((prev, cur) => prev !== cur && prev === true && cur === false))
23
+ .subscribe(() => this.eventBus.fireDraw([this.hitTestCanvasModel.canvasId])));
19
24
  }
20
25
  }
@@ -7,12 +7,13 @@ import { CanvasAnimation } from '../../animation/canvas-animation';
7
7
  import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
8
8
  import { FullChartConfig } from '../../chart.config';
9
9
  import EventBus from '../../events/event-bus';
10
- import { ChartBaseElement, ChartEntity } from '../../model/chart-base-element';
10
+ import { ChartBaseElement } from '../../model/chart-base-element';
11
11
  import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
12
12
  import { ScaleModel } from '../../model/scale.model';
13
13
  import { ChartAreaPanHandler } from '../chart/chart-area-pan.handler';
14
14
  import { BaseType, ChartBaseModel } from '../chart/chart-base.model';
15
15
  import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
16
+ import { MainCanvasTouchHandler } from '../../inputhandlers/main-canvas-touch.handler';
16
17
  export declare class ChartPanComponent extends ChartBaseElement {
17
18
  private eventBus;
18
19
  private mainScale;
@@ -23,21 +24,9 @@ export declare class ChartPanComponent extends ChartBaseElement {
23
24
  private mainCanvasParent;
24
25
  chartBaseModel: ChartBaseModel<BaseType>;
25
26
  private hitTestCanvasModel;
26
- chartPanComponents: Array<ChartEntity>;
27
27
  chartAreaPanHandler: ChartAreaPanHandler;
28
+ mainCanvasTouchHandler: MainCanvasTouchHandler;
28
29
  constructor(eventBus: EventBus, mainScale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig, canvasAnimation: CanvasAnimation, canvasInputListener: CanvasInputListenerComponent, mainCanvasParent: Element, chartBaseModel: ChartBaseModel<BaseType>, hitTestCanvasModel: HitTestCanvasModel);
29
- /**
30
- * Activates the chart pan handlers.
31
- * @protected
32
- * @returns {void}
33
- */
34
- protected doActivate(): void;
35
- /**
36
- * This method is used to deactivate the pan handlers.
37
- * @returns {void}
38
- * @protected
39
- */
40
- protected doDeactivate(): void;
41
30
  /**
42
31
  * Activates user mouse handlers on main chart view.
43
32
  * @function
@@ -51,4 +40,5 @@ export declare class ChartPanComponent extends ChartBaseElement {
51
40
  * Deactivates all the pan handlers of the chart.
52
41
  */
53
42
  deactivatePanHandlers(): void;
43
+ setChartPanningOptions(horizontal: boolean, vertical: boolean): void;
54
44
  }
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { ChartBaseElement } from '../../model/chart-base-element';
7
7
  import { ChartAreaPanHandler } from '../chart/chart-area-pan.handler';
8
+ import { MainCanvasTouchHandler } from '../../inputhandlers/main-canvas-touch.handler';
8
9
  export class ChartPanComponent extends ChartBaseElement {
9
10
  constructor(eventBus, mainScale, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, mainCanvasParent, chartBaseModel, hitTestCanvasModel) {
10
11
  super();
@@ -17,25 +18,10 @@ export class ChartPanComponent extends ChartBaseElement {
17
18
  this.mainCanvasParent = mainCanvasParent;
18
19
  this.chartBaseModel = chartBaseModel;
19
20
  this.hitTestCanvasModel = hitTestCanvasModel;
20
- this.chartPanComponents = [];
21
- this.chartAreaPanHandler = new ChartAreaPanHandler(this.eventBus, this.config, this.mainScale, this.mainCanvasParent, this.canvasInputListener, this.canvasBoundsContainer, this.canvasAnimation, this, this.hitTestCanvasModel);
22
- this.chartPanComponents.push(this.chartAreaPanHandler);
23
- }
24
- /**
25
- * Activates the chart pan handlers.
26
- * @protected
27
- * @returns {void}
28
- */
29
- doActivate() {
30
- this.activateChartPanHandlers();
31
- }
32
- /**
33
- * This method is used to deactivate the pan handlers.
34
- * @returns {void}
35
- * @protected
36
- */
37
- doDeactivate() {
38
- this.deactivatePanHandlers();
21
+ this.chartAreaPanHandler = new ChartAreaPanHandler(this.eventBus, this.config, this.mainScale, this.canvasInputListener, this.canvasBoundsContainer, this.canvasAnimation, this, this.hitTestCanvasModel);
22
+ this.addChildEntity(this.chartAreaPanHandler);
23
+ this.mainCanvasTouchHandler = new MainCanvasTouchHandler(this.chartAreaPanHandler, this.mainScale, this.canvasInputListener, this.mainCanvasParent);
24
+ this.addChildEntity(this.mainCanvasTouchHandler);
39
25
  }
40
26
  /**
41
27
  * Activates user mouse handlers on main chart view.
@@ -46,12 +32,15 @@ export class ChartPanComponent extends ChartBaseElement {
46
32
  * @returns {void}
47
33
  */
48
34
  activateChartPanHandlers() {
49
- this.chartPanComponents.forEach(c => c.activate());
35
+ this.activate();
50
36
  }
51
37
  /**
52
38
  * Deactivates all the pan handlers of the chart.
53
39
  */
54
40
  deactivatePanHandlers() {
55
- this.chartPanComponents.forEach(c => c.deactivate());
41
+ this.deactivate();
42
+ }
43
+ setChartPanningOptions(horizontal, vertical) {
44
+ this.chartAreaPanHandler.chartPanningOptions = { horizontal, vertical };
56
45
  }
57
46
  }
@@ -4,6 +4,7 @@
4
4
  * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
5
  */
6
6
  import { CanvasBoundsContainer } from '../../../canvas/canvas-bounds-container';
7
+ import { YAxisConfig } from '../../../chart.config';
7
8
  import { Bounds } from '../../../model/bounds.model';
8
9
  import { CanvasModel } from '../../../model/canvas.model';
9
10
  import { ChartBaseElement } from '../../../model/chart-base-element';
@@ -23,6 +24,7 @@ export interface YExtentCreationOptions {
23
24
  cursor: string;
24
25
  paneFormatters: YExtentFormatters;
25
26
  increment: number | null;
27
+ initialYAxisState: YAxisConfig;
26
28
  }
27
29
  export declare class YExtentComponent extends ChartBaseElement {
28
30
  paneUUID: string;
@@ -71,11 +71,40 @@ export declare class PaneManager extends ChartBaseElement {
71
71
  * @returns
72
72
  */
73
73
  createPane(uuid?: string, options?: AtLeastOne<YExtentCreationOptions>): PaneComponent;
74
+ /**
75
+ * Moves the canvas bounds container up by calling the movePaneUp method with the uuid of the current object.
76
+ * @returns {void}
77
+ */
78
+ movePaneUp(uuid: string): void;
79
+ /**
80
+ * Moves the canvas bounds container down by calling the movePaneDown method with the uuid of the current object.
81
+ * @returns {void}
82
+ */
83
+ movePaneDown(uuid: string): void;
84
+ /**
85
+ * Checks if the current pane can move up.
86
+ * @returns {boolean} - Returns true if the current pane can move up, otherwise false.
87
+ */
88
+ canMovePaneUp(uuid: string): boolean;
89
+ /**
90
+ * Checks if the current pane can move down.
91
+ *
92
+ * @returns {boolean} - Returns true if the current pane is not the last one in the canvasBoundsContainer, otherwise returns false.
93
+ */
94
+ canMovePaneDown(uuid: string): boolean;
74
95
  /**
75
96
  * Removes pane from the chart and all related components
76
97
  * @param uuid
77
98
  */
78
99
  removePane(uuid: string): void;
100
+ /**
101
+ * Hides a pane from the chart and all related components
102
+ */
103
+ hidePane(paneUUID: string): void;
104
+ /**
105
+ * Shows a pane, use if the pane is hidden
106
+ */
107
+ showPane(paneUUID: string): void;
79
108
  /**
80
109
  * Adds cursors to the chart elements based on the provided uuid and cursor type.
81
110
  * @private