@univerjs-pro/engine-chart 0.6.10-experimental.20250427-173dc06 → 0.6.10-experimental.20250427-89a0949

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { AreaLineStyle, AxisAlignEnum, ChartBorderDashType, ChartTypeBits, InvalidValueType, LabelContentType, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, SelectModeEnum, SeriesLabelPosition, TextAlign, TitlePositionEnum } from '../../enum';
1
+ import { AreaLineStyle, AxisAlignEnum, ChartBorderDashType, ChartTypeBits, InvalidValueType, LabelContentType, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, SelectModeEnum, SeriesLabelPosition, TextAlign, TitlePositionEnum, WaterfallStackTypeEnum } from '../../enum';
2
2
  export declare const themeColors: string[];
3
3
  export declare const defaultChartConfig: {
4
4
  allSeriesId: string;
@@ -71,6 +71,11 @@ export declare const defaultChartConfig: {
71
71
  maskImage: string;
72
72
  repeat: boolean;
73
73
  };
74
+ waterfall: {
75
+ stackType: WaterfallStackTypeEnum;
76
+ useSubtotal: boolean;
77
+ subtotalColor: string;
78
+ };
74
79
  trendline: {
75
80
  period: number;
76
81
  order: number;
@@ -3,3 +3,13 @@ export declare function createLabelMap(config: IChartConfig): {
3
3
  categoryNameMap: Record<string, string>;
4
4
  seriesNameMap: Record<string, string>;
5
5
  };
6
+ /**
7
+ * Generate colors for positive, negative, and subtotal values based on a base theme color.
8
+ * @param themeColor The base color in hex format (e.g., "#3498db").
9
+ * @returns An object containing colors for positive, negative, and subtotal values.
10
+ */
11
+ export declare const generateSeriesColors: (themeColor: string) => {
12
+ positiveColor: string;
13
+ negativeColor: string;
14
+ subtotalColor: string;
15
+ };
@@ -0,0 +1,2 @@
1
+ import { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const waterfallChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,3 @@
1
+ import { EChartRenderSpecOperator } from '../../../../types';
2
+ export declare const waterfallSeriesStyleOperator: EChartRenderSpecOperator;
3
+ export declare const waterfallSeriesDataLabelHandler: EChartRenderSpecOperator;
@@ -10,4 +10,15 @@ export declare const getLegendOrSeriesMaxWidth: (gridInfo: ISpecGrid, config: IC
10
10
  export declare const getCategoryLabelVertical: (gridInfo: ISpecGrid, style: ChartStyle) => number;
11
11
  export declare const getCategoryLabelHorizontal: (gridInfo: ISpecGrid, style: ChartStyle, seriesCount: number, axisLabelMaxWidth?: number) => number;
12
12
  export declare const getIntegerValue: (value: number, digit?: number) => number;
13
+ export declare const getGradientColor: (color: string, gradientFill: boolean) => string | {
14
+ gradient: string;
15
+ x: number;
16
+ y: number;
17
+ x2: number;
18
+ y2: number;
19
+ colorStops: {
20
+ offset: number;
21
+ color: string;
22
+ }[];
23
+ };
13
24
  export {};
@@ -1,6 +1,7 @@
1
1
  import { CellValue, IDisposable, LocaleService, Nullable } from '@univerjs/core';
2
+ import { BarSeriesOption } from 'echarts';
2
3
  import { Observable } from 'rxjs';
3
- import { AreaLineStyle, AxisAlignEnum, AxisValueType, CategoryType, ChartBorderDashType, ChartSourceDataTypeEnum, ChartTrendlineType, ChartTypeBits, DataOrientation, InvalidValueType, IRuntimeAxisPosition, IRuntimeAxisPriority, LabelAlignEnum, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, RelationChartLayoutEnum, SelectModeEnum, SeriesLabelPosition, TitlePositionEnum, WordCloudShapeEnum } from './enum';
4
+ import { AreaLineStyle, AxisAlignEnum, AxisValueType, CategoryType, ChartBorderDashType, ChartSourceDataTypeEnum, ChartTrendlineType, ChartTypeBits, DataOrientation, InvalidValueType, IRuntimeAxisPosition, IRuntimeAxisPriority, LabelAlignEnum, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, RelationChartLayoutEnum, SelectModeEnum, SeriesLabelPosition, TitlePositionEnum, WaterfallSeriesTypeEnum, WaterfallStackTypeEnum, WordCloudShapeEnum } from './enum';
4
5
  import { IEchartTheme } from './model/constants/build-in-theme';
5
6
  export type DeepPartial<T> = T extends Record<string, any> ? T extends any[] ? T : {
6
7
  [key in keyof T]+?: DeepPartial<T[key]>;
@@ -214,9 +215,20 @@ export interface ISeriesStyle {
214
215
  dataPoints: {
215
216
  [index: number]: IDataPointStyle;
216
217
  };
218
+ waterfall: {
219
+ positive: ISeriesStyle & {
220
+ name: string;
221
+ };
222
+ negative: ISeriesStyle & {
223
+ name: string;
224
+ };
225
+ subtotal: ISeriesStyle & {
226
+ name: string;
227
+ };
228
+ };
217
229
  }
218
230
  export type RightYAxisOptions = Omit<IAxisOptions, 'reverse'>;
219
- export interface IAllSeriesStyle extends Pick<ISeriesStyle, 'border' | 'label' | 'rightYAxis' | 'point' | 'color'> {
231
+ export interface IAllSeriesStyle extends Pick<ISeriesStyle, 'border' | 'label' | 'rightYAxis' | 'point' | 'color' | 'waterfall'> {
220
232
  }
221
233
  export interface ITrendLine {
222
234
  seriesIndex: number;
@@ -296,6 +308,10 @@ export interface IChartStyle {
296
308
  rotateLabel: boolean;
297
309
  };
298
310
  };
311
+ waterfall: {
312
+ stackType: WaterfallStackTypeEnum;
313
+ useSubtotal: boolean;
314
+ };
299
315
  tooltip: {
300
316
  indicatorLabelColor: string;
301
317
  indicatorLineType: ChartBorderDashType;
@@ -324,6 +340,10 @@ export interface IChartSnapshot {
324
340
  style?: ChartStyle;
325
341
  dataAggregation?: IChartDataAggregation;
326
342
  }
343
+ export interface IWaterfallLegendData {
344
+ name: string;
345
+ color: string;
346
+ }
327
347
  export interface IChartRenderSpecConverter<ChartRenderSpec = Record<string, any>> {
328
348
  canConvert: (config: IChartConfig) => boolean;
329
349
  convert: (config: IChartConfig, style: ChartStyle) => ChartRenderSpec;
@@ -368,3 +388,7 @@ export interface IChartHostRect {
368
388
  width: number;
369
389
  height: number;
370
390
  }
391
+ export type WaterfallBarSeriesOptionType = BarSeriesOption & {
392
+ baseSeriesIndex: string;
393
+ waterfallSeriesType: WaterfallSeriesTypeEnum;
394
+ };