@univerjs-pro/engine-chart 1.0.0-rc.0 → 1.0.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 (203) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/cjs/locale/ar-SA.js +1 -1
  4. package/lib/cjs/locale/ca-ES.js +1 -1
  5. package/lib/cjs/locale/de-DE.js +1 -1
  6. package/lib/cjs/locale/en-US.js +1 -1
  7. package/lib/cjs/locale/es-ES.js +1 -1
  8. package/lib/cjs/locale/fa-IR.js +1 -1
  9. package/lib/cjs/locale/fr-FR.js +1 -1
  10. package/lib/cjs/locale/id-ID.js +1 -1
  11. package/lib/cjs/locale/it-IT.js +1 -1
  12. package/lib/cjs/locale/ja-JP.js +1 -1
  13. package/lib/cjs/locale/ko-KR.js +1 -1
  14. package/lib/cjs/locale/pl-PL.js +1 -1
  15. package/lib/cjs/locale/pt-BR.js +1 -1
  16. package/lib/cjs/locale/ru-RU.js +1 -1
  17. package/lib/cjs/locale/sk-SK.js +1 -1
  18. package/lib/cjs/locale/vi-VN.js +1 -1
  19. package/lib/cjs/locale/zh-CN.js +1 -1
  20. package/lib/cjs/locale/zh-HK.js +1 -1
  21. package/lib/cjs/locale/zh-TW.js +1 -1
  22. package/lib/es/facade.js +1 -1
  23. package/lib/es/index.js +1 -1
  24. package/lib/es/locale/ar-SA.js +1 -1
  25. package/lib/es/locale/ca-ES.js +1 -1
  26. package/lib/es/locale/de-DE.js +1 -1
  27. package/lib/es/locale/en-US.js +1 -1
  28. package/lib/es/locale/es-ES.js +1 -1
  29. package/lib/es/locale/fa-IR.js +1 -1
  30. package/lib/es/locale/fr-FR.js +1 -1
  31. package/lib/es/locale/id-ID.js +1 -1
  32. package/lib/es/locale/it-IT.js +1 -1
  33. package/lib/es/locale/ja-JP.js +1 -1
  34. package/lib/es/locale/ko-KR.js +1 -1
  35. package/lib/es/locale/pl-PL.js +1 -1
  36. package/lib/es/locale/pt-BR.js +1 -1
  37. package/lib/es/locale/ru-RU.js +1 -1
  38. package/lib/es/locale/sk-SK.js +1 -1
  39. package/lib/es/locale/vi-VN.js +1 -1
  40. package/lib/es/locale/zh-CN.js +1 -1
  41. package/lib/es/locale/zh-HK.js +1 -1
  42. package/lib/es/locale/zh-TW.js +1 -1
  43. package/lib/facade.js +1 -1
  44. package/lib/index.js +1 -1
  45. package/lib/locale/ar-SA.js +1 -1
  46. package/lib/locale/ca-ES.js +1 -1
  47. package/lib/locale/de-DE.js +1 -1
  48. package/lib/locale/en-US.js +1 -1
  49. package/lib/locale/es-ES.js +1 -1
  50. package/lib/locale/fa-IR.js +1 -1
  51. package/lib/locale/fr-FR.js +1 -1
  52. package/lib/locale/id-ID.js +1 -1
  53. package/lib/locale/it-IT.js +1 -1
  54. package/lib/locale/ja-JP.js +1 -1
  55. package/lib/locale/ko-KR.js +1 -1
  56. package/lib/locale/pl-PL.js +1 -1
  57. package/lib/locale/pt-BR.js +1 -1
  58. package/lib/locale/ru-RU.js +1 -1
  59. package/lib/locale/sk-SK.js +1 -1
  60. package/lib/locale/vi-VN.js +1 -1
  61. package/lib/locale/zh-CN.js +1 -1
  62. package/lib/locale/zh-HK.js +1 -1
  63. package/lib/locale/zh-TW.js +1 -1
  64. package/lib/types/chart-builder/chart-types.d.ts +10 -1
  65. package/lib/types/chart-builder/configuration/chart-config-group.d.ts +1 -0
  66. package/lib/types/chart-builder/conversion/chart-context-patch.d.ts +5 -2
  67. package/lib/types/chart-builder/conversion/chart-model-fields.d.ts +5 -0
  68. package/lib/types/chart-builder/conversion/describe-chart-model.d.ts +1030 -16
  69. package/lib/types/chart-text-measure-canvas.d.ts +1 -0
  70. package/lib/types/enum.d.ts +11 -1
  71. package/lib/types/facade/builders/f-scatter-chart-builder.d.ts +24 -0
  72. package/lib/types/facade/f-chart-builder-base.d.ts +22 -0
  73. package/lib/types/facade/f-chart.d.ts +22 -0
  74. package/lib/types/index.d.ts +3 -3
  75. package/lib/types/model/chart-data-operators/build-chart-data.d.ts +4 -0
  76. package/lib/types/model/chart-data-operators/index.d.ts +2 -0
  77. package/lib/types/model/chart-data-operators/operators.d.ts +25 -0
  78. package/lib/types/model/chart-locale-texts.d.ts +22 -0
  79. package/lib/types/model/chart-model.d.ts +3424 -0
  80. package/lib/types/model/chart-theme.service.d.ts +40 -0
  81. package/lib/types/model/constants/build-in-theme/default.d.ts +2 -0
  82. package/lib/types/model/constants/build-in-theme/index.d.ts +15 -0
  83. package/lib/types/model/constants/build-in-theme/theme-util.d.ts +5 -0
  84. package/lib/types/model/constants/build-in-theme/types.d.ts +76 -0
  85. package/lib/types/model/constants/build-in-theme/univer-gradient1.d.ts +2 -0
  86. package/lib/types/model/constants/build-in-theme/univer-gradient2.d.ts +2 -0
  87. package/lib/types/model/constants/build-in-theme/univer-gradient3.d.ts +2 -0
  88. package/lib/types/model/constants/build-in-theme/univer-gradient4.d.ts +2 -0
  89. package/lib/types/model/constants/build-in-theme/univer-gradient5.d.ts +2 -0
  90. package/lib/types/model/constants/build-in-theme/univer-gradient6.d.ts +2 -0
  91. package/lib/types/model/constants/build-in-theme/univer1.d.ts +2 -0
  92. package/lib/types/model/constants/build-in-theme/univer2.d.ts +2 -0
  93. package/lib/types/model/constants/build-in-theme/univer3.d.ts +2 -0
  94. package/lib/types/model/constants/build-in-theme/univer4.d.ts +2 -0
  95. package/lib/types/model/constants/build-in-theme/univer5.d.ts +2 -0
  96. package/lib/types/model/constants/build-in-theme/univer6.d.ts +2 -0
  97. package/lib/types/model/constants/default-chart-style.d.ts +114 -0
  98. package/lib/types/model/constants/default.d.ts +11 -0
  99. package/lib/types/model/data-context-transformers/bar-data-context-transformer.d.ts +3 -0
  100. package/lib/types/model/data-context-transformers/box-plot-data-context-transformer.d.ts +3 -0
  101. package/lib/types/model/data-context-transformers/line-like-context-transformer.d.ts +3 -0
  102. package/lib/types/model/data-context-transformers/pareto-data-context-transformer.d.ts +3 -0
  103. package/lib/types/model/data-context-transformers/percent-data-context-transformer.d.ts +3 -0
  104. package/lib/types/model/data-context-transformers/pie-data-context-transformer.d.ts +3 -0
  105. package/lib/types/model/data-context-transformers/word-cloud-data-context-transform.d.ts +3 -0
  106. package/lib/types/model/echart-render-model.d.ts +32 -0
  107. package/lib/types/model/echart-to-chart-model-init.d.ts +3 -0
  108. package/lib/types/model/mode-converter/converters/boxplot-chart-converter.d.ts +2 -0
  109. package/lib/types/model/mode-converter/converters/bubble-chart-converter.d.ts +2 -0
  110. package/lib/types/model/mode-converter/converters/combination-chart-converter.d.ts +2 -0
  111. package/lib/types/model/mode-converter/converters/constants.d.ts +7 -0
  112. package/lib/types/model/mode-converter/converters/funnel-chart-converter.d.ts +2 -0
  113. package/lib/types/model/mode-converter/converters/heatmap-chart-convert.d.ts +2 -0
  114. package/lib/types/model/mode-converter/converters/pareto-chart-converter.d.ts +2 -0
  115. package/lib/types/model/mode-converter/converters/pie-chart-converter.d.ts +2 -0
  116. package/lib/types/model/mode-converter/converters/radar-chart-converter.d.ts +2 -0
  117. package/lib/types/model/mode-converter/converters/relation-chart-converter.d.ts +2 -0
  118. package/lib/types/model/mode-converter/converters/sankey-chart-converter.d.ts +2 -0
  119. package/lib/types/model/mode-converter/converters/scatter-chart-converter.d.ts +2 -0
  120. package/lib/types/model/mode-converter/converters/tools.d.ts +15 -0
  121. package/lib/types/model/mode-converter/converters/waterfall-chart-converter.d.ts +2 -0
  122. package/lib/types/model/mode-converter/converters/word-cloud-converter.d.ts +76 -0
  123. package/lib/types/model/mode-converter/mode-converter.d.ts +96 -0
  124. package/lib/types/model/mode-converter/render-spec-operators/axis-title.operator.d.ts +2 -0
  125. package/lib/types/model/mode-converter/render-spec-operators/bubble-style.operator.d.ts +2 -0
  126. package/lib/types/model/mode-converter/render-spec-operators/chart-axes.operator.d.ts +2 -0
  127. package/lib/types/model/mode-converter/render-spec-operators/chart-box-style.operator.d.ts +2 -0
  128. package/lib/types/model/mode-converter/render-spec-operators/empty-style-operator.d.ts +2 -0
  129. package/lib/types/model/mode-converter/render-spec-operators/font-size.operator.d.ts +2 -0
  130. package/lib/types/model/mode-converter/render-spec-operators/grid-operator.d.ts +2 -0
  131. package/lib/types/model/mode-converter/render-spec-operators/heatmap-chart-operator.d.ts +2 -0
  132. package/lib/types/model/mode-converter/render-spec-operators/hover-mark-style.operator.d.ts +2 -0
  133. package/lib/types/model/mode-converter/render-spec-operators/index.d.ts +13 -0
  134. package/lib/types/model/mode-converter/render-spec-operators/invalid-value-style.operator.d.ts +2 -0
  135. package/lib/types/model/mode-converter/render-spec-operators/legend-style.operator.d.ts +2 -0
  136. package/lib/types/model/mode-converter/render-spec-operators/line-like-style.operator.d.ts +2 -0
  137. package/lib/types/model/mode-converter/render-spec-operators/operator-types.d.ts +7 -0
  138. package/lib/types/model/mode-converter/render-spec-operators/pie-style.operator.d.ts +2 -0
  139. package/lib/types/model/mode-converter/render-spec-operators/radar-style.operator.d.ts +2 -0
  140. package/lib/types/model/mode-converter/render-spec-operators/relation-chart-operator/relation-chart-operator.d.ts +2 -0
  141. package/lib/types/model/mode-converter/render-spec-operators/relation-chart-operator/relation-force-directed-layout.d.ts +28 -0
  142. package/lib/types/model/mode-converter/render-spec-operators/sankey-chart-operator.d.ts +2 -0
  143. package/lib/types/model/mode-converter/render-spec-operators/scatter-style.operator.d.ts +2 -0
  144. package/lib/types/model/mode-converter/render-spec-operators/series-style-operator/pareto-series-style.handler.d.ts +2 -0
  145. package/lib/types/model/mode-converter/render-spec-operators/series-style-operator/series-chart-style.handler.d.ts +2 -0
  146. package/lib/types/model/mode-converter/render-spec-operators/series-style-operator/series-data-label.handler.d.ts +2 -0
  147. package/lib/types/model/mode-converter/render-spec-operators/series-style-operator/series-style-operator.d.ts +11 -0
  148. package/lib/types/model/mode-converter/render-spec-operators/series-style-operator/waterfall-series-style-operator.d.ts +3 -0
  149. package/lib/types/model/mode-converter/render-spec-operators/stack.operator.d.ts +2 -0
  150. package/lib/types/model/mode-converter/render-spec-operators/theme.operator.d.ts +2 -0
  151. package/lib/types/model/mode-converter/render-spec-operators/title-style.operator.d.ts +2 -0
  152. package/lib/types/model/mode-converter/render-spec-operators/tool-tip-operator.d.ts +3 -0
  153. package/lib/types/model/mode-converter/render-spec-operators/tools.d.ts +26 -0
  154. package/lib/types/model/mode-converter/render-spec-operators/trend-line/trend-line.operator.d.ts +2 -0
  155. package/lib/types/model/mode-converter/render-spec-operators/trend-line/trendline-util.d.ts +13 -0
  156. package/lib/types/model/mode-converter/render-spec-operators/visual-map-operator.d.ts +2 -0
  157. package/lib/types/model/mode-converter/render-spec-operators/watermark.operator.d.ts +2 -0
  158. package/lib/types/model/spec-converter/spec-converter.d.ts +1 -0
  159. package/lib/types/model/word-cloud-musk-image.service.d.ts +17 -0
  160. package/lib/types/models/chart-context/chart-field-selection.d.ts +3 -7
  161. package/lib/types/models/chart-data/build-chart-data.d.ts +1 -1
  162. package/lib/types/models/chart-host/chart-license.d.ts +5 -0
  163. package/lib/types/models/chart-model/chart-model.d.ts +3093 -48
  164. package/lib/types/models/chart-render/axes/axis-placement.d.ts +19 -0
  165. package/lib/types/models/chart-render/chart-field-button-layout.d.ts +51 -0
  166. package/lib/types/models/chart-render/converter/calendar-date-axis.d.ts +7 -0
  167. package/lib/types/models/chart-render/converter/render-spec-operators/date-axis-label-layout.d.ts +5 -0
  168. package/lib/types/models/chart-render/converter/render-spec-operators/error-bars.operator.d.ts +3 -0
  169. package/lib/types/models/chart-render/converter/render-spec-operators/grid-operator.d.ts +3 -0
  170. package/lib/types/models/chart-render/converter/render-spec-operators/legend-size.d.ts +24 -1
  171. package/lib/types/models/chart-render/converter/render-spec-operators/multi-level-category-axis-layout.d.ts +2 -1
  172. package/lib/types/models/chart-render/converter/render-spec-operators/pie-auto-label-layout.d.ts +4 -0
  173. package/lib/types/models/chart-render/converter/render-spec-operators/title-size.d.ts +10 -0
  174. package/lib/types/models/chart-render/converter/render-spec-operators/tool-tip-operator.d.ts +2 -0
  175. package/lib/types/models/chart-render/converter/render-spec-operators/tools.d.ts +6 -3
  176. package/lib/types/models/chart-render/converter/render-spec-operators/value-axis-scale.d.ts +9 -0
  177. package/lib/types/models/chart-render/echart-render-model/echart-render-engine.d.ts +1 -0
  178. package/lib/types/models/chart-render/format/pie-data-label.d.ts +9 -0
  179. package/lib/types/models/chart-render/style/chart-runtime-style.d.ts +2 -1
  180. package/lib/types/models/common/constants/default-chart-style.d.ts +2 -1
  181. package/lib/types/types.d.ts +142 -11
  182. package/lib/umd/facade.js +1 -1
  183. package/lib/umd/index.js +1 -1
  184. package/lib/umd/locale/ar-SA.js +1 -1
  185. package/lib/umd/locale/ca-ES.js +1 -1
  186. package/lib/umd/locale/de-DE.js +1 -1
  187. package/lib/umd/locale/en-US.js +1 -1
  188. package/lib/umd/locale/es-ES.js +1 -1
  189. package/lib/umd/locale/fa-IR.js +1 -1
  190. package/lib/umd/locale/fr-FR.js +1 -1
  191. package/lib/umd/locale/id-ID.js +1 -1
  192. package/lib/umd/locale/it-IT.js +1 -1
  193. package/lib/umd/locale/ja-JP.js +1 -1
  194. package/lib/umd/locale/ko-KR.js +1 -1
  195. package/lib/umd/locale/pl-PL.js +1 -1
  196. package/lib/umd/locale/pt-BR.js +1 -1
  197. package/lib/umd/locale/ru-RU.js +1 -1
  198. package/lib/umd/locale/sk-SK.js +1 -1
  199. package/lib/umd/locale/vi-VN.js +1 -1
  200. package/lib/umd/locale/zh-CN.js +1 -1
  201. package/lib/umd/locale/zh-HK.js +1 -1
  202. package/lib/umd/locale/zh-TW.js +1 -1
  203. package/package.json +7 -7
