Skip to content

Commit ee5a45f

Browse files
Keelaro1dxcity
authored and
dxcity
committed
Pull request #5511: Feature/DXCF-5871 visual improvements for multiple scales
Merge in DXCHARTS/dxchart5 from feature/DXCF-5871-visual-improvements-for-multiple-scales to master * commit '55c72f5e1176b7deec692f8456cbea61a5c304ac': (25 commits) CI: update snapshots [DXCF-5871] Visual improvements for multiple scales // copy [DXCF-5871] Visual improvements for multiple scales // copyright [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // pr fix CI: update snapshots [DXCF-5871] Visual improvements for multiple scales // remove copy [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // pr fix [DXCF-5871] Visual improvements for multiple scales // init [DXCF-5871] Visual improvements for multiple scales // init [DXCF-5871] Visual improvements for multiple scales // init ... GitOrigin-RevId: 547298504de4c8ee30d805ced4cfd40321746449
1 parent f739ea6 commit ee5a45f

File tree

6 files changed

+29
-9
lines changed

6 files changed

+29
-9
lines changed

src/chart/bootstrap.ts

+15-4
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ export default class ChartBootstrap {
223223
this.canvasModels,
224224
elements.chartResizer,
225225
);
226+
const yAxisDescriptionsCanvasModel = createCanvasModel(
227+
eventBus,
228+
elements.yAxisDescriptionsCanvas,
229+
config,
230+
drawingManager,
231+
this.canvasModels,
232+
elements.chartResizer,
233+
);
226234
const canvasBoundsContainer = new CanvasBoundsContainer(
227235
config,
228236
eventBus,
@@ -457,7 +465,7 @@ export default class ChartBootstrap {
457465
);
458466
this.chartComponents.push(highLowComponent);
459467

460-
this.initYAxisDrawer(yAxisLabelsCanvasModel);
468+
this.initYAxisDrawer(yAxisLabelsCanvasModel, yAxisDescriptionsCanvasModel);
461469

462470
this.yAxisComponent = mainPane.mainExtent.yAxis;
463471
// default labels provider
@@ -558,24 +566,27 @@ export default class ChartBootstrap {
558566
this.clearer = clearerSafe(this.components);
559567
}
560568

561-
private initYAxisDrawer(yAxisLabelsCanvasModel: CanvasModel) {
569+
private initYAxisDrawer(yAxisLabelsCanvasModel: CanvasModel, yAxisDescriptionsCanvasModel: CanvasModel) {
562570
const yAxisCompositeDrawer = new CompositeDrawer();
563571
const clearYAxis = new ClearCanvasDrawer(yAxisLabelsCanvasModel);
572+
const clearYAxisDescriptions = new ClearCanvasDrawer(yAxisDescriptionsCanvasModel);
564573
yAxisCompositeDrawer.addDrawer(clearYAxis, 'YAXIS_CLEAR');
574+
yAxisCompositeDrawer.addDrawer(clearYAxisDescriptions, 'Y_AXIS_DESCRIPTIONS_CLEAR');
565575

566576
this.drawingManager.addDrawer(yAxisCompositeDrawer, 'Y_AXIS');
567577

568578
const yAxisDrawer = new YAxisDrawer(this.config, yAxisLabelsCanvasModel, this.paneManager);
569579
yAxisCompositeDrawer.addDrawer(yAxisDrawer);
570580

571-
const yAxisLabelsDrawer = new YAxisPriceLabelsDrawer(
581+
const yAxisPriceLabelsDrawer = new YAxisPriceLabelsDrawer(
572582
yAxisLabelsCanvasModel,
583+
yAxisDescriptionsCanvasModel,
573584
this.backgroundCanvasModel,
574585
this.canvasBoundsContainer,
575586
this.config,
576587
this.paneManager,
577588
);
578-
yAxisCompositeDrawer.addDrawer(yAxisLabelsDrawer);
589+
this.drawingManager.addDrawer(yAxisPriceLabelsDrawer, 'Y_AXIS_PRICE_LABELS');
579590
}
580591

581592
// TODO remove chartModel dependency, put period to global config somewhere

src/chart/canvas/canvas-chart-html.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
2+
* Copyright (C) 2019 - 2025 Devexperts Solutions IE Limited
33
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
44
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
@@ -12,6 +12,7 @@ export default (devexpertsPromoLink: boolean) =>
1212
'\t\t\t<canvas data-element="mainCanvas"></canvas>\n' +
1313
'\t\t\t<canvas data-element="yAxisLabelsCanvas"></canvas>\n' +
1414
'\t\t\t<canvas data-element="dynamicObjectsCanvas"></canvas>\n' +
15+
'\t\t\t<canvas data-element="yAxisDescriptionsCanvas"></canvas>\n' +
1516
'\t\t\t<canvas data-element="crossToolCanvas"></canvas>\n' +
1617
'\t\t\t<canvas data-element="hitTestCanvas"></canvas>\n' +
1718
`${

src/chart/canvas/chart-elements.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
2+
* Copyright (C) 2019 - 2025 Devexperts Solutions IE Limited
33
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
44
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
@@ -10,6 +10,7 @@ export interface ChartElements {
1010
mainCanvas?: HTMLCanvasElement;
1111
dynamicObjectsCanvas?: HTMLCanvasElement;
1212
yAxisLabelsCanvas?: HTMLCanvasElement;
13+
yAxisDescriptionsCanvas?: HTMLCanvasElement;
1314
crossToolCanvas?: HTMLCanvasElement;
1415
hitTestCanvas?: HTMLCanvasElement;
1516
chartResizer?: HTMLElement;

src/chart/components/y_axis/price_labels/price-label.drawer.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
2+
* Copyright (C) 2019 - 2025 Devexperts Solutions IE Limited
33
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
44
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
@@ -42,6 +42,7 @@ export const priceLabelDrawersMap: Record<YAxisVisualLabelType, LabelDrawer> = {
4242
*/
4343
export function drawLabel(
4444
ctx: CanvasRenderingContext2D,
45+
yAxisDescriptionsCtx: CanvasRenderingContext2D,
4546
backgroundCtx: CanvasRenderingContext2D,
4647
bounds: Bounds,
4748
paneBounds: Bounds,
@@ -77,7 +78,8 @@ export function drawLabel(
7778
const showLine = isLineVisible(bounds, labelY, labelBoxHeight);
7879

7980
const _drawDescription = () =>
80-
showDescription && drawDescription(backgroundCtx, ctx, bounds, paneBounds, visualLabel, config);
81+
showDescription &&
82+
drawDescription(backgroundCtx, yAxisDescriptionsCtx, bounds, paneBounds, visualLabel, config);
8183

8284
let lineXStart: number;
8385
let lineXEnd: number;

src/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
2+
* Copyright (C) 2019 - 2025 Devexperts Solutions IE Limited
33
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
44
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
@@ -20,6 +20,7 @@ import { LabelGroup, VisualYAxisLabel } from './y-axis-labels.model';
2020
export class YAxisPriceLabelsDrawer implements Drawer {
2121
constructor(
2222
private yAxisLabelsCanvasModel: CanvasModel,
23+
private yAxisDescriptionsCanvasModel: CanvasModel,
2324
private backgroundCanvasModel: CanvasModel,
2425
private canvasBoundsContainer: CanvasBoundsContainer,
2526
private fullConfig: FullChartConfig,
@@ -29,6 +30,7 @@ export class YAxisPriceLabelsDrawer implements Drawer {
2930
draw() {
3031
const ctx = this.yAxisLabelsCanvasModel.ctx;
3132
const backgroundCtx = this.backgroundCanvasModel.ctx;
33+
const descriptionsCtx = this.yAxisDescriptionsCanvasModel.ctx;
3234

3335
this.paneManager.yExtents.forEach(extent => {
3436
if (extent.yAxis.state.visible) {
@@ -41,6 +43,7 @@ export class YAxisPriceLabelsDrawer implements Drawer {
4143
l.labels.forEach(vl =>
4244
drawLabel(
4345
ctx,
46+
descriptionsCtx,
4447
backgroundCtx,
4548
bounds,
4649
paneBounds,
@@ -55,6 +58,7 @@ export class YAxisPriceLabelsDrawer implements Drawer {
5558
Object.values(extent.yAxis.model.fancyLabelsModel.customLabels).forEach(l =>
5659
drawLabel(
5760
ctx,
61+
descriptionsCtx,
5862
backgroundCtx,
5963
yAxisBounds,
6064
paneBounds,

src/chart/components/y_axis/y-axis.component.ts

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export class YAxisComponent extends ChartBaseElement {
5858
public model: YAxisModel;
5959
public axisTypeSetSubject: Subject<PriceAxisType> = new Subject<PriceAxisType>();
6060
public axisAlignSetSubject: Subject<YAxisAlign> = new Subject<YAxisAlign>();
61+
public axisAlignMovedSubject: Subject<YAxisAlign> = new Subject<YAxisAlign>();
6162
public readonly state: YAxisConfig;
6263

6364
constructor(

0 commit comments

Comments
 (0)