Skip to content

Commit

Permalink
Pull request #5280: Bugfix/DXCF-4662 volume volume are displayed inco…
Browse files Browse the repository at this point in the history
…rrectly

Merge in DXCHARTS/dxchart5 from bugfix/DXCF-4662-volume-volume-are-displayed-incorrectly to master

* commit '5661fe5d88d2e89d8d960d947748c2e392b030bd':
  [DXCF-4662] Volume - Volume are displayed incorrectly // init
  [DXCF-4662] Volume - Volume are displayed incorrectly // init
  [DXCF-4662] Volume - Volume are displayed incorrectly // init
  [DXCF-4662] Volume - Volume are displayed incorrectly // init
  [DXCF-4662] Volume - Volume are displayed incorrectly // init
  [DXCF-4662] Volume - Volume are displayed incorrectly // init

GitOrigin-RevId: 1827ac0909beef6c2f188c5f55aaf2e39cbeaa8d
  • Loading branch information
Keelaro1 authored and dxcity committed Dec 11, 2024
1 parent 778d577 commit 1d0a222
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 20 deletions.
1 change: 0 additions & 1 deletion docs/how-to/custom-drawer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ List of default drawer types:
'HIT_TEST_DRAWINGS',
'GRID',
'VOLUMES',
'UNDERLAY_VOLUMES_AREA',
'X_AXIS',
'Y_AXIS',
'HIGH_LOW',
Expand Down
1 change: 0 additions & 1 deletion src/chart/chart.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@ export const getDefaultConfig = (): FullChartConfig => ({
'GRID',
'X_AXIS',
'Y_AXIS',
'UNDERLAY_VOLUMES_AREA',
'DYNAMIC_OBJECTS',
'WATERMARK',
'N_MAP_CHART',
Expand Down
5 changes: 1 addition & 4 deletions src/chart/components/volumes/separate-volumes.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { FullChartConfig } from '../../chart.config';
import { DrawingManager } from '../../drawers/drawing-manager';
import { ChartBaseElement } from '../../model/chart-base-element';
import { Pixel, Unit } from '../../model/scaling/viewport.model';
import { ChartComponent } from '../chart/chart.component';
Expand All @@ -19,7 +18,6 @@ export class SeparateVolumesComponent extends ChartBaseElement {
public pane: PaneComponent | undefined;
constructor(
private chartComponent: ChartComponent,
private drawingManager: DrawingManager,
public config: FullChartConfig,
private volumesModel: VolumesModel,
private paneManager: PaneManager,
Expand Down Expand Up @@ -74,7 +72,6 @@ export class SeparateVolumesComponent extends ChartBaseElement {
deactiveSeparateVolumes() {
this.paneManager.removePane(SeparateVolumesComponent.UUID);
delete this.pane;
this.drawingManager.removeDrawerByName('UNDERLAY_VOLUMES_AREA');
}

/**
Expand Down
10 changes: 2 additions & 8 deletions src/chart/components/volumes/volumes.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
Expand Down Expand Up @@ -43,13 +43,7 @@ export class VolumesComponent extends ChartBaseElement {
const volumesModel = new VolumesModel(chartComponent, scale);
this.volumesModel = volumesModel;
this.addChildEntity(volumesModel);
this.separateVolumes = new SeparateVolumesComponent(
chartComponent,
drawingManager,
config,
volumesModel,
paneManager,
);
this.separateVolumes = new SeparateVolumesComponent(chartComponent, config, volumesModel, paneManager);
this.volumesDrawer = new VolumesDrawer(
config,
this.volumesModel,
Expand Down
8 changes: 4 additions & 4 deletions src/chart/components/volumes/volumes.drawer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
Expand Down Expand Up @@ -118,11 +118,11 @@ export class VolumesDrawer implements DynamicModelDrawer<VolumesModel> {
nextX !== undefined ? nextX - x : floorToDPR(unitToPixels(vCandle.width, viewportModel.zoomX));
if (this.config.components.volumes.showSeparately) {
const y = floorToDPR(viewportModel.toY(vCandle.candle.volume));
const height = floorToDPR(viewportModel.toY(0)) - y;
const height = ceilToDPR(viewportModel.toY(0)) - y;
this.drawVolume(canvasModel, vCandle, x, y, width, height);
} else {
const zoomY = volumeMax / (fullVHeight / OVERLAY_VOLUME_TOTAL_HEIGHT_DIVISOR);
const height = Math.max(unitToPixels(vCandle.candle.volume, zoomY), 2);
const height = Math.max(ceilToDPR(unitToPixels(vCandle.candle.volume, zoomY)), 2);
const y = floorToDPR(bounds.y + fullVHeight - height);
this.drawVolume(canvasModel, vCandle, x, y, width, height);
}
Expand Down Expand Up @@ -161,7 +161,7 @@ export class VolumesDrawer implements DynamicModelDrawer<VolumesModel> {
ctx.lineTo(x, ceilToDPR(yEnd));
ctx.stroke();
} else {
ctx.fillRect(x, y, width, ceilToDPR(height));
ctx.fillRect(x, y, width, height);
}
}
}
3 changes: 1 addition & 2 deletions src/chart/drawers/drawing-manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
Expand All @@ -23,7 +23,6 @@ const drawerTypes = [
'OVER_SERIES_CLEAR',
'HIT_TEST_DRAWINGS',
'GRID',
'UNDERLAY_VOLUMES_AREA',
'X_AXIS',
'Y_AXIS',
'HIGH_LOW',
Expand Down

0 comments on commit 1d0a222

Please sign in to comment.