@univerjs-pro/engine-chart 0.6.10 → 0.7.0-beta.1
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.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/assets/icon-map.json.d.ts +1 -1
- package/lib/types/enum.d.ts +33 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/types/model/chart-model.d.ts +843 -3
- package/lib/types/model/constants/default-chart-style.d.ts +12 -1
- package/lib/types/model/mode-converter/converters/tools.d.ts +10 -0
- package/lib/types/model/mode-converter/converters/waterfall-chart-converter.d.ts +2 -0
- package/lib/types/model/mode-converter/render-spec-operators/series-style-operator/waterfall-series-style-operator.d.ts +3 -0
- package/lib/types/model/mode-converter/render-spec-operators/tool-tip-operator.d.ts +1 -0
- package/lib/types/model/mode-converter/render-spec-operators/tools.d.ts +11 -0
- package/lib/types/source/source-util.d.ts +5 -1
- package/lib/types/types.d.ts +33 -3
- package/lib/types/util.d.ts +2 -0
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
|
@@ -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;
|
|
@@ -13,6 +13,7 @@ export declare const defaultChartConfig: {
|
|
|
13
13
|
labelVisible: boolean;
|
|
14
14
|
reverse: boolean;
|
|
15
15
|
titleAlign: AxisAlignEnum;
|
|
16
|
+
dateAxisRotate: number;
|
|
16
17
|
};
|
|
17
18
|
legend: {
|
|
18
19
|
position: LegendPositionEnum;
|
|
@@ -70,6 +71,11 @@ export declare const defaultChartConfig: {
|
|
|
70
71
|
maskImage: string;
|
|
71
72
|
repeat: boolean;
|
|
72
73
|
};
|
|
74
|
+
waterfall: {
|
|
75
|
+
stackType: WaterfallStackTypeEnum;
|
|
76
|
+
useSubtotal: boolean;
|
|
77
|
+
subtotalColor: string;
|
|
78
|
+
};
|
|
73
79
|
trendline: {
|
|
74
80
|
period: number;
|
|
75
81
|
order: number;
|
|
@@ -93,4 +99,9 @@ export declare const defaultChartConfig: {
|
|
|
93
99
|
tooltipAxisLabelBackground: string;
|
|
94
100
|
tooltipAxisLabelColor: string;
|
|
95
101
|
indicatorLineType: ChartBorderDashType;
|
|
102
|
+
formatStyle: {
|
|
103
|
+
red: {
|
|
104
|
+
color: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
96
107
|
};
|
|
@@ -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
|
+
};
|
|
@@ -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,2 +1,6 @@
|
|
|
1
1
|
import { OptionDataValue } from '../types';
|
|
2
|
-
|
|
2
|
+
import { ChartSourceDataTypeEnum } from '../enum';
|
|
3
|
+
export declare function getCategoryData(source: OptionDataValue[][], categoryIndex: number, isRowDirection: boolean, sourceType: ChartSourceDataTypeEnum[][]): {
|
|
4
|
+
categoryData: OptionDataValue[];
|
|
5
|
+
isAllDateTime: boolean;
|
|
6
|
+
};
|
package/lib/types/types.d.ts
CHANGED
|
@@ -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, 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]>;
|
|
@@ -27,11 +28,16 @@ export type OptionDataValue = string | number | Date | null | undefined;
|
|
|
27
28
|
export interface IUniverDataSet {
|
|
28
29
|
source: OptionDataValue[][];
|
|
29
30
|
dimensions: Array<DimensionDefinitionLoose>;
|
|
31
|
+
sourceType?: ChartSourceDataTypeEnum[][];
|
|
30
32
|
}
|
|
31
33
|
export interface IChartContext {
|
|
32
34
|
headers?: string[];
|
|
33
35
|
categoryType?: CategoryType;
|
|
34
36
|
categoryIndex?: number;
|
|
37
|
+
/**
|
|
38
|
+
* the flag to indicate whether the chart use date axis, only all category data is date type, the chart will use date axis, if there are some string type data, the chart will use category axis even the flag is true.
|
|
39
|
+
*/
|
|
40
|
+
useDateAxis?: boolean;
|
|
35
41
|
categoryResourceIndexes?: number[];
|
|
36
42
|
seriesIndexes?: number[];
|
|
37
43
|
seriesResourceIndexes?: number[];
|
|
@@ -108,6 +114,7 @@ export interface IChartDataCategory {
|
|
|
108
114
|
index: number;
|
|
109
115
|
name: string;
|
|
110
116
|
type: CategoryType;
|
|
117
|
+
useDateAxis: boolean;
|
|
111
118
|
items: IChartDataItem[];
|
|
112
119
|
keys: string[];
|
|
113
120
|
}
|
|
@@ -131,7 +138,6 @@ export interface IChartRuntimeContext {
|
|
|
131
138
|
themeInfo: IEchartTheme;
|
|
132
139
|
hasSecondaryAxis: boolean;
|
|
133
140
|
localeService: LocaleService;
|
|
134
|
-
emptyTips: string;
|
|
135
141
|
wordCloudImageMaskMap: Map<string, HTMLImageElement>;
|
|
136
142
|
}
|
|
137
143
|
export interface ILabelStyle {
|
|
@@ -176,6 +182,7 @@ export interface IAxisOptions {
|
|
|
176
182
|
reverse?: boolean;
|
|
177
183
|
min?: number | null;
|
|
178
184
|
max?: number | null;
|
|
185
|
+
format?: string;
|
|
179
186
|
}
|
|
180
187
|
export interface ISeriesLabelStyle extends ILabelStyle {
|
|
181
188
|
contentType: number;
|
|
@@ -208,9 +215,20 @@ export interface ISeriesStyle {
|
|
|
208
215
|
dataPoints: {
|
|
209
216
|
[index: number]: IDataPointStyle;
|
|
210
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
|
+
};
|
|
211
229
|
}
|
|
212
230
|
export type RightYAxisOptions = Omit<IAxisOptions, 'reverse'>;
|
|
213
|
-
export interface IAllSeriesStyle extends Pick<ISeriesStyle, 'border' | 'label' | 'rightYAxis' | 'point' | 'color'> {
|
|
231
|
+
export interface IAllSeriesStyle extends Pick<ISeriesStyle, 'border' | 'label' | 'rightYAxis' | 'point' | 'color' | 'waterfall'> {
|
|
214
232
|
}
|
|
215
233
|
export interface ITrendLine {
|
|
216
234
|
seriesIndex: number;
|
|
@@ -290,6 +308,10 @@ export interface IChartStyle {
|
|
|
290
308
|
rotateLabel: boolean;
|
|
291
309
|
};
|
|
292
310
|
};
|
|
311
|
+
waterfall: {
|
|
312
|
+
stackType: WaterfallStackTypeEnum;
|
|
313
|
+
useSubtotal: boolean;
|
|
314
|
+
};
|
|
293
315
|
tooltip: {
|
|
294
316
|
indicatorLabelColor: string;
|
|
295
317
|
indicatorLineType: ChartBorderDashType;
|
|
@@ -318,6 +340,10 @@ export interface IChartSnapshot {
|
|
|
318
340
|
style?: ChartStyle;
|
|
319
341
|
dataAggregation?: IChartDataAggregation;
|
|
320
342
|
}
|
|
343
|
+
export interface IWaterfallLegendData {
|
|
344
|
+
name: string;
|
|
345
|
+
color: string;
|
|
346
|
+
}
|
|
321
347
|
export interface IChartRenderSpecConverter<ChartRenderSpec = Record<string, any>> {
|
|
322
348
|
canConvert: (config: IChartConfig) => boolean;
|
|
323
349
|
convert: (config: IChartConfig, style: ChartStyle) => ChartRenderSpec;
|
|
@@ -362,3 +388,7 @@ export interface IChartHostRect {
|
|
|
362
388
|
width: number;
|
|
363
389
|
height: number;
|
|
364
390
|
}
|
|
391
|
+
export type WaterfallBarSeriesOptionType = BarSeriesOption & {
|
|
392
|
+
baseSeriesIndex: string;
|
|
393
|
+
waterfallSeriesType: WaterfallSeriesTypeEnum;
|
|
394
|
+
};
|
package/lib/types/util.d.ts
CHANGED
|
@@ -25,4 +25,6 @@ export declare const clearChartTextMeasureCache: () => void;
|
|
|
25
25
|
* @returns {boolean} If the chart type can use trend line, return true, otherwise return false.
|
|
26
26
|
*/
|
|
27
27
|
export declare const chartTypeCanUseTrendLine: (chartType: ChartTypeBits) => boolean;
|
|
28
|
+
export declare const numfmtRedCache: Map<string, boolean>;
|
|
29
|
+
export declare function isNegativeRedCached(fmt: string): boolean | undefined;
|
|
28
30
|
export {};
|