@univerjs-pro/sheets-chart-ui 0.19.0 → 0.20.0
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/cjs/locale/ca-ES.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/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.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-TW.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/locale/ca-ES.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/ja-JP.js +1 -1
- package/lib/es/locale/ko-KR.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-TW.js +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/ca-ES.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/ja-JP.js +1 -1
- package/lib/locale/ko-KR.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-TW.js +1 -1
- package/lib/types/commands/commands/sheet-chart-menu.command.d.ts +1 -4
- package/lib/types/controllers/sheets-chart-clipboard.controller.d.ts +3 -3
- package/lib/types/controllers/sheets-chart-ui.controller.d.ts +2 -6
- package/lib/types/index.d.ts +0 -2
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ca-ES.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/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.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-TW.js +1 -1
- package/package.json +15 -25
- package/lib/cjs/facade.js +0 -1
- package/lib/es/facade.js +0 -1
- package/lib/facade.js +0 -1
- package/lib/types/commands/commands/sheets-chart.command.d.ts +0 -24
- package/lib/types/const.d.ts +0 -9
- package/lib/types/facade/chart-builder/builder-util.d.ts +0 -5
- package/lib/types/facade/chart-builder/chart-builder-base.d.ts +0 -899
- package/lib/types/facade/chart-builder/line-chart-builder.d.ts +0 -160
- package/lib/types/facade/chart-builder/pie-chart-builder.d.ts +0 -189
- package/lib/types/facade/chart-builder/radar-chart-builder.d.ts +0 -97
- package/lib/types/facade/chart-builder/types.d.ts +0 -34
- package/lib/types/facade/f-chart.d.ts +0 -127
- package/lib/types/facade/f-enum.d.ts +0 -203
- package/lib/types/facade/f-worksheet.d.ts +0 -199
- package/lib/types/facade/index.d.ts +0 -20
- package/lib/umd/facade.js +0 -1
|
@@ -1,899 +0,0 @@
|
|
|
1
|
-
import type { AreaLineStyle, AxisAlignEnum, ChartBorderDashType, ChartTypeBits, IAllSeriesStyle, IAxisOptions, InvalidValueType, ISeriesStyle, LabelAlignEnum, LegendPositionEnum, RadarShape, SelectModeEnum, TitlePositionEnum } from '@univerjs-pro/engine-chart';
|
|
2
|
-
import type { Injector, IRange, Workbook } from '@univerjs/core';
|
|
3
|
-
import { FBase } from '@univerjs/core/facade';
|
|
4
|
-
/**
|
|
5
|
-
* The chart builder info.
|
|
6
|
-
*/
|
|
7
|
-
export interface IChartBuilderInfo {
|
|
8
|
-
/**
|
|
9
|
-
* @property {string} unitId The workbook id where the chart is located.
|
|
10
|
-
*/
|
|
11
|
-
unitId: string;
|
|
12
|
-
/**
|
|
13
|
-
* @property {string} subUnitId The worksheet id where the chart is located.
|
|
14
|
-
*/
|
|
15
|
-
subUnitId: string;
|
|
16
|
-
/**
|
|
17
|
-
* @property {string} chartId The id of the chart.
|
|
18
|
-
*/
|
|
19
|
-
chartId: string;
|
|
20
|
-
/**
|
|
21
|
-
* @property {IRange} range The data source range of the chart.
|
|
22
|
-
*/
|
|
23
|
-
range: IRange | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* @property {string} sourceSheetName The name of the worksheet which the data source range of the chart belongs to.
|
|
26
|
-
* If not set, the data source range is in the current active worksheet.
|
|
27
|
-
*/
|
|
28
|
-
sourceSheetName: string | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* @property {number} x The x-coordinate of the chart.
|
|
31
|
-
*/
|
|
32
|
-
x: number;
|
|
33
|
-
/**
|
|
34
|
-
* @property {number} y The y-coordinate of the chart.
|
|
35
|
-
*/
|
|
36
|
-
y: number;
|
|
37
|
-
/**
|
|
38
|
-
* @property {number} width The width of the chart.
|
|
39
|
-
*/
|
|
40
|
-
width: number;
|
|
41
|
-
/**
|
|
42
|
-
* @property {number} height The height of the chart.
|
|
43
|
-
*/
|
|
44
|
-
height: number;
|
|
45
|
-
/**
|
|
46
|
-
* @property {ChartTypeBits} chartType The type of the chart.
|
|
47
|
-
*/
|
|
48
|
-
chartType: ChartTypeBits;
|
|
49
|
-
/**
|
|
50
|
-
* @property {IChartBuildOptions} options The options of the chart.
|
|
51
|
-
*/
|
|
52
|
-
options: IChartBuildOptions;
|
|
53
|
-
/**
|
|
54
|
-
* @property {boolean} isRowDirection Whether to read the data in the range as row direction.
|
|
55
|
-
*/
|
|
56
|
-
isRowDirection: boolean;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* The chart text style.
|
|
60
|
-
*/
|
|
61
|
-
export interface IChartTextStyle {
|
|
62
|
-
/**
|
|
63
|
-
* @property {string} [titleContent] The content of the chart title.
|
|
64
|
-
*/
|
|
65
|
-
content?: string;
|
|
66
|
-
/**
|
|
67
|
-
* @property {number} [font] The font family for the chart title.
|
|
68
|
-
*/
|
|
69
|
-
font?: number;
|
|
70
|
-
/**
|
|
71
|
-
* @property {number} [fontSize] The font size for the chart title.
|
|
72
|
-
*/
|
|
73
|
-
fontSize?: number;
|
|
74
|
-
/**
|
|
75
|
-
* @property {string} [fontColor] The font color for the chart title.
|
|
76
|
-
*/
|
|
77
|
-
fontColor?: string;
|
|
78
|
-
/**
|
|
79
|
-
* @property {string} [fontStyle] The font style for the chart title.
|
|
80
|
-
*/
|
|
81
|
-
fontStyle?: string;
|
|
82
|
-
/**
|
|
83
|
-
* @property {boolean} [bold] The font is bold.
|
|
84
|
-
*/
|
|
85
|
-
bold?: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* @property {AxisAlignEnum} [axisAlignment] The alignment of the chart axis.The possible values are 'start', 'center' & 'end'.
|
|
88
|
-
*/
|
|
89
|
-
axisAlignment?: AxisAlignEnum;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* The chart build options.
|
|
93
|
-
*/
|
|
94
|
-
export interface IChartBuildOptions {
|
|
95
|
-
/**
|
|
96
|
-
* @property {string} [title] The title of the chart.
|
|
97
|
-
*/
|
|
98
|
-
title?: {
|
|
99
|
-
/**
|
|
100
|
-
* @property {string} [titlePosition] The position of the chart title.
|
|
101
|
-
*/
|
|
102
|
-
position?: TitlePositionEnum;
|
|
103
|
-
/**
|
|
104
|
-
* @property {string} [titleAlignment] The alignment of the chart title.The possible values are 'left', 'center' & 'right'.
|
|
105
|
-
*/
|
|
106
|
-
titleAlignment: LabelAlignEnum;
|
|
107
|
-
} & IChartTextStyle;
|
|
108
|
-
/**
|
|
109
|
-
* @property {string} [legend] The legend of the chart.
|
|
110
|
-
*/
|
|
111
|
-
legend?: {
|
|
112
|
-
/**
|
|
113
|
-
* @property {string} [legendPosition] The position of the legend.The possible values are 'top', 'bottom', 'left', 'right' & 'hide'.
|
|
114
|
-
*/
|
|
115
|
-
position?: LegendPositionEnum;
|
|
116
|
-
/**
|
|
117
|
-
* @property {number} [fontSize] The font size of the legend.
|
|
118
|
-
*/
|
|
119
|
-
fontSize?: number;
|
|
120
|
-
/**
|
|
121
|
-
* @property {string} [color] The font color of the legend.
|
|
122
|
-
*/
|
|
123
|
-
color?: string;
|
|
124
|
-
/**
|
|
125
|
-
* @property {string} [bold] The font style of the legend.
|
|
126
|
-
*/
|
|
127
|
-
bold?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* @property {string} [italic] The font weight of the legend.
|
|
130
|
-
*/
|
|
131
|
-
italic?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* @property {SelectModeEnum} [selectMode] The select mode of the legend.The possible values are 'single', 'multiple' & 'close'.
|
|
134
|
-
*/
|
|
135
|
-
selectMode?: SelectModeEnum;
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* @property {string} [xAxisTitle] The x-axis title of the chart.
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```ts
|
|
142
|
-
* chartBuilder.setOptions('xAxisTitle.content', 'xAxis Title text')
|
|
143
|
-
* .setOptions('xAxisTitle.font', 1)
|
|
144
|
-
* .setOptions('xAxisTitle.fontSize', 12)
|
|
145
|
-
* .setOptions('xAxisTitle.fontColor', '#ff0000')
|
|
146
|
-
* .build();
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
xAxisTitle?: IChartTextStyle;
|
|
150
|
-
/**
|
|
151
|
-
* @property {string} [rightYAxisTitle] The right y-axis title of the chart.
|
|
152
|
-
*/
|
|
153
|
-
yAxisTitle?: IChartTextStyle;
|
|
154
|
-
/**
|
|
155
|
-
* @property {string} [rightYAxisTitle] The right y-axis title of the chart.
|
|
156
|
-
*/
|
|
157
|
-
rightYAxisTitle?: IChartTextStyle;
|
|
158
|
-
/**
|
|
159
|
-
* @property {IAxisOptions} [xAxis] The x-axis option of the chart.
|
|
160
|
-
*/
|
|
161
|
-
xAxis?: IAxisOptions;
|
|
162
|
-
/**
|
|
163
|
-
* @property {IAxisOptions} [yAxis] The y-axis option of the chart.
|
|
164
|
-
*/
|
|
165
|
-
yAxis?: IAxisOptions;
|
|
166
|
-
/**
|
|
167
|
-
* @property {IAxisOptions} [yRightAxis] The right y-axis option of the chart.
|
|
168
|
-
*/
|
|
169
|
-
yRightAxis?: IAxisOptions;
|
|
170
|
-
/**
|
|
171
|
-
* The axis pointer of the chart.
|
|
172
|
-
*/
|
|
173
|
-
axisPointer?: {
|
|
174
|
-
/**
|
|
175
|
-
* @property {string} [indicatorLineType] The line type of the axis pointer.
|
|
176
|
-
*/
|
|
177
|
-
indicatorLineType?: string;
|
|
178
|
-
/**
|
|
179
|
-
* @property {ChartBorderDashType} [indicatorLineColor] The line color of the axis pointer.The maybe values are 'solid', 'dotted', 'dashed'.
|
|
180
|
-
*/
|
|
181
|
-
indicatorLineColor?: ChartBorderDashType;
|
|
182
|
-
/**
|
|
183
|
-
* @property {string} [indicatorLabelColor] The line width of the axis pointer.
|
|
184
|
-
*/
|
|
185
|
-
indicatorLabelColor?: string;
|
|
186
|
-
/**
|
|
187
|
-
* @property {string} [indicatorLabelTextColor] The font color of the axis pointer.
|
|
188
|
-
*/
|
|
189
|
-
indicatorLabelTextColor?: string;
|
|
190
|
-
};
|
|
191
|
-
/**
|
|
192
|
-
* @property {IAllSeriesStyle} [allSeriesStyle] The style of all series.
|
|
193
|
-
*/
|
|
194
|
-
allSeriesStyle?: Partial<IAllSeriesStyle>;
|
|
195
|
-
/**
|
|
196
|
-
* @property {string} [seriesStyleMap] The style of the series.
|
|
197
|
-
*/
|
|
198
|
-
seriesStyleMap?: {
|
|
199
|
-
[id: string]: ISeriesStyle;
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* @property {string} [area] The area of line/area chart.
|
|
203
|
-
*/
|
|
204
|
-
area?: {
|
|
205
|
-
lineStyle: AreaLineStyle;
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
* @property {string} [backgroundColor] The background color of the chart.
|
|
209
|
-
*/
|
|
210
|
-
backgroundColor?: string;
|
|
211
|
-
/**
|
|
212
|
-
* @property {string} [borderColor] The border color of the chart.
|
|
213
|
-
*/
|
|
214
|
-
borderColor?: string;
|
|
215
|
-
/**
|
|
216
|
-
* @property {boolean} [gradientFill] Whether to fill the chart with a gradient.
|
|
217
|
-
*/
|
|
218
|
-
gradientFill?: boolean;
|
|
219
|
-
/**
|
|
220
|
-
* @property {string} [theme] The theme of the chart.
|
|
221
|
-
*/
|
|
222
|
-
theme?: string;
|
|
223
|
-
/**
|
|
224
|
-
* @property {InvalidValueType} [invalidValueType] The invalid value type of the chart.
|
|
225
|
-
*/
|
|
226
|
-
invalidValueType?: InvalidValueType;
|
|
227
|
-
/**
|
|
228
|
-
* @property {RadarShape} [radar] The radar of the chart.
|
|
229
|
-
*/
|
|
230
|
-
radar?: {
|
|
231
|
-
/**
|
|
232
|
-
* @property {RadarShape} [shape] The shape of the radar chart.
|
|
233
|
-
*/
|
|
234
|
-
shape?: RadarShape;
|
|
235
|
-
/**
|
|
236
|
-
* @property {boolean} [fill] True if the radar chart is filled; false otherwise.
|
|
237
|
-
*/
|
|
238
|
-
fill?: boolean;
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* The base class for chart builder.The chart builder is used to create a chart in the sheet.For line chart , radar chart and pie chart, you use the LineChartBuilder, RadarChartBuilder and PieChartBuilder classes respectively.
|
|
243
|
-
* @ignore
|
|
244
|
-
* @hideconstructor
|
|
245
|
-
*/
|
|
246
|
-
export declare class FChartBuilderBase extends FBase {
|
|
247
|
-
protected readonly _workbook: Workbook;
|
|
248
|
-
protected readonly _injector: Injector;
|
|
249
|
-
/**
|
|
250
|
-
* @property {string} unitId The workbook id where the chart is located.
|
|
251
|
-
*/
|
|
252
|
-
unitId: string;
|
|
253
|
-
/**
|
|
254
|
-
* @property {string} subUnitId The worksheet id where the chart is located.
|
|
255
|
-
*/
|
|
256
|
-
subUnitId: string;
|
|
257
|
-
/**
|
|
258
|
-
* @property {string} chartId The id of the chart.
|
|
259
|
-
*/
|
|
260
|
-
chartId: string;
|
|
261
|
-
/**
|
|
262
|
-
* @property {IRange} range The data source range of the chart.
|
|
263
|
-
*/
|
|
264
|
-
range: IRange | undefined;
|
|
265
|
-
/**
|
|
266
|
-
* @property {string} sourceSheetName The name of the worksheet which the data source range of the chart belongs to.
|
|
267
|
-
* If not set, the data source range is in the current active worksheet.
|
|
268
|
-
*/
|
|
269
|
-
sourceSheetName: string | undefined;
|
|
270
|
-
/**
|
|
271
|
-
* @property {number} x The x-coordinate of the chart.
|
|
272
|
-
*/
|
|
273
|
-
x: number;
|
|
274
|
-
/**
|
|
275
|
-
* @property {number} y The y-coordinate of the chart.
|
|
276
|
-
*/
|
|
277
|
-
y: number;
|
|
278
|
-
/**
|
|
279
|
-
* @property {number} width The width of the chart.
|
|
280
|
-
*/
|
|
281
|
-
width: number;
|
|
282
|
-
/**
|
|
283
|
-
* @property {number} height The height of the chart.
|
|
284
|
-
*/
|
|
285
|
-
height: number;
|
|
286
|
-
/**
|
|
287
|
-
* @property {ChartTypeBits} chartType The type of the chart.
|
|
288
|
-
*/
|
|
289
|
-
chartType: ChartTypeBits;
|
|
290
|
-
/**
|
|
291
|
-
* @property {IChartBuildOptions} options The options of the chart.
|
|
292
|
-
*/
|
|
293
|
-
options: IChartBuildOptions;
|
|
294
|
-
/**
|
|
295
|
-
* @property {boolean} transposeRowsAndColumns Whether to read the data in the range as row direction.
|
|
296
|
-
*/
|
|
297
|
-
transposeRowsAndColumns: boolean;
|
|
298
|
-
constructor(unitId: string, subUnitId: string, workbook: Workbook, injector: Injector, chartId?: string);
|
|
299
|
-
/**
|
|
300
|
-
* Gets the chart type of the chart this builder modifies.
|
|
301
|
-
* @description The chart type of the chart this builder modifies. The chart type (ChartTypeBits) can be found from package @univerjs-pro/sheets-chart.
|
|
302
|
-
* Please pay attention to the type of the chart you are creating, a Pie chart have a property of Doughnut is donut chart, and a Pie chart have a property of Rose is rose pie chart.But the chart builder will not change the chart type to the corresponding chart type.
|
|
303
|
-
* @returns {ChartTypeBits} ChartType - The chart type of the chart this builder modifies.
|
|
304
|
-
*/
|
|
305
|
-
getChartType(): ChartTypeBits;
|
|
306
|
-
/**
|
|
307
|
-
* Adds a range to the chart this builder modifies
|
|
308
|
-
* @param {IRange | string} range The range string or object to add for chart source data.The should be not a single cell.
|
|
309
|
-
* @returns {FChartBuilderBase} -this builder, for chaining
|
|
310
|
-
*
|
|
311
|
-
* @example
|
|
312
|
-
* ```ts
|
|
313
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
314
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
315
|
-
*
|
|
316
|
-
* // Create a column chart with data source A1:D6
|
|
317
|
-
* // The starting position is upper-left corner of cell B2.
|
|
318
|
-
* const chartInfo = fWorksheet.newChart()
|
|
319
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
320
|
-
* .addRange('A1:D6')
|
|
321
|
-
* .setPosition(1, 1, 0, 0)
|
|
322
|
-
* .build();
|
|
323
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
324
|
-
* ```
|
|
325
|
-
*/
|
|
326
|
-
addRange(range: IRange | string): this;
|
|
327
|
-
/**
|
|
328
|
-
* Clears the range from the chart this builder modifies
|
|
329
|
-
* @returns {FChartBuilderBase} -this builder, for chaining
|
|
330
|
-
*/
|
|
331
|
-
clearRange(): this;
|
|
332
|
-
/**
|
|
333
|
-
* Sets the position, changing where the chart appears on the sheet. anchorRowPos and anchorColPos are 0-indexed.This api can only work in the active sheet.
|
|
334
|
-
* @description The chart's start anchor position is the top left-hand corner of the chart. The rowOffset and columnOffset are the pixel offsets from the anchor position.
|
|
335
|
-
* @param {number} anchorRowPos The chart's top side is anchored in this row.
|
|
336
|
-
* @param {number} anchorColPos The chart's left side is anchored in this column.
|
|
337
|
-
* @param {number} rowOffset The chart's top left-hand corner is offset by this many pixels.
|
|
338
|
-
* @param {number} columnOffset The chart's lower left-hand corner is offset by this many pixels.
|
|
339
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
340
|
-
*
|
|
341
|
-
* @example
|
|
342
|
-
* ```ts
|
|
343
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
344
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
345
|
-
*
|
|
346
|
-
* // Create a column chart with data source A1:D6
|
|
347
|
-
* // The starting position is upper-left corner of cell F3 and offset 20 pixels to the right and down.
|
|
348
|
-
* const chartInfo = fWorksheet.newChart()
|
|
349
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
350
|
-
* .addRange('A1:D6')
|
|
351
|
-
* .setPosition(2, 5, 20, 20)
|
|
352
|
-
* .build();
|
|
353
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
354
|
-
* ```
|
|
355
|
-
*/
|
|
356
|
-
setPosition(anchorRowPos: number, anchorColPos: number, rowOffset: number, columnOffset: number): this;
|
|
357
|
-
/**
|
|
358
|
-
* Sets the position, changing where the chart appears on the sheet by pixel.
|
|
359
|
-
* @description The chart's start anchor position is the top left-hand corner of the chart. This api is opposite to setPosition.
|
|
360
|
-
* @param {number} x The x-coordinate of the chart's top left-hand corner.
|
|
361
|
-
* @param {number} y The y-coordinate of the chart's top left-hand corner.
|
|
362
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
363
|
-
*
|
|
364
|
-
* @example
|
|
365
|
-
* ```ts
|
|
366
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
367
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
368
|
-
*
|
|
369
|
-
* // Create a column chart with data source A1:D6
|
|
370
|
-
* // The starting position is (100, 200) pixels from the top left-hand corner of the sheet.
|
|
371
|
-
* const chartInfo = fWorksheet.newChart()
|
|
372
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
373
|
-
* .addRange('A1:D6')
|
|
374
|
-
* .setAbsolutePosition(100, 200)
|
|
375
|
-
* .build();
|
|
376
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
377
|
-
* ```
|
|
378
|
-
*/
|
|
379
|
-
setAbsolutePosition(x: number, y: number): this;
|
|
380
|
-
/**
|
|
381
|
-
* The type of chart to create.
|
|
382
|
-
* @param {ChartTypeBits} chartType The type of chart to create.Which can be found from package @univerjs-pro/sheets-chart.
|
|
383
|
-
* @description The type of chart to create. The following are the possible values: Line,Column,ColumnStacked,ColumnPercentStacked,Bar,BarStacked,BarPercentStacked,Pie,Doughnut,Area,AreaStacked,AreaPercentStacked,Radar,Scatter,Combination
|
|
384
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
385
|
-
*
|
|
386
|
-
* @example
|
|
387
|
-
* ```ts
|
|
388
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
389
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
390
|
-
*
|
|
391
|
-
* // Create a column chart with data source A1:D6
|
|
392
|
-
* // The starting position is upper-left corner of cell B2.
|
|
393
|
-
* const chartInfo = fWorksheet.newChart()
|
|
394
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
395
|
-
* .addRange('A1:D6')
|
|
396
|
-
* .setPosition(1, 1, 0, 0)
|
|
397
|
-
* .build();
|
|
398
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
399
|
-
*
|
|
400
|
-
* // Get all charts on the active sheet.
|
|
401
|
-
* const charts = fWorksheet.getCharts();
|
|
402
|
-
*
|
|
403
|
-
* // Update the first chart type to line after 3 seconds.
|
|
404
|
-
* setTimeout(() => {
|
|
405
|
-
* const newChartInfo = fWorksheet.newChart(charts[0])
|
|
406
|
-
* .setChartType(univerAPI.Enum.ChartType.Line)
|
|
407
|
-
* .build();
|
|
408
|
-
* fWorksheet.updateChart(newChartInfo);
|
|
409
|
-
* }, 3000);
|
|
410
|
-
* ```
|
|
411
|
-
*/
|
|
412
|
-
setChartType(chartType: ChartTypeBits): this;
|
|
413
|
-
/**
|
|
414
|
-
* Sets the width of the chart in pixels.
|
|
415
|
-
* @param {number} width The width of the chart in pixels.
|
|
416
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
417
|
-
*
|
|
418
|
-
* @example
|
|
419
|
-
* ```ts
|
|
420
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
421
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
422
|
-
*
|
|
423
|
-
* // Create a column chart with data source A1:D6
|
|
424
|
-
* // The starting position is upper-left corner of cell B2.
|
|
425
|
-
* // The width of the chart is 600 and the height is 400.
|
|
426
|
-
* const chartInfo = fWorksheet.newChart()
|
|
427
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
428
|
-
* .addRange('A1:D6')
|
|
429
|
-
* .setPosition(1, 1, 0, 0)
|
|
430
|
-
* .setWidth(600)
|
|
431
|
-
* .setHeight(400)
|
|
432
|
-
* .build();
|
|
433
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
434
|
-
* ```
|
|
435
|
-
*/
|
|
436
|
-
setWidth(width: number): this;
|
|
437
|
-
/**
|
|
438
|
-
* Sets the height of the chart in pixels.
|
|
439
|
-
* @param {number} height The height of the chart in pixels.
|
|
440
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
441
|
-
*
|
|
442
|
-
* @example
|
|
443
|
-
* ```ts
|
|
444
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
445
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
446
|
-
*
|
|
447
|
-
* // Create a column chart with data source A1:D6
|
|
448
|
-
* // The starting position is upper-left corner of cell B2.
|
|
449
|
-
* // The width of the chart is 600 and the height is 400.
|
|
450
|
-
* const chartInfo = fWorksheet.newChart()
|
|
451
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
452
|
-
* .addRange('A1:D6')
|
|
453
|
-
* .setPosition(1, 1, 0, 0)
|
|
454
|
-
* .setWidth(600)
|
|
455
|
-
* .setHeight(400)
|
|
456
|
-
* .build();
|
|
457
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
458
|
-
* ```
|
|
459
|
-
*/
|
|
460
|
-
setHeight(height: number): this;
|
|
461
|
-
/**
|
|
462
|
-
* The options for the chart. This function will overwrite existing options and merge new options property.
|
|
463
|
-
* @param {string} optionPath The path of the option to set. A '' path means the root of the options object.
|
|
464
|
-
* @param {object|number|string} optionVal The value to set. Undefined value will be ignore , and null means delete the property.If a path is '', the value must be the whole options object.
|
|
465
|
-
* @returns {FChartBuilderBase} The builder, for chaining.
|
|
466
|
-
*
|
|
467
|
-
* @example
|
|
468
|
-
* ```ts
|
|
469
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
470
|
-
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
471
|
-
* const chartBuilder = fWorkSheet.newChart().asPieChart();
|
|
472
|
-
* const chartBuilderInfo1 = chartBuilder
|
|
473
|
-
* .addRange('A1:D6')
|
|
474
|
-
* .setOptions('title.content', 'Chart Title')
|
|
475
|
-
* .setOptions('legend.position', 'right')
|
|
476
|
-
* .setDoughnutHole(0.5)
|
|
477
|
-
* .setHasPaddingAngle(true)
|
|
478
|
-
* .setRosePie(true)
|
|
479
|
-
* .setIsHalfPie(true)
|
|
480
|
-
* .build();
|
|
481
|
-
* // setOptions can be replaced by setOptions('', { ... })
|
|
482
|
-
* const chartBuilderInfo2 = chartBuilder
|
|
483
|
-
* .addRange('A1:D6')
|
|
484
|
-
* .setOptions('', {
|
|
485
|
-
* "title": {
|
|
486
|
-
* "content": "Chart Title"
|
|
487
|
-
* },
|
|
488
|
-
* "legend": {
|
|
489
|
-
* "position": "right"
|
|
490
|
-
* },
|
|
491
|
-
* "pie": {
|
|
492
|
-
* "doughnutHole": 0.5,
|
|
493
|
-
* "hasPaddingAngle": true,
|
|
494
|
-
* "isHalfPie": true,
|
|
495
|
-
* "rosePie": true
|
|
496
|
-
* }
|
|
497
|
-
* })
|
|
498
|
-
* .build();
|
|
499
|
-
* await fWorkSheet.insertChart(chartBuilderInfo1);
|
|
500
|
-
* // or they are same effect
|
|
501
|
-
* // await fWorkSheet.insertChart(chartBuilderInfo2);
|
|
502
|
-
* ```
|
|
503
|
-
*/
|
|
504
|
-
setOptions(optionPath: string, optionVal: unknown): this;
|
|
505
|
-
/**
|
|
506
|
-
* Sets whether to transpose the rows and columns of the chart.
|
|
507
|
-
* @param {boolean} transposeRowsAndColumns Whether to transpose the rows and columns of the chart.The default value is false.
|
|
508
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
509
|
-
*
|
|
510
|
-
* @example
|
|
511
|
-
* ```ts
|
|
512
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
513
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
514
|
-
*
|
|
515
|
-
* // Create a column chart with data source A1:D6
|
|
516
|
-
* // The starting position is upper-left corner of cell B2.
|
|
517
|
-
* // The chart will transpose the rows and columns.
|
|
518
|
-
* const chartInfo = fWorksheet.newChart()
|
|
519
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
520
|
-
* .addRange('A1:D6')
|
|
521
|
-
* .setPosition(1, 1, 0, 0)
|
|
522
|
-
* // the chart will transpose the rows and columns
|
|
523
|
-
* .setTransposeRowsAndColumns(true)
|
|
524
|
-
* .build();
|
|
525
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
526
|
-
* ```
|
|
527
|
-
*/
|
|
528
|
-
setTransposeRowsAndColumns(transposeRowsAndColumns: boolean): this;
|
|
529
|
-
/**
|
|
530
|
-
* Sets the theme of the chart. If the theme name not registered, a default theme will be used.
|
|
531
|
-
* @param {string} theme The theme name of the chart.
|
|
532
|
-
* @returns {{FChartBuilderBase}} -this builder, for chaining.
|
|
533
|
-
*
|
|
534
|
-
* @example
|
|
535
|
-
* ```ts
|
|
536
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
537
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
538
|
-
*
|
|
539
|
-
* // register your theme
|
|
540
|
-
* const theme = { // your theme object
|
|
541
|
-
* 'version': 1,
|
|
542
|
-
* 'themeName': 'myTheme',
|
|
543
|
-
* 'theme': {
|
|
544
|
-
* // ... Some code is omitted for brevity
|
|
545
|
-
* color: [
|
|
546
|
-
* '#893448',
|
|
547
|
-
* '#d95850',
|
|
548
|
-
* '#eb8146',
|
|
549
|
-
* '#ffb248',
|
|
550
|
-
* '#f2d643',
|
|
551
|
-
* '#ebdba4'
|
|
552
|
-
* ],
|
|
553
|
-
* // ... Some code is omitted for brevity
|
|
554
|
-
* visualMapColor: [
|
|
555
|
-
* '#893448',
|
|
556
|
-
* '#d95850',
|
|
557
|
-
* '#eb8146',
|
|
558
|
-
* '#ffb248',
|
|
559
|
-
* '#f2d643',
|
|
560
|
-
* 'rgb(247,238,173)'
|
|
561
|
-
* ],
|
|
562
|
-
* // ... Some code is omitted for brevity
|
|
563
|
-
* 'axes': [
|
|
564
|
-
* // ... Some code is omitted for brevity
|
|
565
|
-
* ]
|
|
566
|
-
* // ... Some code is omitted for brevity
|
|
567
|
-
* }
|
|
568
|
-
* };
|
|
569
|
-
* fWorksheet.registerChartTheme('myTheme', theme);
|
|
570
|
-
*
|
|
571
|
-
* // use your theme for chart
|
|
572
|
-
* const chartInfo = fWorksheet.newChart()
|
|
573
|
-
* .asLineChart()
|
|
574
|
-
* .addRange('A1:D6')
|
|
575
|
-
* .setPosition(1, 1, 0, 0)
|
|
576
|
-
* .setTheme('myTheme')
|
|
577
|
-
* .build();
|
|
578
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
579
|
-
* ```
|
|
580
|
-
*/
|
|
581
|
-
setTheme(theme: string): this;
|
|
582
|
-
/**
|
|
583
|
-
* Sets the title of the chart x-axis.
|
|
584
|
-
* @param {string} title The title of the chart x-axis.
|
|
585
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
586
|
-
*
|
|
587
|
-
* @example
|
|
588
|
-
* ```ts
|
|
589
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
590
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
591
|
-
*
|
|
592
|
-
* // Create a column chart with data source A1:D6
|
|
593
|
-
* // The starting position is upper-left corner of cell B2.
|
|
594
|
-
* // The x-axis title is 'xAxis Title text'.
|
|
595
|
-
* const chartInfo = fWorksheet.newChart()
|
|
596
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
597
|
-
* .addRange('A1:D6')
|
|
598
|
-
* .setPosition(1, 1, 0, 0)
|
|
599
|
-
* .setXAxisTitle('xAxis Title text')
|
|
600
|
-
* .build();
|
|
601
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
602
|
-
* ```
|
|
603
|
-
*/
|
|
604
|
-
setXAxisTitle(title: string): this;
|
|
605
|
-
/**
|
|
606
|
-
* Sets the title of the chart y-axis.
|
|
607
|
-
* @param {string} title The title of the chart y-axis.
|
|
608
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
609
|
-
*
|
|
610
|
-
* @example
|
|
611
|
-
* ```ts
|
|
612
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
613
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
614
|
-
*
|
|
615
|
-
* // Create a line chart with data source A1:D6
|
|
616
|
-
* // The starting position is upper-left corner of cell B2.
|
|
617
|
-
* // The y-axis title is 'yAxis Title text'.
|
|
618
|
-
* const chartInfo = fWorksheet.newChart()
|
|
619
|
-
* .asLineChart()
|
|
620
|
-
* .addRange('A1:D6')
|
|
621
|
-
* .setPosition(1, 1, 0, 0)
|
|
622
|
-
* .setYAxisTitle('yAxis Title text')
|
|
623
|
-
* .build();
|
|
624
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
625
|
-
* ```
|
|
626
|
-
*/
|
|
627
|
-
setYAxisTitle(title: string): this;
|
|
628
|
-
/**
|
|
629
|
-
* Sets the title of the chart right y-axis.
|
|
630
|
-
* @param {string} title The title of the chart right y-axis.
|
|
631
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
632
|
-
*
|
|
633
|
-
* @example
|
|
634
|
-
* ```ts
|
|
635
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
636
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
637
|
-
*
|
|
638
|
-
* // Create a line chart with data source A1:D6
|
|
639
|
-
* // The starting position is upper-left corner of cell B2.
|
|
640
|
-
* // The right y-axis title is 'rightYAxis Title text'.
|
|
641
|
-
* const chartInfo = fWorksheet.newChart()
|
|
642
|
-
* .asLineChart()
|
|
643
|
-
* .addRange('A1:D6')
|
|
644
|
-
* .setPosition(1, 1, 0, 0)
|
|
645
|
-
* .setRightYAxisTitle('rightYAxis Title text')
|
|
646
|
-
* .build();
|
|
647
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
648
|
-
* ```
|
|
649
|
-
*/
|
|
650
|
-
setRightYAxisTitle(title: string): this;
|
|
651
|
-
/**
|
|
652
|
-
* Sets the text style for the chart x-axis.
|
|
653
|
-
* @param {IChartTextStyle} textStyle The text style for the chart x-axis.
|
|
654
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
655
|
-
*
|
|
656
|
-
* @example
|
|
657
|
-
* ```ts
|
|
658
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
659
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
660
|
-
*
|
|
661
|
-
* // Create a column chart with data source A1:D6
|
|
662
|
-
* // The starting position is upper-left corner of cell B2.
|
|
663
|
-
* // The x-axis style is set.
|
|
664
|
-
* const chartInfo = fWorksheet.newChart()
|
|
665
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
666
|
-
* .addRange('A1:D6')
|
|
667
|
-
* .setPosition(1, 1, 0, 0)
|
|
668
|
-
* .setXAxisTextStyle({
|
|
669
|
-
* content: 'xAxis Title text',
|
|
670
|
-
* fontSize: 12,
|
|
671
|
-
* fontColor: '#ff0000'
|
|
672
|
-
* })
|
|
673
|
-
* .build();
|
|
674
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
675
|
-
* ```
|
|
676
|
-
*/
|
|
677
|
-
setXAxisTextStyle(textStyle: IChartTextStyle): this;
|
|
678
|
-
/**
|
|
679
|
-
* Sets the text style for the chart y-axis.
|
|
680
|
-
* @param {IChartTextStyle} textStyle The text style for the chart y-axis.
|
|
681
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
682
|
-
*
|
|
683
|
-
* @example
|
|
684
|
-
* ```ts
|
|
685
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
686
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
687
|
-
*
|
|
688
|
-
* // Create a line chart with data source A1:D6
|
|
689
|
-
* // The starting position is upper-left corner of cell B2.
|
|
690
|
-
* // The y-axis style is set.
|
|
691
|
-
* const chartInfo = fWorksheet.newChart()
|
|
692
|
-
* .asLineChart()
|
|
693
|
-
* .addRange('A1:D6')
|
|
694
|
-
* .setPosition(1, 1, 0, 0)
|
|
695
|
-
* .setYAxisTextStyle({
|
|
696
|
-
* content: 'yAxis Title text',
|
|
697
|
-
* fontSize: 12,
|
|
698
|
-
* fontColor: '#ff0000'
|
|
699
|
-
* })
|
|
700
|
-
* .build();
|
|
701
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
702
|
-
* ```
|
|
703
|
-
*/
|
|
704
|
-
setYAxisTextStyle(textStyle: IChartTextStyle): this;
|
|
705
|
-
/**
|
|
706
|
-
* Sets the text style for the chart right y-axis. Only works in charts have right y-axis.
|
|
707
|
-
* @param {IChartTextStyle} textStyle The text style for the chart right y-axis.
|
|
708
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
709
|
-
*
|
|
710
|
-
* @example
|
|
711
|
-
* ```ts
|
|
712
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
713
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
714
|
-
*
|
|
715
|
-
* // Create a line chart with data source A1:D6
|
|
716
|
-
* // The starting position is upper-left corner of cell B2.
|
|
717
|
-
* // The right y-axis style is set.
|
|
718
|
-
* const chartInfo = fWorksheet.newChart()
|
|
719
|
-
* .asLineChart()
|
|
720
|
-
* .addRange('A1:D6')
|
|
721
|
-
* .setPosition(1, 1, 0, 0)
|
|
722
|
-
* .setRightYAxisTextStyle({
|
|
723
|
-
* content: 'rightYAxis Title text',
|
|
724
|
-
* fontSize: 12,
|
|
725
|
-
* fontColor: '#ff0000'
|
|
726
|
-
* })
|
|
727
|
-
* .build();
|
|
728
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
729
|
-
* ```
|
|
730
|
-
*/
|
|
731
|
-
setRightYAxisTextStyle(textStyle: IChartTextStyle): this;
|
|
732
|
-
/**
|
|
733
|
-
* Sets how to handle invalid data in the chart.The possible values are 'zero', 'break' & 'link'.
|
|
734
|
-
* @description The default value is 'zero'. It means that invalid data will be treated as zero. 'break' means that the chart will have a gap where the invalid data is. 'link' means that the chart will connect the data points on either side of the invalid data.
|
|
735
|
-
* @param {InvalidValueType} invalidValueType The type of invalid value to use.
|
|
736
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
737
|
-
*
|
|
738
|
-
* @example
|
|
739
|
-
* ```ts
|
|
740
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
741
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
742
|
-
*
|
|
743
|
-
* // Create a line chart with data source A1:D6
|
|
744
|
-
* // The starting position is upper-left corner of cell B2.
|
|
745
|
-
* // The invalid value is set as zero.
|
|
746
|
-
* const chartInfo = fWorksheet.newChart()
|
|
747
|
-
* .asLineChart()
|
|
748
|
-
* .addRange('A1:D6')
|
|
749
|
-
* .setPosition(1, 1, 0, 0)
|
|
750
|
-
* .setInvalidValueStrategy('zero')
|
|
751
|
-
* .build();
|
|
752
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
753
|
-
* ```
|
|
754
|
-
*/
|
|
755
|
-
setInvalidValueStrategy(invalidValueType: InvalidValueType): this;
|
|
756
|
-
/**
|
|
757
|
-
* Sets the axis pointer style
|
|
758
|
-
* @param {IChartBuildOptions['axisPointer']} style The style for the axis pointer.
|
|
759
|
-
* @typedef AxisPointerStyle
|
|
760
|
-
* @property {string} [AxisPointerStyle.indicatorLabelColor] The line color of the axis pointer.
|
|
761
|
-
* @property {string} [AxisPointerStyle.indicatorLabelTextColor] The font color of the axis pointer.
|
|
762
|
-
* @property {ChartBorderDashType} [AxisPointerStyle.indicatorLineType] The line type of the axis pointer.
|
|
763
|
-
* @property {string} [AxisPointerStyle.indicatorLineColor] The line width of the axis pointer.
|
|
764
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
765
|
-
*
|
|
766
|
-
* @example
|
|
767
|
-
* ```ts
|
|
768
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
769
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
770
|
-
*
|
|
771
|
-
* // Create a line chart with data source A1:D6
|
|
772
|
-
* // The starting position is upper-left corner of cell B2.
|
|
773
|
-
* // The axis pointer style is set.
|
|
774
|
-
* const chartInfo = fWorksheet.newChart()
|
|
775
|
-
* .asLineChart()
|
|
776
|
-
* .addRange('A1:D6')
|
|
777
|
-
* .setPosition(1, 1, 0, 0)
|
|
778
|
-
* .setAxisPointerStyle({
|
|
779
|
-
* indicatorLabelColor: '#ff0000',
|
|
780
|
-
* indicatorLineType: univerAPI.Enum.ChartBorderDashType.Solid,
|
|
781
|
-
* indicatorLineColor: '#00ff00',
|
|
782
|
-
* indicatorLabelTextColor: '#0000ff',
|
|
783
|
-
* })
|
|
784
|
-
* .build();
|
|
785
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
786
|
-
*
|
|
787
|
-
* // a AxisPointerStyle can be defined like following:
|
|
788
|
-
* const chartInfo = fWorksheet.newChart().setOptions('axisPointer.indicatorLineColor', '#ff0000')
|
|
789
|
-
* .setOptions('axisPointer.indicatorLineType', univerAPI.Enum.ChartBorderDashType.Solid)
|
|
790
|
-
* .setOptions('axisPointer.indicatorLineColor', '#00ff00')
|
|
791
|
-
* .setOptions('axisPointer.indicatorLabelTextColor', '#0000ff')
|
|
792
|
-
* .build();
|
|
793
|
-
* ```
|
|
794
|
-
*/
|
|
795
|
-
setAxisPointerStyle(style: IChartBuildOptions['axisPointer']): this;
|
|
796
|
-
/**
|
|
797
|
-
* Sets styles for all series.
|
|
798
|
-
* @typedef allSeriesStyle
|
|
799
|
-
* @property {ChartTypeBits} [chartType] The chart type of the series.It only works in combination chart, and the value must be one of ChartTypeBits.Line | ChartTypeBits.Column | ChartTypeBits.Area;
|
|
800
|
-
* @property {boolean} [rightYAxis] Use the right y-axis for the series.
|
|
801
|
-
* @property {string} [color] The color of the series.
|
|
802
|
-
* @property {number} [fillOpacity] The opacity of the series fill.
|
|
803
|
-
* @property {object} [border] The border style of the series.
|
|
804
|
-
* @property {string} [border.color] The color of the series border.
|
|
805
|
-
* @property {number} [border.opacity] The opacity of the series border.
|
|
806
|
-
* @property {number} [border.width] The width of the series border.
|
|
807
|
-
* @property {ChartBorderDashType} [border.dashType] The dash type of the series border.
|
|
808
|
-
* @property {ISeriesLabelStyle} [label] The label style of the series.
|
|
809
|
-
* @property {IPointStyle} [point] The point style of the series.
|
|
810
|
-
* @property {IDataPointStyle} [dataPoints] The data point style of the series.Radar chart does not support this property.
|
|
811
|
-
* @param {allSeriesStyle} allSeriesStyle The style for all series.
|
|
812
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
813
|
-
*
|
|
814
|
-
* @example
|
|
815
|
-
* ```ts
|
|
816
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
817
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
818
|
-
*
|
|
819
|
-
* // Create a line chart with data source A1:D6
|
|
820
|
-
* // The starting position is upper-left corner of cell B2.
|
|
821
|
-
* // The all series style is set.
|
|
822
|
-
* const chartInfo = fWorksheet.newChart()
|
|
823
|
-
* .asLineChart()
|
|
824
|
-
* .addRange('A1:D6')
|
|
825
|
-
* .setPosition(1, 1, 0, 0)
|
|
826
|
-
* .setAllSeriesStyle({
|
|
827
|
-
* rightYAxis: false,
|
|
828
|
-
* color: '#ff0000',
|
|
829
|
-
* border: {
|
|
830
|
-
* color: '#00ff00',
|
|
831
|
-
* opacity: 0.5,
|
|
832
|
-
* width: 1,
|
|
833
|
-
* dashType: univerAPI.Enum.ChartBorderDashType.Solid,
|
|
834
|
-
* },
|
|
835
|
-
* })
|
|
836
|
-
* .build();
|
|
837
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
838
|
-
* ```
|
|
839
|
-
*/
|
|
840
|
-
setAllSeriesStyle(allSeriesStyle: Partial<IAllSeriesStyle>): this;
|
|
841
|
-
/**
|
|
842
|
-
* Sets the series style by series index.
|
|
843
|
-
* @description Like setALLSeriesStyle, this difference is the style only set for the provide sty
|
|
844
|
-
* @param {number | string} index The index of the series to set the style for.
|
|
845
|
-
* @param {ISeriesStyle} seriesStyle The style for the series.
|
|
846
|
-
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
847
|
-
*
|
|
848
|
-
* @example
|
|
849
|
-
* ```ts
|
|
850
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
851
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
852
|
-
*
|
|
853
|
-
* // Create a line chart with data source A1:D6
|
|
854
|
-
* // The starting position is upper-left corner of cell B2.
|
|
855
|
-
* const chartInfo = fWorksheet.newChart()
|
|
856
|
-
* .asLineChart()
|
|
857
|
-
* .addRange('A1:D6')
|
|
858
|
-
* .setPosition(1, 1, 0, 0)
|
|
859
|
-
* .build();
|
|
860
|
-
* const fChart = await fWorksheet.insertChart(chartInfo);
|
|
861
|
-
*
|
|
862
|
-
* // Update the first series style after 3 seconds.
|
|
863
|
-
* setTimeout(() => {
|
|
864
|
-
* const first = fChart.getSeriesData()[0];
|
|
865
|
-
* const newChartInfo = fWorksheet.newChart(fChart)
|
|
866
|
-
* .setSeriesStyle(first.index, {
|
|
867
|
-
* color: '#ff0000',
|
|
868
|
-
* })
|
|
869
|
-
* .build();
|
|
870
|
-
* fWorksheet.updateChart(newChartInfo);
|
|
871
|
-
* }, 3000);
|
|
872
|
-
* ```
|
|
873
|
-
*/
|
|
874
|
-
setSeriesStyle(index: number | string, seriesStyle: ISeriesStyle): this;
|
|
875
|
-
/**
|
|
876
|
-
* Builds the chart to reflect all changes made to it.
|
|
877
|
-
* @description This method does not automatically draw the chart on top of the spreadsheet. A new chart must be inserted via sheet.insertChart(chart), and an existing chart should be updated via sheet.updateChart(chart).
|
|
878
|
-
* @returns {IChartBuilderInfo} -The chart builder info.
|
|
879
|
-
*
|
|
880
|
-
* @example
|
|
881
|
-
* ```ts
|
|
882
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
883
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
884
|
-
*
|
|
885
|
-
* // Create a column chart with data source A1:D6
|
|
886
|
-
* // The starting position is upper-left corner of cell B2.
|
|
887
|
-
* // The width of the chart is 600 and the height is 400.
|
|
888
|
-
* const chartInfo = fWorksheet.newChart()
|
|
889
|
-
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
890
|
-
* .addRange('A1:D6')
|
|
891
|
-
* .setPosition(1, 1, 0, 0)
|
|
892
|
-
* .setWidth(600)
|
|
893
|
-
* .setHeight(400)
|
|
894
|
-
* .build();
|
|
895
|
-
* await fWorksheet.insertChart(chartInfo);
|
|
896
|
-
* ```
|
|
897
|
-
*/
|
|
898
|
-
build(): IChartBuilderInfo;
|
|
899
|
-
}
|