@univerjs-pro/sheets-chart 0.5.0-alpha.0 → 0.5.0-beta.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.
Files changed (62) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/cjs/locale/en-US.js +1 -1
  3. package/lib/cjs/locale/ru-RU.js +1 -1
  4. package/lib/cjs/locale/vi-VN.js +1 -1
  5. package/lib/cjs/locale/zh-CN.js +1 -1
  6. package/lib/cjs/locale/zh-TW.js +1 -1
  7. package/lib/es/index.js +1 -1
  8. package/lib/es/locale/en-US.js +1 -1
  9. package/lib/es/locale/ru-RU.js +1 -1
  10. package/lib/es/locale/vi-VN.js +1 -1
  11. package/lib/es/locale/zh-CN.js +1 -1
  12. package/lib/es/locale/zh-TW.js +1 -1
  13. package/lib/types/chart-source/chart-source.d.ts +59 -0
  14. package/lib/types/chart-source/source-util.d.ts +30 -0
  15. package/lib/types/commands/commands/sheets-chart-update-config.command.d.ts +14 -0
  16. package/lib/types/commands/commands/sheets-chart-update-source.command.d.ts +8 -0
  17. package/lib/types/commands/mutations/sheet-chart-update-source.mutation.d.ts +8 -0
  18. package/lib/types/commands/mutations/sheets-chart-update-config.mutation.d.ts +13 -0
  19. package/lib/types/commands/mutations/sheets-chart.mutation.d.ts +11 -0
  20. package/lib/types/common/util.d.ts +15 -0
  21. package/lib/types/index.d.ts +37 -814
  22. package/lib/types/locale/en-US.d.ts +3 -0
  23. package/lib/types/locale/ru-RU.d.ts +3 -0
  24. package/lib/types/locale/vi-VN.d.ts +3 -0
  25. package/lib/types/locale/zh-CN.d.ts +22 -0
  26. package/lib/types/locale/zh-TW.d.ts +3 -0
  27. package/lib/types/models/chart-data-operators/build-chart-data.d.ts +3 -0
  28. package/lib/types/models/chart-data-operators/index.d.ts +17 -0
  29. package/lib/types/models/chart-data-operators/operators.d.ts +24 -0
  30. package/lib/types/models/constants/build-in-theme/default.d.ts +2 -0
  31. package/lib/types/models/constants/build-in-theme/index.d.ts +15 -0
  32. package/lib/types/models/constants/build-in-theme/types.d.ts +77 -0
  33. package/lib/types/models/constants/build-in-theme/univer-gradient1.d.ts +2 -0
  34. package/lib/types/models/constants/build-in-theme/univer-gradient2.d.ts +2 -0
  35. package/lib/types/models/constants/build-in-theme/univer-gradient3.d.ts +2 -0
  36. package/lib/types/models/constants/build-in-theme/univer-gradient4.d.ts +2 -0
  37. package/lib/types/models/constants/build-in-theme/univer-gradient5.d.ts +2 -0
  38. package/lib/types/models/constants/build-in-theme/univer-gradient6.d.ts +2 -0
  39. package/lib/types/models/constants/build-in-theme/univer1.d.ts +2 -0
  40. package/lib/types/models/constants/build-in-theme/univer2.d.ts +2 -0
  41. package/lib/types/models/constants/build-in-theme/univer3.d.ts +2 -0
  42. package/lib/types/models/constants/build-in-theme/univer4.d.ts +2 -0
  43. package/lib/types/models/constants/build-in-theme/univer5.d.ts +2 -0
  44. package/lib/types/models/constants/build-in-theme/univer6.d.ts +2 -0
  45. package/lib/types/models/constants/default-chart-style.d.ts +63 -0
  46. package/lib/types/models/constants.d.ts +59 -0
  47. package/lib/types/models/data-context-transformers/bar-data-context-transformer.d.ts +3 -0
  48. package/lib/types/models/data-context-transformers/pie-data-context-transformer.d.ts +3 -0
  49. package/lib/types/models/runtime-context.types.d.ts +28 -0
  50. package/lib/types/models/style.types.d.ts +213 -0
  51. package/lib/types/models/types.d.ts +124 -0
  52. package/lib/types/plugins/univer-sheets-chart-plugin.d.ts +15 -0
  53. package/lib/types/services/chart-model.service.d.ts +23 -0
  54. package/lib/types/services/chart-theme.service.d.ts +17 -0
  55. package/lib/types/services/sheets-chart.service.d.ts +45 -0
  56. package/lib/umd/index.js +1 -1
  57. package/lib/umd/locale/en-US.js +1 -1
  58. package/lib/umd/locale/ru-RU.js +1 -1
  59. package/lib/umd/locale/vi-VN.js +1 -1
  60. package/lib/umd/locale/zh-CN.js +1 -1
  61. package/lib/umd/locale/zh-TW.js +1 -1
  62. package/package.json +10 -15
