@devexperts/dxcharts-lite 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -29
- package/dist/chart/bootstrap.d.ts +7 -2
- package/dist/chart/bootstrap.js +2 -2
- package/dist/chart/chart.d.ts +2 -0
- package/dist/chart/chart.js +3 -1
- package/dist/chart/components/chart/candle-transformer.functions.d.ts +1 -0
- package/dist/chart/components/chart/candle-transformer.functions.js +1 -0
- package/dist/chart/components/chart/chart-base.model.d.ts +1 -1
- package/dist/chart/components/chart/chart-base.model.js +2 -2
- package/dist/chart/components/chart/chart.component.d.ts +6 -0
- package/dist/chart/components/chart/chart.component.js +10 -1
- package/dist/chart/components/chart/chart.model.d.ts +7 -1
- package/dist/chart/components/chart/chart.model.js +26 -6
- package/dist/chart/components/pane/pane-hit-test.controller.d.ts +2 -2
- package/dist/chart/components/pane/pane-hit-test.controller.js +5 -5
- package/dist/chart/components/pane/pane-manager.component.d.ts +2 -1
- package/dist/chart/components/pane/pane-manager.component.js +4 -3
- package/dist/chart/components/watermark/water-mark.component.js +1 -1
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.d.ts +4 -3
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +7 -6
- package/dist/chart/components/y_axis/y-axis.model.d.ts +1 -0
- package/dist/chart/components/y_axis/y-axis.model.js +2 -1
- package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +7 -0
- package/dist/chart/inputlisteners/canvas-input-listener.component.js +12 -1
- package/dist/chart/model/scale.model.d.ts +1 -1
- package/dist/chart/model/scale.model.js +11 -11
- package/dist/chart/model/scaling/auto-scale.model.d.ts +2 -4
- package/dist/chart/model/scaling/auto-scale.model.js +4 -10
- package/dist/dxchart.min.js +4 -4
- package/package.json +12 -1
- package/dist/chart/chart-container.d.ts +0 -18
- package/dist/chart/chart-container.js +0 -6
|
@@ -53,7 +53,7 @@ export class ScaleModel extends ViewportModel {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* The method adds a new "constraint" to the existing list of x-axis constraints for charting.
|
|
56
|
-
* The "
|
|
56
|
+
* The "constraint" is expected to be an object containing information about the constraints, such as the minimum and maximum values for the x-axis.
|
|
57
57
|
* @param constraint
|
|
58
58
|
*/
|
|
59
59
|
addXConstraint(constraint) {
|
|
@@ -112,7 +112,7 @@ export class ScaleModel extends ViewportModel {
|
|
|
112
112
|
lockedYEndViewportCalculator(constrainedState, this.zoomXYRatio);
|
|
113
113
|
}
|
|
114
114
|
if (this.state.auto) {
|
|
115
|
-
this.autoScaleModel.
|
|
115
|
+
this.autoScaleModel.doAutoYScale(constrainedState);
|
|
116
116
|
}
|
|
117
117
|
if (forceNoAnimation) {
|
|
118
118
|
this.apply(constrainedState);
|
|
@@ -133,14 +133,14 @@ export class ScaleModel extends ViewportModel {
|
|
|
133
133
|
const initialState = this.export();
|
|
134
134
|
super.setXScale(xStart, xEnd, false);
|
|
135
135
|
const state = this.export();
|
|
136
|
-
const
|
|
136
|
+
const constrainedState = this.scalePostProcessor(initialState, state);
|
|
137
137
|
if (this.state.lockPriceToBarRatio) {
|
|
138
|
-
lockedYEndViewportCalculator(
|
|
138
|
+
lockedYEndViewportCalculator(constrainedState, this.zoomXYRatio);
|
|
139
139
|
}
|
|
140
140
|
if (this.state.auto) {
|
|
141
|
-
this.autoScaleModel.
|
|
141
|
+
this.autoScaleModel.doAutoYScale(constrainedState);
|
|
142
142
|
}
|
|
143
|
-
this.apply(
|
|
143
|
+
this.apply(constrainedState);
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* Moves both xStart and xEnd without changing the viewport width (zoom).
|
|
@@ -153,12 +153,12 @@ export class ScaleModel extends ViewportModel {
|
|
|
153
153
|
// always stop the animations
|
|
154
154
|
this.haltAnimation();
|
|
155
155
|
moveXStart(state, xStart);
|
|
156
|
-
// there we need only candles
|
|
157
|
-
const
|
|
156
|
+
// there we need only candles constraint
|
|
157
|
+
const constrainedState = this.scalePostProcessor(initialStateCopy, state);
|
|
158
158
|
if (this.state.auto) {
|
|
159
|
-
this.autoScaleModel.
|
|
159
|
+
this.autoScaleModel.doAutoYScale(constrainedState);
|
|
160
160
|
}
|
|
161
|
-
this.apply(
|
|
161
|
+
this.apply(constrainedState);
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* Moves both yStart and yEnd without changing the viewport height (zoom).
|
|
@@ -184,7 +184,7 @@ export class ScaleModel extends ViewportModel {
|
|
|
184
184
|
// dont auto-scale if animation, otherwise - forced or config
|
|
185
185
|
if ((!this.isViewportAnimationInProgress() && this.state.auto) || forceApply) {
|
|
186
186
|
const state = this.export();
|
|
187
|
-
this.autoScaleModel.
|
|
187
|
+
this.autoScaleModel.doAutoYScale(state);
|
|
188
188
|
if (!compareStates(state, this.export())) {
|
|
189
189
|
this.apply(state);
|
|
190
190
|
}
|
|
@@ -29,9 +29,8 @@ type HighLowPostProcessor = (highLow: HighLow) => HighLow;
|
|
|
29
29
|
*/
|
|
30
30
|
export declare class AutoScaleViewportSubModel {
|
|
31
31
|
private delegate;
|
|
32
|
-
auto: boolean;
|
|
33
32
|
highLowProviders: Record<string, HighLowProvider>;
|
|
34
|
-
|
|
33
|
+
highLowPostProcessor: Record<string, HighLowPostProcessor>;
|
|
35
34
|
constructor(delegate: ViewportModel, highLowProviders?: Record<string, HighLowProvider>);
|
|
36
35
|
/**
|
|
37
36
|
* Sets a HighLowProvider for a given name.
|
|
@@ -55,10 +54,9 @@ export declare class AutoScaleViewportSubModel {
|
|
|
55
54
|
/**
|
|
56
55
|
* Sets the auto and recalculates the state of the viewport model.
|
|
57
56
|
* @param {ViewportModelState} state - The state of the viewport model.
|
|
58
|
-
* @param {boolean} auto - The auto value to set.
|
|
59
57
|
* @returns {void}
|
|
60
58
|
*/
|
|
61
|
-
|
|
59
|
+
doAutoYScale(state: ViewportModelState): void;
|
|
62
60
|
}
|
|
63
61
|
/**
|
|
64
62
|
* Y auto-scale viewport transformer. Calculates highLow for all chart visuals and recalculates the Y scale.
|
|
@@ -11,10 +11,8 @@
|
|
|
11
11
|
export class AutoScaleViewportSubModel {
|
|
12
12
|
constructor(delegate, highLowProviders) {
|
|
13
13
|
this.delegate = delegate;
|
|
14
|
-
// local state, used for pane X dragging
|
|
15
|
-
this.auto = true;
|
|
16
14
|
// post processors can apply some changes to high low before applying it
|
|
17
|
-
this.
|
|
15
|
+
this.highLowPostProcessor = {};
|
|
18
16
|
this.highLowProviders = highLowProviders !== null && highLowProviders !== void 0 ? highLowProviders : {};
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
@@ -40,19 +38,15 @@ export class AutoScaleViewportSubModel {
|
|
|
40
38
|
* @returns {void}
|
|
41
39
|
*/
|
|
42
40
|
setHighLowPostProcessor(name, processor) {
|
|
43
|
-
this.
|
|
41
|
+
this.highLowPostProcessor[name] = processor;
|
|
44
42
|
}
|
|
45
43
|
/**
|
|
46
44
|
* Sets the auto and recalculates the state of the viewport model.
|
|
47
45
|
* @param {ViewportModelState} state - The state of the viewport model.
|
|
48
|
-
* @param {boolean} auto - The auto value to set.
|
|
49
46
|
* @returns {void}
|
|
50
47
|
*/
|
|
51
|
-
|
|
52
|
-
this.
|
|
53
|
-
if (auto) {
|
|
54
|
-
autoScaleYViewportTransformer(this.delegate, state, Object.values(this.highLowProviders), Object.values(this.highLowPostPorcessor));
|
|
55
|
-
}
|
|
48
|
+
doAutoYScale(state) {
|
|
49
|
+
autoScaleYViewportTransformer(this.delegate, state, Object.values(this.highLowProviders), Object.values(this.highLowPostProcessor));
|
|
56
50
|
}
|
|
57
51
|
}
|
|
58
52
|
/**
|