@devexperts/dxcharts-lite 2.7.0 → 2.7.1
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/chart/chart.model.js +1 -1
- package/dist/chart/components/pane/pane-manager.component.d.ts +3 -1
- package/dist/chart/components/pane/pane-manager.component.js +7 -5
- package/dist/chart/components/pane/pane.component.d.ts +1 -1
- package/dist/chart/components/pane/pane.component.js +7 -5
- package/dist/chart/components/resizer/bar-resizer.component.d.ts +2 -0
- package/dist/chart/components/resizer/bar-resizer.component.js +11 -9
- package/dist/chart/components/y_axis/y-axis-scale.handler.js +0 -5
- package/dist/chart/model/data-series-view.js +3 -1
- package/dist/chart/model/data-series.model.js +1 -1
- package/dist/dxchart.min.js +4 -4
- package/package.json +1 -1
|
@@ -113,7 +113,7 @@ export class ChartModel extends ChartBaseElement {
|
|
|
113
113
|
const nextChartWidth = this.canvasBoundsContainer.getEffectiveChartWidth();
|
|
114
114
|
const nextYAxisWidth = this.canvasBoundsContainer.getEffectiveYAxisWidth();
|
|
115
115
|
if (this.prevChartWidth === 0 && this.scale) {
|
|
116
|
-
this.scale.isViewportValid(false)
|
|
116
|
+
this.scale.isViewportValid(false) ? this.scale.recalculateZoom() : this.doBasicScale();
|
|
117
117
|
this.prevChartWidth = nextChartWidth;
|
|
118
118
|
this.prevYWidth = nextYAxisWidth;
|
|
119
119
|
return;
|
|
@@ -7,7 +7,7 @@ import { Subject } from 'rxjs';
|
|
|
7
7
|
import { CanvasAnimation } from '../../animation/canvas-animation';
|
|
8
8
|
import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
|
|
9
9
|
import { CursorHandler } from '../../canvas/cursor.handler';
|
|
10
|
-
import { FullChartConfig } from '../../chart.config';
|
|
10
|
+
import { FullChartConfig, YAxisAlign } from '../../chart.config';
|
|
11
11
|
import { DrawingManager } from '../../drawers/drawing-manager';
|
|
12
12
|
import EventBus from '../../events/event-bus';
|
|
13
13
|
import { CrossEventProducerComponent } from '../../inputhandlers/cross-event-producer.component';
|
|
@@ -29,6 +29,8 @@ interface MoveDataSeriesToPaneOptions {
|
|
|
29
29
|
paneUUID?: string;
|
|
30
30
|
extent?: YExtentComponent;
|
|
31
31
|
direction?: MoveDataSeriesToPaneDirection;
|
|
32
|
+
align?: YAxisAlign;
|
|
33
|
+
extentIdx?: number;
|
|
32
34
|
isForceKeepPane?: boolean;
|
|
33
35
|
index?: number;
|
|
34
36
|
}
|
|
@@ -193,20 +193,22 @@ export class PaneManager extends ChartBaseElement {
|
|
|
193
193
|
* Move data series to a certain pane, or create a new one if no pane is found
|
|
194
194
|
*/
|
|
195
195
|
moveDataSeriesToPane(dataSeries, initialPane, initialExtent, options) {
|
|
196
|
-
const { paneUUID, extent, direction, isForceKeepPane, index = 0 } = options;
|
|
196
|
+
const { paneUUID, extent, direction, align, extentIdx, isForceKeepPane, index = 0 } = options;
|
|
197
197
|
const pane = paneUUID && this.panes[paneUUID];
|
|
198
|
+
const initialYAxisState = align ? Object.assign(Object.assign({}, this.panes[CHART_UUID].yAxis.state), { align }) : undefined;
|
|
199
|
+
const onNewScale = extentIdx && extentIdx > 0;
|
|
198
200
|
if (!pane) {
|
|
199
|
-
const order = direction && direction === 'above' ? index :
|
|
200
|
-
const newPane = this.createPane(paneUUID, { order });
|
|
201
|
+
const order = direction && direction === 'above' ? index : index + 1;
|
|
202
|
+
const newPane = this.createPane(paneUUID, { order, initialYAxisState });
|
|
201
203
|
newPane.moveDataSeriesToExistingExtentComponent(dataSeries, initialPane, initialExtent, newPane.mainExtent, isForceKeepPane);
|
|
202
204
|
!isForceKeepPane && initialPane.yExtentComponents.length === 0 && this.removePane(initialPane.uuid);
|
|
203
205
|
return;
|
|
204
206
|
}
|
|
205
|
-
if (extent) {
|
|
207
|
+
if (extent && !onNewScale) {
|
|
206
208
|
pane.moveDataSeriesToExistingExtentComponent(dataSeries, initialPane, initialExtent, extent);
|
|
207
209
|
}
|
|
208
210
|
else {
|
|
209
|
-
pane.moveDataSeriesToNewExtentComponent(dataSeries, initialPane, initialExtent, initialExtent.yAxis.state.align);
|
|
211
|
+
pane.moveDataSeriesToNewExtentComponent(dataSeries, initialPane, initialExtent, align !== null && align !== void 0 ? align : initialExtent.yAxis.state.align);
|
|
210
212
|
}
|
|
211
213
|
!isForceKeepPane && initialPane.yExtentComponents.length === 0 && this.removePane(initialPane.uuid);
|
|
212
214
|
}
|
|
@@ -86,7 +86,7 @@ export declare class PaneComponent extends ChartBaseElement {
|
|
|
86
86
|
private createYPanHandler;
|
|
87
87
|
private addCursors;
|
|
88
88
|
createExtentComponent(options?: AtLeastOne<YExtentCreationOptions>): YExtentComponent;
|
|
89
|
-
|
|
89
|
+
removeExtentComponents(extentComponents: YExtentComponent[]): void;
|
|
90
90
|
/**
|
|
91
91
|
* Create new pane extent and attach data series to it
|
|
92
92
|
*/
|
|
@@ -147,9 +147,9 @@ export class PaneComponent extends ChartBaseElement {
|
|
|
147
147
|
this.yExtentComponentsChangedSubject.next();
|
|
148
148
|
return yExtentComponent;
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
extentComponent.disable();
|
|
152
|
-
this.yExtentComponents.
|
|
150
|
+
removeExtentComponents(extentComponents) {
|
|
151
|
+
extentComponents.forEach(extentComponent => extentComponent.disable());
|
|
152
|
+
this.yExtentComponents = this.yExtentComponents.filter(current => !extentComponents.map(excluded => excluded.idx).includes(current.idx));
|
|
153
153
|
// re-index extents
|
|
154
154
|
this.yExtentComponents.forEach((c, idx) => (c.idx = idx));
|
|
155
155
|
this.canvasBoundsContainer.updateYAxisWidths();
|
|
@@ -162,7 +162,7 @@ export class PaneComponent extends ChartBaseElement {
|
|
|
162
162
|
const extent = this.createExtentComponent();
|
|
163
163
|
extent.yAxis.setYAxisAlign(align);
|
|
164
164
|
dataSeries.forEach(series => series.moveToExtent(extent));
|
|
165
|
-
initialExtent.dataSeries.size === 0 && initialPane.
|
|
165
|
+
initialExtent.dataSeries.size === 0 && initialPane.removeExtentComponents([initialExtent]);
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
168
|
* Attach data series to existing y axis extent
|
|
@@ -172,7 +172,9 @@ export class PaneComponent extends ChartBaseElement {
|
|
|
172
172
|
// because the next data series could be moved to it
|
|
173
173
|
isForceKeepExtent) {
|
|
174
174
|
dataSeries.forEach(series => series.moveToExtent(extentComponent));
|
|
175
|
-
!isForceKeepExtent &&
|
|
175
|
+
!isForceKeepExtent &&
|
|
176
|
+
initialExtent.dataSeries.size === 0 &&
|
|
177
|
+
initialPane.removeExtentComponents([initialExtent]);
|
|
176
178
|
this.yExtentComponentsChangedSubject.next();
|
|
177
179
|
}
|
|
178
180
|
/**
|
|
@@ -52,7 +52,9 @@ export declare class BarResizerComponent extends ChartBaseElement {
|
|
|
52
52
|
* @returns {void}
|
|
53
53
|
*/
|
|
54
54
|
protected doActivate(): void;
|
|
55
|
+
private onYDragStartMobile;
|
|
55
56
|
private onYDragStart;
|
|
57
|
+
private onYDragEndMobile;
|
|
56
58
|
private onYDragEnd;
|
|
57
59
|
private onYDragTick;
|
|
58
60
|
/**
|
|
@@ -3,17 +3,13 @@
|
|
|
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
|
-
/*
|
|
7
|
-
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
|
|
8
|
-
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
9
|
-
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
10
|
-
*/
|
|
11
6
|
import { Subject } from 'rxjs';
|
|
12
7
|
import { distinctUntilChanged, skip, startWith, filter } from 'rxjs/operators';
|
|
13
8
|
import { DynamicDrawerType } from '../../drawers/drawing-manager';
|
|
14
9
|
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
15
10
|
import { DragNDropYComponent } from '../dran-n-drop_helper/drag-n-drop-y.component';
|
|
16
11
|
import { BarResizerDrawer } from './bar-resizer.drawer';
|
|
12
|
+
import { isMobile } from '../../utils/device/browser.utils';
|
|
17
13
|
export const RESIZER_HIT_TEST_EXTENSION = 8;
|
|
18
14
|
/**
|
|
19
15
|
* Bar separator between panes.
|
|
@@ -40,15 +36,21 @@ export class BarResizerComponent extends ChartBaseElement {
|
|
|
40
36
|
this.hitTestCanvasModel = hitTestCanvasModel;
|
|
41
37
|
this.initialY = 0;
|
|
42
38
|
this.resizeEvent$ = new Subject();
|
|
43
|
-
this.
|
|
39
|
+
this.onYDragStartMobile = () => {
|
|
44
40
|
this.config.components.crossTool.type = 'none';
|
|
41
|
+
this.onYDragStart();
|
|
42
|
+
};
|
|
43
|
+
this.onYDragStart = () => {
|
|
45
44
|
this.initialY = this.boundsProvider().y;
|
|
46
45
|
// Stop redrawing hit test
|
|
47
46
|
this.hitTestCanvasModel.hitTestDrawersPredicateSubject.next(false);
|
|
48
47
|
this.chartPanComponent.deactivatePanHandlers();
|
|
49
48
|
};
|
|
50
|
-
this.
|
|
49
|
+
this.onYDragEndMobile = () => {
|
|
51
50
|
this.config.components.crossTool.type = 'cross-and-labels';
|
|
51
|
+
this.onYDragEnd();
|
|
52
|
+
};
|
|
53
|
+
this.onYDragEnd = () => {
|
|
52
54
|
this.initialY = this.boundsProvider().y;
|
|
53
55
|
this.canvasBoundsContainer.graphsHeightRatioChangedSubject.next(this.canvasBoundsContainer.graphsHeightRatio);
|
|
54
56
|
// Continue redrawing hit test
|
|
@@ -82,8 +84,8 @@ export class BarResizerComponent extends ChartBaseElement {
|
|
|
82
84
|
if (!fixedMode) {
|
|
83
85
|
const dragNDropYComponent = new DragNDropYComponent(this.hitTest, {
|
|
84
86
|
onDragTick: this.onYDragTick,
|
|
85
|
-
onDragStart: this.onYDragStart,
|
|
86
|
-
onDragEnd: this.onYDragEnd,
|
|
87
|
+
onDragStart: isMobile() ? this.onYDragStartMobile : this.onYDragStart,
|
|
88
|
+
onDragEnd: isMobile() ? this.onYDragEndMobile : this.onYDragEnd,
|
|
87
89
|
}, this.canvasInputListener, this.chartPanComponent, {
|
|
88
90
|
dragPredicate: this.dragPredicate,
|
|
89
91
|
});
|
|
@@ -3,11 +3,6 @@
|
|
|
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
|
-
/*
|
|
7
|
-
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
|
|
8
|
-
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
9
|
-
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
10
|
-
*/
|
|
11
6
|
import { Subject } from 'rxjs';
|
|
12
7
|
import { CanvasElement, DEFAULT_MIN_PANE_HEIGHT, } from '../../canvas/canvas-bounds-container';
|
|
13
8
|
import { ChartBaseElement } from '../../model/chart-base-element';
|
|
@@ -85,7 +85,9 @@ export class DataSeriesView {
|
|
|
85
85
|
const baseline = this.percentAnimationHandler.getBaselineForPercent(getBaseline);
|
|
86
86
|
return unitToPercent(value, baseline);
|
|
87
87
|
case 'logarithmic':
|
|
88
|
-
|
|
88
|
+
// TODO: temporary fix for dataseries with negative values, think about the requirements for these cases
|
|
89
|
+
// should probably not allow to switch to log values at all, or just keep it as it is
|
|
90
|
+
return value <= 0 ? value : calcLogValue(value);
|
|
89
91
|
case 'regular':
|
|
90
92
|
return value;
|
|
91
93
|
}
|
|
@@ -105,7 +105,7 @@ export class DataSeriesModel extends ChartBaseElement {
|
|
|
105
105
|
* @param {number} [idx=this.dataIdxStart] - The index of the visual point to retrieve the close value for.
|
|
106
106
|
* @returns {Unit} The close value of the visual point at the given index, or 1 if the visual point is not defined.
|
|
107
107
|
*/
|
|
108
|
-
this.getBaseline = (idx = this.dataIdxStart) => { var _a, _b; return (
|
|
108
|
+
this.getBaseline = (idx = this.dataIdxStart) => { var _a, _b, _c; return ((_a = this.visualPoints[idx]) === null || _a === void 0 ? void 0 : _a.close) && ((_b = this.visualPoints[idx]) === null || _b === void 0 ? void 0 : _b.close) >= 0 ? (_c = this.visualPoints[idx]) === null || _c === void 0 ? void 0 : _c.close : 1; };
|
|
109
109
|
/**
|
|
110
110
|
* Returns the string representation of the close value of the given visual point.
|
|
111
111
|
*
|