Skip to content

Commit

Permalink
Pull request #5462: [DXCF-5804] [Web] Multiple scales - Not all multi…
Browse files Browse the repository at this point in the history
…ple scale operations are support undo/redo actions

Merge in DXCHARTS/dxchart5 from bugfix/DXCF-5804-web-multiple-scales-not-all-multiple-scale-operations-are-support-undo-redo-actions to master

* commit 'e1633527ef12bc0625e6c524e83e22a3003db7da':
  [DXCF-5804] [Web] Multiple scales - Not all multiple scale operations are support undo/redo actions // default Align state
  [DXCF-5804] [Web] Multiple scales - Not all multiple scale operations are support undo/redo actions // forgotten return
  [DXCF-5804] [Web] Multiple scales - Not all multiple scale operations are support undo/redo actions // removed comment
  [DXCF-5804] [Web] Multiple scales - Not all multiple scale operations are support undo/redo actions // code style fix
  [DXCF-5804] [Web] Multiple scales - Not all multiple scale operations are support undo/redo actions

GitOrigin-RevId: 2197e51698532b1e42a9ae2702e33a7909b4194e
  • Loading branch information
artskar authored and dxcity committed Feb 5, 2025
1 parent 28288ab commit f48aac0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/chart/components/pane/pane-manager.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Subject } from 'rxjs';
import { CanvasAnimation } from '../../animation/canvas-animation';
import { CHART_UUID, CanvasBoundsContainer, CanvasElement } from '../../canvas/canvas-bounds-container';
import { CursorHandler } from '../../canvas/cursor.handler';
import { FullChartConfig } from '../../chart.config';
import { FullChartConfig, YAxisAlign } from '../../chart.config';
import { DrawingManager } from '../../drawers/drawing-manager';
import EventBus from '../../events/event-bus';
import { CrossEventProducerComponent } from '../../inputhandlers/cross-event-producer.component';
Expand Down Expand Up @@ -40,6 +40,8 @@ interface MoveDataSeriesToPaneOptions {
paneUUID?: string;
extent?: YExtentComponent;
direction?: MoveDataSeriesToPaneDirection;
align?: YAxisAlign;
extentIdx?: number;
// in some cases pane should not be deleted right after data series move,
// because the next data series could be moved to it
isForceKeepPane?: boolean;
Expand Down Expand Up @@ -308,12 +310,14 @@ export class PaneManager extends ChartBaseElement {
initialExtent: YExtentComponent,
options: MoveDataSeriesToPaneOptions,
) {
const { paneUUID, extent, direction, isForceKeepPane, index = 0 } = options;
const { paneUUID, extent, direction, align, extentIdx, isForceKeepPane, index = 0 } = options;
const pane = paneUUID && this.panes[paneUUID];
const initialYAxisState = align ? { ...this.panes[CHART_UUID].yAxis.state, align } : undefined;
const onNewScale = extentIdx && extentIdx > 0;

if (!pane) {
const order = direction && direction === 'above' ? index : this.panesOrder.length + index;
const newPane = this.createPane(paneUUID, { order });
const newPane = this.createPane(paneUUID, { order, initialYAxisState });
newPane.moveDataSeriesToExistingExtentComponent(
dataSeries,
initialPane,
Expand All @@ -325,14 +329,14 @@ export class PaneManager extends ChartBaseElement {
return;
}

if (extent) {
if (extent && !onNewScale) {
pane.moveDataSeriesToExistingExtentComponent(dataSeries, initialPane, initialExtent, extent);
} else {
pane.moveDataSeriesToNewExtentComponent(
dataSeries,
initialPane,
initialExtent,
initialExtent.yAxis.state.align,
align ?? initialExtent.yAxis.state.align,
);
}
!isForceKeepPane && initialPane.yExtentComponents.length === 0 && this.removePane(initialPane.uuid);
Expand Down

0 comments on commit f48aac0

Please sign in to comment.