@devexperts/dxcharts-lite 2.4.3 → 2.4.4
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/dist/chart/bootstrap.js +3 -3
- package/dist/chart/canvas/canvas-bounds-container.js +17 -19
- package/dist/chart/components/chart/chart-area-pan.handler.d.ts +4 -1
- package/dist/chart/components/chart/chart-area-pan.handler.js +14 -1
- package/dist/chart/components/chart/chart.component.d.ts +1 -1
- package/dist/chart/components/chart/chart.component.js +5 -5
- package/dist/chart/components/events/events-hit-test.drawer.d.ts +2 -1
- package/dist/chart/components/events/events-hit-test.drawer.js +32 -29
- package/dist/chart/components/events/events.component.js +1 -1
- package/dist/chart/components/high_low/high-low.drawer.js +3 -3
- package/dist/chart/components/pan/chart-pan.component.d.ts +3 -1
- package/dist/chart/components/pan/chart-pan.component.js +3 -2
- package/dist/chart/components/pane/pane-manager.component.d.ts +3 -1
- package/dist/chart/components/pane/pane-manager.component.js +4 -3
- package/dist/chart/components/pane/pane.component.d.ts +3 -1
- package/dist/chart/components/pane/pane.component.js +3 -2
- package/dist/chart/components/resizer/bar-resizer.component.d.ts +3 -1
- package/dist/chart/components/resizer/bar-resizer.component.js +6 -1
- package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +4 -1
- package/dist/chart/components/x_axis/x-axis-scale.handler.js +9 -1
- package/dist/chart/components/x_axis/x-axis.component.d.ts +2 -1
- package/dist/chart/components/x_axis/x-axis.component.js +2 -2
- package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +0 -1
- package/dist/chart/components/y_axis/y-axis-labels.drawer.js +0 -1
- package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +3 -1
- package/dist/chart/components/y_axis/y-axis-scale.handler.js +6 -1
- package/dist/chart/components/y_axis/y-axis.component.d.ts +2 -1
- package/dist/chart/components/y_axis/y-axis.component.js +3 -3
- package/dist/chart/drawers/chart-background.drawer.d.ts +2 -2
- package/dist/chart/drawers/chart-background.drawer.js +3 -3
- package/dist/chart/drawers/ht-data-series.drawer.d.ts +2 -1
- package/dist/chart/drawers/ht-data-series.drawer.js +11 -8
- package/dist/chart/inputhandlers/cross-event-producer.component.d.ts +3 -0
- package/dist/chart/inputhandlers/hover-producer.component.js +7 -3
- package/dist/chart/model/hit-test-canvas.model.d.ts +2 -1
- package/dist/chart/model/hit-test-canvas.model.js +4 -1
- package/dist/dxchart.min.js +4 -4
- package/package.json +1 -1
package/dist/chart/bootstrap.js
CHANGED
|
@@ -122,11 +122,11 @@ export default class ChartBootstrap {
|
|
|
122
122
|
this.chartComponents.push(this.crossEventProducer);
|
|
123
123
|
const chartBaseModel = new ChartBaseModel('candle');
|
|
124
124
|
this.chartBaseModel = chartBaseModel;
|
|
125
|
-
const chartPanComponent = new ChartPanComponent(eventBus, scaleModel, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, mainCanvasParent, chartBaseModel);
|
|
125
|
+
const chartPanComponent = new ChartPanComponent(eventBus, scaleModel, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, mainCanvasParent, chartBaseModel, hitTestCanvasModel);
|
|
126
126
|
this.chartPanComponent = chartPanComponent;
|
|
127
127
|
this.chartComponents.push(chartPanComponent);
|
|
128
128
|
this.userInputListenerComponents.push(chartPanComponent.chartAreaPanHandler);
|
|
129
|
-
const paneManager = new PaneManager(chartBaseModel, this.dynamicObjectsCanvasModel, this.userInputListenerComponents, eventBus, scaleModel, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, drawingManager, this.cursorHandler, this.crossEventProducer, chartPanComponent, mainCanvasModel, yAxisLabelsCanvasModel);
|
|
129
|
+
const paneManager = new PaneManager(chartBaseModel, this.dynamicObjectsCanvasModel, this.userInputListenerComponents, eventBus, scaleModel, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, drawingManager, this.cursorHandler, this.crossEventProducer, chartPanComponent, mainCanvasModel, yAxisLabelsCanvasModel, this.hitTestCanvasModel);
|
|
130
130
|
this.paneManager = paneManager;
|
|
131
131
|
const mainPane = this.paneManager.panes[CHART_UUID];
|
|
132
132
|
this.mainPane = mainPane;
|
|
@@ -144,7 +144,7 @@ export default class ChartBootstrap {
|
|
|
144
144
|
this.canvasBoundsContainer.setMainCandleSeries(this.chartModel.mainCandleSeries);
|
|
145
145
|
hitTestCanvasModel.addSubscriber(paneManager.hitTestController);
|
|
146
146
|
// X-axis component
|
|
147
|
-
this.xAxisComponent = new XAxisComponent(eventBus, config, mainCanvasModel, chartComponent, scaleModel, canvasBoundsContainer, canvasInputListener, chartResizeHandler, this.drawingManager, timeZoneModel, chartPanComponent, this.cursorHandler);
|
|
147
|
+
this.xAxisComponent = new XAxisComponent(eventBus, config, mainCanvasModel, chartComponent, scaleModel, canvasBoundsContainer, canvasInputListener, chartResizeHandler, this.drawingManager, timeZoneModel, chartPanComponent, this.cursorHandler, this.hitTestCanvasModel);
|
|
148
148
|
this.chartComponents.push(this.xAxisComponent);
|
|
149
149
|
this.userInputListenerComponents.push(this.xAxisComponent.xAxisScaleHandler);
|
|
150
150
|
const mainCanvasClearDrawer = new ClearCanvasDrawer(mainCanvasModel);
|
|
@@ -226,37 +226,34 @@ export class CanvasBoundsContainer {
|
|
|
226
226
|
this.panesOrder.forEach((uuid, index) => {
|
|
227
227
|
var _a;
|
|
228
228
|
const paneHeightRatio = this.graphsHeightRatio[this.panesOrder[index]];
|
|
229
|
-
|
|
229
|
+
// hide resizer for first pane with index === 0
|
|
230
|
+
const resizerVisible = this.config.components.paneResizer.visible && index !== 0;
|
|
231
|
+
const resizerUUID = CanvasElement.PANE_UUID_RESIZER(uuid);
|
|
232
|
+
const paneUUID = CanvasElement.PANE_UUID(uuid);
|
|
230
233
|
if (resizerVisible) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
upsertBounds(this.bounds, CanvasElement.PANE_UUID_RESIZER(uuid), 0, 0, 0, 0, this.canvasOnPageLocation);
|
|
236
|
-
}
|
|
234
|
+
upsertBounds(this.bounds, resizerUUID, 0, nextY, canvas.width, paneResizerHeight, this.canvasOnPageLocation);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
upsertBounds(this.bounds, resizerUUID, 0, 0, 0, 0, this.canvasOnPageLocation);
|
|
237
238
|
}
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
: chartHeight * paneHeightRatio, this.canvasOnPageLocation);
|
|
239
|
+
const paneYStart = nextY + (resizerVisible ? paneResizerHeight : 0);
|
|
240
|
+
const paneBounds = upsertBounds(this.bounds, paneUUID, paneXStart, paneYStart, chartWidth, chartHeight * paneHeightRatio - (resizerVisible ? this.config.components.paneResizer.height : 0), this.canvasOnPageLocation);
|
|
241
241
|
// y axis
|
|
242
242
|
if (this.config.components.yAxis.visible) {
|
|
243
243
|
const extents = this.yAxisBoundsContainer.extentsOrder.get(uuid);
|
|
244
244
|
if (extents === undefined) {
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
|
-
const
|
|
248
|
-
const height = resizerVisible
|
|
249
|
-
? chartHeight * paneHeightRatio - paneResizerHeight
|
|
250
|
-
: chartHeight * paneHeightRatio;
|
|
247
|
+
const height = chartHeight * paneHeightRatio - (resizerVisible ? paneResizerHeight : 0);
|
|
251
248
|
let startXLeft = paneXStart - ((_a = yAxisWidths.left[0]) !== null && _a !== void 0 ? _a : 0); // we need to provide right to left order on the left y-axis side
|
|
252
249
|
let startXRight = yAxisXRight;
|
|
253
250
|
extents.left.forEach((extentIdx, i) => {
|
|
254
251
|
var _a;
|
|
255
|
-
upsertBounds(this.bounds, CanvasElement.PANE_UUID_Y_AXIS(uuid, extentIdx), startXLeft,
|
|
252
|
+
upsertBounds(this.bounds, CanvasElement.PANE_UUID_Y_AXIS(uuid, extentIdx), startXLeft, paneYStart, yAxisWidths.left[i], height, this.canvasOnPageLocation);
|
|
256
253
|
startXLeft -= (_a = yAxisWidths.left[i + 1]) !== null && _a !== void 0 ? _a : 0;
|
|
257
254
|
});
|
|
258
255
|
extents.right.forEach((extentIdx, i) => {
|
|
259
|
-
upsertBounds(this.bounds, CanvasElement.PANE_UUID_Y_AXIS(uuid, extentIdx), startXRight,
|
|
256
|
+
upsertBounds(this.bounds, CanvasElement.PANE_UUID_Y_AXIS(uuid, extentIdx), startXRight, paneYStart, yAxisWidths.right[i], height, this.canvasOnPageLocation);
|
|
260
257
|
startXRight += yAxisWidths.right[i];
|
|
261
258
|
});
|
|
262
259
|
}
|
|
@@ -272,7 +269,7 @@ export class CanvasBoundsContainer {
|
|
|
272
269
|
allPanesBounds.height = nextY;
|
|
273
270
|
// chart with Y axis
|
|
274
271
|
const chartWithYAxis = this.getBounds(CanvasElement.CHART_WITH_Y_AXIS);
|
|
275
|
-
const chartBounds = this.getBounds(CanvasElement.
|
|
272
|
+
const chartBounds = this.getBounds(CanvasElement.CHART);
|
|
276
273
|
this.getEventsBounds(chartBounds);
|
|
277
274
|
this.copyBounds(chartBounds, chartWithYAxis);
|
|
278
275
|
chartWithYAxis.width = canvas.width;
|
|
@@ -347,10 +344,11 @@ export class CanvasBoundsContainer {
|
|
|
347
344
|
getXAxisBounds(nMap, canvas) {
|
|
348
345
|
const xAxis = this.getBounds(CanvasElement.X_AXIS);
|
|
349
346
|
if (this.config.components.xAxis.visible) {
|
|
347
|
+
const xAxisHeight = this.getXAxisHeight();
|
|
350
348
|
xAxis.x = 0;
|
|
351
|
-
xAxis.y = canvas.height -
|
|
349
|
+
xAxis.y = canvas.height - xAxisHeight - nMap.height;
|
|
352
350
|
xAxis.width = canvas.width;
|
|
353
|
-
xAxis.height =
|
|
351
|
+
xAxis.height = xAxisHeight;
|
|
354
352
|
}
|
|
355
353
|
else {
|
|
356
354
|
this.applyDefaultBounds(xAxis);
|
|
@@ -12,6 +12,7 @@ import { ChartBaseElement } from '../../model/chart-base-element';
|
|
|
12
12
|
import { ScaleModel } from '../../model/scale.model';
|
|
13
13
|
import { DragNDropYComponent } from '../dran-n-drop_helper/drag-n-drop-y.component';
|
|
14
14
|
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
15
|
+
import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
|
|
15
16
|
export interface ChartWheelEvent {
|
|
16
17
|
readonly originalEvent: WheelEvent;
|
|
17
18
|
readonly candleIdx: number;
|
|
@@ -45,12 +46,13 @@ export declare class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
45
46
|
private canvasBoundsContainer;
|
|
46
47
|
private canvasAnimation;
|
|
47
48
|
private chartPanComponent;
|
|
49
|
+
private hitTestCanvasModel;
|
|
48
50
|
private readonly touchHandler;
|
|
49
51
|
private currentPoint;
|
|
50
52
|
xDraggedCandlesDelta: number;
|
|
51
53
|
lastXStart: number;
|
|
52
54
|
wheelTrottleTime: number;
|
|
53
|
-
constructor(bus: EventBus, config: FullChartConfig, scale: ScaleModel, mainCanvasParent: Element, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, canvasAnimation: CanvasAnimation, chartPanComponent: ChartPanComponent);
|
|
55
|
+
constructor(bus: EventBus, config: FullChartConfig, scale: ScaleModel, mainCanvasParent: Element, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, canvasAnimation: CanvasAnimation, chartPanComponent: ChartPanComponent, hitTestCanvasModel: HitTestCanvasModel);
|
|
54
56
|
/**
|
|
55
57
|
* It observes the wheel event on all panes of the canvas and throttles it to the specified time.
|
|
56
58
|
* It then calculates the zoom sensitivity based on whether the event was triggered by a touchpad or not.
|
|
@@ -77,6 +79,7 @@ export declare class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
77
79
|
registerChartYPanHandler(scale: ScaleModel, hitTest: HitBoundsTest): DragNDropYComponent;
|
|
78
80
|
private onXDragStart;
|
|
79
81
|
private onXDragTick;
|
|
82
|
+
private onXDragEnd;
|
|
80
83
|
}
|
|
81
84
|
/**
|
|
82
85
|
* This function calculates angle between current point and point(0, 0), and compares the result with config values
|
|
@@ -35,7 +35,7 @@ import { DragNDropYComponent } from '../dran-n-drop_helper/drag-n-drop-y.compone
|
|
|
35
35
|
|
|
36
36
|
*/
|
|
37
37
|
export class ChartAreaPanHandler extends ChartBaseElement {
|
|
38
|
-
constructor(bus, config, scale, mainCanvasParent, canvasInputListener, canvasBoundsContainer, canvasAnimation, chartPanComponent) {
|
|
38
|
+
constructor(bus, config, scale, mainCanvasParent, canvasInputListener, canvasBoundsContainer, canvasAnimation, chartPanComponent, hitTestCanvasModel) {
|
|
39
39
|
super();
|
|
40
40
|
this.bus = bus;
|
|
41
41
|
this.config = config;
|
|
@@ -45,6 +45,7 @@ export class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
45
45
|
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
46
46
|
this.canvasAnimation = canvasAnimation;
|
|
47
47
|
this.chartPanComponent = chartPanComponent;
|
|
48
|
+
this.hitTestCanvasModel = hitTestCanvasModel;
|
|
48
49
|
this.currentPoint = { x: 0, y: 0 };
|
|
49
50
|
// number of candles delta changed during X dragging: 1, 5 or -3 for ex.
|
|
50
51
|
this.xDraggedCandlesDelta = 0;
|
|
@@ -81,6 +82,8 @@ export class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
81
82
|
this.canvasAnimation.forceStopAnimation(VIEWPORT_ANIMATION_ID);
|
|
82
83
|
this.xDraggedCandlesDelta = 0;
|
|
83
84
|
this.lastXStart = this.scale.xStart;
|
|
85
|
+
// Stop redrawing hit test
|
|
86
|
+
this.hitTestCanvasModel.hitTestDrawersPredicateSubject.next(false);
|
|
84
87
|
};
|
|
85
88
|
this.onXDragTick = (dragInfo) => {
|
|
86
89
|
const { delta: absoluteXDelta } = dragInfo;
|
|
@@ -89,12 +92,17 @@ export class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
89
92
|
this.scale.moveXStart(this.lastXStart - unitsDelta);
|
|
90
93
|
this.bus.fireDraw();
|
|
91
94
|
};
|
|
95
|
+
this.onXDragEnd = () => {
|
|
96
|
+
// Continue redrawing hit test
|
|
97
|
+
this.hitTestCanvasModel.hitTestDrawersPredicateSubject.next(true);
|
|
98
|
+
};
|
|
92
99
|
this.touchHandler = new MainCanvasTouchHandler(this.scale, this.canvasInputListener, this.mainCanvasParent);
|
|
93
100
|
const allPanesHitTest = this.canvasBoundsContainer.getBoundsHitTest(CanvasElement.ALL_PANES);
|
|
94
101
|
//#region drag-n-drop logic
|
|
95
102
|
const dragNDropXComponent = new DragNDropXComponent(allPanesHitTest, {
|
|
96
103
|
onDragStart: this.onXDragStart,
|
|
97
104
|
onDragTick: this.onXDragTick,
|
|
105
|
+
onDragEnd: this.onXDragEnd,
|
|
98
106
|
}, this.canvasInputListener, this.chartPanComponent, {
|
|
99
107
|
disableChartPanning: false,
|
|
100
108
|
});
|
|
@@ -179,9 +187,14 @@ export class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
179
187
|
scale.moveYStart(lastYStart + unitsDelta);
|
|
180
188
|
}
|
|
181
189
|
};
|
|
190
|
+
const onYDragEnd = () => {
|
|
191
|
+
// Continue redrawing hit test
|
|
192
|
+
this.hitTestCanvasModel.hitTestDrawersPredicateSubject.next(true);
|
|
193
|
+
};
|
|
182
194
|
const dragNDropYComponent = new DragNDropYComponent(hitTest, {
|
|
183
195
|
onDragTick: onYDragTick,
|
|
184
196
|
onDragStart: onYDragStart,
|
|
197
|
+
onDragEnd: onYDragEnd,
|
|
185
198
|
}, this.canvasInputListener, this.chartPanComponent, {
|
|
186
199
|
disableChartPanning: false,
|
|
187
200
|
});
|
|
@@ -65,7 +65,7 @@ export declare class ChartComponent extends ChartBaseElement {
|
|
|
65
65
|
private readonly backgroundDrawer;
|
|
66
66
|
private readonly _dataSeriesDrawers;
|
|
67
67
|
private readonly dataSeriesDrawer;
|
|
68
|
-
private
|
|
68
|
+
private backgroundDrawerPredicateSubject;
|
|
69
69
|
constructor(chartModel: ChartModel, canvasModel: CanvasModel, config: FullChartConfig, scale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, hitTestCanvasModel: HitTestCanvasModel, canvasInputListener: CanvasInputListenerComponent, backgroundCanvasModel: CanvasModel, chartPanComponent: ChartPanComponent, paneManager: PaneManager, cursorHandler: CursorHandler, dynamicObjects: DynamicObjectsComponent, chartResizeHandler: ChartResizeHandler);
|
|
70
70
|
/**
|
|
71
71
|
* This method overrides the doActivate method of the parent class and calls it.
|
|
@@ -63,20 +63,20 @@ export class ChartComponent extends ChartBaseElement {
|
|
|
63
63
|
this.dynamicObjects = dynamicObjects;
|
|
64
64
|
this.chartResizeHandler = chartResizeHandler;
|
|
65
65
|
this._dataSeriesDrawers = {};
|
|
66
|
-
this.
|
|
66
|
+
this.backgroundDrawerPredicateSubject = new BehaviorSubject(true);
|
|
67
67
|
this.strToBarType = (str) => { var _a; return (_a = this.barTypeValues.find(t => t === str)) !== null && _a !== void 0 ? _a : 'candle'; };
|
|
68
68
|
this.addChildEntity(this.chartModel);
|
|
69
69
|
this.registerDefaultCandlesTransformers();
|
|
70
70
|
this.baselineModel = new BaselineModel(this.chartModel, chartPanComponent, this.canvasModel, this.canvasInputListener, this.config, this.canvasBoundsContainer, cursorHandler);
|
|
71
71
|
this.addChildEntity(this.baselineModel);
|
|
72
72
|
//#region main chart drawers
|
|
73
|
-
const hTChartDrawer = new HTDataSeriesDrawer(this._dataSeriesDrawers, this.hitTestCanvasModel, paneManager);
|
|
73
|
+
const hTChartDrawer = new HTDataSeriesDrawer(this._dataSeriesDrawers, this.hitTestCanvasModel, paneManager, () => this.hitTestCanvasModel.hitTestDrawersPredicateSubject.getValue());
|
|
74
74
|
this.drawingManager.addDrawerBefore(hTChartDrawer, HIT_TEST_PREFIX + 'DATA_SERIES', 'HIT_TEST_EVENTS');
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region data series drawers
|
|
77
77
|
this.registerDefaultDataSeriesDrawers();
|
|
78
78
|
//#endregion
|
|
79
|
-
this.backgroundDrawer = new BackgroundDrawer(backgroundCanvasModel, this.config, () => this.
|
|
79
|
+
this.backgroundDrawer = new BackgroundDrawer(backgroundCanvasModel, this.config, () => this.backgroundDrawerPredicateSubject.getValue());
|
|
80
80
|
drawingManager.addDrawer(this.backgroundDrawer, 'MAIN_BACKGROUND');
|
|
81
81
|
cursorHandler.setCursorForCanvasEl(CanvasElement.PANE_UUID(CHART_UUID), config.components.chart.cursor);
|
|
82
82
|
this.dataSeriesDrawer = new DataSeriesDrawer(paneManager, this.dataSeriesDrawers);
|
|
@@ -109,10 +109,10 @@ export class ChartComponent extends ChartBaseElement {
|
|
|
109
109
|
}));
|
|
110
110
|
// redraw background only when chart is resized
|
|
111
111
|
this.addRxSubscription(this.canvasBoundsContainer.observeAnyBoundsChanged().subscribe(() => {
|
|
112
|
-
this.
|
|
112
|
+
this.backgroundDrawerPredicateSubject.next(false);
|
|
113
113
|
}));
|
|
114
114
|
this.addRxSubscription(this.chartResizeHandler.canvasResized.subscribe(() => {
|
|
115
|
-
this.
|
|
115
|
+
this.backgroundDrawerPredicateSubject.next(true);
|
|
116
116
|
}));
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -15,7 +15,8 @@ export declare class EventsHitTestDrawer implements Drawer {
|
|
|
15
15
|
private config;
|
|
16
16
|
private canvasBoundsContainer;
|
|
17
17
|
private model;
|
|
18
|
-
|
|
18
|
+
private drawPredicate;
|
|
19
|
+
constructor(hitTestCanvasModel: HitTestCanvasModel, chartModel: ChartModel, config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer, model: EventsModel, drawPredicate?: () => boolean);
|
|
19
20
|
/**
|
|
20
21
|
* Draws events on the hit test canvas.
|
|
21
22
|
* @function
|
|
@@ -7,12 +7,13 @@ import { CanvasElement } from '../../canvas/canvas-bounds-container';
|
|
|
7
7
|
import { getEventSize } from './events.drawer';
|
|
8
8
|
const hoverExtendedAreaPixels = 5;
|
|
9
9
|
export class EventsHitTestDrawer {
|
|
10
|
-
constructor(hitTestCanvasModel, chartModel, config, canvasBoundsContainer, model) {
|
|
10
|
+
constructor(hitTestCanvasModel, chartModel, config, canvasBoundsContainer, model, drawPredicate = () => true) {
|
|
11
11
|
this.hitTestCanvasModel = hitTestCanvasModel;
|
|
12
12
|
this.chartModel = chartModel;
|
|
13
13
|
this.config = config;
|
|
14
14
|
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
15
15
|
this.model = model;
|
|
16
|
+
this.drawPredicate = drawPredicate;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Draws events on the hit test canvas.
|
|
@@ -24,39 +25,41 @@ export class EventsHitTestDrawer {
|
|
|
24
25
|
|
|
25
26
|
*/
|
|
26
27
|
draw() {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
if (this.drawPredicate()) {
|
|
29
|
+
const ctx = this.hitTestCanvasModel.ctx;
|
|
30
|
+
const bounds = this.canvasBoundsContainer.getBounds(CanvasElement.EVENTS);
|
|
31
|
+
ctx.save();
|
|
32
|
+
this.model.events.forEach((event, idx) => {
|
|
33
|
+
const prevEvent = this.model.events[idx - 1];
|
|
34
|
+
const prevX = prevEvent &&
|
|
35
|
+
this.chartModel.candleFromTimestamp(prevEvent.timestamp).xCenter(this.chartModel.scale);
|
|
36
|
+
const x = this.chartModel.candleFromTimestamp(event.timestamp).xCenter(this.chartModel.scale);
|
|
37
|
+
if (x > bounds.x && x < bounds.x + bounds.width) {
|
|
38
|
+
const color = this.config.colors.events[event.type].color;
|
|
39
|
+
ctx.strokeStyle = color;
|
|
40
|
+
ctx.fillStyle = color;
|
|
41
|
+
const size = getEventSize(event);
|
|
42
|
+
// draw hit test
|
|
43
|
+
ctx.fillStyle = this.hitTestCanvasModel.idToColor(event.id);
|
|
44
|
+
const hoverSize = (size + hoverExtendedAreaPixels) * 2;
|
|
45
|
+
if (prevX !== undefined) {
|
|
46
|
+
const prevSize = getEventSize(prevEvent);
|
|
47
|
+
const isIntersectsWithPrev = prevX + prevSize > x - hoverSize / 2;
|
|
48
|
+
if (isIntersectsWithPrev) {
|
|
49
|
+
const hoverSize = size * 2 + hoverExtendedAreaPixels;
|
|
50
|
+
ctx.fillRect(prevX + prevSize, bounds.y, hoverSize, bounds.height);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
ctx.fillRect(x - size - hoverExtendedAreaPixels, bounds.y, hoverSize, bounds.height);
|
|
54
|
+
}
|
|
49
55
|
}
|
|
50
56
|
else {
|
|
51
57
|
ctx.fillRect(x - size - hoverExtendedAreaPixels, bounds.y, hoverSize, bounds.height);
|
|
52
58
|
}
|
|
53
59
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
ctx.restore();
|
|
60
|
+
});
|
|
61
|
+
ctx.restore();
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
/**
|
|
62
65
|
* Returns an array of string containing the canvas ID of the hitTestCanvasModel.
|
|
@@ -25,7 +25,7 @@ export class EventsComponent extends ChartBaseElement {
|
|
|
25
25
|
hitTestCanvasModel.addSubscriber(eventsModel);
|
|
26
26
|
const eventsDrawer = new EventsDrawer(canvasModel, chartModel, config, canvasBoundsContainer, eventsModel, this.eventsXAxisLabelFormatterProvider);
|
|
27
27
|
this.drawingManager.addDrawer(eventsDrawer, 'EVENTS');
|
|
28
|
-
const eventsHitTestDrawer = new EventsHitTestDrawer(hitTestCanvasModel, chartModel, config, canvasBoundsContainer, eventsModel);
|
|
28
|
+
const eventsHitTestDrawer = new EventsHitTestDrawer(hitTestCanvasModel, chartModel, config, canvasBoundsContainer, eventsModel, () => hitTestCanvasModel.hitTestDrawersPredicateSubject.getValue());
|
|
29
29
|
this.drawingManager.addDrawerBefore(eventsHitTestDrawer, 'HIT_TEST_EVENTS', 'HIT_TEST_DRAWINGS');
|
|
30
30
|
cursorHandler.setCursorForCanvasEl(CanvasElement.EVENTS, config.components.events.cursor);
|
|
31
31
|
}
|
|
@@ -35,10 +35,7 @@ export class HighLowDrawer {
|
|
|
35
35
|
ctx.font = this.config.components.highLow.font;
|
|
36
36
|
this.drawMarkerLabel(ctx, finalHighIdx, high, 'high');
|
|
37
37
|
this.drawMarkerLabel(ctx, finalLowIdx, low, 'low');
|
|
38
|
-
const chartBounds = this.canvasBoundsContainer.getBounds('PANE_CHART');
|
|
39
38
|
ctx.restore();
|
|
40
|
-
// We need clip here so lowLabel won't overlap other panes
|
|
41
|
-
clipToBounds(ctx, chartBounds);
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
41
|
/**
|
|
@@ -62,6 +59,9 @@ export class HighLowDrawer {
|
|
|
62
59
|
ctx.fillStyle =
|
|
63
60
|
type === 'high' ? this.config.colors.highLowTheme.highColor : this.config.colors.highLowTheme.lowColor;
|
|
64
61
|
ctx.fillText(text, x, y);
|
|
62
|
+
const chartBounds = this.canvasBoundsContainer.getBounds('PANE_CHART');
|
|
63
|
+
// We need clip here so lowLabel won't overlap other panes
|
|
64
|
+
clipToBounds(ctx, chartBounds);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Returns a string that represents a marker text for a given yValue and type.
|
|
@@ -12,6 +12,7 @@ import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-
|
|
|
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
|
+
import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
|
|
15
16
|
export declare class ChartPanComponent extends ChartBaseElement {
|
|
16
17
|
private eventBus;
|
|
17
18
|
private mainScale;
|
|
@@ -21,9 +22,10 @@ export declare class ChartPanComponent extends ChartBaseElement {
|
|
|
21
22
|
private canvasInputListener;
|
|
22
23
|
private mainCanvasParent;
|
|
23
24
|
chartBaseModel: ChartBaseModel<BaseType>;
|
|
25
|
+
private hitTestCanvasModel;
|
|
24
26
|
chartPanComponents: Array<ChartEntity>;
|
|
25
27
|
chartAreaPanHandler: ChartAreaPanHandler;
|
|
26
|
-
constructor(eventBus: EventBus, mainScale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig, canvasAnimation: CanvasAnimation, canvasInputListener: CanvasInputListenerComponent, mainCanvasParent: Element, chartBaseModel: ChartBaseModel<BaseType
|
|
28
|
+
constructor(eventBus: EventBus, mainScale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig, canvasAnimation: CanvasAnimation, canvasInputListener: CanvasInputListenerComponent, mainCanvasParent: Element, chartBaseModel: ChartBaseModel<BaseType>, hitTestCanvasModel: HitTestCanvasModel);
|
|
27
29
|
/**
|
|
28
30
|
* Activates the chart pan handlers.
|
|
29
31
|
* @protected
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
7
7
|
import { ChartAreaPanHandler } from '../chart/chart-area-pan.handler';
|
|
8
8
|
export class ChartPanComponent extends ChartBaseElement {
|
|
9
|
-
constructor(eventBus, mainScale, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, mainCanvasParent, chartBaseModel) {
|
|
9
|
+
constructor(eventBus, mainScale, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, mainCanvasParent, chartBaseModel, hitTestCanvasModel) {
|
|
10
10
|
super();
|
|
11
11
|
this.eventBus = eventBus;
|
|
12
12
|
this.mainScale = mainScale;
|
|
@@ -16,8 +16,9 @@ export class ChartPanComponent extends ChartBaseElement {
|
|
|
16
16
|
this.canvasInputListener = canvasInputListener;
|
|
17
17
|
this.mainCanvasParent = mainCanvasParent;
|
|
18
18
|
this.chartBaseModel = chartBaseModel;
|
|
19
|
+
this.hitTestCanvasModel = hitTestCanvasModel;
|
|
19
20
|
this.chartPanComponents = [];
|
|
20
|
-
this.chartAreaPanHandler = new ChartAreaPanHandler(this.eventBus, this.config, this.mainScale, this.mainCanvasParent, this.canvasInputListener, this.canvasBoundsContainer, this.canvasAnimation, this);
|
|
21
|
+
this.chartAreaPanHandler = new ChartAreaPanHandler(this.eventBus, this.config, this.mainScale, this.mainCanvasParent, this.canvasInputListener, this.canvasBoundsContainer, this.canvasAnimation, this, this.hitTestCanvasModel);
|
|
21
22
|
this.chartPanComponents.push(this.chartAreaPanHandler);
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
@@ -22,6 +22,7 @@ import { YExtentComponent, YExtentCreationOptions } from './extent/y-extent-comp
|
|
|
22
22
|
import { PaneHitTestController } from './pane-hit-test.controller';
|
|
23
23
|
import { PaneComponent } from './pane.component';
|
|
24
24
|
import { DataSeriesModel } from '../../model/data-series.model';
|
|
25
|
+
import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
|
|
25
26
|
export declare class PaneManager extends ChartBaseElement {
|
|
26
27
|
private chartBaseModel;
|
|
27
28
|
private dynamicObjectsCanvasModel;
|
|
@@ -38,6 +39,7 @@ export declare class PaneManager extends ChartBaseElement {
|
|
|
38
39
|
chartPanComponent: ChartPanComponent;
|
|
39
40
|
private mainCanvasModel;
|
|
40
41
|
private yAxisLabelsCanvasModel;
|
|
42
|
+
private hitTestCanvasModel;
|
|
41
43
|
panes: Record<string, PaneComponent>;
|
|
42
44
|
paneRemovedSubject: Subject<PaneComponent>;
|
|
43
45
|
paneAddedSubject: Subject<Record<string, PaneComponent>>;
|
|
@@ -48,7 +50,7 @@ export declare class PaneManager extends ChartBaseElement {
|
|
|
48
50
|
* Returns order of panes in the chart from top to bottom.
|
|
49
51
|
*/
|
|
50
52
|
get panesOrder(): string[];
|
|
51
|
-
constructor(chartBaseModel: ChartBaseModel<'candle'>, dynamicObjectsCanvasModel: CanvasModel, userInputListenerComponents: ChartEntity[], eventBus: EventBus, mainScale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig, canvasAnimation: CanvasAnimation, canvasInputListener: CanvasInputListenerComponent, drawingManager: DrawingManager, cursorHandler: CursorHandler, crossEventProducer: CrossEventProducerComponent, chartPanComponent: ChartPanComponent, mainCanvasModel: CanvasModel, yAxisLabelsCanvasModel: CanvasModel);
|
|
53
|
+
constructor(chartBaseModel: ChartBaseModel<'candle'>, dynamicObjectsCanvasModel: CanvasModel, userInputListenerComponents: ChartEntity[], eventBus: EventBus, mainScale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig, canvasAnimation: CanvasAnimation, canvasInputListener: CanvasInputListenerComponent, drawingManager: DrawingManager, cursorHandler: CursorHandler, crossEventProducer: CrossEventProducerComponent, chartPanComponent: ChartPanComponent, mainCanvasModel: CanvasModel, yAxisLabelsCanvasModel: CanvasModel, hitTestCanvasModel: HitTestCanvasModel);
|
|
52
54
|
private addBounds;
|
|
53
55
|
/**
|
|
54
56
|
* Adds a resizer to the canvas bounds container for the given uuid.
|
|
@@ -20,7 +20,7 @@ export class PaneManager extends ChartBaseElement {
|
|
|
20
20
|
get panesOrder() {
|
|
21
21
|
return this.canvasBoundsContainer.panesOrder;
|
|
22
22
|
}
|
|
23
|
-
constructor(chartBaseModel, dynamicObjectsCanvasModel, userInputListenerComponents, eventBus, mainScale, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, drawingManager, cursorHandler, crossEventProducer, chartPanComponent, mainCanvasModel, yAxisLabelsCanvasModel) {
|
|
23
|
+
constructor(chartBaseModel, dynamicObjectsCanvasModel, userInputListenerComponents, eventBus, mainScale, canvasBoundsContainer, config, canvasAnimation, canvasInputListener, drawingManager, cursorHandler, crossEventProducer, chartPanComponent, mainCanvasModel, yAxisLabelsCanvasModel, hitTestCanvasModel) {
|
|
24
24
|
super();
|
|
25
25
|
this.chartBaseModel = chartBaseModel;
|
|
26
26
|
this.dynamicObjectsCanvasModel = dynamicObjectsCanvasModel;
|
|
@@ -37,6 +37,7 @@ export class PaneManager extends ChartBaseElement {
|
|
|
37
37
|
this.chartPanComponent = chartPanComponent;
|
|
38
38
|
this.mainCanvasModel = mainCanvasModel;
|
|
39
39
|
this.yAxisLabelsCanvasModel = yAxisLabelsCanvasModel;
|
|
40
|
+
this.hitTestCanvasModel = hitTestCanvasModel;
|
|
40
41
|
this.panes = {};
|
|
41
42
|
this.paneRemovedSubject = new Subject();
|
|
42
43
|
this.paneAddedSubject = new Subject();
|
|
@@ -68,7 +69,7 @@ export class PaneManager extends ChartBaseElement {
|
|
|
68
69
|
this.eventBus.fireDraw([this.mainCanvasModel.canvasId, 'dynamicObjectsCanvas']);
|
|
69
70
|
};
|
|
70
71
|
const resizerId = CanvasElement.PANE_UUID_RESIZER(uuid);
|
|
71
|
-
const barResizerComponent = new BarResizerComponent(resizerId, () => this.canvasBoundsContainer.getBounds(resizerId), resizerHT, dragTick, this.chartPanComponent, this.mainCanvasModel, this.drawingManager, this.canvasInputListener, this.canvasAnimation, this.config, this.canvasBoundsContainer);
|
|
72
|
+
const barResizerComponent = new BarResizerComponent(resizerId, () => this.canvasBoundsContainer.getBounds(resizerId), resizerHT, dragTick, this.chartPanComponent, this.mainCanvasModel, this.drawingManager, this.canvasInputListener, this.canvasAnimation, this.config, this.canvasBoundsContainer, this.hitTestCanvasModel);
|
|
72
73
|
this.userInputListenerComponents.push(barResizerComponent);
|
|
73
74
|
return barResizerComponent;
|
|
74
75
|
}
|
|
@@ -93,7 +94,7 @@ export class PaneManager extends ChartBaseElement {
|
|
|
93
94
|
if (this.panes[uuid] !== undefined) {
|
|
94
95
|
return this.panes[uuid];
|
|
95
96
|
}
|
|
96
|
-
const paneComponent = new PaneComponent(this.chartBaseModel, this.mainCanvasModel, this.yAxisLabelsCanvasModel, this.dynamicObjectsCanvasModel, this.hitTestController, this.config, this.mainScale, this.drawingManager, this.chartPanComponent, this.canvasInputListener, this.canvasAnimation, this.cursorHandler, this.eventBus, this.canvasBoundsContainer, uuid, this.dataSeriesAddedSubject, this.dataSeriesRemovedSubject, options);
|
|
97
|
+
const paneComponent = new PaneComponent(this.chartBaseModel, this.mainCanvasModel, this.yAxisLabelsCanvasModel, this.dynamicObjectsCanvasModel, this.hitTestController, this.config, this.mainScale, this.drawingManager, this.chartPanComponent, this.canvasInputListener, this.canvasAnimation, this.cursorHandler, this.eventBus, this.canvasBoundsContainer, uuid, this.dataSeriesAddedSubject, this.dataSeriesRemovedSubject, this.hitTestCanvasModel, options);
|
|
97
98
|
// TODO: is resizer should be added always?
|
|
98
99
|
if (this.config.components.paneResizer.visible) {
|
|
99
100
|
paneComponent.addChildEntity(this.addResizer(uuid));
|
|
@@ -24,6 +24,7 @@ import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
|
24
24
|
import { YAxisComponent } from '../y_axis/y-axis.component';
|
|
25
25
|
import { YExtentComponent, YExtentCreationOptions } from './extent/y-extent-component';
|
|
26
26
|
import { PaneHitTestController } from './pane-hit-test.controller';
|
|
27
|
+
import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
|
|
27
28
|
export declare class PaneComponent extends ChartBaseElement {
|
|
28
29
|
chartBaseModel: ChartBaseModel<'candle'>;
|
|
29
30
|
private mainCanvasModel;
|
|
@@ -42,6 +43,7 @@ export declare class PaneComponent extends ChartBaseElement {
|
|
|
42
43
|
readonly uuid: string;
|
|
43
44
|
seriesAddedSubject: Subject<DataSeriesModel>;
|
|
44
45
|
seriesRemovedSubject: Subject<DataSeriesModel>;
|
|
46
|
+
private hitTestCanvasModel;
|
|
45
47
|
private _paneOrder;
|
|
46
48
|
/**
|
|
47
49
|
* Pane hit test (without Y-Axis and resizer)
|
|
@@ -52,7 +54,7 @@ export declare class PaneComponent extends ChartBaseElement {
|
|
|
52
54
|
get yAxis(): YAxisComponent;
|
|
53
55
|
get dataSeries(): DataSeriesModel<import("../../model/data-series.model").DataSeriesPoint, import("../../model/data-series.model").VisualSeriesPoint>[];
|
|
54
56
|
mainExtent: YExtentComponent;
|
|
55
|
-
constructor(chartBaseModel: ChartBaseModel<'candle'>, mainCanvasModel: CanvasModel, yAxisLabelsCanvasModel: CanvasModel, dynamicObjectsCanvasModel: CanvasModel, hitTestController: PaneHitTestController, config: FullChartConfig, mainScale: ScaleModel, drawingManager: DrawingManager, chartPanComponent: ChartPanComponent, canvasInputListener: CanvasInputListenerComponent, canvasAnimation: CanvasAnimation, cursorHandler: CursorHandler, eventBus: EventBus, canvasBoundsContainer: CanvasBoundsContainer, uuid: string, seriesAddedSubject: Subject<DataSeriesModel>, seriesRemovedSubject: Subject<DataSeriesModel>, options?: AtLeastOne<YExtentCreationOptions>);
|
|
57
|
+
constructor(chartBaseModel: ChartBaseModel<'candle'>, mainCanvasModel: CanvasModel, yAxisLabelsCanvasModel: CanvasModel, dynamicObjectsCanvasModel: CanvasModel, hitTestController: PaneHitTestController, config: FullChartConfig, mainScale: ScaleModel, drawingManager: DrawingManager, chartPanComponent: ChartPanComponent, canvasInputListener: CanvasInputListenerComponent, canvasAnimation: CanvasAnimation, cursorHandler: CursorHandler, eventBus: EventBus, canvasBoundsContainer: CanvasBoundsContainer, uuid: string, seriesAddedSubject: Subject<DataSeriesModel>, seriesRemovedSubject: Subject<DataSeriesModel>, hitTestCanvasModel: HitTestCanvasModel, options?: AtLeastOne<YExtentCreationOptions>);
|
|
56
58
|
/**
|
|
57
59
|
* Method that activates the canvas bounds container and recalculates the zoom Y of the scale model.
|
|
58
60
|
* @protected
|
|
@@ -22,7 +22,7 @@ export class PaneComponent extends ChartBaseElement {
|
|
|
22
22
|
get dataSeries() {
|
|
23
23
|
return flatMap(this.yExtentComponents, c => Array.from(c.dataSeries));
|
|
24
24
|
}
|
|
25
|
-
constructor(chartBaseModel, mainCanvasModel, yAxisLabelsCanvasModel, dynamicObjectsCanvasModel, hitTestController, config, mainScale, drawingManager, chartPanComponent, canvasInputListener, canvasAnimation, cursorHandler, eventBus, canvasBoundsContainer, uuid, seriesAddedSubject, seriesRemovedSubject, options) {
|
|
25
|
+
constructor(chartBaseModel, mainCanvasModel, yAxisLabelsCanvasModel, dynamicObjectsCanvasModel, hitTestController, config, mainScale, drawingManager, chartPanComponent, canvasInputListener, canvasAnimation, cursorHandler, eventBus, canvasBoundsContainer, uuid, seriesAddedSubject, seriesRemovedSubject, hitTestCanvasModel, options) {
|
|
26
26
|
super();
|
|
27
27
|
this.chartBaseModel = chartBaseModel;
|
|
28
28
|
this.mainCanvasModel = mainCanvasModel;
|
|
@@ -41,6 +41,7 @@ export class PaneComponent extends ChartBaseElement {
|
|
|
41
41
|
this.uuid = uuid;
|
|
42
42
|
this.seriesAddedSubject = seriesAddedSubject;
|
|
43
43
|
this.seriesRemovedSubject = seriesRemovedSubject;
|
|
44
|
+
this.hitTestCanvasModel = hitTestCanvasModel;
|
|
44
45
|
this._paneOrder = 0;
|
|
45
46
|
this.yExtentComponents = [];
|
|
46
47
|
this.getYAxisBounds = () => {
|
|
@@ -121,7 +122,7 @@ export class PaneComponent extends ChartBaseElement {
|
|
|
121
122
|
const [unsub, dragNDrop] = this.createYPanHandler(this.uuid, scaleModel);
|
|
122
123
|
// creating partially resolved constructor except formatter & dataSeriesProvider - bcs it's not possible to provide formatter
|
|
123
124
|
// before y-extent is created
|
|
124
|
-
const createYAxisComponent = (formatter, dataSeriesProvider) => new YAxisComponent(this.eventBus, this.config, this.yAxisLabelsCanvasModel, scaleModel, this.canvasInputListener, this.canvasBoundsContainer, this.chartPanComponent, this.cursorHandler, formatter, dataSeriesProvider, this.uuid, extentIdx);
|
|
125
|
+
const createYAxisComponent = (formatter, dataSeriesProvider) => new YAxisComponent(this.eventBus, this.config, this.yAxisLabelsCanvasModel, scaleModel, this.canvasInputListener, this.canvasBoundsContainer, this.chartPanComponent, this.cursorHandler, formatter, dataSeriesProvider, this.uuid, extentIdx, this.hitTestCanvasModel);
|
|
125
126
|
const yExtentComponent = new YExtentComponent(this.uuid, extentIdx, this, this.chartBaseModel, this.canvasBoundsContainer, this.hitTestController, this.dynamicObjectsCanvasModel, scaleModel, createYAxisComponent, dragNDrop);
|
|
126
127
|
yExtentComponent.addSubscription(unsub);
|
|
127
128
|
yExtentComponent.addSubscription(this.addCursors(extentIdx, yExtentComponent.yAxis));
|
|
@@ -13,6 +13,7 @@ import { ChartBaseElement } from '../../model/chart-base-element';
|
|
|
13
13
|
import { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component';
|
|
14
14
|
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
15
15
|
import { BoundsProvider } from '../../model/bounds.model';
|
|
16
|
+
import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
|
|
16
17
|
/**
|
|
17
18
|
* Bar separator between panes.
|
|
18
19
|
* Used to resize the areas height or just draw a fixed line.
|
|
@@ -32,10 +33,11 @@ export declare class BarResizerComponent extends ChartBaseElement {
|
|
|
32
33
|
private canvasAnimation;
|
|
33
34
|
private config;
|
|
34
35
|
private canvasBoundsContainer;
|
|
36
|
+
private hitTestCanvasModel;
|
|
35
37
|
animationId: string;
|
|
36
38
|
initialY: number;
|
|
37
39
|
resizeEvent$: Subject<void>;
|
|
38
|
-
constructor(id: string, boundsProvider: BoundsProvider, hitTest: HitBoundsTest, dragTickCb: (yDelta: number) => void, chartPanComponent: ChartPanComponent, canvasModel: CanvasModel, drawingManager: DrawingManager, canvasInputListener: CanvasInputListenerComponent, canvasAnimation: CanvasAnimation, config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer);
|
|
40
|
+
constructor(id: string, boundsProvider: BoundsProvider, hitTest: HitBoundsTest, dragTickCb: (yDelta: number) => void, chartPanComponent: ChartPanComponent, canvasModel: CanvasModel, drawingManager: DrawingManager, canvasInputListener: CanvasInputListenerComponent, canvasAnimation: CanvasAnimation, config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer, hitTestCanvasModel: HitTestCanvasModel);
|
|
39
41
|
/**
|
|
40
42
|
* This method activates the pane resizer component.
|
|
41
43
|
* It calls the parent class's doActivate method and then checks if the fixedMode property is set to false in the config object.
|
|
@@ -17,7 +17,7 @@ import { BarResizerDrawer } from './bar-resizer.drawer';
|
|
|
17
17
|
* @doc-tags chart-core,resizer
|
|
18
18
|
*/
|
|
19
19
|
export class BarResizerComponent extends ChartBaseElement {
|
|
20
|
-
constructor(id, boundsProvider, hitTest, dragTickCb, chartPanComponent, canvasModel, drawingManager, canvasInputListener, canvasAnimation, config, canvasBoundsContainer) {
|
|
20
|
+
constructor(id, boundsProvider, hitTest, dragTickCb, chartPanComponent, canvasModel, drawingManager, canvasInputListener, canvasAnimation, config, canvasBoundsContainer, hitTestCanvasModel) {
|
|
21
21
|
super();
|
|
22
22
|
this.id = id;
|
|
23
23
|
this.boundsProvider = boundsProvider;
|
|
@@ -30,16 +30,21 @@ export class BarResizerComponent extends ChartBaseElement {
|
|
|
30
30
|
this.canvasAnimation = canvasAnimation;
|
|
31
31
|
this.config = config;
|
|
32
32
|
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
33
|
+
this.hitTestCanvasModel = hitTestCanvasModel;
|
|
33
34
|
this.initialY = 0;
|
|
34
35
|
this.resizeEvent$ = new Subject();
|
|
35
36
|
this.onYDragStart = () => {
|
|
36
37
|
this.config.components.crossTool.type = 'none';
|
|
37
38
|
this.initialY = this.boundsProvider().y;
|
|
39
|
+
// Stop redrawing hit test
|
|
40
|
+
this.hitTestCanvasModel.hitTestDrawersPredicateSubject.next(false);
|
|
38
41
|
};
|
|
39
42
|
this.onYDragEnd = () => {
|
|
40
43
|
this.config.components.crossTool.type = 'cross-and-labels';
|
|
41
44
|
this.initialY = this.boundsProvider().y;
|
|
42
45
|
this.canvasBoundsContainer.graphsHeightRatioChangedSubject.next(this.canvasBoundsContainer.graphsHeightRatio);
|
|
46
|
+
// Continue redrawing hit test
|
|
47
|
+
this.hitTestCanvasModel.hitTestDrawersPredicateSubject.next(true);
|
|
43
48
|
};
|
|
44
49
|
this.onYDragTick = (dragInfo) => {
|
|
45
50
|
const { delta: yDelta, draggedPixels } = dragInfo;
|
|
@@ -10,6 +10,7 @@ import { ScaleModel } from '../../model/scale.model';
|
|
|
10
10
|
import { Pixel, Unit } from '../../model/scaling/viewport.model';
|
|
11
11
|
import { ChartModel } from '../chart/chart.model';
|
|
12
12
|
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
13
|
+
import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
|
|
13
14
|
/**
|
|
14
15
|
* Handles the mouse drag on X axis - to zoom the viewport horizontally.
|
|
15
16
|
* @doc-tags scaling,zoom,viewport
|
|
@@ -20,10 +21,11 @@ export declare class XAxisScaleHandler extends ChartBaseElement {
|
|
|
20
21
|
private canvasBoundsContainer;
|
|
21
22
|
private chartPanComponent;
|
|
22
23
|
private chartModel;
|
|
24
|
+
private hitTestCanvasModel;
|
|
23
25
|
lastXStart: Unit;
|
|
24
26
|
lastXWidth: Unit;
|
|
25
27
|
lastXPxWidth: Pixel;
|
|
26
|
-
constructor(scale: ScaleModel, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, chartPanComponent: ChartPanComponent, chartModel: ChartModel);
|
|
28
|
+
constructor(scale: ScaleModel, canvasInputListener: CanvasInputListenerComponent, canvasBoundsContainer: CanvasBoundsContainer, chartPanComponent: ChartPanComponent, chartModel: ChartModel, hitTestCanvasModel: HitTestCanvasModel);
|
|
27
29
|
/**
|
|
28
30
|
* This method is used to activate the canvas input listener and add a subscription to it.
|
|
29
31
|
* It calls the parent class's doActivate method and then subscribes to the canvasInputListener's observeDbClick method.
|
|
@@ -35,4 +37,5 @@ export declare class XAxisScaleHandler extends ChartBaseElement {
|
|
|
35
37
|
protected doActivate(): void;
|
|
36
38
|
private onXDragStart;
|
|
37
39
|
private onXDragTick;
|
|
40
|
+
private onXDragEnd;
|
|
38
41
|
}
|