@devexperts/dxcharts-lite 2.7.15 → 2.7.17
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/animation/canvas-animation.d.ts +1 -0
- package/dist/chart/animation/canvas-animation.js +2 -1
- package/dist/chart/animation/viewport-model-animation.d.ts +4 -1
- package/dist/chart/animation/viewport-model-animation.js +21 -3
- package/dist/chart/bootstrap.js +17 -5
- package/dist/chart/chart.config.js +1 -1
- package/dist/chart/components/chart/chart-area-pan.handler.d.ts +16 -16
- package/dist/chart/components/chart/chart-area-pan.handler.js +8 -2
- package/dist/chart/components/chart/chart.component.js +2 -0
- package/dist/chart/components/chart/chart.model.d.ts +11 -0
- package/dist/chart/components/chart/chart.model.js +20 -0
- package/dist/chart/components/chart/price-formatters/__tests__/treasury-price.formatter.test.d.ts +6 -0
- package/dist/chart/components/chart/price-formatters/__tests__/treasury-price.formatter.test.js +94 -0
- package/dist/chart/components/chart/price-formatters/treasury-price.formatter.d.ts +9 -0
- package/dist/chart/components/chart/price-formatters/treasury-price.formatter.js +22 -1
- package/dist/chart/components/cross_tool/cross-tool.component.d.ts +3 -1
- package/dist/chart/components/cross_tool/cross-tool.component.js +3 -2
- package/dist/chart/components/cross_tool/cross-tool.model.d.ts +6 -3
- package/dist/chart/components/cross_tool/cross-tool.model.js +9 -5
- package/dist/chart/components/grid/grid.component.d.ts +1 -1
- package/dist/chart/components/grid/grid.component.js +2 -2
- package/dist/chart/components/grid/grid.drawer.d.ts +2 -1
- package/dist/chart/components/grid/grid.drawer.js +3 -2
- package/dist/chart/components/pan/chart-pan.component.js +17 -1
- package/dist/chart/components/pane/pane.component.js +3 -1
- package/dist/chart/drawers/data-series-drawers/trend-points.drawer.d.ts +12 -0
- package/dist/chart/drawers/data-series-drawers/trend-points.drawer.js +70 -0
- package/dist/chart/drawers/drawing-manager.js +0 -1
- package/dist/chart/inputhandlers/chart-resize.handler.d.ts +5 -0
- package/dist/chart/inputhandlers/chart-resize.handler.js +9 -1
- package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +28 -0
- package/dist/chart/inputlisteners/canvas-input-listener.component.js +104 -7
- package/dist/chart/model/data-series.config.d.ts +1 -1
- package/dist/chart/model/hit-test-canvas.model.d.ts +15 -13
- package/dist/chart/model/hit-test-canvas.model.js +2 -2
- package/dist/chart/model/scale.model.d.ts +5 -0
- package/dist/chart/model/scale.model.js +72 -6
- package/dist/chart/utils/device/touchpad.utils.d.ts +1 -0
- package/dist/chart/utils/device/touchpad.utils.js +1 -1
- package/dist/chart/utils/math.utils.js +1 -1
- package/dist/chart/utils/performance/queue-microtask.utils.d.ts +5 -0
- package/dist/chart/utils/performance/queue-microtask.utils.js +12 -0
- package/dist/chart/utils/performance/request-animation-frame-throttle.utils.d.ts +1 -0
- package/dist/chart/utils/performance/request-animation-frame-throttle.utils.js +3 -0
- package/dist/chart/utils/performance/safari/components/animations/safari-canvas-animation.d.ts +77 -0
- package/dist/chart/utils/performance/safari/components/animations/safari-canvas-animation.js +137 -0
- package/dist/chart/utils/performance/safari/components/chart-area-pan.handler/safari-chart-area-pan.handler.d.ts +54 -0
- package/dist/chart/utils/performance/safari/components/chart-area-pan.handler/safari-chart-area-pan.handler.js +180 -0
- package/dist/chart/utils/performance/safari/safari-performance.model.d.ts +32 -0
- package/dist/chart/utils/performance/safari/safari-performance.model.js +31 -0
- package/dist/chart/utils/performance/safari/safari-performance.utils.d.ts +18 -0
- package/dist/chart/utils/performance/safari/safari-performance.utils.js +34 -0
- package/dist/dxchart.min.js +4 -4
- package/package.json +2 -2
|
@@ -9,6 +9,7 @@ import { ViewportModel } from '../model/scaling/viewport.model';
|
|
|
9
9
|
import { ColorAlphaAnimation, ColorAlphaAnimationConfig } from './types/color-alpha-animation';
|
|
10
10
|
import { ColorTransitionAnimation, ColorTransitionAnimationConfig } from './types/color-transition-animation';
|
|
11
11
|
import { ViewportMovementAnimation, ViewportMovementAnimationConfig } from './types/viewport-movement-animation';
|
|
12
|
+
export declare const DEFAULT_ANIMATION_TIME_MS: number;
|
|
12
13
|
export declare const VIEWPORT_ANIMATION_ID = "VIEWPORT_ANIMATION";
|
|
13
14
|
export interface AnimationConfig {
|
|
14
15
|
duration: number;
|
|
@@ -9,7 +9,8 @@ import { uuid } from '../utils/uuid.utils';
|
|
|
9
9
|
import { ColorAlphaAnimation } from './types/color-alpha-animation';
|
|
10
10
|
import { ColorTransitionAnimation } from './types/color-transition-animation';
|
|
11
11
|
import { ViewportMovementAnimation } from './types/viewport-movement-animation';
|
|
12
|
-
|
|
12
|
+
import { isSafari } from '../utils/device/touchpad.utils';
|
|
13
|
+
export const DEFAULT_ANIMATION_TIME_MS = isSafari ? 150 : 400;
|
|
13
14
|
export const VIEWPORT_ANIMATION_ID = 'VIEWPORT_ANIMATION';
|
|
14
15
|
/**
|
|
15
16
|
* Singleton animation container for all chart animations.
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { CanvasAnimation } from './canvas-animation';
|
|
7
7
|
import { ViewportModel, ViewportModelState } from '../model/scaling/viewport.model';
|
|
8
|
+
import { AutoScaleViewportSubModel } from '../model/scaling/auto-scale.model';
|
|
8
9
|
/**
|
|
9
|
-
* Starts the animation for chart viewport movement.
|
|
10
|
+
* Starts the animation for chart viewport movement for safari.
|
|
10
11
|
* @param canvasAnimation
|
|
11
12
|
* @param viewportModel
|
|
12
13
|
* @param state
|
|
14
|
+
* @param autoScaleModel - Optional autoScale model to apply before animation
|
|
13
15
|
* @doc-tags animation,viewport
|
|
14
16
|
*/
|
|
17
|
+
export declare const startViewportModelAnimationSafari: (canvasAnimation: CanvasAnimation, viewportModel: ViewportModel, state: ViewportModelState, autoScaleModel?: AutoScaleViewportSubModel) => void;
|
|
15
18
|
export declare const startViewportModelAnimation: (canvasAnimation: CanvasAnimation, viewportModel: ViewportModel, state: ViewportModelState) => void;
|
|
@@ -3,15 +3,33 @@
|
|
|
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 { VIEWPORT_ANIMATION_ID } from './canvas-animation';
|
|
7
|
-
const VIEWPORT_ANIMATION_DURATION_MS =
|
|
6
|
+
import { DEFAULT_ANIMATION_TIME_MS, VIEWPORT_ANIMATION_ID } from './canvas-animation';
|
|
7
|
+
const VIEWPORT_ANIMATION_DURATION_MS = DEFAULT_ANIMATION_TIME_MS;
|
|
8
|
+
const STUCK_ANIMATION_THRESHOLD = 0.90; // Force finish animations stuck at 90%+
|
|
8
9
|
/**
|
|
9
|
-
* Starts the animation for chart viewport movement.
|
|
10
|
+
* Starts the animation for chart viewport movement for safari.
|
|
10
11
|
* @param canvasAnimation
|
|
11
12
|
* @param viewportModel
|
|
12
13
|
* @param state
|
|
14
|
+
* @param autoScaleModel - Optional autoScale model to apply before animation
|
|
13
15
|
* @doc-tags animation,viewport
|
|
14
16
|
*/
|
|
17
|
+
export const startViewportModelAnimationSafari = (canvasAnimation, viewportModel, state, autoScaleModel) => {
|
|
18
|
+
// Force finish stuck animations to prevent memory leaks
|
|
19
|
+
if (viewportModel.currentAnimation && viewportModel.currentAnimation.animationInProgress) {
|
|
20
|
+
const progress = viewportModel.currentAnimation.getProgress();
|
|
21
|
+
// Force finish animation if it's taking too long (prevent stuck animations)
|
|
22
|
+
if (progress > STUCK_ANIMATION_THRESHOLD) {
|
|
23
|
+
viewportModel.currentAnimation.finishAnimation();
|
|
24
|
+
viewportModel.currentAnimation = undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Apply autoScale BEFORE starting animation to get correct Y scale
|
|
28
|
+
if (autoScaleModel) {
|
|
29
|
+
autoScaleModel.doAutoYScale(state);
|
|
30
|
+
}
|
|
31
|
+
startViewportModelAnimation(canvasAnimation, viewportModel, state);
|
|
32
|
+
};
|
|
15
33
|
export const startViewportModelAnimation = (canvasAnimation, viewportModel, state) => {
|
|
16
34
|
const animation = canvasAnimation.startViewportMovementAnimation(viewportModel, {
|
|
17
35
|
duration: VIEWPORT_ANIMATION_DURATION_MS,
|
package/dist/chart/bootstrap.js
CHANGED
|
@@ -45,6 +45,8 @@ import { TimeZoneModel } from './model/time-zone.model';
|
|
|
45
45
|
import { clearerSafe } from './utils/function.utils';
|
|
46
46
|
import { merge } from './utils/merge.utils';
|
|
47
47
|
import { HitTestComponent } from './components/hit-test/hit-test.component';
|
|
48
|
+
import { isSafari } from './utils/device/touchpad.utils';
|
|
49
|
+
import { SafariCanvasAnimation } from './utils/performance/safari/components/animations/safari-canvas-animation';
|
|
48
50
|
/**
|
|
49
51
|
* @deprecated use {Chart} instead
|
|
50
52
|
*/
|
|
@@ -100,13 +102,23 @@ export default class ChartBootstrap {
|
|
|
100
102
|
this.canvasInputListener = canvasInputListener;
|
|
101
103
|
this.chartComponents.push(this.canvasInputListener);
|
|
102
104
|
//#endregion
|
|
103
|
-
const
|
|
105
|
+
const hitTestCanvasModelParams = [
|
|
106
|
+
eventBus,
|
|
107
|
+
elements.hitTestCanvas,
|
|
108
|
+
canvasInputListener,
|
|
109
|
+
canvasBoundsContainer,
|
|
110
|
+
drawingManager,
|
|
111
|
+
config,
|
|
112
|
+
this.canvasModels,
|
|
113
|
+
elements.chartResizer,
|
|
114
|
+
];
|
|
115
|
+
const hitTestCanvasModel = new HitTestCanvasModel(...hitTestCanvasModelParams);
|
|
104
116
|
this.hitTestCanvasModel = hitTestCanvasModel;
|
|
105
117
|
const hitTestClearCanvas = new ClearCanvasDrawer(hitTestCanvasModel);
|
|
106
118
|
drawingManager.addDrawer(hitTestClearCanvas, 'HIT_TEST_CLEAR');
|
|
107
119
|
//#endregion
|
|
108
|
-
// canvas animation container
|
|
109
|
-
const canvasAnimation = new CanvasAnimation(eventBus);
|
|
120
|
+
// canvas animation container, safari has separate animation logic due to browser specifics
|
|
121
|
+
const canvasAnimation = isSafari ? new SafariCanvasAnimation(eventBus) : new CanvasAnimation(eventBus);
|
|
110
122
|
this.canvasAnimation = canvasAnimation;
|
|
111
123
|
const chartPaneId = CanvasElement.PANE_UUID(CHART_UUID);
|
|
112
124
|
//#region ScaleModel init
|
|
@@ -181,11 +193,11 @@ export default class ChartBootstrap {
|
|
|
181
193
|
this.volumesComponent = new VolumesComponent(this.dynamicObjectsCanvasModel, chartComponent, scaleModel, canvasBoundsContainer, drawingManager, config, paneManager, this.dynamicObjects);
|
|
182
194
|
this.chartComponents.push(this.volumesComponent);
|
|
183
195
|
// grid component
|
|
184
|
-
const verticalGridComponent = new GridComponent(mainCanvasModel, scaleModel, config, this.yAxisComponent.state, 'GRID', drawingManager, () => this.canvasBoundsContainer.getBounds(CanvasElement.ALL_PANES), () => this.canvasBoundsContainer.getBounds(chartPaneId), () => this.xAxisComponent.xAxisLabelsGenerator.labels, () => [], undefined, undefined, () => config.components.grid.visible);
|
|
196
|
+
const verticalGridComponent = new GridComponent(mainCanvasModel, scaleModel, config, this.yAxisComponent.state, 'GRID', drawingManager, () => this.canvasBoundsContainer.getBounds(CanvasElement.ALL_PANES), () => this.canvasBoundsContainer.getBounds(chartPaneId), () => this.xAxisComponent.xAxisLabelsGenerator.labels, () => [], undefined, undefined, () => config.components.grid.visible, this.mainPane.mainExtent.idx);
|
|
185
197
|
this.chartComponents.push(verticalGridComponent);
|
|
186
198
|
this.hoverProducer = new HoverProducerComponent(this.crossEventProducer, scaleModel, config, chartModel, canvasInputListener, this.canvasBoundsContainer, this.paneManager, timeZoneModel, chartPanComponent.mainCanvasTouchHandler, formatterFactory);
|
|
187
199
|
this.chartComponents.push(this.hoverProducer);
|
|
188
|
-
this.crossToolComponent = new CrossToolComponent(config, crossToolCanvasModel, canvasBoundsContainer, drawingManager, paneManager, this.crossEventProducer, this.hoverProducer, this.chartComponent.baselineModel);
|
|
200
|
+
this.crossToolComponent = new CrossToolComponent(config, crossToolCanvasModel, canvasBoundsContainer, drawingManager, paneManager, this.crossEventProducer, this.hoverProducer, this.chartComponent.baselineModel, this.chartModel);
|
|
189
201
|
this.chartComponents.push(this.crossToolComponent);
|
|
190
202
|
// Snapshot component
|
|
191
203
|
const snapshotCanvasModel = createCanvasModel(eventBus, elements.snapshotCanvas, config, drawingManager, this.canvasModels, elements.chartResizer);
|
|
@@ -11,13 +11,14 @@ import { CanvasInputListenerComponent, Point } from '../../inputlisteners/canvas
|
|
|
11
11
|
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
|
+
import { DragInfo } from '../dran-n-drop_helper/drag-n-drop.component';
|
|
14
15
|
import { ChartPanComponent } from '../pan/chart-pan.component';
|
|
15
16
|
import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
|
|
16
17
|
export interface ChartWheelEvent {
|
|
17
18
|
readonly originalEvent: WheelEvent;
|
|
18
19
|
readonly candleIdx: number;
|
|
19
20
|
}
|
|
20
|
-
interface ChartPanningOptions {
|
|
21
|
+
export interface ChartPanningOptions {
|
|
21
22
|
horizontal: boolean;
|
|
22
23
|
vertical: boolean;
|
|
23
24
|
}
|
|
@@ -39,15 +40,15 @@ interface ChartPanningOptions {
|
|
|
39
40
|
* @param {ChartPanComponent} chartPanComponent - An instance of the ChartPanComponent class.
|
|
40
41
|
*/
|
|
41
42
|
export declare class ChartAreaPanHandler extends ChartBaseElement {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
protected bus: EventBus;
|
|
44
|
+
protected config: FullChartConfig;
|
|
45
|
+
protected scale: ScaleModel;
|
|
46
|
+
protected canvasInputListener: CanvasInputListenerComponent;
|
|
47
|
+
protected canvasBoundsContainer: CanvasBoundsContainer;
|
|
48
|
+
protected canvasAnimation: CanvasAnimation;
|
|
49
|
+
protected chartPanComponent: ChartPanComponent;
|
|
50
|
+
protected hitTestCanvasModel: HitTestCanvasModel;
|
|
51
|
+
protected currentPoint: Point;
|
|
51
52
|
xDraggedCandlesDelta: number;
|
|
52
53
|
lastXStart: number;
|
|
53
54
|
wheelThrottleTime: number;
|
|
@@ -64,14 +65,14 @@ export declare class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
64
65
|
* @param {number} zoomSensitivity - zoom sensitivity
|
|
65
66
|
* @returns {void}
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
|
+
protected zoomXHandler: (e: WheelEvent, zoomSensitivity: number) => void;
|
|
68
69
|
/**
|
|
69
70
|
* This method is used to activate the zoom functionality of the canvas. It extends the doActivate method of the parent class.
|
|
70
71
|
* @protected
|
|
71
72
|
* @returns {void}
|
|
72
73
|
*/
|
|
73
74
|
protected doActivate(): void;
|
|
74
|
-
|
|
75
|
+
protected calculateDynamicSesitivity(e: WheelEvent, maxSensitivity: number): number;
|
|
75
76
|
/**
|
|
76
77
|
* Registers a handler for panning the chart along the Y-axis.
|
|
77
78
|
* @param {ScaleModel} scale - The scale model of the extent.
|
|
@@ -79,9 +80,9 @@ export declare class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
79
80
|
* @returns {DragNDropYComponent} - The drag and drop component for panning the chart along the Y-axis.
|
|
80
81
|
*/
|
|
81
82
|
registerChartYPanHandler(scale: ScaleModel, hitTest: HitBoundsTest): DragNDropYComponent;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
protected onXDragStart: () => void;
|
|
84
|
+
protected onXDragTick: (dragInfo: DragInfo) => void;
|
|
85
|
+
protected onXDragEnd: () => void;
|
|
85
86
|
}
|
|
86
87
|
/**
|
|
87
88
|
* This function calculates angle between current point and point(0, 0), and compares the result with config values
|
|
@@ -91,4 +92,3 @@ export declare class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
91
92
|
* @doc-tags chart-core,auto-scale,y-axis
|
|
92
93
|
*/
|
|
93
94
|
export declare const shouldDisableAutoScale: (point: Point, config: Required<AutoScaleDisableOnDrag>) => boolean;
|
|
94
|
-
export {};
|
|
@@ -46,7 +46,10 @@ export class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
46
46
|
this.xDraggedCandlesDelta = 0;
|
|
47
47
|
this.lastXStart = 0;
|
|
48
48
|
this.wheelThrottleTime = 15; // in ms
|
|
49
|
-
this.chartPanningOptions = {
|
|
49
|
+
this.chartPanningOptions = {
|
|
50
|
+
horizontal: true,
|
|
51
|
+
vertical: true,
|
|
52
|
+
};
|
|
50
53
|
/**
|
|
51
54
|
* It observes the wheel event on all panes of the canvas and throttles it to the specified time.
|
|
52
55
|
* It then calculates the zoom sensitivity based on whether the event was triggered by a touchpad or not.
|
|
@@ -117,7 +120,10 @@ export class ChartAreaPanHandler extends ChartBaseElement {
|
|
|
117
120
|
//#endregion
|
|
118
121
|
this.addRxSubscription(this.canvasInputListener
|
|
119
122
|
.observeWheel(allPanesHitTest)
|
|
120
|
-
.pipe(filter(() => this.chartPanningOptions.horizontal && this.chartPanningOptions.vertical), throttleTime(this.wheelThrottleTime, animationFrameScheduler, {
|
|
123
|
+
.pipe(filter(() => this.chartPanningOptions.horizontal && this.chartPanningOptions.vertical), throttleTime(this.wheelThrottleTime, animationFrameScheduler, {
|
|
124
|
+
trailing: true,
|
|
125
|
+
leading: true,
|
|
126
|
+
}))
|
|
121
127
|
.subscribe(e => {
|
|
122
128
|
const device = deviceDetector();
|
|
123
129
|
const direction = device === 'apple' || device === 'mobile' ? -1 : 1;
|
|
@@ -34,6 +34,7 @@ import { deleteCandlesIndex } from './candle.functions';
|
|
|
34
34
|
import { TrendHistogramDrawer } from '../../drawers/data-series-drawers/trend-histogram.drawer';
|
|
35
35
|
import { debounce } from '../../utils/performance/debounce.utils';
|
|
36
36
|
import { LinearTrendDrawer } from '../../drawers/data-series-drawers/linear-trend.drawer';
|
|
37
|
+
import { TrendPointsDrawer } from '../../drawers/data-series-drawers/trend-points.drawer';
|
|
37
38
|
/**
|
|
38
39
|
* Represents a financial instrument to be displayed on a chart
|
|
39
40
|
* @class
|
|
@@ -187,6 +188,7 @@ export class ChartComponent extends ChartBaseElement {
|
|
|
187
188
|
this.registerDataSeriesTypeDrawer('HISTOGRAM', new HistogramDrawer());
|
|
188
189
|
this.registerDataSeriesTypeDrawer('TREND_HISTOGRAM', new TrendHistogramDrawer());
|
|
189
190
|
this.registerDataSeriesTypeDrawer('POINTS', new PointsDrawer());
|
|
191
|
+
this.registerDataSeriesTypeDrawer('TREND_POINTS', new TrendPointsDrawer());
|
|
190
192
|
this.registerDataSeriesTypeDrawer('COLOR_CANDLE', new CandleSeriesWrapper(new ColorCandleDrawer(this.chartModel), this.config, mainChartBoundsProvider));
|
|
191
193
|
this.registerDataSeriesTypeDrawer('TEXT', new TextDrawer(this.config));
|
|
192
194
|
this.registerDataSeriesTypeDrawer('TRIANGLE', new TriangleDrawer());
|
|
@@ -109,6 +109,12 @@ export declare class ChartModel extends ChartBaseElement {
|
|
|
109
109
|
* Applies the basic scale viewport transformer to the visual points of the main candle series and fires a draw event.
|
|
110
110
|
*/
|
|
111
111
|
doBasicScale(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Applies the basic scale only on x-axis.
|
|
114
|
+
* @param forceNoAnimations - A boolean value for disabling scale animations. Defaults to false.
|
|
115
|
+
* @param withZoom - A boolean value for enabling zoom. Defaults to false.
|
|
116
|
+
*/
|
|
117
|
+
doBasicXScale(): void;
|
|
112
118
|
/**
|
|
113
119
|
* Changes the time frame scale to the previous one and redraws the chart.
|
|
114
120
|
* @param {boolean | null} zoomIn - If true, zooms in the chart, if false, zooms out the chart, if null, does not zoom.
|
|
@@ -370,6 +376,11 @@ export declare class ChartModel extends ChartBaseElement {
|
|
|
370
376
|
* @returns {boolean} - True if the candle is within the viewport, false otherwise.
|
|
371
377
|
*/
|
|
372
378
|
isCandleInViewport(idx: number): boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Checks if the last candle is within the viewport.
|
|
381
|
+
* @returns {boolean} - True if the last candle is within the viewport, false otherwise.
|
|
382
|
+
*/
|
|
383
|
+
isLastCandleInViewport(): boolean;
|
|
373
384
|
/**
|
|
374
385
|
* Updates candles in series. Default is main series.
|
|
375
386
|
* Any number of candles may be provided - they would be matched by their index and updated.
|
|
@@ -254,6 +254,15 @@ export class ChartModel extends ChartBaseElement {
|
|
|
254
254
|
this.basicScaleViewportTransformer(this.mainCandleSeries.visualPoints);
|
|
255
255
|
this.bus.fireDraw();
|
|
256
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Applies the basic scale only on x-axis.
|
|
259
|
+
* @param forceNoAnimations - A boolean value for disabling scale animations. Defaults to false.
|
|
260
|
+
* @param withZoom - A boolean value for enabling zoom. Defaults to false.
|
|
261
|
+
*/
|
|
262
|
+
doBasicXScale() {
|
|
263
|
+
this.scale.setXScaleWithoutYScale(this.mainCandleSeries.visualPoints);
|
|
264
|
+
this.bus.fireDraw();
|
|
265
|
+
}
|
|
257
266
|
/**
|
|
258
267
|
* Changes the time frame scale to the previous one and redraws the chart.
|
|
259
268
|
* @param {boolean | null} zoomIn - If true, zooms in the chart, if false, zooms out the chart, if null, does not zoom.
|
|
@@ -746,6 +755,17 @@ export class ChartModel extends ChartBaseElement {
|
|
|
746
755
|
isCandleInViewport(idx) {
|
|
747
756
|
return this.getFirstIdx() <= idx && idx <= this.getLastIdx();
|
|
748
757
|
}
|
|
758
|
+
/**
|
|
759
|
+
* Checks if the last candle is within the viewport.
|
|
760
|
+
* @returns {boolean} - True if the last candle is within the viewport, false otherwise.
|
|
761
|
+
*/
|
|
762
|
+
isLastCandleInViewport() {
|
|
763
|
+
const lastCandle = this.getLastCandle();
|
|
764
|
+
if (lastCandle && lastCandle.idx) {
|
|
765
|
+
return this.isCandleInViewport(lastCandle.idx);
|
|
766
|
+
}
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
749
769
|
/**
|
|
750
770
|
* Updates candles in series. Default is main series.
|
|
751
771
|
* Any number of candles may be provided - they would be matched by their index and updated.
|
package/dist/chart/components/chart/price-formatters/__tests__/treasury-price.formatter.test.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2025 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 {};
|
package/dist/chart/components/chart/price-formatters/__tests__/treasury-price.formatter.test.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 - 2025 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 { treasuryPriceFormatter, parseTreasuryPrice, isTreasuryPriceFormat, TREASURY_32ND } from '../treasury-price.formatter';
|
|
7
|
+
describe('Treasury Price Formatter', () => {
|
|
8
|
+
describe('treasuryPriceFormatter', () => {
|
|
9
|
+
it('should format decimal prices to treasury format', () => {
|
|
10
|
+
expect(treasuryPriceFormatter(132.0)).toBe("132'00");
|
|
11
|
+
expect(treasuryPriceFormatter(132.0625)).toBe("132'02");
|
|
12
|
+
expect(treasuryPriceFormatter(132.3125)).toBe("132'10");
|
|
13
|
+
expect(treasuryPriceFormatter(132.5)).toBe("132'16");
|
|
14
|
+
expect(treasuryPriceFormatter(132.96875)).toBe("132'31");
|
|
15
|
+
});
|
|
16
|
+
it('should handle edge cases', () => {
|
|
17
|
+
expect(treasuryPriceFormatter(0)).toBe("0'00");
|
|
18
|
+
expect(treasuryPriceFormatter(0.03125)).toBe("0'01");
|
|
19
|
+
expect(treasuryPriceFormatter(1.0)).toBe("1'00");
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
describe('parseTreasuryPrice', () => {
|
|
23
|
+
it('should parse treasury format back to decimal', () => {
|
|
24
|
+
expect(parseTreasuryPrice("132'00")).toBe(132.0);
|
|
25
|
+
expect(parseTreasuryPrice("132'02")).toBe(132.0625);
|
|
26
|
+
expect(parseTreasuryPrice("132'10")).toBe(132.3125);
|
|
27
|
+
expect(parseTreasuryPrice("132'16")).toBe(132.5);
|
|
28
|
+
expect(parseTreasuryPrice("132'31")).toBe(132.96875);
|
|
29
|
+
});
|
|
30
|
+
it('should handle edge cases', () => {
|
|
31
|
+
expect(parseTreasuryPrice("0'00")).toBe(0);
|
|
32
|
+
expect(parseTreasuryPrice("0'01")).toBe(0.03125);
|
|
33
|
+
expect(parseTreasuryPrice("1'00")).toBe(1.0);
|
|
34
|
+
});
|
|
35
|
+
it('should return NaN for invalid formats', () => {
|
|
36
|
+
expect(parseTreasuryPrice("invalid")).toBe(NaN);
|
|
37
|
+
expect(parseTreasuryPrice("132'")).toBe(NaN);
|
|
38
|
+
expect(parseTreasuryPrice("'10")).toBe(NaN);
|
|
39
|
+
expect(parseTreasuryPrice("132'1")).toBe(NaN);
|
|
40
|
+
expect(parseTreasuryPrice("132'100")).toBe(NaN);
|
|
41
|
+
expect(parseTreasuryPrice("abc123")).toBe(NaN);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('isTreasuryPriceFormat', () => {
|
|
45
|
+
it('should identify valid treasury format strings', () => {
|
|
46
|
+
expect(isTreasuryPriceFormat("132'00")).toBe(true);
|
|
47
|
+
expect(isTreasuryPriceFormat("132'10")).toBe(true);
|
|
48
|
+
expect(isTreasuryPriceFormat("0'00")).toBe(true);
|
|
49
|
+
expect(isTreasuryPriceFormat("1'31")).toBe(true);
|
|
50
|
+
});
|
|
51
|
+
it('should reject invalid formats', () => {
|
|
52
|
+
expect(isTreasuryPriceFormat("invalid")).toBe(false);
|
|
53
|
+
expect(isTreasuryPriceFormat("132")).toBe(false);
|
|
54
|
+
expect(isTreasuryPriceFormat("132'")).toBe(false);
|
|
55
|
+
expect(isTreasuryPriceFormat("'10")).toBe(false);
|
|
56
|
+
expect(isTreasuryPriceFormat("132'1")).toBe(false);
|
|
57
|
+
expect(isTreasuryPriceFormat("132'100")).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe('TREASURY_32ND constant', () => {
|
|
61
|
+
it('should equal 1/32', () => {
|
|
62
|
+
expect(TREASURY_32ND).toBe(1 / 32);
|
|
63
|
+
expect(TREASURY_32ND).toBe(0.03125);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
describe('Round trip conversion', () => {
|
|
67
|
+
it('should maintain precision through format and parse cycle', () => {
|
|
68
|
+
const originalPrice = 234.3125;
|
|
69
|
+
const formatted = treasuryPriceFormatter(originalPrice);
|
|
70
|
+
const parsed = parseTreasuryPrice(formatted);
|
|
71
|
+
expect(parsed).toBe(originalPrice);
|
|
72
|
+
});
|
|
73
|
+
it('should work with various precision levels', () => {
|
|
74
|
+
const testCases = [
|
|
75
|
+
132.0, // 132'00
|
|
76
|
+
132.03125, // 132'01
|
|
77
|
+
132.0625, // 132'02
|
|
78
|
+
132.09375, // 132'03
|
|
79
|
+
132.125, // 132'04
|
|
80
|
+
132.15625, // 132'05
|
|
81
|
+
132.1875, // 132'06
|
|
82
|
+
132.21875, // 132'07
|
|
83
|
+
132.25, // 132'08
|
|
84
|
+
132.28125, // 132'09
|
|
85
|
+
132.3125, // 132'10
|
|
86
|
+
];
|
|
87
|
+
testCases.forEach(price => {
|
|
88
|
+
const formatted = treasuryPriceFormatter(price);
|
|
89
|
+
const parsed = parseTreasuryPrice(formatted);
|
|
90
|
+
expect(parsed).toBe(price);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -15,3 +15,12 @@
|
|
|
15
15
|
export declare const TREASURY_32ND: number;
|
|
16
16
|
export declare const treasuryPriceFormatter: (value: number) => string;
|
|
17
17
|
export declare const isTreasuryPriceFormat: (value: string) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Parses treasury price format back to decimal number
|
|
20
|
+
*
|
|
21
|
+
* Examples:
|
|
22
|
+
* 132'00 => 132.0
|
|
23
|
+
* 132'02 => 132.0625
|
|
24
|
+
* 132'10 => 132.3125
|
|
25
|
+
*/
|
|
26
|
+
export declare const parseTreasuryPrice: (value: string) => number;
|
|
@@ -24,4 +24,25 @@ export const treasuryPriceFormatter = (value) => {
|
|
|
24
24
|
const thirtySecondsFormatted = thirtySeconds.toString().padStart(2, '0');
|
|
25
25
|
return `${integerValue}'${thirtySecondsFormatted}`;
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
const getTreasuryPriceMatch = (value) => value.match(/^\-?0*(\d+)'(\d{2})$/);
|
|
28
|
+
export const isTreasuryPriceFormat = (value) => Boolean(getTreasuryPriceMatch(value));
|
|
29
|
+
/**
|
|
30
|
+
* Parses treasury price format back to decimal number
|
|
31
|
+
*
|
|
32
|
+
* Examples:
|
|
33
|
+
* 132'00 => 132.0
|
|
34
|
+
* 132'02 => 132.0625
|
|
35
|
+
* 132'10 => 132.3125
|
|
36
|
+
*/
|
|
37
|
+
export const parseTreasuryPrice = (value) => {
|
|
38
|
+
const match = getTreasuryPriceMatch(value);
|
|
39
|
+
if (match) {
|
|
40
|
+
const integerPart = parseInt(match[1], 10);
|
|
41
|
+
const thirtySeconds = parseInt(match[2], 10);
|
|
42
|
+
// Convert 32nds to decimal
|
|
43
|
+
const decimalPart = (thirtySeconds * TREASURY_32ND);
|
|
44
|
+
return integerPart + decimalPart;
|
|
45
|
+
}
|
|
46
|
+
// Return Number(value) for non-treasury formats (this will be NaN for invalid strings)
|
|
47
|
+
return Number(value);
|
|
48
|
+
};
|
|
@@ -11,6 +11,7 @@ import { HoverProducerComponent } from '../../inputhandlers/hover-producer.compo
|
|
|
11
11
|
import { BaselineModel } from '../../model/baseline.model';
|
|
12
12
|
import { CanvasModel } from '../../model/canvas.model';
|
|
13
13
|
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
14
|
+
import { ChartModel } from '../chart/chart.model';
|
|
14
15
|
import { PaneManager } from '../pane/pane-manager.component';
|
|
15
16
|
import { CrossToolTypeDrawer } from './cross-tool.drawer';
|
|
16
17
|
import { CrossToolModel, CrossToolType } from './cross-tool.model';
|
|
@@ -27,9 +28,10 @@ export declare class CrossToolComponent extends ChartBaseElement {
|
|
|
27
28
|
private crossEventProducer;
|
|
28
29
|
private hoverProducer;
|
|
29
30
|
private baselineModel;
|
|
31
|
+
private chartModel;
|
|
30
32
|
readonly model: CrossToolModel;
|
|
31
33
|
private readonly crossToolTypeDrawers;
|
|
32
|
-
constructor(config: FullChartConfig, crossToolCanvasModel: CanvasModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, paneManager: PaneManager, crossEventProducer: CrossEventProducerComponent, hoverProducer: HoverProducerComponent, baselineModel: BaselineModel);
|
|
34
|
+
constructor(config: FullChartConfig, crossToolCanvasModel: CanvasModel, canvasBoundsContainer: CanvasBoundsContainer, drawingManager: DrawingManager, paneManager: PaneManager, crossEventProducer: CrossEventProducerComponent, hoverProducer: HoverProducerComponent, baselineModel: BaselineModel, chartModel: ChartModel);
|
|
33
35
|
/**
|
|
34
36
|
* Registers default drawer types for the chart.
|
|
35
37
|
* @private
|
|
@@ -14,7 +14,7 @@ import { NoneDrawerType } from './types/none.drawer';
|
|
|
14
14
|
* Default bundled chart cross tool.
|
|
15
15
|
*/
|
|
16
16
|
export class CrossToolComponent extends ChartBaseElement {
|
|
17
|
-
constructor(config, crossToolCanvasModel, canvasBoundsContainer, drawingManager, paneManager, crossEventProducer, hoverProducer, baselineModel) {
|
|
17
|
+
constructor(config, crossToolCanvasModel, canvasBoundsContainer, drawingManager, paneManager, crossEventProducer, hoverProducer, baselineModel, chartModel) {
|
|
18
18
|
super();
|
|
19
19
|
this.config = config;
|
|
20
20
|
this.crossToolCanvasModel = crossToolCanvasModel;
|
|
@@ -24,8 +24,9 @@ export class CrossToolComponent extends ChartBaseElement {
|
|
|
24
24
|
this.crossEventProducer = crossEventProducer;
|
|
25
25
|
this.hoverProducer = hoverProducer;
|
|
26
26
|
this.baselineModel = baselineModel;
|
|
27
|
+
this.chartModel = chartModel;
|
|
27
28
|
this.crossToolTypeDrawers = {};
|
|
28
|
-
this.model = new CrossToolModel(config.components.crossTool, this.crossToolCanvasModel, this.crossEventProducer, this.hoverProducer, this.canvasBoundsContainer, this.baselineModel);
|
|
29
|
+
this.model = new CrossToolModel(config.components.crossTool, this.crossToolCanvasModel, this.crossEventProducer, this.hoverProducer, this.canvasBoundsContainer, this.baselineModel, this.chartModel);
|
|
29
30
|
this.addChildEntity(this.model);
|
|
30
31
|
const clearCanvasDrawer = new ClearCanvasDrawer(this.crossToolCanvasModel);
|
|
31
32
|
this.registerDefaultDrawerTypes();
|
|
@@ -11,6 +11,7 @@ import { CanvasModel } from '../../model/canvas.model';
|
|
|
11
11
|
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
12
12
|
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
13
13
|
import { BaselineModel } from '../../model/baseline.model';
|
|
14
|
+
import { ChartModel } from '../chart/chart.model';
|
|
14
15
|
export type CrossToolType = 'cross-and-labels' | 'only-labels' | 'none' | string;
|
|
15
16
|
export interface CrossToolHover {
|
|
16
17
|
x: number;
|
|
@@ -25,10 +26,11 @@ export declare class CrossToolModel extends ChartBaseElement {
|
|
|
25
26
|
private hoverProducer;
|
|
26
27
|
private canvasBoundsContainer;
|
|
27
28
|
private baselineModel;
|
|
29
|
+
private chartModel;
|
|
28
30
|
currentHoverSubject: BehaviorSubject<CrossToolHover | null>;
|
|
29
31
|
get currentHover(): CrossToolHover | null;
|
|
30
32
|
set currentHover(value: CrossToolHover | null);
|
|
31
|
-
constructor(config: Required<ChartConfigComponentsCrossTool>, crossToolCanvasModel: CanvasModel, crossEventProducer: CrossEventProducerComponent, hoverProducer: HoverProducerComponent, canvasBoundsContainer: CanvasBoundsContainer, baselineModel: BaselineModel);
|
|
33
|
+
constructor(config: Required<ChartConfigComponentsCrossTool>, crossToolCanvasModel: CanvasModel, crossEventProducer: CrossEventProducerComponent, hoverProducer: HoverProducerComponent, canvasBoundsContainer: CanvasBoundsContainer, baselineModel: BaselineModel, chartModel: ChartModel);
|
|
32
34
|
/**
|
|
33
35
|
* Sets the type of the CrossTool object.
|
|
34
36
|
*
|
|
@@ -49,7 +51,8 @@ export declare class CrossToolModel extends ChartBaseElement {
|
|
|
49
51
|
/**
|
|
50
52
|
* Updates the current hover position with the provided hover object.
|
|
51
53
|
* @param {Object} hover - The hover object containing the x and y coordinates and time formatted.
|
|
52
|
-
* @param
|
|
54
|
+
* @param {MagnetTarget} magnetTarget
|
|
55
|
+
* @param {boolean} discrete
|
|
53
56
|
* @param {number} hover.x - The x coordinate of the hover.
|
|
54
57
|
* @param {number} hover.y - The y coordinate of the hover.
|
|
55
58
|
* @param {string} hover.timeFormatted - The formatted time of the hover.
|
|
@@ -61,6 +64,6 @@ export declare class CrossToolModel extends ChartBaseElement {
|
|
|
61
64
|
* @param {number} hover.candleHover.closestOHLCY - The y coordinate of the closest OHLC price of the candle.
|
|
62
65
|
* @returns {void}
|
|
63
66
|
*/
|
|
64
|
-
updateCrossTool(hover: Hover, magnetTarget?: import("./cross-tool.component").MagnetTarget): void;
|
|
67
|
+
updateCrossTool(hover: Hover, magnetTarget?: import("./cross-tool.component").MagnetTarget, discrete?: boolean): void;
|
|
65
68
|
private updateCrossToolMobile;
|
|
66
69
|
}
|
|
@@ -14,7 +14,7 @@ export class CrossToolModel extends ChartBaseElement {
|
|
|
14
14
|
set currentHover(value) {
|
|
15
15
|
this.currentHoverSubject.next(value);
|
|
16
16
|
}
|
|
17
|
-
constructor(config, crossToolCanvasModel, crossEventProducer, hoverProducer, canvasBoundsContainer, baselineModel) {
|
|
17
|
+
constructor(config, crossToolCanvasModel, crossEventProducer, hoverProducer, canvasBoundsContainer, baselineModel, chartModel) {
|
|
18
18
|
super();
|
|
19
19
|
this.config = config;
|
|
20
20
|
this.crossToolCanvasModel = crossToolCanvasModel;
|
|
@@ -22,6 +22,7 @@ export class CrossToolModel extends ChartBaseElement {
|
|
|
22
22
|
this.hoverProducer = hoverProducer;
|
|
23
23
|
this.canvasBoundsContainer = canvasBoundsContainer;
|
|
24
24
|
this.baselineModel = baselineModel;
|
|
25
|
+
this.chartModel = chartModel;
|
|
25
26
|
// the main hover object which will be presented on UI
|
|
26
27
|
this.currentHoverSubject = new BehaviorSubject(null);
|
|
27
28
|
}
|
|
@@ -84,7 +85,8 @@ export class CrossToolModel extends ChartBaseElement {
|
|
|
84
85
|
/**
|
|
85
86
|
* Updates the current hover position with the provided hover object.
|
|
86
87
|
* @param {Object} hover - The hover object containing the x and y coordinates and time formatted.
|
|
87
|
-
* @param
|
|
88
|
+
* @param {MagnetTarget} magnetTarget
|
|
89
|
+
* @param {boolean} discrete
|
|
88
90
|
* @param {number} hover.x - The x coordinate of the hover.
|
|
89
91
|
* @param {number} hover.y - The y coordinate of the hover.
|
|
90
92
|
* @param {string} hover.timeFormatted - The formatted time of the hover.
|
|
@@ -96,12 +98,14 @@ export class CrossToolModel extends ChartBaseElement {
|
|
|
96
98
|
* @param {number} hover.candleHover.closestOHLCY - The y coordinate of the closest OHLC price of the candle.
|
|
97
99
|
* @returns {void}
|
|
98
100
|
*/
|
|
99
|
-
updateCrossTool(hover, magnetTarget = this.config.magnetTarget) {
|
|
101
|
+
updateCrossTool(hover, magnetTarget = this.config.magnetTarget, discrete = this.config.discrete) {
|
|
102
|
+
var _a;
|
|
103
|
+
const x = discrete ? this.chartModel.toX((_a = this.chartModel.candleFromX(hover.x, true).idx) !== null && _a !== void 0 ? _a : 0) : hover.x;
|
|
100
104
|
if (this.currentHover === null) {
|
|
101
|
-
this.currentHover = { x
|
|
105
|
+
this.currentHover = { x, y: 0, time: hover.timeFormatted, paneId: hover.paneId };
|
|
102
106
|
}
|
|
103
107
|
else {
|
|
104
|
-
this.currentHover.x =
|
|
108
|
+
this.currentHover.x = x;
|
|
105
109
|
this.currentHover.time = hover.timeFormatted;
|
|
106
110
|
}
|
|
107
111
|
if (hover.candleHover && hover.paneId === CHART_UUID) {
|
|
@@ -15,7 +15,7 @@ export declare class GridComponent extends ChartBaseElement {
|
|
|
15
15
|
private drawerName;
|
|
16
16
|
private drawingManager;
|
|
17
17
|
private readonly drawer;
|
|
18
|
-
constructor(canvasModel: CanvasModel, viewportModel: ViewportModel, config: FullChartConfig, yAxisState: YAxisConfig, drawerName: string, drawingManager: DrawingManager | CompositeDrawer, xBoundsProvider: BoundsProvider, yBoundsProvider: BoundsProvider, xLabelsProvider: () => NumericAxisLabel[], yLabelsProvider: () => NumericAxisLabel[], extentIdx?: number, getBaseline?: () => Unit, drawPredicate?: () => boolean);
|
|
18
|
+
constructor(canvasModel: CanvasModel, viewportModel: ViewportModel, config: FullChartConfig, yAxisState: YAxisConfig, drawerName: string, drawingManager: DrawingManager | CompositeDrawer, xBoundsProvider: BoundsProvider, yBoundsProvider: BoundsProvider, xLabelsProvider: () => NumericAxisLabel[], yLabelsProvider: () => NumericAxisLabel[], extentIdx?: number, getBaseline?: () => Unit, drawPredicate?: () => boolean, mainExtentIdx?: number);
|
|
19
19
|
/**
|
|
20
20
|
* This method is used to deactivate the drawer and remove it from the drawing manager.
|
|
21
21
|
* @protected
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
7
7
|
import { GridDrawer } from './grid.drawer';
|
|
8
8
|
export class GridComponent extends ChartBaseElement {
|
|
9
|
-
constructor(canvasModel, viewportModel, config, yAxisState, drawerName, drawingManager, xBoundsProvider, yBoundsProvider, xLabelsProvider, yLabelsProvider, extentIdx, getBaseline, drawPredicate) {
|
|
9
|
+
constructor(canvasModel, viewportModel, config, yAxisState, drawerName, drawingManager, xBoundsProvider, yBoundsProvider, xLabelsProvider, yLabelsProvider, extentIdx, getBaseline, drawPredicate, mainExtentIdx) {
|
|
10
10
|
super();
|
|
11
11
|
this.drawerName = drawerName;
|
|
12
12
|
this.drawingManager = drawingManager;
|
|
13
|
-
this.drawer = new GridDrawer(canvasModel, viewportModel, config, yAxisState, xBoundsProvider, yBoundsProvider, xLabelsProvider, yLabelsProvider, drawPredicate, extentIdx, getBaseline);
|
|
13
|
+
this.drawer = new GridDrawer(canvasModel, viewportModel, config, yAxisState, xBoundsProvider, yBoundsProvider, xLabelsProvider, yLabelsProvider, drawPredicate, extentIdx, getBaseline, mainExtentIdx);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* This method is used to deactivate the drawer and remove it from the drawing manager.
|
|
@@ -28,7 +28,8 @@ export declare class GridDrawer implements Drawer {
|
|
|
28
28
|
private drawPredicate;
|
|
29
29
|
private extentIdx?;
|
|
30
30
|
private getBaseline?;
|
|
31
|
-
|
|
31
|
+
private mainExtentIdx?;
|
|
32
|
+
constructor(canvasModel: CanvasModel, viewportModel: ViewportModel, config: FullChartConfig, yAxisState: YAxisConfig, xBoundsProvider: BoundsProvider, yBoundsProvider: BoundsProvider, xLabelsProvider: () => NumericAxisLabel[], yLabelsProvider: () => NumericAxisLabel[], drawPredicate?: () => boolean, extentIdx?: number | undefined, getBaseline?: (() => Unit) | undefined, mainExtentIdx?: number | undefined);
|
|
32
33
|
/**
|
|
33
34
|
* Draws the chart on the canvas if the drawPredicate is true.
|
|
34
35
|
* @returns {void}
|