@@ -1,814 +1,37 @@
1
- import { CellValue } from '@univerjs/core';
2
- import { ChartModel } from './models/chart-model';
3
- import { ChartModel as ChartModel_2 } from '../models/chart-model';
4
- import { Disposable as Disposable_2 } from '@univerjs/core';
5
- import { getThemeAxesByType } from './theme-util';
6
- import { getThemeProps } from './theme-util';
7
- import { IChartModelInit } from '../models/chart-model';
8
- import { ICommandService } from '@univerjs/core';
9
- import { ILogService } from '@univerjs/core';
10
- import { IMutation } from '@univerjs/core';
11
- import { Injector } from '@univerjs/core';
12
- import { IRange } from '@univerjs/core';
13
- import { IResourceManagerService } from '@univerjs/core';
14
- import { ISheetCommandSharedParams } from '@univerjs/sheets';
15
- import { IUniverInstanceService } from '@univerjs/core';
16
- import { Nullable } from '@univerjs/core';
17
- import { Observable } from 'rxjs';
18
- import { Plugin as Plugin_2 } from '@univerjs/core';
19
- import { RefRangeService } from '@univerjs/sheets';
20
- import { UniverInstanceType } from '@univerjs/core';
21
-
22
- export declare const aggregateOperator: IChartDataAggregateOperator;
23
-
24
- export declare enum AreaLineStyle {
25
- Line = "line",
26
- Smooth = "smooth",
27
- Step = "step"
28
- }
29
-
30
- export declare enum AxisAlignEnum {
31
- Start = "start",
32
- Center = "center",
33
- End = "end"
34
- }
35
-
36
- export declare enum AxisValueType {
37
- Text = 1,
38
- Numeric = 2
39
- }
40
-
41
- export declare const calcPosition: (text: string, font: string) => ISize;
42
-
43
- export declare enum CategoryType {
44
- Linear = "Linear",
45
- Text = "Text"
46
- }
47
-
48
- /**
49
- * Copyright 2023-present DreamNum Inc.
50
- *
51
- * Licensed under the Apache License, Version 2.0 (the "License");
52
- * you may not use this file except in compliance with the License.
53
- * You may obtain a copy of the License at
54
- *
55
- * http://www.apache.org/licenses/LICENSE-2.0
56
- *
57
- * Unless required by applicable law or agreed to in writing, software
58
- * distributed under the License is distributed on an "AS IS" BASIS,
59
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60
- * See the License for the specific language governing permissions and
61
- * limitations under the License.
62
- */
63
- export declare enum ChartAttributeBits {
64
- Stack = 1073741824,
65
- PercentStack = 1610612736,
66
- Horizontal = 268435456
67
- }
68
-
69
- export declare const chartBitsUtils: {
70
- has(bit: number, attribute: number): boolean;
71
- baseOn(bit: number, base: number): boolean;
72
- remove(bit: number, attribute: number): number;
73
- chartBitToString(bit: ChartTypeBits): "" | "line" | "pie" | "bar" | "radar" | "scatter" | "combination";
74
- };
75
-
76
- export declare enum ChartBorderDashType {
77
- Solid = "solid",
78
- Dashed = "dashed",
79
- Dotted = "dotted"
80
- }
81
-
82
- export declare enum ChartCartesianAxisPosition {
83
- Left = "left",
84
- Right = "right"
85
- }
86
-
87
- declare type ChartDataSourceValue = Nullable<CellValue>;
88
-
89
- declare type ChartDataSourceValues = Array<Array<ChartDataSourceValue>>;
90
-
91
- export { ChartModel }
92
-
93
- export declare class ChartModelService extends Disposable_2 {
94
- private _injector;
95
- private readonly _logService;
96
- private _commandService;
97
- private _univerInstanceService;
98
- private readonly _activeChartModel$;
99
- readonly activeChartModel$: Observable<Nullable<ChartModel_2>>;
100
- get activeChartModel(): Nullable<ChartModel_2>;
101
- private _models;
102
- private _converters;
103
- private readonly _chartModelAdded$;
104
- readonly chartModelAdded$: Observable<ChartModel_2>;
105
- constructor(_injector: Injector, _logService: ILogService, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService);
106
- setActiveChartModel(chartModel: ChartModel_2): void;
107
- getChartModel(id: string): ChartModel_2 | undefined;
108
- refreshChartModel(): void;
109
- createChartModel(id: string, options: IChartModelInit): ChartModel_2;
110
- removeChartModel(id: string): void;
111
- dispose(): void;
112
- }
113
-
114
- export declare type ChartStyle = DeepPartial<IChartStyle>;
115
-
116
- export declare const ChartTextMeasureCache: Map<string, ISize>;
117
-
118
- export declare class ChartThemeService extends Disposable_2 {
119
- private _themeMap;
120
- private _hasRegistered;
121
- constructor();
122
- getColors(name: string | undefined): string[];
123
- initBuildInThemes(): void;
124
- getRegisteredThemes(): string[];
125
- registerTheme(name: string, theme: IEchartTheme): void;
126
- getTheme(name: string | undefined): IEchartTheme;
127
- getDefaultTheme(): IEchartTheme;
128
- dispose(): void;
129
- }
130
-
131
- export declare enum ChartTypeBits {
132
- None = 0,
133
- /** Line chart */
134
- Line = 2,
135
- /** Bar chart */
136
- Column = 4,
137
- ColumnStacked = 1073741828,
138
- ColumnPercentStacked = 1610612740,
139
- Bar = 268435460,
140
- BarStacked = 1342177284,
141
- BarPercentStacked = 1879048196,
142
- /** Pie chart */
143
- Pie = 8,
144
- Doughnut = 264,
145
- /** Area chart */
146
- Area = 16,
147
- AreaStacked = 1073741840,
148
- AreaPercentStacked = 1610612752,
149
- /** Radar chart */
150
- Radar = 32,
151
- /** Scatter chart */
152
- Scatter = 64,
153
- /** Combination chart */
154
- Combination = 128
155
- }
156
-
157
- export declare const ChartUpdateConfigMutation: IMutation<IChartUpdateConfigMutationParams>;
158
-
159
- export declare const ChartUpdateSourceConfigMutation: IMutation<IChartUpdateSourceMutationParams>;
160
-
161
- export declare const clearChartTextMeasureCache: () => void;
162
-
163
- export declare function countTypesFromArray(arrayData: OptionDataValue[]): {
164
- numbers: number;
165
- strings: number;
166
- };
167
-
168
- export declare enum DataOrientation {
169
- Row = "Row",
170
- Column = "Column"
171
- }
172
-
173
- export declare type DeepPartial<T> = T extends Record<string, any> ? T extends any[] ? T : {
174
- [key in keyof T]+?: DeepPartial<T[key]>;
175
- } : T;
176
-
177
- declare const defaultChartConfig: {
178
- allSeriesId: string;
179
- invalidValueType: InvalidValueType;
180
- line: {
181
- width: number;
182
- };
183
- point: {
184
- shape: LinePointShape;
185
- size: number;
186
- };
187
- axis: {
188
- labelVisible: boolean;
189
- reverse: boolean;
190
- titleAlign: AxisAlignEnum;
191
- };
192
- legend: {
193
- position: LegendPositionEnum;
194
- };
195
- borderStyle: {
196
- opacity: number;
197
- width: number;
198
- dashType: ChartBorderDashType;
199
- };
200
- textStyle: {
201
- fontSize: number;
202
- subTitleFontSize: number;
203
- titleFontSize: number;
204
- color: string;
205
- align: string;
206
- position: SeriesLabelPosition;
207
- bold: boolean;
208
- family: string;
209
- italic: boolean;
210
- };
211
- titlePosition: TitlePositionEnum;
212
- titlePositionAlign: TextAlign;
213
- titleFontSize: number;
214
- area: {
215
- lineStyle: AreaLineStyle;
216
- };
217
- labelContentType: LabelContentType;
218
- pie: {
219
- labelContentType: number;
220
- radius: number;
221
- doughnutHole: number;
222
- borderColor: string;
223
- labelPosition: PieLabelPosition;
224
- hasPaddingAngle: boolean;
225
- };
226
- combination: {
227
- firstChartType: ChartTypeBits;
228
- otherChartType: ChartTypeBits;
229
- };
230
- radar: {
231
- shape: RadarShape;
232
- };
233
- };
234
- export { defaultChartConfig }
235
- export { defaultChartConfig as defaultChartStyle }
236
-
237
- declare type DimensionDefinitionLoose = IDimensionDefinition['name'] | IDimensionDefinition;
238
-
239
- export declare function findCategoryIndexes(dataSource: IChartDataSource): number[];
240
-
241
- export declare const findCategoryOperator: IChartContextOperator;
242
-
243
- export declare const findHeaderOperator: IChartContextOperator;
244
-
245
- export declare const findSeriesOperator: IChartContextOperator;
246
-
247
- export { getThemeAxesByType }
248
-
249
- export { getThemeProps }
250
-
251
- export declare function groupBy<T = any>(ary: T[], selector: (item: T, index: number) => string): {
252
- name: string;
253
- values: T[];
254
- }[];
255
-
256
- export declare interface IAllSeriesStyle extends Pick<ISeriesStyle, 'border' | 'label' | 'rightYAxis' | 'point' | 'color'> {
257
- }
258
-
259
- export declare interface IAxisOptions {
260
- lineVisible: boolean;
261
- label: Omit<ILabelStyle, 'align' | 'content'>;
262
- gridLine: IGridLineStyle;
263
- tick: {
264
- visible: boolean;
265
- lineWidth: number;
266
- lineColor: string;
267
- length: number;
268
- position: PieLabelPosition;
269
- };
270
- reverse?: boolean;
271
- min?: number;
272
- max?: number;
273
- }
274
-
275
- export declare interface IChartConfig extends IChartData {
276
- type: ChartTypeBits;
277
- }
278
-
279
- export declare interface IChartContext {
280
- headers?: string[];
281
- categoryType?: CategoryType;
282
- categoryIndex?: number;
283
- categoryResourceIndexes?: number[];
284
- seriesIndexes?: number[];
285
- seriesResourceIndexes?: number[];
286
- transform?: {
287
- categoryIndex?: number;
288
- seriesIndexes?: number[];
289
- };
290
- }
291
-
292
- export declare type IChartContextOperator = (dataSource: IChartDataSource, context: IChartContext) => IChartContext;
293
-
294
- declare interface IChartData {
295
- category?: IChartDataCategory;
296
- headers?: string[];
297
- series: IChartDataSeries[];
298
- /**
299
- * the dataset of the chart, it should match echat dataset option
300
- */
301
- dataset?: IUniverDataSet;
302
- }
303
-
304
- export declare type IChartDataAggregateOperator = (dataSource: ChartDataSourceValues, context: IChartContext, dataAggregation: IChartDataAggregation) => ChartDataSourceValues | void;
305
-
306
- declare interface IChartDataAggregation {
307
- aggregate?: boolean;
308
- topN?: number;
309
- }
310
-
311
- declare interface IChartDataCategory {
312
- index: number;
313
- name: string;
314
- type: CategoryType;
315
- items: IChartDataItem[];
316
- keys: string[];
317
- }
318
-
319
- declare interface IChartDataItem {
320
- value: OptionDataValue;
321
- label: string;
322
- }
323
-
324
- declare interface IChartDataSeries {
325
- index: number;
326
- name: string;
327
- items: IChartDataItem[];
328
- }
329
-
330
- declare interface IChartDataSource {
331
- /**
332
- * the dataset of the chart, it should match echarts dataset option
333
- */
334
- data$: Observable<IUniverDataSet>;
335
- /**
336
- * can switch the orient of the data, only single range or multi range all range has same value length can switch
337
- */
338
- canSwitchOrient$: Observable<boolean>;
339
- /**
340
- * the range info of the chart source
341
- */
342
- rangeInfo$: Observable<ISheetChartSourceRanges>;
343
- /**
344
- * update the range info of the chart source
345
- */
346
- convertDataSet(): IUniverDataSet;
347
- updateRangeInfo(rangeInfo: ISheetChartSourceSingleRange | IChartSourceMultiRangeItem[]): void;
348
- watchRange(): void;
349
- canSwitchOrient(): boolean;
350
- dispose(): void;
351
- getRangeInfo(): ISheetChartSourceSingleRange | IChartSourceMultiRangeItem[];
352
- setRangeInfo(rangeInfo: ISheetChartSourceSingleRange | IChartSourceMultiRangeItem[]): void;
353
- setOrient(flag: boolean): void;
354
- getDataSet(): IUniverDataSet;
355
- getDimensionCount(): number;
356
- refresh(): void;
357
- }
358
-
359
- export declare interface IChartRuntimeContext {
360
- themeColors?: string[];
361
- axes: IRuntimeAxis[];
362
- themeInfo: IEchartTheme;
363
- hasSecondaryAxis: boolean;
364
- }
365
-
366
- /** Chart resource snapshot */
367
- declare interface IChartSnapshot {
368
- id: string;
369
- chartType: ChartTypeBits;
370
- orient?: DataOrientation;
371
- context?: Pick<IChartContext, 'categoryIndex' | 'seriesIndexes' | 'transform'>;
372
- style?: ChartStyle;
373
- dataAggregation?: IChartDataAggregation;
374
- }
375
-
376
- export declare type IChartSourceMultiRangeItem = [IChartSourceRangeItem, IChartSourceRangeItem];
377
-
378
- export declare interface IChartSourceRangeItem {
379
- range: IRange;
380
- subUnitId: string;
381
- unitId: string;
382
- }
383
-
384
- export declare interface IChartStyle {
385
- runtime: IChartRuntimeContext;
386
- width: number;
387
- height: number;
388
- theme: string;
389
- invalidValueType: InvalidValueType;
390
- gradientFill: boolean;
391
- backgroundColor: string;
392
- titleFontSize: number;
393
- fontSize: number;
394
- fontColor: string;
395
- borderColor: string;
396
- titles: {
397
- title: Omit<ILabelStyle, 'visible'>;
398
- subtitle: Omit<ILabelStyle, 'visible'>;
399
- xAxisTitle: Omit<ILabelStyle, 'visible'>;
400
- yAxisTitle: Omit<ILabelStyle, 'visible'>;
401
- rightYAxisTitle: Omit<ILabelStyle, 'visible'>;
402
- titlePosition: TitlePositionEnum;
403
- };
404
- legend: ILegendStyle;
405
- xAxis: IAxisOptions;
406
- yAxis: IAxisOptions;
407
- rightYAxis: RightYAxisOptions;
408
- allSeriesStyle: IAllSeriesStyle;
409
- seriesStyleMap: {
410
- [id: string]: ISeriesStyle;
411
- };
412
- pie: {
413
- doughnutHole: number;
414
- labelStyle: IPieLabelStyle;
415
- borderColor: string;
416
- hasPaddingAngle: boolean;
417
- isHalfPie: boolean;
418
- showLabelLine: boolean;
419
- };
420
- area: {
421
- lineStyle: AreaLineStyle;
422
- };
423
- radar: {
424
- shape: RadarShape;
425
- fill: boolean;
426
- };
427
- }
428
-
429
- export declare interface IChartUpdateConfigMutationParams {
430
- unitId: string;
431
- chartModelId: string;
432
- orient?: DataOrientation;
433
- chartType?: ChartTypeBits;
434
- range?: IRange;
435
- dataAggregation?: Partial<IChartDataAggregation>;
436
- style?: ChartStyle;
437
- context?: IChartContext;
438
- }
439
-
440
- export declare interface IChartUpdateSourceMutationParams {
441
- chartModelId: string;
442
- rangeInfo: ISheetChartSourceSingleRange | IChartSourceMultiRangeItem[];
443
- }
444
-
445
- export declare interface IDataPointStyle extends IPointStyle {
446
- }
447
-
448
- declare interface IDimensionDefinition {
449
- type?: 'number' | 'ordinal' | 'time' | 'float' | 'int';
450
- name?: string;
451
- displayName?: string;
452
- }
453
-
454
- export declare interface IEchartTheme {
455
- version: number | string;
456
- themeName: string;
457
- theme: IEchartThemeContent;
458
- }
459
-
460
- declare interface IEchartThemeAxisConfig {
461
- type: string;
462
- name: string;
463
- axisLineShow: boolean;
464
- axisLineColor: string;
465
- axisTickShow: boolean;
466
- axisTickColor: string;
467
- axisLabelShow: boolean;
468
- axisLabelColor: string;
469
- splitLineShow: boolean;
470
- splitLineColor: string[];
471
- splitAreaShow: boolean;
472
- splitAreaColor: string[];
473
- }
474
-
475
- declare interface IEchartThemeContent {
476
- seriesCnt: string;
477
- backgroundColor: string;
478
- titleColor: string;
479
- subtitleColor: string;
480
- textColorShow: boolean;
481
- textColor: string;
482
- markTextColor: string;
483
- color: string[];
484
- borderColor: string;
485
- borderWidth: string | number;
486
- visualMapColor: string[];
487
- legendTextColor: string;
488
- kColor: string;
489
- kColor0: string;
490
- kBorderColor: string;
491
- kBorderColor0: string;
492
- kBorderWidth: string | number;
493
- lineWidth: string | number;
494
- symbolSize: string | number;
495
- symbol: string;
496
- symbolBorderWidth: string | number;
497
- lineSmooth: boolean;
498
- graphLineWidth: string | number;
499
- graphLineColor: string;
500
- mapLabelColor: string;
501
- mapLabelColorE: string;
502
- mapBorderColor: string;
503
- mapBorderColorE: string;
504
- mapBorderWidth: string | number;
505
- mapBorderWidthE: string | number;
506
- mapAreaColor: string;
507
- mapAreaColorE: string;
508
- axes: IEchartThemeAxisConfig[];
509
- axisSeperateSetting: boolean;
510
- toolboxColor: string;
511
- toolboxEmphasisColor: string;
512
- tooltipAxisColor: string;
513
- tooltipAxisWidth: string | number;
514
- timelineLineColor: string;
515
- timelineLineWidth: string | number;
516
- timelineItemColor: string;
517
- timelineItemColorE: string;
518
- timelineCheckColor: string;
519
- timelineCheckBorderColor: string;
520
- timelineItemBorderWidth: string | number;
521
- timelineControlColor: string;
522
- timelineControlBorderColor: string;
523
- timelineControlBorderWidth: string | number;
524
- timelineLabelColor: string;
525
- datazoomBackgroundColor: string;
526
- datazoomDataColor: string;
527
- datazoomFillColor: string;
528
- datazoomHandleColor: string;
529
- datazoomHandleWidth: string;
530
- datazoomLabelColor: string;
531
- }
532
-
533
- export declare interface IGridLineStyle {
534
- visible: boolean;
535
- color: string;
536
- width: number;
537
- }
538
-
539
- export declare interface IInsertSheetsChartMutationParams extends ISheetCommandSharedParams {
540
- range: IRange;
541
- chartId: string;
542
- }
543
-
544
- export declare interface ILabelStyle {
545
- visible: boolean;
546
- content: string;
547
- fontSize: number;
548
- color: string;
549
- align: LabelAlignEnum;
550
- bold: boolean;
551
- family: string;
552
- strikethrough: boolean;
553
- italic: boolean;
554
- underline: boolean;
555
- padAngle: boolean;
556
- axisTitleAlign?: AxisAlignEnum | undefined;
557
- }
558
-
559
- export declare interface ILegendStyle {
560
- position?: LegendPositionEnum;
561
- label?: Omit<ILabelStyle, 'visible' | 'align' | 'content'>;
562
- }
563
-
564
- export declare const InsertSheetsChartMutation: IMutation<IInsertSheetsChartMutationParams>;
565
-
566
- export declare enum InvalidValueType {
567
- Zero = "zero",
568
- Break = "break",
569
- Link = "link"
570
- }
571
-
572
- export declare interface IPieLabelStyle extends Omit<ILabelStyle, 'align' | 'content'> {
573
- contentType: number;
574
- position: PieLabelPosition;
575
- }
576
-
577
- export declare interface IPointStyle {
578
- shape: LinePointShape;
579
- size: number;
580
- color: string;
581
- }
582
-
583
- export declare interface IRemoveSheetsChartMutationParams extends ISheetCommandSharedParams {
584
- chartId: string;
585
- }
586
-
587
- export declare interface IRuntimeAxis {
588
- priority: IRuntimeAxisPriority;
589
- position: IRuntimeAxisPosition;
590
- type: AxisValueType;
591
- }
592
-
593
- export declare enum IRuntimeAxisPosition {
594
- Left = "left",
595
- Right = "right",
596
- Bottom = "bottom"
597
- }
598
-
599
- export declare enum IRuntimeAxisPriority {
600
- Primary = 1,
601
- Secondary = 2,
602
- Tertiary = 3
603
- }
604
-
605
- export declare interface ISeriesLabelStyle extends ILabelStyle {
606
- contentType: number;
607
- position: SeriesLabelPosition;
608
- }
609
-
610
- export declare interface ISeriesStyle {
611
- chartType?: ChartTypeBits.Line | ChartTypeBits.Column | ChartTypeBits.Area;
612
- rightYAxis?: boolean;
613
- color: string;
614
- fillOpacity: number;
615
- border: {
616
- opacity: number;
617
- color: string;
618
- width: number;
619
- dashType: ChartBorderDashType;
620
- };
621
- label: ISeriesLabelStyle;
622
- point: IPointStyle;
623
- dataPoints: {
624
- [index: number]: IDataPointStyle;
625
- };
626
- }
627
-
628
- declare type ISheetChartModelOptions = OptionalProperties<ISheetChartSnapshot, 'id' | 'chartType'>;
629
-
630
- declare interface ISheetChartSnapshot extends IChartSnapshot {
631
- rangeInfo: ISheetChartSourceRanges;
632
- }
633
-
634
- /**
635
- * @description
636
- * the chart source range maybe a single range or a multi ranges
637
- * if the range is a single range, it is a IUnitRangeNameWithSubUnitId
638
- * if the range is a multi ranges, it is a array of IChartSourceMultiRangeItem, which is a tuple of two IUnitRangeName
639
- * one is the dimension range, the other is the value range
640
- */
641
- declare type ISheetChartSourceRanges = ISheetChartSourceSingleRange | IChartSourceMultiRangeItem[];
642
-
643
- export declare interface ISheetChartSourceSingleRange {
644
- rangeInfo: IChartSourceRangeItem;
645
- isRowDirection?: boolean;
646
- }
647
-
648
- declare interface ISize {
649
- width: number;
650
- height: number;
651
- }
652
-
653
- export declare function isNil(value: any): value is Nil;
654
-
655
- declare interface IUniverDataSet {
656
- source: OptionDataValue[][];
657
- dimensions: Array<DimensionDefinitionLoose>;
658
- }
659
-
660
- export declare interface IUniverSheetsChartPluginConfig {
661
- }
662
-
663
- export declare enum LabelAlignEnum {
664
- Left = "left",
665
- Right = "right",
666
- Center = "center"
667
- }
668
-
669
- export declare enum LabelContentType {
670
- Empty = 0,
671
- CategoryName = 2,
672
- SeriesName = 4,
673
- Value = 8,
674
- Percentage = 16
675
- }
676
-
677
- export declare enum LegendPositionEnum {
678
- Top = "top",
679
- Left = "left",
680
- Right = "right",
681
- Bottom = "bottom",
682
- Hide = "hide"
683
- }
684
-
685
- export declare enum LinePointShape {
686
- Circle = "circle",
687
- Square = "square",
688
- Triangle = "triangle",
689
- Diamond = "diamond"
690
- }
691
-
692
- declare type Nil = null | undefined;
693
-
694
- declare type OptionalProperties<T, K extends keyof T> = Omit<T, K> & {
695
- [P in K]+?: T[P];
696
- };
697
-
698
- declare type OptionDataValue = string | number | Date | null | undefined;
699
-
700
- export declare enum PieLabelPosition {
701
- Inside = "inside",
702
- Outside = "outside"
703
- }
704
-
705
- export declare enum RadarShape {
706
- Polygon = "polygon",
707
- Circle = "circle"
708
- }
709
-
710
- export declare const RemoveSheetsChartMutation: IMutation<IRemoveSheetsChartMutationParams>;
711
-
712
- export declare type RightYAxisOptions = Omit<IAxisOptions, 'reverse'>;
713
-
714
- export declare enum SeriesLabelPosition {
715
- Auto = "auto",
716
- Top = "top",
717
- Bottom = "bottom",
718
- Left = "left",
719
- Inside = "inside",
720
- Outside = "outside"
721
- }
722
-
723
- /**
724
- * Set graphic element to data.
725
- * because we use graphic element to draw watermark title, so we need to set it to data.
726
- */
727
- export declare const setGraphicToSpec: (spec: Record<string, any>, graphicElements: unknown[]) => void;
728
-
729
- export declare const setProperty: (data: Record<string, any>, propertyPath: string, value: any) => void;
730
-
731
- export declare const SHEETS_CHART_PLUGIN_NAME = "SHEET_CHART_PLUGIN";
732
-
733
- export declare class SheetsChartService extends Disposable_2 {
734
- private readonly _injector;
735
- private readonly _resourcesManagerService;
736
- private readonly _refRangeService;
737
- private readonly _univerInstanceService;
738
- private readonly _chartModelService;
739
- private readonly _commandService;
740
- private _chartModelIdMap;
741
- private _dataSourceMap;
742
- constructor(_injector: Injector, _resourcesManagerService: IResourceManagerService, _refRangeService: RefRangeService, _univerInstanceService: IUniverInstanceService, _chartModelService: ChartModelService, _commandService: ICommandService);
743
- getUnitChartModels(unitId: string, subUnitId: string): (ChartModel | undefined)[];
744
- getChartSuggestion(rangeInfo: ISheetChartSourceRanges): {
745
- orient: DataOrientation;
746
- chartType: ChartTypeBits;
747
- };
748
- ensureChartModelCollection(unitId: string, subUnitId: string): Set<string>;
749
- getChartDataSource(id: string): IChartDataSource | undefined;
750
- setChartDataSource(id: string, dataSource: IChartDataSource): void;
751
- refreshChartSource(): void;
752
- createChartModel(unitId: string, subUnitId: string, options: ISheetChartModelOptions): ChartModel;
753
- removeChartModel(id: string): void;
754
- getChartModel(id: string): ChartModel | undefined;
755
- private _serializeChartForUnit;
756
- watchRange(dataSource: IChartDataSource): () => void;
757
- private _deserializeChartForUnit;
758
- private _initSnapshot;
759
- dispose(): void;
760
- }
761
-
762
- export declare enum StackType {
763
- Stacked = "0",
764
- Percent = "1"
765
- }
766
-
767
- export declare function sumArray(ary: ChartDataSourceValue[]): number;
768
-
769
- export declare enum TextAlign {
770
- Left = "left",
771
- Center = "center",
772
- Right = "right"
773
- }
774
-
775
- export declare enum TextVerticalAlign {
776
- Top = "top",
777
- Middle = "middle",
778
- Bottom = "bottom"
779
- }
780
-
781
- export declare const themeColors: string[];
782
-
783
- export declare enum TitlePositionEnum {
784
- Top = "top",
785
- Left = "left",
786
- Right = "right",
787
- Bottom = "bottom",
788
- Hide = "hide"
789
- }
790
-
791
- export declare function toColumnOrient<T = any>(dataSource: T[][]): T[][];
792
-
793
- export declare function toNumber(value: ChartDataSourceValue): number;
794
-
795
- export declare const topNOperator: IChartDataAggregateOperator;
796
-
797
- declare function toString_2(value: ChartDataSourceValue): string;
798
- export { toString_2 as toString }
799
-
800
- export declare const translateAngleToRadian: (angle: number) => number;
801
-
802
- export declare class UniverSheetsChartPlugin extends Plugin_2 {
803
- private readonly _config;
804
- protected readonly _injector: Injector;
805
- private readonly _commandService;
806
- static type: UniverInstanceType;
807
- static pluginName: string;
808
- constructor(_config: IUniverSheetsChartPluginConfig, _injector: Injector, _commandService: ICommandService);
809
- onRendered(): void;
810
- onStarting(): void;
811
- private _initCommands;
812
- }
813
-
814
- export { }
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export { ChartModel } from './models/chart-model';
17
+ export { CategoryType, ChartAttributeBits, chartBitsUtils, ChartTypeBits, DataOrientation } from './models/constants';
18
+ export type { IChartConfig, IChartContext, IChartSourceMultiRangeItem, IChartSourceRangeItem, ISheetChartSourceSingleRange } from './models/types';
19
+ export * from './models/style.types';
20
+ export * from './models/runtime-context.types';
21
+ export { type IUniverSheetsChartPluginConfig, SHEETS_CHART_PLUGIN_NAME, UniverSheetsChartPlugin } from './plugins/univer-sheets-chart-plugin';
22
+ export { ChartModelService } from './services/chart-model.service';
23
+ export { SheetsChartService } from './services/sheets-chart.service';
24
+ export { isNil } from './models/chart-data-operators/index';
25
+ export { defaultChartConfig as defaultChartStyle } from './models/constants/default-chart-style';
26
+ export { ChartUpdateSourceCommand, type IChartUpdateSourceCommandParams } from './commands/commands/sheets-chart-update-source.command';
27
+ export { ChartUpdateConfigCommand, type IChartUpdateConfigCommandParams } from './commands/commands/sheets-chart-update-config.command';
28
+ export { type IInsertSheetsChartMutationParams, InsertSheetsChartMutation, type IRemoveSheetsChartMutationParams, RemoveSheetsChartMutation } from './commands/mutations/sheets-chart.mutation';
29
+ export { ChartUpdateConfigMutation, type IChartUpdateConfigMutationParams } from './commands/mutations/sheets-chart-update-config.mutation';
30
+ export { ChartUpdateSourceConfigMutation, type IChartUpdateSourceConfigMutationParams } from './commands/mutations/sheet-chart-update-source.mutation';
31
+ export * from './common/util';
32
+ export * from './models/constants/default-chart-style';
33
+ export * from './models/chart-data-operators/operators';
34
+ export * from './chart-source/chart-source';
35
+ export { ChartThemeService } from './services/chart-theme.service';
36
+ export { getThemeAxesByType, getThemeProps } from './models/constants/build-in-theme';
37
+ export type { IEchartTheme } from './models/constants/build-in-theme';