Skip to content

Commit

Permalink
Pull request #5330: [DXCF-5561], [DXCF-5563], [DXCF-5564]
Browse files Browse the repository at this point in the history
Merge in DXCHARTS/dxchart5 from feature/DXCF-5563-web-multiple-scales-implement-configuring-multiple-scales-from-indicator-settings to master

* commit 'c5b54e7ea2c0d34fa7c51661898ff5ba2b2c7afe': (33 commits)
  [DXCF-5561], [DXCF-5563], [DXCF-5564] // pr fix
  [DXCF-5561], [DXCF-5563], [DXCF-5564] // pr fix
  [DXCF-5561], [DXCF-5563], [DXCF-5564] // pr fix
  [DXCF-5561], [DXCF-5563], [DXCF-5564] // pr fix
  [DXCF-5561], [DXCF-5563], [DXCF-5564] // pr fix
  [DXCF-5561], [DXCF-5563], [DXCF-5564] // pr fix
  [DXCF-5561], [DXCF-5563], [DXCF-5564] // pr fix
  [DXCF-5561], [DXCF-5563], [DXCF-5564] // small fix
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  [DXCF-5563] [Web] Multiple scales - implement configuring multiple-scales from indicator settings by extending Overlaying checkbox with optional dropdown // init
  ...

GitOrigin-RevId: 3e9cf71b0cc8758bba185e4798e861956f05afe4
  • Loading branch information
Keelaro1 authored and dxcity committed Nov 19, 2024
1 parent 41cc122 commit 6f935cb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 18 deletions.
31 changes: 24 additions & 7 deletions src/chart/components/pane/pane-manager.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import { HitTestCanvasModel } from '../../model/hit-test-canvas.model';
import { firstOf, flatMap, lastOf } from '../../utils/array.utils';
import { ChartResizeHandler } from '../../inputhandlers/chart-resize.handler';

export type MoveDataSeriesToPaneDirection = 'above' | 'below';

export class PaneManager extends ChartBaseElement {
public panes: Record<string, PaneComponent> = {};
public paneRemovedSubject: Subject<PaneComponent> = new Subject();
Expand Down Expand Up @@ -287,17 +289,32 @@ export class PaneManager extends ChartBaseElement {
}

/**
* Moves data series to a certain pane, or creates a new one if no pane is found
* Move data series to a certain pane, or create a new one if no pane is found
*/
public moveDataSeriesToPane(dataSeries: DataSeriesModel, paneUUID?: string) {
const initialPane = dataSeries.extentComponent.paneComponent;
public moveDataSeriesToPane(
dataSeries: DataSeriesModel[],
initialPane: PaneComponent,
initialExtent: YExtentComponent,
paneUUID?: string,
extent?: YExtentComponent,
direction?: MoveDataSeriesToPaneDirection,
) {
const pane = paneUUID && this.panes[paneUUID];

const pane = paneUUID && this.panes[paneUUID] ? this.panes[paneUUID] : this.createPane();
pane.moveDataSeriesToExistingExtentComponent(dataSeries, pane.mainExtent);
if (!pane) {
const order = direction && direction === 'above' ? 0 : this.panesOrder.length;
const newPane = this.createPane(undefined, { order });
newPane.moveDataSeriesToExistingExtentComponent(dataSeries, initialPane, initialExtent, newPane.mainExtent);
initialPane.yExtentComponents.length === 0 && this.removePane(initialPane.uuid);
return;
}

if (initialPane.yExtentComponents.length === 0) {
this.removePane(initialPane.uuid);
if (extent) {
pane.moveDataSeriesToExistingExtentComponent(dataSeries, initialPane, initialExtent, extent);
} else {
pane.moveDataSeriesToNewExtentComponent(dataSeries, initialPane, initialExtent);
}
initialPane.yExtentComponents.length === 0 && this.removePane(initialPane.uuid);
}

/**
Expand Down
33 changes: 22 additions & 11 deletions src/chart/components/pane/pane.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,21 +267,32 @@ export class PaneComponent extends ChartBaseElement {
this.canvasBoundsContainer.updateYAxisWidths();
}

public moveDataSeriesToNewExtentComponent(dataSeries: DataSeriesModel, align: YAxisAlign = 'right') {
/**
* Create new pane extent and attach data series to it
*/
public moveDataSeriesToNewExtentComponent(
dataSeries: DataSeriesModel[],
initialPane: PaneComponent,
initialExtent: YExtentComponent,
align: YAxisAlign = 'right',
) {
const extent = this.createExtentComponent();
extent.yAxis.setYAxisAlign(align);
dataSeries.moveToExtent(extent);
dataSeries.forEach(series => series.moveToExtent(extent));
initialExtent.dataSeries.size === 0 && initialPane.removeExtentComponent(initialExtent);
}

public moveDataSeriesToExistingExtentComponent(dataSeries: DataSeriesModel, extentComponent: YExtentComponent) {
const initialPane = dataSeries.extentComponent.paneComponent;
const initialExtent = dataSeries.extentComponent;
dataSeries.moveToExtent(extentComponent);

const initialExtentDataSeriesSize = initialExtent.dataSeries.size;
if (initialExtentDataSeriesSize === 0) {
initialPane.removeExtentComponent(initialExtent);
}
/**
* Attach data series to existing y axis extent
*/
public moveDataSeriesToExistingExtentComponent(
dataSeries: DataSeriesModel[],
initialPane: PaneComponent,
initialExtent: YExtentComponent,
extentComponent: YExtentComponent,
) {
dataSeries.forEach(series => series.moveToExtent(extentComponent));
initialExtent.dataSeries.size === 0 && initialPane.removeExtentComponent(initialExtent);
}

/**
Expand Down

0 comments on commit 6f935cb

Please sign in to comment.