import type { AreaLineStyle, AxisAlignEnum, ChartBorderDashType, ChartTypeBits, IAllSeriesStyle, IAxisOptions, InvalidValueType, ISeriesStyle, LabelAlignEnum, LegendPositionEnum, RadarShape, SelectModeEnum, TitlePositionEnum } from '@univerjs-pro/engine-chart'; import type { IShapeLineStyle } from '@univerjs-pro/engine-shape'; import type { ISlideChartBuildOptions as ISlideChartBuildOptionsBase, ISlideChartDataSource, ISlideChartElement, ISlidePlaceholderData } from '@univerjs-pro/slides'; export type { ISlideChartCellValue, ISlideChartDataSource, ISlideChartResource } from '@univerjs-pro/slides'; /** * The text style used by slide chart titles and axis titles. */ export interface ISlideChartTextStyle { /** * @property {string} [content] The text content. */ content?: string; /** * @property {number} [font] The font id or font index. */ font?: number; /** * @property {number} [fontSize] The font size. */ fontSize?: number; /** * @property {string} [fontColor] The font color. */ fontColor?: string; /** * @property {string} [fontStyle] The font family or style name. */ fontStyle?: string; /** * @property {boolean} [bold] Whether the text is bold. */ bold?: boolean; /** * @property {AxisAlignEnum} [axisAlignment] The axis title alignment. */ axisAlignment?: AxisAlignEnum; } /** * The build options used by slide chart builders. */ export interface ISlideChartBuildOptions extends ISlideChartBuildOptionsBase { /** * @property {object} [title] The chart title options. */ title?: { /** @property {TitlePositionEnum} [position] The title position. */ position?: TitlePositionEnum; /** @property {LabelAlignEnum} [titleAlignment] The title alignment. */ titleAlignment?: LabelAlignEnum; } & ISlideChartTextStyle; /** * @property {object} [legend] The chart legend options. */ legend?: { /** @property {LegendPositionEnum} [position] The legend position. */ position?: LegendPositionEnum; /** @property {number} [fontSize] The legend font size. */ fontSize?: number; /** @property {string} [color] The legend font color. */ color?: string; /** @property {boolean} [bold] Whether the legend text is bold. */ bold?: boolean; /** @property {boolean} [italic] Whether the legend text is italic. */ italic?: boolean; /** @property {SelectModeEnum} [selectMode] The legend select mode. */ selectMode?: SelectModeEnum; }; /** @property {ISlideChartTextStyle} [xAxisTitle] The x-axis title style. */ xAxisTitle?: ISlideChartTextStyle; /** @property {ISlideChartTextStyle} [yAxisTitle] The y-axis title style. */ yAxisTitle?: ISlideChartTextStyle; /** @property {ISlideChartTextStyle} [rightYAxisTitle] The right y-axis title style. */ rightYAxisTitle?: ISlideChartTextStyle; /** @property {IAxisOptions} [xAxis] The x-axis options. */ xAxis?: IAxisOptions; /** @property {IAxisOptions} [yAxis] The y-axis options. */ yAxis?: IAxisOptions; /** @property {IAxisOptions} [yRightAxis] The right y-axis options. */ yRightAxis?: IAxisOptions; /** * @property {object} [axisPointer] The axis pointer style. */ axisPointer?: { /** @property {string} [indicatorLineType] The indicator line type. */ indicatorLineType?: string; /** @property {ChartBorderDashType} [indicatorLineColor] The indicator line color or dash type. */ indicatorLineColor?: ChartBorderDashType; /** @property {string} [indicatorLabelColor] The indicator label background color. */ indicatorLabelColor?: string; /** @property {string} [indicatorLabelTextColor] The indicator label text color. */ indicatorLabelTextColor?: string; }; /** @property {Partial} [allSeriesStyle] The style applied to all series. */ allSeriesStyle?: Partial; /** @property {Record} [seriesStyleMap] The per-series style map. */ seriesStyleMap?: Record; /** * @property {object} [area] The line/area chart area options. */ area?: { /** @property {AreaLineStyle} [lineStyle] The line style. */ lineStyle?: AreaLineStyle; }; /** * @property {object} [pie] The pie chart options. */ pie?: { /** @property {number} [doughnutHole] The doughnut hole size. */ doughnutHole?: number; /** @property {string} [borderColor] The pie border color. */ borderColor?: string; /** @property {boolean} [hasPaddingAngle] Whether slices have padding angle. */ hasPaddingAngle?: boolean; /** @property {boolean} [isHalfPie] Whether the pie is rendered as a half pie. */ isHalfPie?: boolean; /** @property {boolean} [rosePie] Whether the pie is rendered as a rose pie. */ rosePie?: boolean; /** @property {boolean} [showLabelLine] Whether label lines are shown. */ showLabelLine?: boolean; }; /** * @property {object} [radar] The radar chart options. */ radar?: { /** @property {RadarShape} [shape] The radar chart shape. */ shape?: RadarShape; /** @property {boolean} [fill] Whether the radar chart area is filled. */ fill?: boolean; }; /** @property {string} [backgroundColor] The chart background color. */ backgroundColor?: string; /** @property {string} [borderColor] The chart border color. */ borderColor?: string; /** @property {boolean} [gradientFill] Whether the chart uses gradient fill. */ gradientFill?: boolean; /** @property {string} [theme] The chart theme name. */ theme?: string; /** @property {InvalidValueType} [invalidValueType] The invalid value handling strategy. */ invalidValueType?: InvalidValueType; /** @property {unknown} [key] Additional chart options. */ [key: string]: unknown; } /** * The chart builder info returned by `FChartBuilderBase.build()`. */ export interface ISlideChartBuilderInfo { /** @property {string} unitId The presentation id where the chart is located. */ unitId: string; /** @property {string} subUnitId The slide id where the chart is located. */ subUnitId: string; /** @property {ISlideChartElement} element The chart element data. */ element: ISlideChartElement; /** @property {ChartTypeBits} chartType The chart type. */ chartType: ChartTypeBits; /** @property {ISlideChartDataSource} dataSource The chart data source. */ dataSource: ISlideChartDataSource; /** @property {ISlideChartBuildOptions} options The chart build options. */ options: ISlideChartBuildOptions; } /** * The internal state used when switching between specialized chart builders. * @ignore */ export interface ISlideChartBuilderState { /** @property {string} unitId The presentation id where the chart is located. */ unitId: string; /** @property {string} subUnitId The slide id where the chart is located. */ subUnitId: string; /** @property {string} elementId The chart element id. */ elementId: string; /** @property {string} chartId The chart resource id. */ chartId: string; /** @property {number} left The x-coordinate of the chart's top-left corner. */ left: number; /** @property {number} top The y-coordinate of the chart's top-left corner. */ top: number; /** @property {number} width The chart width. */ width: number; /** @property {number} height The chart height. */ height: number; /** @property {ChartTypeBits} [chartType] The chart type. */ chartType?: ChartTypeBits; /** @property {ISlideChartDataSource} [dataSource] The chart data source. */ dataSource?: ISlideChartDataSource; /** @property {ISlideChartBuildOptions} [options] The chart build options. */ options?: ISlideChartBuildOptions; /** @property {ISlidePlaceholderData} [placeholder] The placeholder metadata. */ placeholder?: ISlidePlaceholderData; /** @property {IShapeLineStyle} [stroke] The chart frame stroke style. */ stroke?: IShapeLineStyle; }