@devexperts/dxcharts-lite
Version:
55 lines (54 loc) • 1.94 kB
TypeScript
/*
* Copyright (C) 2019 - 2025 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 { YAxisConfig, FullChartConfig } from '../chart.config';
import { CanvasModel } from '../model/canvas.model';
export interface YAxisWidthContributor {
getLargestLabel: () => string;
getYAxisIndex: () => number;
getYAxisState: () => YAxisConfig;
getPaneUUID: () => string;
}
export type ExtentsOrder = Map<string, // uuid of the pane
{
left: number[];
right: number[];
}>;
export interface YAxisWidths {
left: number[];
right: number[];
}
export declare class YAxisBoundsContainer {
private config;
private mainCanvasModel;
extentsOrder: ExtentsOrder;
constructor(config: FullChartConfig, mainCanvasModel: CanvasModel);
yAxisWidthContributors: YAxisWidthContributor[];
/**
* Registers a YAxisWidthContributor to the chart.
*
* @param {YAxisWidthContributor} contributor - The YAxisWidthContributor to be registered.
* @returns {void}
*/
registerYAxisWidthContributor(contributor: YAxisWidthContributor): void;
/**
* Removes a YAxisWidthContributor from the chart.
*
* @param {YAxisWidthContributor} contributor - The YAxisWidthContributor to be removed.
* @returns {void}
*/
removeYAxisWidthContributor(contributor: YAxisWidthContributor): void;
/**
* Calculates the width of a given text using the font from the yAxis component of the chart configuration
* @param {string} text - The text to calculate the width of
* @returns {number} - The width of the text in pixels
*/
private getTextWidth;
/**
* Updates width of Y axis.
* Considers max text of YAxis labels.
*/
getYAxisWidths(): YAxisWidths;
}