import type { ISparklineGroupConfig } from '@univerjs-pro/sheets-sparkline'; import type { IRange } from '@univerjs/core'; import { Injector } from '@univerjs/core'; /** * The facade class for the sparkline group.Which uses to setting multiple sparklines, all sparkline in the same group will share the configs. * @hideconstructor */ export declare class FSparklineGroup { private _unitId; private _subUnitId; private _groupId; private _row; private _col; protected readonly _injector: Injector; constructor(_unitId: string, _subUnitId: string, _groupId: string, _row: number, _col: number, _injector: Injector); private _getMemberRange; /** * @description Modify the data source of the sparkline group * @param {IRange[]} sourceRanges Location of new data source * @param {IRange[]} targetRanges New placement * @returns {FSparklineGroup | undefined} Return this, for chaining * * @example * ```ts * const fWorkbook = univerAPI.getActiveWorkbook(); * const fWorksheet = fWorkbook.getSheetByName('Sheet1'); * if (!fWorksheet) return; * * // Create a sparkline in the range A10, with the data source in the range A1:A7. * const sparklineGroup = fWorksheet.addSparkline( * [fWorksheet.getRange('A1:A7').getRange()], * [fWorksheet.getRange('A10').getRange()] * ); * if (!sparklineGroup) return; * * setTimeout(() => { * // Modify the data source of the sparkline group to the range B1:B7 after 3 seconds. * sparklineGroup.changeDataSource( * [fWorksheet.getRange('B1:B7').getRange()], * [fWorksheet.getRange('A10').getRange()] * ); * }, 3000); * ``` */ changeDataSource(sourceRanges: IRange[], targetRanges: IRange[]): FSparklineGroup | undefined; /** * @description Delete the sparkline group * @returns {void} * * @example * ```ts * const fWorkbook = univerAPI.getActiveWorkbook(); * const fWorksheet = fWorkbook.getSheetByName('Sheet1'); * if (!fWorksheet) return; * * // Create a sparkline in the range A10, with the data source in the range A1:A7. * const sparklineGroup = fWorksheet.addSparkline( * [fWorksheet.getRange('A1:A7').getRange()], * [fWorksheet.getRange('A10').getRange()] * ); * if (!sparklineGroup) return; * * setTimeout(() => { * // Remove sparkline group after 3 seconds. * sparklineGroup.removeSparklineGroup(); * }, 3000); * ``` */ removeSparklineGroup(): void; /** * @description Modify the configuration of the current sparkline group * @param {ISparklineGroupConfig} config new sparkline group config * @returns {FSparklineGroup} Return this instance, for chaining * * @example * ```ts * const fWorkbook = univerAPI.getActiveWorkbook(); * const fWorksheet = fWorkbook.getSheetByName('Sheet1'); * if (!fWorksheet) return; * * // Create a sparkline in the range A10, with the data source in the range A1:A7. * const sparklineGroup = fWorksheet.addSparkline( * [fWorksheet.getRange('A1:A7').getRange()], * [fWorksheet.getRange('A10').getRange()] * ); * if (!sparklineGroup) return; * * // Set sparkline type to bar chart after 3 seconds * setTimeout(() => { * sparklineGroup.setConfig({ * type: univerAPI.Enum.SparklineTypeEnum.BAR_CHART * }); * }, 3000); * ``` */ setConfig(config: ISparklineGroupConfig): FSparklineGroup; }