@devexperts/dxcharts-lite 2.7.31 → 2.7.32
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/components/pane/pane.component.d.ts +1 -0
- package/dist/chart/components/pane/pane.component.js +10 -2
- package/dist/chart/components/volumes/separate-volumes.component.d.ts +3 -1
- package/dist/chart/components/volumes/separate-volumes.component.js +19 -3
- package/dist/chart/components/volumes/volumes.component.d.ts +2 -0
- package/dist/chart/components/volumes/volumes.component.js +9 -0
- package/dist/dxchart.min.js +4 -4
- package/package.json +1 -1
|
@@ -86,6 +86,7 @@ export declare class PaneComponent extends ChartBaseElement {
|
|
|
86
86
|
private createYPanHandler;
|
|
87
87
|
private addCursors;
|
|
88
88
|
createExtentComponent(options?: AtLeastOne<YExtentCreationOptions>): YExtentComponent;
|
|
89
|
+
private shouldKeepVolumeHostExtent;
|
|
89
90
|
removeExtentComponents(extentComponents: YExtentComponent[]): void;
|
|
90
91
|
/**
|
|
91
92
|
* Create new pane extent and attach data series to it
|
|
@@ -15,6 +15,7 @@ import { GridComponent } from '../grid/grid.component';
|
|
|
15
15
|
import { YAxisComponent } from '../y_axis/y-axis.component';
|
|
16
16
|
import { createDefaultYExtentHighLowProvider, YExtentComponent, } from './extent/y-extent-component';
|
|
17
17
|
import { merge } from '../../utils/merge.utils';
|
|
18
|
+
import { VOLUMES_UUID } from '../volumes/volumes.model';
|
|
18
19
|
export class PaneComponent extends ChartBaseElement {
|
|
19
20
|
get scale() {
|
|
20
21
|
return this.mainExtent.scale;
|
|
@@ -160,9 +161,16 @@ export class PaneComponent extends ChartBaseElement {
|
|
|
160
161
|
this.yExtentComponentsChangedSubject.next();
|
|
161
162
|
return yExtentComponent;
|
|
162
163
|
}
|
|
164
|
+
shouldKeepVolumeHostExtent(extent) {
|
|
165
|
+
return (this.uuid === VOLUMES_UUID && extent === this.mainExtent && this.config.components.volumes.showSeparately);
|
|
166
|
+
}
|
|
163
167
|
removeExtentComponents(extentComponents) {
|
|
164
|
-
extentComponents.
|
|
165
|
-
|
|
168
|
+
const removableExtents = extentComponents.filter(extent => !this.shouldKeepVolumeHostExtent(extent));
|
|
169
|
+
if (removableExtents.length === 0) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
removableExtents.forEach(extentComponent => extentComponent.disable());
|
|
173
|
+
this.yExtentComponents = this.yExtentComponents.filter(current => !removableExtents.map(excluded => excluded.idx).includes(current.idx));
|
|
166
174
|
// re-index extents
|
|
167
175
|
this.yExtentComponents.forEach((c, idx) => {
|
|
168
176
|
c.yAxis.setExtentIdx(idx);
|
|
@@ -19,6 +19,7 @@ export declare class SeparateVolumesComponent extends ChartBaseElement {
|
|
|
19
19
|
pane: PaneComponent | undefined;
|
|
20
20
|
constructor(chartComponent: ChartComponent, config: FullChartConfig, volumesModel: VolumesModel, paneManager: PaneManager);
|
|
21
21
|
protected doActivate(): void;
|
|
22
|
+
private paneHasStudyDataSeries;
|
|
22
23
|
/**
|
|
23
24
|
* Activates the separate volumes feature.
|
|
24
25
|
* If the pane component for separate volumes does not exist, it creates a new pane with the specified UUID and options.
|
|
@@ -27,7 +28,8 @@ export declare class SeparateVolumesComponent extends ChartBaseElement {
|
|
|
27
28
|
*/
|
|
28
29
|
activateSeparateVolumes(): void;
|
|
29
30
|
/**
|
|
30
|
-
* Deactivates the separate volumes feature by removing the separate volumes pane
|
|
31
|
+
* Deactivates the separate volumes feature by removing the separate volumes pane when it has no study data series,
|
|
32
|
+
* or by keeping the pane when studies remain on it.
|
|
31
33
|
*/
|
|
32
34
|
deactiveSeparateVolumes(): void;
|
|
33
35
|
/**
|
|
@@ -22,6 +22,9 @@ export class SeparateVolumesComponent extends ChartBaseElement {
|
|
|
22
22
|
this.addRxSubscription(this.chartComponent.chartModel.candlesUpdatedSubject.subscribe(() => { var _a, _b; return !((_a = this.pane) === null || _a === void 0 ? void 0 : _a.scale.isViewportValid()) && ((_b = this.pane) === null || _b === void 0 ? void 0 : _b.scale.doAutoScale(true)); }));
|
|
23
23
|
this.addRxSubscription(this.volumesModel.volumeMax.subscribe(() => { var _a; return (_a = this.pane) === null || _a === void 0 ? void 0 : _a.scale.doAutoScale(); }));
|
|
24
24
|
}
|
|
25
|
+
paneHasStudyDataSeries(pane) {
|
|
26
|
+
return pane.dataSeries.length > 0;
|
|
27
|
+
}
|
|
25
28
|
/**
|
|
26
29
|
* Activates the separate volumes feature.
|
|
27
30
|
* If the pane component for separate volumes does not exist, it creates a new pane with the specified UUID and options.
|
|
@@ -29,7 +32,8 @@ export class SeparateVolumesComponent extends ChartBaseElement {
|
|
|
29
32
|
* A new VolumesDrawer is created and added to the drawing manager with the specified parameters.
|
|
30
33
|
*/
|
|
31
34
|
activateSeparateVolumes() {
|
|
32
|
-
|
|
35
|
+
const existingPane = this.paneManager.panes[SeparateVolumesComponent.UUID];
|
|
36
|
+
if (existingPane === undefined) {
|
|
33
37
|
const precision = 1;
|
|
34
38
|
const volumePane = this.paneManager.createPane(SeparateVolumesComponent.UUID, {
|
|
35
39
|
paneFormatters: {
|
|
@@ -38,18 +42,30 @@ export class SeparateVolumesComponent extends ChartBaseElement {
|
|
|
38
42
|
useDefaultHighLow: false,
|
|
39
43
|
increment: 1,
|
|
40
44
|
});
|
|
41
|
-
this.pane = volumePane;
|
|
42
45
|
volumePane.mainExtent.yAxis.setAxisType('regular');
|
|
43
46
|
const { scale: scaleModel } = volumePane;
|
|
44
47
|
const volumesHighLowProvider = createCandlesOffsetProvider(() => ({ top: 10, bottom: 0, left: 0, right: 0, visible: true }), this.volumesModel.highLowProvider);
|
|
45
48
|
scaleModel.autoScaleModel.setHighLowProvider('volumes', volumesHighLowProvider);
|
|
46
49
|
scaleModel.doAutoScale(true);
|
|
50
|
+
this.pane = volumePane;
|
|
51
|
+
return;
|
|
47
52
|
}
|
|
53
|
+
this.pane = existingPane;
|
|
48
54
|
}
|
|
49
55
|
/**
|
|
50
|
-
* Deactivates the separate volumes feature by removing the separate volumes pane
|
|
56
|
+
* Deactivates the separate volumes feature by removing the separate volumes pane when it has no study data series,
|
|
57
|
+
* or by keeping the pane when studies remain on it.
|
|
51
58
|
*/
|
|
52
59
|
deactiveSeparateVolumes() {
|
|
60
|
+
const pane = this.paneManager.panes[SeparateVolumesComponent.UUID];
|
|
61
|
+
if (pane === undefined) {
|
|
62
|
+
delete this.pane;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (this.paneHasStudyDataSeries(pane)) {
|
|
66
|
+
this.pane = undefined;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
53
69
|
this.paneManager.removePane(SeparateVolumesComponent.UUID);
|
|
54
70
|
delete this.pane;
|
|
55
71
|
}
|
|
@@ -40,6 +40,8 @@ export declare class VolumesComponent extends ChartBaseElement {
|
|
|
40
40
|
* @param {boolean} separate - A boolean value indicating whether the volumes should be shown separately or not.
|
|
41
41
|
* @returns {void}
|
|
42
42
|
*/
|
|
43
|
+
/** Restores separate volumes pane and dynamic object after study pane cleanup. */
|
|
44
|
+
ensureSeparateVolumesHost(): void;
|
|
43
45
|
setShowVolumesSeparatly(separate: boolean): void;
|
|
44
46
|
/**
|
|
45
47
|
* This method deactivates the current component by calling the superclass doDeactivate method and setting the visibility of the component to false.
|
|
@@ -53,6 +53,15 @@ export class VolumesComponent extends ChartBaseElement {
|
|
|
53
53
|
* @param {boolean} separate - A boolean value indicating whether the volumes should be shown separately or not.
|
|
54
54
|
* @returns {void}
|
|
55
55
|
*/
|
|
56
|
+
/** Restores separate volumes pane and dynamic object after study pane cleanup. */
|
|
57
|
+
ensureSeparateVolumesHost() {
|
|
58
|
+
if (!this.config.components.volumes.showSeparately) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
this.separateVolumes.activateSeparateVolumes();
|
|
62
|
+
this.syncVolumesDynamicObject();
|
|
63
|
+
this.canvasModel.fireDraw();
|
|
64
|
+
}
|
|
56
65
|
setShowVolumesSeparatly(separate) {
|
|
57
66
|
if (this.config.components.volumes.showSeparately !== separate) {
|
|
58
67
|
this.config.components.volumes.showSeparately = separate;
|