@@ -0,0 +1,40 @@
1
+ import type { Injector } from '@univerjs/core';
2
+ import type { IEchartTheme } from './constants/build-in-theme';
3
+ import { Disposable, ThemeService } from '@univerjs/core';
4
+ import { ICanvasColorService } from '@univerjs/engine-render';
5
+ export interface IChartTheme {
6
+ colors: string[];
7
+ }
8
+ export interface IChartThemeService {
9
+ getColors(name: string | undefined): string[];
10
+ getRegisteredThemes(): string[];
11
+ registerTheme(name: string, theme: IEchartTheme): void;
12
+ getTheme(name: string | undefined): IEchartTheme;
13
+ getDefaultTheme(): IEchartTheme;
14
+ }
15
+ export declare class ChartThemeService extends Disposable {
16
+ private readonly _themeService;
17
+ private readonly _canvasColorService;
18
+ private _themeMap;
19
+ private _hasRegistered;
20
+ constructor(_themeService: ThemeService, _canvasColorService: ICanvasColorService);
21
+ /**
22
+ * Get the univer color system theme is dark mode or not.
23
+ * @returns {boolean} - true if dark mode, false otherwise.
24
+ */
25
+ getSystemThemeIsDarkMode(): boolean;
26
+ /**
27
+ * Get the real color for rendering.It will check the system theme is dark mode or not.
28
+ * @param {string} color - The color to be rendered.
29
+ * @returns {string} - The color to be rendered.
30
+ */
31
+ getRenderColor(color: string): string;
32
+ getColors(name: string | undefined): string[];
33
+ initBuildInThemes(): void;
34
+ getRegisteredThemes(): string[];
35
+ registerTheme(name: string, theme: IEchartTheme): void;
36
+ getTheme(name: string | undefined): IEchartTheme;
37
+ getDefaultTheme(): IEchartTheme;
38
+ dispose(): void;
39
+ }
40
+ export declare function registerChartThemeService(injector: Injector): void;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const themeDefault: IEchartTheme;
@@ -0,0 +1,15 @@
1
+ export { themeDefault } from './default';
2
+ export { getThemeAxesByType, getThemeProps } from './theme-util';
3
+ export type { IEchartTheme } from './types';
4
+ export { univer1 as UniverTheme1 } from './univer1';
5
+ export { univer2 as UniverTheme2 } from './univer2';
6
+ export { univer3 as UniverTheme3 } from './univer3';
7
+ export { univer4 as UniverTheme4 } from './univer4';
8
+ export { univer5 as UniverTheme5 } from './univer5';
9
+ export { univer6 as UniverTheme6 } from './univer6';
10
+ export { univerGradient1 as UniverThemeGradient1 } from './univer-gradient1';
11
+ export { univerGradient2 as UniverThemeGradient2 } from './univer-gradient2';
12
+ export { univerGradient3 as UniverThemeGradient3 } from './univer-gradient3';
13
+ export { univerGradient4 as UniverThemeGradient4 } from './univer-gradient4';
14
+ export { univerGradient5 as UniverThemeGradient5 } from './univer-gradient5';
15
+ export { univerGradient6 as UniverThemeGradient6 } from './univer-gradient6';
@@ -0,0 +1,5 @@
1
+ import type { IEchartTheme } from './types';
2
+ export type axesType = 'category' | 'value' | 'time' | 'log' | 'all' | undefined;
3
+ export declare function getThemeAxesByType(themeInfo: IEchartTheme, axesType: axesType): import("./types").IEchartThemeAxisConfig | undefined;
4
+ export declare function getThemeTitleColor(themeInfo: IEchartTheme): string | undefined;
5
+ export declare function getThemeProps(themeInfo: IEchartTheme | undefined, key: string): undefined;
@@ -0,0 +1,76 @@
1
+ export interface IEchartThemeAxisConfig {
2
+ type: string;
3
+ name: string;
4
+ axisLineShow: boolean;
5
+ axisLineColor: string;
6
+ axisTickShow: boolean;
7
+ axisTickColor: string;
8
+ axisLabelShow: boolean;
9
+ axisLabelColor: string;
10
+ splitLineShow: boolean;
11
+ splitLineColor: string[];
12
+ splitAreaShow: boolean;
13
+ splitAreaColor: string[];
14
+ }
15
+ export interface IEchartThemeContent {
16
+ seriesCnt: string;
17
+ backgroundColor: string;
18
+ titleColor: string;
19
+ subtitleColor: string;
20
+ textColorShow: boolean;
21
+ textColor: string;
22
+ markTextColor: string;
23
+ color: string[];
24
+ borderColor: string;
25
+ borderWidth: string | number;
26
+ visualMapColor: string[];
27
+ legendTextColor: string;
28
+ kColor: string;
29
+ kColor0: string;
30
+ kBorderColor: string;
31
+ kBorderColor0: string;
32
+ kBorderWidth: string | number;
33
+ lineWidth: string | number;
34
+ symbolSize: string | number;
35
+ symbol: string;
36
+ symbolBorderWidth: string | number;
37
+ lineSmooth: boolean;
38
+ graphLineWidth: string | number;
39
+ graphLineColor: string;
40
+ mapLabelColor: string;
41
+ mapLabelColorE: string;
42
+ mapBorderColor: string;
43
+ mapBorderColorE: string;
44
+ mapBorderWidth: string | number;
45
+ mapBorderWidthE: string | number;
46
+ mapAreaColor: string;
47
+ mapAreaColorE: string;
48
+ axes: IEchartThemeAxisConfig[];
49
+ axisSeperateSetting: boolean;
50
+ toolboxColor: string;
51
+ toolboxEmphasisColor: string;
52
+ tooltipAxisColor: string;
53
+ tooltipAxisWidth: string | number;
54
+ timelineLineColor: string;
55
+ timelineLineWidth: string | number;
56
+ timelineItemColor: string;
57
+ timelineItemColorE: string;
58
+ timelineCheckColor: string;
59
+ timelineCheckBorderColor: string;
60
+ timelineItemBorderWidth: string | number;
61
+ timelineControlColor: string;
62
+ timelineControlBorderColor: string;
63
+ timelineControlBorderWidth: string | number;
64
+ timelineLabelColor: string;
65
+ datazoomBackgroundColor: string;
66
+ datazoomDataColor: string;
67
+ datazoomFillColor: string;
68
+ datazoomHandleColor: string;
69
+ datazoomHandleWidth: string;
70
+ datazoomLabelColor: string;
71
+ }
72
+ export interface IEchartTheme {
73
+ version: number | string;
74
+ themeName: string;
75
+ theme: IEchartThemeContent;
76
+ }
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univerGradient1: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univerGradient2: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univerGradient3: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univerGradient4: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univerGradient5: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univerGradient6: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univer1: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univer2: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univer3: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univer4: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univer5: IEchartTheme;
@@ -0,0 +1,2 @@
1
+ import type { IEchartTheme } from './types';
2
+ export declare const univer6: IEchartTheme;
@@ -0,0 +1,114 @@
1
+ import { AreaLineStyle, AxisAlignEnum, ChartBorderDashType, ChartTypeBits, InvalidValueType, LabelContentType, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, SelectModeEnum, SeriesLabelPosition, TextAlign, TitlePositionEnum, WaterfallStackTypeEnum } from '../../enum';
2
+ export declare const themeColors: string[];
3
+ export declare const defaultChartConfig: {
4
+ allSeriesId: string;
5
+ invalidValueType: InvalidValueType;
6
+ point: {
7
+ shape: LinePointShape;
8
+ size: number;
9
+ scatterSymbolSize: number;
10
+ };
11
+ backgroundColor: string;
12
+ axis: {
13
+ labelVisible: boolean;
14
+ reverse: boolean;
15
+ titleAlign: AxisAlignEnum;
16
+ dateAxisRotate: number;
17
+ };
18
+ legend: {
19
+ position: LegendPositionEnum;
20
+ selectMode: SelectModeEnum;
21
+ };
22
+ borderStyle: {
23
+ opacity: number;
24
+ width: number;
25
+ specialChartWidthMap: {
26
+ lineOrArea: number;
27
+ radar: number;
28
+ };
29
+ dashType: ChartBorderDashType;
30
+ };
31
+ textStyle: {
32
+ fontSize: number;
33
+ subTitleFontSize: number;
34
+ titleFontSize: number;
35
+ color: string;
36
+ align: string;
37
+ position: SeriesLabelPosition;
38
+ bold: boolean;
39
+ family: string;
40
+ italic: boolean;
41
+ };
42
+ titlePosition: TitlePositionEnum;
43
+ titlePositionAlign: TextAlign;
44
+ titleFontSize: number;
45
+ area: {
46
+ lineStyle: AreaLineStyle;
47
+ };
48
+ labelContentType: LabelContentType;
49
+ pie: {
50
+ labelContentType: number;
51
+ radius: number;
52
+ doughnutHole: number;
53
+ borderColor: string;
54
+ labelPosition: PieLabelPosition;
55
+ hasPaddingAngle: boolean;
56
+ };
57
+ combination: {
58
+ firstChartType: ChartTypeBits;
59
+ otherChartType: ChartTypeBits;
60
+ };
61
+ funnel: {
62
+ gap: number;
63
+ };
64
+ radar: {
65
+ shape: RadarShape;
66
+ symbolSize: number;
67
+ symbolType: LinePointShape;
68
+ areaOpacity: number;
69
+ };
70
+ wordCloud: {
71
+ maskImage: string;
72
+ repeat: boolean;
73
+ };
74
+ waterfall: {
75
+ stackType: WaterfallStackTypeEnum;
76
+ useSubtotal: boolean;
77
+ subtotalColor: string;
78
+ };
79
+ trendline: {
80
+ period: number;
81
+ order: number;
82
+ opacity: number;
83
+ width: number;
84
+ dashType: ChartBorderDashType;
85
+ color: string;
86
+ showFormula: boolean;
87
+ showR2: boolean;
88
+ };
89
+ relation: {
90
+ force: {
91
+ gravity: number;
92
+ repulsion: number;
93
+ };
94
+ circular: {
95
+ rotateLabel: boolean;
96
+ };
97
+ emphasis: boolean;
98
+ nodeShape: LinePointShape;
99
+ };
100
+ tooltipAxisLabelBackground: string;
101
+ tooltipAxisLabelColor: string;
102
+ indicatorLineType: ChartBorderDashType;
103
+ formatStyle: {
104
+ red: {
105
+ color: string;
106
+ };
107
+ };
108
+ pareto: {
109
+ symbolSize: number;
110
+ };
111
+ heatmap: {
112
+ visualMapType: string;
113
+ };
114
+ };
@@ -0,0 +1,11 @@
1
+ export declare const EChartRenderEngineName = "EChartRenderEngine";
2
+ export declare const defaultChartWidth = 468;
3
+ export declare const defaultChartHeight = 369;
4
+ export declare const LegendPadding = 15;
5
+ export declare const TitleOrLegendPadding = 12;
6
+ export declare const TitleDefaultStartPosition = 8;
7
+ export declare const defaultChartPadding = 14;
8
+ export declare const TitleLineHeightBase = 1.2;
9
+ export declare const AxisLabelMaxPercent = 0.15;
10
+ export declare const defaultBubbleSize = 0.12;
11
+ export declare const defaultRelationSize = 0.08;
@@ -0,0 +1,3 @@
1
+ import type { ChartModel } from '../chart-model';
2
+ import { ChartTypeBits } from '../../enum';
3
+ export declare const barDataContextTransformer: (fromType: ChartTypeBits, toType: ChartTypeBits, model: ChartModel) => void;
@@ -0,0 +1,3 @@
1
+ import type { ChartModel } from '../chart-model';
2
+ import { ChartTypeBits } from '../../enum';
3
+ export declare const BoxplotDataContextTransformer: (fromType: ChartTypeBits, toType: ChartTypeBits, model: ChartModel) => void;
@@ -0,0 +1,3 @@
1
+ import type { ChartModel } from '../chart-model';
2
+ import { ChartTypeBits } from '../../enum';
3
+ export declare const lineLikeContextTransformer: (fromType: ChartTypeBits, toType: ChartTypeBits, model: ChartModel) => void;
@@ -0,0 +1,3 @@
1
+ import type { ChartModel } from '../chart-model';
2
+ import { ChartTypeBits } from '../../enum';
3
+ export declare const paretoDataContextTransformer: (fromType: ChartTypeBits, toType: ChartTypeBits, model: ChartModel) => void;
@@ -0,0 +1,3 @@
1
+ import type { ChartModel } from '../chart-model';
2
+ import { ChartTypeBits } from '../../enum';
3
+ export declare const percentDataContextTransformer: (fromType: ChartTypeBits, toType: ChartTypeBits, model: ChartModel) => void;
@@ -0,0 +1,3 @@
1
+ import type { ChartModel } from '../chart-model';
2
+ import { ChartTypeBits } from '../../enum';
3
+ export declare const pieDataContextTransformer: (fromType: ChartTypeBits, toType: ChartTypeBits, model: ChartModel) => void;
@@ -0,0 +1,3 @@
1
+ import type { ChartModel } from '../chart-model';
2
+ import { ChartTypeBits } from '../../enum';
3
+ export declare const wordCloudDataContextTransformer: (fromType: ChartTypeBits, toType: ChartTypeBits, model: ChartModel) => void;
@@ -0,0 +1,32 @@
1
+ import type { ChartStyle, EChartInstance, EChartSpec, IChartConfig, IChartHostRect, IChartInstance, IChartRenderModel, IChartRenderModelStylizeInit } from '../types';
2
+ import { Disposable } from '@univerjs/core';
3
+ export declare class EChartRenderModel extends Disposable implements IChartRenderModel {
4
+ private _specConverters;
5
+ private _specOperators;
6
+ private _addWatermark;
7
+ constructor(_addWatermark: boolean);
8
+ updateWatermark(addWatermark: boolean): void;
9
+ private _addSpecConverters;
10
+ private _addSpecOperators;
11
+ createChartInstance(): IChartInstance<EChartSpec>;
12
+ toSpec(config: IChartConfig, style: ChartStyle): import("echarts").EChartsOption;
13
+ stylizeSpec(spec: EChartSpec, stylizeInit: IChartRenderModelStylizeInit<EChartSpec>, rect: IChartHostRect): import("echarts").EChartsOption | {
14
+ backgroundColor: string;
15
+ };
16
+ }
17
+ export declare class EChartRenderEngine extends Disposable implements EChartInstance {
18
+ static engineName: string;
19
+ private _instance;
20
+ container: HTMLElement | string;
21
+ private _devicePixelRatio;
22
+ constructor();
23
+ getDevicePixelRatio(): 1 | 2 | undefined;
24
+ mount(id: string | HTMLElement): void;
25
+ resize(echartsProvider?: any): void;
26
+ private _ensureChartInstance;
27
+ get containerElement(): HTMLElement | null;
28
+ render(spec: EChartSpec, echartsProvider?: any): void;
29
+ exportImg(echartsProvider?: any): Promise<string>;
30
+ onDispose(): void;
31
+ dispose(): void;
32
+ }
@@ -0,0 +1,3 @@
1
+ import type { IChartModelInitParams } from './mode-converter/mode-converter';
2
+ export declare function echartToChartModelInit(echartOption: echarts.EChartsOption): IChartModelInitParams;
3
+ export declare function isChartModelInit(option: any): option is IChartModelInitParams;
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const boxplotChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const bubbleChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const combinationChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,7 @@
1
+ export declare enum SpecField {
2
+ ValueField = "__valueField__",
3
+ SeriesField = "__seriesField__",
4
+ SeriesFieldLabel = "__seriesFieldLabel__",
5
+ CategoryField = "__categoryField__",
6
+ CategoryFieldLabel = "__categoryFieldLabel__"
7
+ }
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const funnelChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const heatmapChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const paretoChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const pieChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const radarChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const relationChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const sankeyChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const scatterChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,15 @@
1
+ import type { IChartConfig } from '../../../types';
2
+ export declare function createLabelMap(config: IChartConfig): {
3
+ categoryNameMap: Record<string, string>;
4
+ seriesNameMap: Record<string, string>;
5
+ };
6
+ /**
7
+ * Generate colors for positive, negative, and subtotal values based on a base theme color.
8
+ * @param themeColor The base color in hex format (e.g., "#3498db").
9
+ * @returns An object containing colors for positive, negative, and subtotal values.
10
+ */
11
+ export declare const generateSeriesColors: (themeColor: string) => {
12
+ positiveColor: string;
13
+ negativeColor: string;
14
+ subtotalColor: string;
15
+ };
@@ -0,0 +1,2 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ export declare const waterfallChartConverter: IChartRenderSpecConverter<EChartSpec>;
@@ -0,0 +1,76 @@
1
+ import type { EChartSpec, IChartRenderSpecConverter } from '../../../types';
2
+ interface IWordCloudTextStyle {
3
+ color?: string;
4
+ fontStyle?: string;
5
+ fontWeight?: string | number;
6
+ fontFamily?: string;
7
+ fontSize?: number | string;
8
+ align?: string;
9
+ verticalAlign?: string;
10
+ baseline?: string;
11
+ opacity?: number;
12
+ lineHeight?: number;
13
+ backgroundColor?: string | {
14
+ image: HTMLImageElement | HTMLCanvasElement | string;
15
+ };
16
+ borderColor?: string;
17
+ borderWidth?: number;
18
+ borderType?: string;
19
+ borderDashOffset?: number;
20
+ borderRadius?: number | number[];
21
+ padding?: number | number[];
22
+ width?: number | string;
23
+ height?: number;
24
+ textBorderColor?: string;
25
+ textBorderWidth?: number;
26
+ textBorderType?: string;
27
+ textBorderDashOffset?: number;
28
+ textShadowBlur?: number;
29
+ textShadowColor?: string;
30
+ textShadowOffsetX?: number;
31
+ textShadowOffsetY?: number;
32
+ }
33
+ export interface IWorldCloudDataItem {
34
+ name?: string;
35
+ value?: number | number[];
36
+ textStyle?: IWordCloudTextStyle;
37
+ emphasis?: {
38
+ textStyle?: IWordCloudTextStyle;
39
+ };
40
+ }
41
+ export interface IWordCloudSeriesOption {
42
+ mainType?: 'series';
43
+ type?: 'wordCloud';
44
+ silent?: boolean;
45
+ blendMode?: string;
46
+ /**
47
+ * Cursor when mouse on the elements
48
+ */
49
+ cursor?: string;
50
+ width?: number | string;
51
+ height?: number | string;
52
+ top?: number | string;
53
+ right?: number | string;
54
+ bottom?: number | string;
55
+ left?: number | string;
56
+ textStyle?: IWordCloudTextStyle | {
57
+ color?: (params?: any) => string;
58
+ };
59
+ emphasis?: {
60
+ focus?: 'self' | 'series' | 'none';
61
+ blurScope?: 'coordinateSystem' | 'global' | 'series';
62
+ textStyle?: IWordCloudTextStyle;
63
+ };
64
+ shape?: string;
65
+ maskImage?: HTMLImageElement | HTMLCanvasElement;
66
+ sizeRange?: number[];
67
+ rotationRange?: number[];
68
+ rotationStep?: number;
69
+ gridSize?: number;
70
+ drawOutOfBound?: boolean;
71
+ layoutAnimation?: boolean;
72
+ keepAspect?: boolean;
73
+ data?: IWorldCloudDataItem[];
74
+ }
75
+ export declare const wordCloudChartConverter: IChartRenderSpecConverter<EChartSpec>;
76
+ export {};
@@ -0,0 +1,96 @@
1
+ import type { Injector } from '@univerjs/core';
2
+ import type { ChartTypeBits } from '../../enum';
3
+ import type { ChartStyle, IChartContext, IChartHostRect, IUniverDataSet } from '../../types';
4
+ import type { IChartLocaleTexts } from '../chart-locale-texts';
5
+ import { StaticChartSource } from '../../source/static-chart-source';
6
+ import { ChartModel } from '../chart-model';
7
+ /**
8
+ * The parameters for initializing a chart model.
9
+ */
10
+ export interface IChartModelInitParams {
11
+ /**
12
+ * The type of the chart.
13
+ */
14
+ chartType: ChartTypeBits;
15
+ /**
16
+ * The data source of the chart. The data should be like has dimensions and source.
17
+ * @example
18
+ * ```json
19
+ * {
20
+ * "dimensions": ['a', 'b', 'c'],
21
+ * "source": [
22
+ * [1, 2, 3],
23
+ * [4, 5, 6],
24
+ * [7, 8, 9],
25
+ * ]
26
+ * }
27
+ * ```
28
+ */
29
+ source: IUniverDataSet;
30
+ /**
31
+ * The chart title.
32
+ */
33
+ title: string;
34
+ /**
35
+ * The id of the chart model. This property will be provided by chart model json.
36
+ */
37
+ id?: string;
38
+ /**
39
+ * The context of the chart model. This property will be provided by chart model json.
40
+ */
41
+ context?: Partial<IChartContext>;
42
+ /**
43
+ * The style of the chart model. This property will be provided by chart model json.
44
+ */
45
+ style?: ChartStyle;
46
+ /**
47
+ * The theme name of the chart model. This property will be provided by chart model json.
48
+ */
49
+ themeName?: string;
50
+ /**
51
+ * The direction of the data source. If the data source is column direction, the value should be false.The default value is true.
52
+ */
53
+ isRowDirection?: boolean;
54
+ localeTexts?: IChartLocaleTexts;
55
+ }
56
+ export declare function generateChartModelContext(chartModel: ChartModel, dataSource: StaticChartSource): IChartContext | null;
57
+ /**
58
+ * Convert the initial data to a chart model.
59
+ * @param initJson The initial data of the chart model.
60
+ * @param injector The injector of the chart model.
61
+ * @returns {Promise<ChartModel>} The chart model.
62
+ * @example
63
+ * ```typescript
64
+ * const workbook = univerAPI.getActiveWorkbook()
65
+ * const sheet = workbook.getActiveSheet()
66
+ * const inject = sheet.getInject(); *
67
+ * const data = {
68
+ * dimensions: ['a', 'b', 'c'],
69
+ * source: [['test', 1, 3], ['test1', 2, 2], ['tes2', 3, 1], ['test3', 4, 4], ]
70
+ * } *
71
+ * const initData = {
72
+ * chartType: 4,
73
+ * source: data,
74
+ * title: 'test title',
75
+ * }
76
+ * const model = await window.convertModelFromInitData(initData, inject)
77
+ * const rect = {
78
+ * width: 500,
79
+ * height: 400
80
+ * };
81
+ * console.log(window.convertModelToSpec(model, rect))
82
+ * setTimeout(()=>{
83
+ * console.log('1111',window.convertModelToSpec(model, rect))
84
+ * },1000)
85
+ * ```
86
+ */
87
+ export declare function convertModelFromInitData(initJson: IChartModelInitParams, injector: Injector): Promise<ChartModel>;
88
+ /**
89
+ * Convert the chart model to a chart spec.The spec is a echart option object.
90
+ * @param model The chart model.
91
+ * @param rect The current size of the chart.
92
+ * @returns {EChartSpec} The chart spec.
93
+ */
94
+ export declare function convertModelToSpec(model: ChartModel, rect: IChartHostRect): import("echarts").EChartsOption | {
95
+ backgroundColor: string;
96
+ };
@@ -0,0 +1,2 @@
1
+ import type { EChartRenderSpecOperator } from '../../../types';
2
+ export declare const axisTitleStyleOperator: EChartRenderSpecOperator;