@univerjs-pro/sheets-chart 1.0.0-alpha.2 → 1.0.0-alpha.4
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/README.md +8 -2
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/locale/ar-SA.js +1 -1
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/de-DE.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/id-ID.js +1 -1
- package/lib/cjs/locale/it-IT.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/pl-PL.js +1 -1
- package/lib/cjs/locale/pt-BR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-HK.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/locale/ar-SA.js +1 -1
- package/lib/es/locale/ca-ES.js +1 -1
- package/lib/es/locale/de-DE.js +1 -1
- package/lib/es/locale/en-US.js +1 -1
- package/lib/es/locale/es-ES.js +1 -1
- package/lib/es/locale/fa-IR.js +1 -1
- package/lib/es/locale/fr-FR.js +1 -1
- package/lib/es/locale/id-ID.js +1 -1
- package/lib/es/locale/it-IT.js +1 -1
- package/lib/es/locale/ja-JP.js +1 -1
- package/lib/es/locale/ko-KR.js +1 -1
- package/lib/es/locale/pl-PL.js +1 -1
- package/lib/es/locale/pt-BR.js +1 -1
- package/lib/es/locale/ru-RU.js +1 -1
- package/lib/es/locale/sk-SK.js +1 -1
- package/lib/es/locale/vi-VN.js +1 -1
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-HK.js +1 -1
- package/lib/es/locale/zh-TW.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/ar-SA.js +1 -1
- package/lib/locale/ca-ES.js +1 -1
- package/lib/locale/de-DE.js +1 -1
- package/lib/locale/en-US.js +1 -1
- package/lib/locale/es-ES.js +1 -1
- package/lib/locale/fa-IR.js +1 -1
- package/lib/locale/fr-FR.js +1 -1
- package/lib/locale/id-ID.js +1 -1
- package/lib/locale/it-IT.js +1 -1
- package/lib/locale/ja-JP.js +1 -1
- package/lib/locale/ko-KR.js +1 -1
- package/lib/locale/pl-PL.js +1 -1
- package/lib/locale/pt-BR.js +1 -1
- package/lib/locale/ru-RU.js +1 -1
- package/lib/locale/sk-SK.js +1 -1
- package/lib/locale/vi-VN.js +1 -1
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-HK.js +1 -1
- package/lib/locale/zh-TW.js +1 -1
- package/lib/types/chart-builder/index.d.ts +10 -0
- package/lib/types/chart-builder/sheet-chart-builder-adapter.d.ts +41 -0
- package/lib/types/chart-builder/sheet-chart-builder.d.ts +17 -0
- package/lib/types/chart-builder/sheet-chart-create-spec.d.ts +6 -0
- package/lib/types/chart-builder/sheet-chart-description.d.ts +5 -0
- package/lib/types/chart-builder/sheet-chart-layout.d.ts +21 -0
- package/lib/types/chart-builder/sheet-chart-source.d.ts +32 -0
- package/lib/types/chart-builder/types.d.ts +159 -0
- package/lib/types/chart-source/chart-source.d.ts +14 -7
- package/lib/types/commands/commands/sheets-chart-update-config.command.d.ts +2 -0
- package/lib/types/commands/commands/sheets-chart.command.d.ts +3 -4
- package/lib/types/commands/mutations/sheets-chart-update-config.mutation.d.ts +1 -0
- package/lib/types/commands/mutations/sheets-chart.mutation.d.ts +15 -5
- package/lib/types/common/util.d.ts +1 -1
- package/lib/types/facade/chart/f-sheet-chart-builder.d.ts +83 -0
- package/lib/types/facade/chart/f-sheet-charts.d.ts +100 -0
- package/lib/types/facade/chart/index.d.ts +2 -0
- package/lib/types/facade/chart/sheet-chart-command-adapter.d.ts +13 -0
- package/lib/types/facade/f-chart.d.ts +1 -143
- package/lib/types/facade/f-enum.d.ts +7 -205
- package/lib/types/facade/f-worksheet-charts.d.ts +3 -19
- package/lib/types/facade/index.d.ts +3 -23
- package/lib/types/index.d.ts +7 -6
- package/lib/types/models/chart-model.d.ts +3 -3
- package/lib/types/models/types.d.ts +14 -1
- package/lib/types/plugin.d.ts +1 -0
- package/lib/types/services/chart-model.service.d.ts +2 -0
- package/lib/types/services/sheet-chart-range-watcher.d.ts +22 -0
- package/lib/types/services/sheets-chart.service.d.ts +8 -8
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +10 -10
- package/lib/types/facade/chart-builder/builder-util.d.ts +0 -5
- package/lib/types/facade/chart-builder/chart-builder-base.d.ts +0 -919
- package/lib/types/facade/chart-builder/line-chart-builder.d.ts +0 -165
- package/lib/types/facade/chart-builder/pie-chart-builder.d.ts +0 -196
- package/lib/types/facade/chart-builder/radar-chart-builder.d.ts +0 -100
- package/lib/types/facade/chart-builder/types.d.ts +0 -34
- package/lib/types/facade/chart-facade-adapter.d.ts +0 -58
- package/lib/types/facade/chart-facade-builders.d.ts +0 -62
- package/lib/types/facade/chart-facade-types.d.ts +0 -393
- package/lib/types/facade/f-worksheet.d.ts +0 -205
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
import type { ChartBorderDashType, ChartStyle, IChartDataCategory, IChartDataSeries, IEchartTheme, LabelContentType, LinePointShape, RadarShape, WordCloudShapeEnum } from '@univerjs-pro/engine-chart';
|
|
2
|
-
import type { IRange } from '@univerjs/core';
|
|
3
|
-
import type { FChart } from './f-chart';
|
|
4
|
-
export type DeepReadonly<T> = T extends (...args: any[]) => unknown ? T : T extends readonly (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? {
|
|
5
|
-
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
6
|
-
} : T;
|
|
7
|
-
export type DeepPartial<T> = T extends (...args: any[]) => unknown ? T : T extends readonly (infer U)[] ? DeepPartial<U>[] : T extends object ? {
|
|
8
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
9
|
-
} : T;
|
|
10
|
-
export type ChartKnownTypeName = 'line' | 'column' | 'bar' | 'pie' | 'donut' | 'doughnut' | 'area' | 'radar' | 'scatter' | 'combo' | 'combination' | 'wordCloud';
|
|
11
|
-
export type ChartTypeName = ChartKnownTypeName | 'unsupported';
|
|
12
|
-
export type ChartSourceOrientation = 'auto' | 'row' | 'column' | 'rows' | 'columns' | 'rowsAsSeries' | 'columnsAsSeries';
|
|
13
|
-
export type ChartRangeSpec = string | IRange;
|
|
14
|
-
export type ChartSourceSpec = ChartRangeSpec | {
|
|
15
|
-
range: ChartRangeSpec;
|
|
16
|
-
sheetName?: string;
|
|
17
|
-
sheetId?: string;
|
|
18
|
-
unitId?: string;
|
|
19
|
-
orientation?: ChartSourceOrientation;
|
|
20
|
-
};
|
|
21
|
-
export type ChartAnchorSpec = string | {
|
|
22
|
-
row: number;
|
|
23
|
-
column: number;
|
|
24
|
-
rowOffset?: number;
|
|
25
|
-
columnOffset?: number;
|
|
26
|
-
};
|
|
27
|
-
export interface IChartSizeSpec {
|
|
28
|
-
width?: number;
|
|
29
|
-
height?: number;
|
|
30
|
-
}
|
|
31
|
-
export type ChartSizeSpec = IChartSizeSpec;
|
|
32
|
-
export interface IChartLayoutPatch {
|
|
33
|
-
anchor?: ChartAnchorSpec;
|
|
34
|
-
position?: {
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
|
-
};
|
|
38
|
-
size?: ChartSizeSpec;
|
|
39
|
-
}
|
|
40
|
-
export type ChartLayoutPatch = IChartLayoutPatch;
|
|
41
|
-
export type ChartTitleSpec = string | {
|
|
42
|
-
text?: string;
|
|
43
|
-
visible?: boolean;
|
|
44
|
-
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
45
|
-
alignment?: 'left' | 'center' | 'right';
|
|
46
|
-
fontSize?: number;
|
|
47
|
-
color?: string;
|
|
48
|
-
bold?: boolean;
|
|
49
|
-
};
|
|
50
|
-
export type ChartLegendSpec = boolean | {
|
|
51
|
-
visible?: boolean;
|
|
52
|
-
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
53
|
-
selectMode?: 'single' | 'multiple' | 'close';
|
|
54
|
-
fontSize?: number;
|
|
55
|
-
color?: string;
|
|
56
|
-
bold?: boolean;
|
|
57
|
-
italic?: boolean;
|
|
58
|
-
};
|
|
59
|
-
export interface IChartAxisSpec {
|
|
60
|
-
title?: string;
|
|
61
|
-
min?: number | null;
|
|
62
|
-
max?: number | null;
|
|
63
|
-
reverse?: boolean;
|
|
64
|
-
line?: {
|
|
65
|
-
visible?: boolean;
|
|
66
|
-
color?: string;
|
|
67
|
-
width?: number;
|
|
68
|
-
};
|
|
69
|
-
tick?: {
|
|
70
|
-
visible?: boolean;
|
|
71
|
-
color?: string;
|
|
72
|
-
width?: number;
|
|
73
|
-
length?: number;
|
|
74
|
-
position?: 'inside' | 'outside';
|
|
75
|
-
};
|
|
76
|
-
format?: string | null;
|
|
77
|
-
titleStyle?: {
|
|
78
|
-
color?: string;
|
|
79
|
-
fontSize?: number;
|
|
80
|
-
bold?: boolean;
|
|
81
|
-
italic?: boolean;
|
|
82
|
-
family?: string;
|
|
83
|
-
};
|
|
84
|
-
label?: {
|
|
85
|
-
visible?: boolean;
|
|
86
|
-
color?: string;
|
|
87
|
-
fontSize?: number;
|
|
88
|
-
rotate?: number;
|
|
89
|
-
};
|
|
90
|
-
gridLine?: {
|
|
91
|
-
visible?: boolean;
|
|
92
|
-
color?: string;
|
|
93
|
-
width?: number;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
export type ChartAxisSpec = IChartAxisSpec;
|
|
97
|
-
export interface IChartAxesSpec {
|
|
98
|
-
x?: ChartAxisSpec;
|
|
99
|
-
y?: ChartAxisSpec;
|
|
100
|
-
rightY?: Omit<ChartAxisSpec, 'reverse'>;
|
|
101
|
-
}
|
|
102
|
-
export type ChartAxesSpec = IChartAxesSpec;
|
|
103
|
-
export type ChartSeriesSelector = {
|
|
104
|
-
index: number;
|
|
105
|
-
} | {
|
|
106
|
-
name: string;
|
|
107
|
-
};
|
|
108
|
-
export interface IChartSeriesPatch {
|
|
109
|
-
selector: ChartSeriesSelector;
|
|
110
|
-
name?: string;
|
|
111
|
-
type?: 'column' | 'line' | 'area';
|
|
112
|
-
color?: string;
|
|
113
|
-
fillOpacity?: number;
|
|
114
|
-
border?: {
|
|
115
|
-
color?: string | null;
|
|
116
|
-
width?: number;
|
|
117
|
-
opacity?: number;
|
|
118
|
-
dashType?: ChartBorderDashType;
|
|
119
|
-
};
|
|
120
|
-
point?: {
|
|
121
|
-
shape?: LinePointShape;
|
|
122
|
-
size?: number;
|
|
123
|
-
color?: string | null;
|
|
124
|
-
};
|
|
125
|
-
rightAxis?: boolean;
|
|
126
|
-
label?: {
|
|
127
|
-
visible?: boolean;
|
|
128
|
-
position?: 'top' | 'bottom' | 'inside' | 'outside';
|
|
129
|
-
contentType?: LabelContentType;
|
|
130
|
-
color?: string;
|
|
131
|
-
fontSize?: number;
|
|
132
|
-
bold?: boolean;
|
|
133
|
-
italic?: boolean;
|
|
134
|
-
};
|
|
135
|
-
dataPoints?: Record<number, {
|
|
136
|
-
shape?: LinePointShape;
|
|
137
|
-
size?: number;
|
|
138
|
-
color?: string | null;
|
|
139
|
-
fillOpacity?: number;
|
|
140
|
-
}>;
|
|
141
|
-
}
|
|
142
|
-
export type ChartSeriesPatch = IChartSeriesPatch;
|
|
143
|
-
export interface IChartWordCloudSpec {
|
|
144
|
-
shape?: WordCloudShapeEnum;
|
|
145
|
-
/**
|
|
146
|
-
* Stable wordcloud mask resource id/key known to the runtime.
|
|
147
|
-
*
|
|
148
|
-
* The public facade intentionally does not recommend arbitrary URL/data URL
|
|
149
|
-
* input in v1. Legacy URL/data URL values may still appear through rawStyle
|
|
150
|
-
* for expert/debug compatibility, but normal callers should use registered
|
|
151
|
-
* mask resource ids.
|
|
152
|
-
*
|
|
153
|
-
* Patch semantics:
|
|
154
|
-
* - omitted/undefined: keep the current mask image setting.
|
|
155
|
-
* - null: clear the persisted mask image and fall back to shape.
|
|
156
|
-
* - string: set the mask image id; the mask image takes precedence over shape.
|
|
157
|
-
*/
|
|
158
|
-
maskImageId?: string | null;
|
|
159
|
-
repeat?: boolean;
|
|
160
|
-
}
|
|
161
|
-
export type ChartWordCloudSpec = IChartWordCloudSpec;
|
|
162
|
-
export interface IChartWordCloudDescription {
|
|
163
|
-
shape?: WordCloudShapeEnum;
|
|
164
|
-
maskImageId?: string;
|
|
165
|
-
repeat?: boolean;
|
|
166
|
-
effectiveShapeSource: 'shape' | 'maskImage';
|
|
167
|
-
}
|
|
168
|
-
export type ChartWordCloudDescription = IChartWordCloudDescription;
|
|
169
|
-
export interface IChartAppearanceSpec {
|
|
170
|
-
background?: {
|
|
171
|
-
color?: string | null;
|
|
172
|
-
gradient?: boolean;
|
|
173
|
-
};
|
|
174
|
-
border?: {
|
|
175
|
-
color?: string | null;
|
|
176
|
-
width?: number;
|
|
177
|
-
};
|
|
178
|
-
font?: {
|
|
179
|
-
color?: string;
|
|
180
|
-
size?: number;
|
|
181
|
-
family?: string;
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
export type ChartAppearanceSpec = IChartAppearanceSpec;
|
|
185
|
-
export interface IChartMappingSpec {
|
|
186
|
-
categoryIndex?: number | null;
|
|
187
|
-
seriesIndexes?: number[] | null;
|
|
188
|
-
useDateAxis?: boolean | null;
|
|
189
|
-
bubble?: {
|
|
190
|
-
sizeSeriesIndex?: number | null;
|
|
191
|
-
xAxisIndex?: number | null;
|
|
192
|
-
yAxisIndex?: number | null;
|
|
193
|
-
labelIndex?: number | null;
|
|
194
|
-
seriesIndex?: number | null;
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
export type ChartMappingSpec = IChartMappingSpec;
|
|
198
|
-
export interface IChartAggregationSpec {
|
|
199
|
-
aggregate?: boolean;
|
|
200
|
-
topN?: number | null;
|
|
201
|
-
}
|
|
202
|
-
export type ChartAggregationSpec = IChartAggregationSpec;
|
|
203
|
-
export interface IChartPieSpec {
|
|
204
|
-
doughnutHole?: number | null;
|
|
205
|
-
borderColor?: string;
|
|
206
|
-
hasPaddingAngle?: boolean;
|
|
207
|
-
isHalfPie?: boolean;
|
|
208
|
-
rosePie?: boolean;
|
|
209
|
-
showLabelLine?: boolean;
|
|
210
|
-
valueScale?: number;
|
|
211
|
-
valueSuffix?: string;
|
|
212
|
-
digitalFixed?: number;
|
|
213
|
-
label?: {
|
|
214
|
-
visible?: boolean;
|
|
215
|
-
position?: 'inside' | 'outside';
|
|
216
|
-
contentType?: LabelContentType;
|
|
217
|
-
color?: string;
|
|
218
|
-
fontSize?: number;
|
|
219
|
-
bold?: boolean;
|
|
220
|
-
italic?: boolean;
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
export type ChartPieSpec = IChartPieSpec;
|
|
224
|
-
export interface IChartRadarSpec {
|
|
225
|
-
shape?: RadarShape;
|
|
226
|
-
fill?: boolean;
|
|
227
|
-
}
|
|
228
|
-
export type ChartRadarSpec = IChartRadarSpec;
|
|
229
|
-
export type ChartAdvancedStylePatch = DeepPartial<Pick<ChartStyle, 'tooltip' | 'area' | 'funnel' | 'relation' | 'waterfall'>>;
|
|
230
|
-
export interface IChartCreateSpec {
|
|
231
|
-
type: ChartKnownTypeName;
|
|
232
|
-
source: ChartSourceSpec;
|
|
233
|
-
anchor?: ChartAnchorSpec;
|
|
234
|
-
position?: {
|
|
235
|
-
x: number;
|
|
236
|
-
y: number;
|
|
237
|
-
};
|
|
238
|
-
size?: ChartSizeSpec;
|
|
239
|
-
title?: ChartTitleSpec;
|
|
240
|
-
legend?: ChartLegendSpec;
|
|
241
|
-
axes?: ChartAxesSpec;
|
|
242
|
-
series?: ChartSeriesPatch[];
|
|
243
|
-
wordCloud?: ChartWordCloudSpec;
|
|
244
|
-
appearance?: ChartAppearanceSpec;
|
|
245
|
-
mapping?: ChartMappingSpec;
|
|
246
|
-
aggregation?: ChartAggregationSpec;
|
|
247
|
-
pie?: ChartPieSpec;
|
|
248
|
-
radar?: ChartRadarSpec;
|
|
249
|
-
advancedStyle?: ChartAdvancedStylePatch;
|
|
250
|
-
theme?: string;
|
|
251
|
-
}
|
|
252
|
-
export type ChartCreateSpec = IChartCreateSpec;
|
|
253
|
-
export interface IChartUpdatePatch {
|
|
254
|
-
type?: ChartKnownTypeName;
|
|
255
|
-
source?: ChartSourceSpec;
|
|
256
|
-
title?: ChartTitleSpec;
|
|
257
|
-
legend?: ChartLegendSpec;
|
|
258
|
-
axes?: ChartAxesSpec;
|
|
259
|
-
series?: ChartSeriesPatch[];
|
|
260
|
-
wordCloud?: ChartWordCloudSpec;
|
|
261
|
-
appearance?: ChartAppearanceSpec;
|
|
262
|
-
mapping?: ChartMappingSpec;
|
|
263
|
-
aggregation?: ChartAggregationSpec;
|
|
264
|
-
pie?: ChartPieSpec;
|
|
265
|
-
radar?: ChartRadarSpec;
|
|
266
|
-
advancedStyle?: ChartAdvancedStylePatch;
|
|
267
|
-
theme?: string;
|
|
268
|
-
layout?: ChartLayoutPatch;
|
|
269
|
-
}
|
|
270
|
-
export type ChartUpdatePatch = IChartUpdatePatch;
|
|
271
|
-
export type ChartDiagnosticCode = 'CHART_NOT_FOUND' | 'SERIES_NOT_FOUND' | 'AMBIGUOUS_SERIES_SELECTOR' | 'INVALID_RANGE' | 'SINGLE_CELL_SOURCE' | 'NO_NUMERIC_SERIES' | 'UNKNOWN_CHART_TYPE' | 'UNSUPPORTED_CHART_TYPE' | 'INVALID_SIZE' | 'INVALID_COLOR' | 'COMMAND_FAILED' | 'UNKNOWN_OPTION';
|
|
272
|
-
export interface IChartDiagnostic {
|
|
273
|
-
code: ChartDiagnosticCode;
|
|
274
|
-
severity: 'error' | 'warning';
|
|
275
|
-
message: string;
|
|
276
|
-
path?: string;
|
|
277
|
-
details?: unknown;
|
|
278
|
-
allowedValues?: readonly unknown[];
|
|
279
|
-
suggestion?: string;
|
|
280
|
-
}
|
|
281
|
-
export type ChartDiagnostic = IChartDiagnostic;
|
|
282
|
-
export interface IChartValidationResult<TNormalized = unknown> {
|
|
283
|
-
ok: boolean;
|
|
284
|
-
diagnostics: ChartDiagnostic[];
|
|
285
|
-
normalized?: DeepReadonly<TNormalized>;
|
|
286
|
-
}
|
|
287
|
-
export type ChartValidationResult<TNormalized = unknown> = IChartValidationResult<TNormalized>;
|
|
288
|
-
export interface IChartUpdateResult {
|
|
289
|
-
ok: boolean;
|
|
290
|
-
chart: FChart | null;
|
|
291
|
-
diagnostics: ChartDiagnostic[];
|
|
292
|
-
changed: Array<'source' | 'type' | 'style' | 'data' | 'layout'>;
|
|
293
|
-
}
|
|
294
|
-
export type ChartUpdateResult = IChartUpdateResult;
|
|
295
|
-
export interface IChartSuggestion {
|
|
296
|
-
type: ChartKnownTypeName;
|
|
297
|
-
orientation: 'rows' | 'columns';
|
|
298
|
-
reason?: string;
|
|
299
|
-
}
|
|
300
|
-
export type ChartSuggestion = IChartSuggestion;
|
|
301
|
-
export interface IChartCapabilities {
|
|
302
|
-
version: string;
|
|
303
|
-
chartTypes: readonly ChartKnownTypeName[];
|
|
304
|
-
patchSemantics: {
|
|
305
|
-
omitted: 'noChange';
|
|
306
|
-
undefined: 'noChange';
|
|
307
|
-
null: 'clearWhereSupported';
|
|
308
|
-
object: 'semanticMerge';
|
|
309
|
-
array: 'replaceUnlessSelectorMerge';
|
|
310
|
-
unknownField: 'validationError';
|
|
311
|
-
};
|
|
312
|
-
createGroups: readonly string[];
|
|
313
|
-
updateGroups: readonly string[];
|
|
314
|
-
styleGroups: readonly string[];
|
|
315
|
-
advancedStyle: {
|
|
316
|
-
supported: boolean;
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
export type ChartCapabilities = IChartCapabilities;
|
|
320
|
-
export interface IChartInstanceCapabilities extends IChartCapabilities {
|
|
321
|
-
chartId: string;
|
|
322
|
-
type: ChartTypeName;
|
|
323
|
-
rawType?: number;
|
|
324
|
-
unsupportedGroups: readonly string[];
|
|
325
|
-
}
|
|
326
|
-
export type ChartInstanceCapabilities = IChartInstanceCapabilities;
|
|
327
|
-
export interface IChartSourceDescription {
|
|
328
|
-
range: IRange;
|
|
329
|
-
sheetName?: string;
|
|
330
|
-
sheetId: string;
|
|
331
|
-
unitId: string;
|
|
332
|
-
orientation: ChartSourceOrientation;
|
|
333
|
-
}
|
|
334
|
-
export type ChartSourceDescription = IChartSourceDescription;
|
|
335
|
-
export interface IChartSeriesDescription {
|
|
336
|
-
index: number;
|
|
337
|
-
name: string;
|
|
338
|
-
type?: 'column' | 'line' | 'area';
|
|
339
|
-
color?: string | null;
|
|
340
|
-
fillOpacity?: number;
|
|
341
|
-
border?: ChartSeriesPatch['border'];
|
|
342
|
-
point?: ChartSeriesPatch['point'];
|
|
343
|
-
rightAxis?: boolean;
|
|
344
|
-
label?: {
|
|
345
|
-
visible?: boolean;
|
|
346
|
-
position?: 'top' | 'bottom' | 'inside' | 'outside';
|
|
347
|
-
contentType?: LabelContentType;
|
|
348
|
-
color?: string;
|
|
349
|
-
fontSize?: number;
|
|
350
|
-
bold?: boolean;
|
|
351
|
-
italic?: boolean;
|
|
352
|
-
};
|
|
353
|
-
dataPoints?: ChartSeriesPatch['dataPoints'];
|
|
354
|
-
data?: DeepReadonly<IChartDataSeries>;
|
|
355
|
-
}
|
|
356
|
-
export type ChartSeriesDescription = IChartSeriesDescription;
|
|
357
|
-
export interface IChartLayoutDescription {
|
|
358
|
-
position?: {
|
|
359
|
-
x: number;
|
|
360
|
-
y: number;
|
|
361
|
-
};
|
|
362
|
-
size?: ChartSizeSpec;
|
|
363
|
-
anchor?: {
|
|
364
|
-
row: number;
|
|
365
|
-
column: number;
|
|
366
|
-
rowOffset?: number;
|
|
367
|
-
columnOffset?: number;
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
export type ChartLayoutDescription = IChartLayoutDescription;
|
|
371
|
-
export interface IChartDescription {
|
|
372
|
-
id: string;
|
|
373
|
-
type: ChartTypeName;
|
|
374
|
-
rawType?: number;
|
|
375
|
-
diagnostics?: ChartDiagnostic[];
|
|
376
|
-
source: ChartSourceDescription | null;
|
|
377
|
-
title?: ChartTitleSpec;
|
|
378
|
-
legend?: ChartLegendSpec;
|
|
379
|
-
axes?: ChartAxesSpec;
|
|
380
|
-
wordCloud?: ChartWordCloudDescription;
|
|
381
|
-
appearance?: ChartAppearanceSpec;
|
|
382
|
-
mapping?: ChartMappingSpec;
|
|
383
|
-
aggregation?: ChartAggregationSpec;
|
|
384
|
-
pie?: ChartPieSpec;
|
|
385
|
-
radar?: ChartRadarSpec;
|
|
386
|
-
series: ChartSeriesDescription[];
|
|
387
|
-
category?: DeepReadonly<IChartDataCategory>;
|
|
388
|
-
theme?: string;
|
|
389
|
-
layout?: ChartLayoutDescription;
|
|
390
|
-
rawStyle?: DeepReadonly<ChartStyle>;
|
|
391
|
-
}
|
|
392
|
-
export type ChartDescription = IChartDescription;
|
|
393
|
-
export type { IEchartTheme };
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import type { IEchartTheme } from '@univerjs-pro/engine-chart';
|
|
2
|
-
import type { IChartBuilderInfo } from './chart-builder/chart-builder-base';
|
|
3
|
-
import { FWorksheet } from '@univerjs/sheets/facade';
|
|
4
|
-
import { FChartBuilderBase } from './chart-builder/chart-builder-base';
|
|
5
|
-
import { FChart } from './f-chart';
|
|
6
|
-
/**
|
|
7
|
-
* @ignore
|
|
8
|
-
*/
|
|
9
|
-
export interface IFWorksheetChartMixin {
|
|
10
|
-
/**
|
|
11
|
-
* Adds a new chart to this sheet.
|
|
12
|
-
* @param {IChartBuilderInfo} chartBuildInfo - The chart builder info.
|
|
13
|
-
* @returns {Promise<FChart>} - The new chart.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
18
|
-
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
19
|
-
* if (!fWorksheet) return;
|
|
20
|
-
*
|
|
21
|
-
* // Create a column chart with data source A1:D6.
|
|
22
|
-
* // The starting position is upper-left corner of cell B2.
|
|
23
|
-
* const chartInfo = fWorksheet.newChart()
|
|
24
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
25
|
-
* .addRange('A1:D6')
|
|
26
|
-
* .setPosition(1, 1, 0, 0)
|
|
27
|
-
* .build();
|
|
28
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
insertChart(chartBuildInfo: IChartBuilderInfo): Promise<FChart>;
|
|
32
|
-
/**
|
|
33
|
-
* Updates the chart on this sheet. This api can not update source range, please use FChart.updateRange.
|
|
34
|
-
* @param {IChartBuilderInfo} chartBuildInfo - The chart builder info.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
39
|
-
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
40
|
-
* if (!fWorksheet) return;
|
|
41
|
-
*
|
|
42
|
-
* // Create a column chart with data source A1:D6.
|
|
43
|
-
* // The starting position is upper-left corner of cell B2.
|
|
44
|
-
* const chartInfo = fWorksheet.newChart()
|
|
45
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
46
|
-
* .addRange('A1:D6')
|
|
47
|
-
* .setPosition(1, 1, 0, 0)
|
|
48
|
-
* .build();
|
|
49
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
50
|
-
*
|
|
51
|
-
* // Get all charts on the active sheet.
|
|
52
|
-
* const charts = fWorksheet.getCharts();
|
|
53
|
-
*
|
|
54
|
-
* // Update the first chart after 3 seconds.
|
|
55
|
-
* setTimeout(() => {
|
|
56
|
-
* const newChartInfo = fWorksheet.newChart(charts[0])
|
|
57
|
-
* .asLineChart()
|
|
58
|
-
* .setOptions('legend.position', univerAPI.Enum.LegendPositionEnum.Right)
|
|
59
|
-
* .build();
|
|
60
|
-
* fWorksheet.updateChart(newChartInfo);
|
|
61
|
-
* }, 3000);
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
updateChart(chartBuildInfo: IChartBuilderInfo): void;
|
|
65
|
-
/**
|
|
66
|
-
* Returns a builder to create a new chart for this sheet.The builder will not automatically create the chart. You must call build() on the returned builder to create the chart by calling insertChart(chartBuilder).
|
|
67
|
-
* @description If the fChart is provided, the builder will be initialized with the existing chart's data.
|
|
68
|
-
* @param {FChart} [fChart] - The chart to update.
|
|
69
|
-
* @returns {FChartBuilderBase} - a new chart builder
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```ts
|
|
73
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
74
|
-
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
75
|
-
* if (!fWorksheet) return;
|
|
76
|
-
*
|
|
77
|
-
* // Create a column chart with data source A1:D6.
|
|
78
|
-
* // The starting position is upper-left corner of cell B2.
|
|
79
|
-
* // The width of the chart is 600 and the height is 400.
|
|
80
|
-
* const chartInfo = fWorksheet.newChart()
|
|
81
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
82
|
-
* .addRange('A1:D6')
|
|
83
|
-
* .setPosition(1, 1, 0, 0)
|
|
84
|
-
* .setWidth(600)
|
|
85
|
-
* .setHeight(400)
|
|
86
|
-
* .build();
|
|
87
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
newChart(fChart?: FChart): FChartBuilderBase;
|
|
91
|
-
/**
|
|
92
|
-
* Returns an array of charts on this sheet.
|
|
93
|
-
* @returns {FChart[]} - An array of charts on this sheet.
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
98
|
-
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
99
|
-
* if (!fWorksheet) return;
|
|
100
|
-
*
|
|
101
|
-
* // Get all charts on the active sheet.
|
|
102
|
-
* const charts = fWorksheet.getCharts();
|
|
103
|
-
* console.log(charts);
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
getCharts(): FChart[];
|
|
107
|
-
/**
|
|
108
|
-
* Removes a chart from the parent sheet.
|
|
109
|
-
* @param {FChart} chart - The chart to remove.
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```ts
|
|
113
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
114
|
-
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
115
|
-
* if (!fWorksheet) return;
|
|
116
|
-
*
|
|
117
|
-
* // Create a column chart with data source A1:D6.
|
|
118
|
-
* // The starting position is upper-left corner of cell B2.
|
|
119
|
-
* const chartInfo = fWorksheet.newChart()
|
|
120
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
121
|
-
* .addRange('A1:D6')
|
|
122
|
-
* .setPosition(1, 1, 0, 0)
|
|
123
|
-
* .build();
|
|
124
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
125
|
-
*
|
|
126
|
-
* // Get all charts on the active sheet.
|
|
127
|
-
* const charts = fWorksheet.getCharts();
|
|
128
|
-
*
|
|
129
|
-
* // Remove the first chart after 3 seconds.
|
|
130
|
-
* setTimeout(async () => {
|
|
131
|
-
* await fWorksheet.removeChart(charts[0]);
|
|
132
|
-
* console.log(fWorksheet.getCharts());
|
|
133
|
-
* }, 3000);
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
removeChart(chart: FChart): Promise<boolean>;
|
|
137
|
-
/**
|
|
138
|
-
* Univer chart is base on echarts, you can register your own theme by echart theme builder.
|
|
139
|
-
* @description The theme object should be a valid echarts theme object.The online builder is available at https://echarts.apache.org/zh/theme-builder.html
|
|
140
|
-
* @param {string} themeName - The name of the theme.
|
|
141
|
-
* @param {IEchartTheme} theme - The theme object.
|
|
142
|
-
*
|
|
143
|
-
* @example
|
|
144
|
-
* ```ts
|
|
145
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
146
|
-
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
147
|
-
* if (!fWorksheet) return;
|
|
148
|
-
*
|
|
149
|
-
* // register your theme
|
|
150
|
-
* const theme = { // your theme object
|
|
151
|
-
* 'version': 1,
|
|
152
|
-
* 'themeName': 'myTheme',
|
|
153
|
-
* 'theme': {
|
|
154
|
-
* // ... Some code is omitted for brevity
|
|
155
|
-
* color: [
|
|
156
|
-
* '#893448',
|
|
157
|
-
* '#d95850',
|
|
158
|
-
* '#eb8146',
|
|
159
|
-
* '#ffb248',
|
|
160
|
-
* '#f2d643',
|
|
161
|
-
* '#ebdba4'
|
|
162
|
-
* ],
|
|
163
|
-
* // ... Some code is omitted for brevity
|
|
164
|
-
* visualMapColor: [
|
|
165
|
-
* '#893448',
|
|
166
|
-
* '#d95850',
|
|
167
|
-
* '#eb8146',
|
|
168
|
-
* '#ffb248',
|
|
169
|
-
* '#f2d643',
|
|
170
|
-
* 'rgb(247,238,173)'
|
|
171
|
-
* ],
|
|
172
|
-
* // ... Some code is omitted for brevity
|
|
173
|
-
* 'axes': []
|
|
174
|
-
* // ... Some code is omitted for brevity
|
|
175
|
-
* }
|
|
176
|
-
* };
|
|
177
|
-
* fWorksheet.registerChartTheme('myTheme', theme);
|
|
178
|
-
*
|
|
179
|
-
* // use your theme for chart
|
|
180
|
-
* const chartInfo = fWorksheet.newChart()
|
|
181
|
-
* .asLineChart()
|
|
182
|
-
* .addRange('A1:D6')
|
|
183
|
-
* .setPosition(1, 1, 0, 0)
|
|
184
|
-
* .setTheme('myTheme')
|
|
185
|
-
* .build();
|
|
186
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
187
|
-
* ```
|
|
188
|
-
*/
|
|
189
|
-
registerChartTheme(themeName: string, theme: IEchartTheme): void;
|
|
190
|
-
}
|
|
191
|
-
export declare class FWorksheetChartMixin extends FWorksheet implements IFWorksheetChartMixin {
|
|
192
|
-
insertChart(chartBuildInfo: IChartBuilderInfo): Promise<FChart>;
|
|
193
|
-
updateChart(chartBuilder: IChartBuilderInfo): void;
|
|
194
|
-
newChart(fChart?: FChart): FChartBuilderBase;
|
|
195
|
-
getCharts(): FChart[];
|
|
196
|
-
removeChart(chart: FChart): Promise<boolean>;
|
|
197
|
-
registerChartTheme(themeName: string, theme: IEchartTheme): void;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* @ignore
|
|
201
|
-
*/
|
|
202
|
-
declare module '@univerjs/sheets/facade' {
|
|
203
|
-
interface FWorksheet extends IFWorksheetChartMixin {
|
|
204
|
-
}
|
|
205
|
-
}
|