@univerjs-pro/engine-chart 1.0.0-beta.0 → 1.0.0-beta.2

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 (187) hide show
  1. package/README.md +9 -0
  2. package/lib/cjs/facade.js +1 -1
  3. package/lib/cjs/index.js +1 -1
  4. package/lib/cjs/locale/ar-SA.js +1 -1
  5. package/lib/cjs/locale/ca-ES.js +1 -1
  6. package/lib/cjs/locale/de-DE.js +1 -1
  7. package/lib/cjs/locale/en-US.js +1 -1
  8. package/lib/cjs/locale/es-ES.js +1 -1
  9. package/lib/cjs/locale/fa-IR.js +1 -1
  10. package/lib/cjs/locale/fr-FR.js +1 -1
  11. package/lib/cjs/locale/id-ID.js +1 -1
  12. package/lib/cjs/locale/it-IT.js +1 -1
  13. package/lib/cjs/locale/ja-JP.js +1 -1
  14. package/lib/cjs/locale/ko-KR.js +1 -1
  15. package/lib/cjs/locale/pl-PL.js +1 -1
  16. package/lib/cjs/locale/pt-BR.js +1 -1
  17. package/lib/cjs/locale/ru-RU.js +1 -1
  18. package/lib/cjs/locale/sk-SK.js +1 -1
  19. package/lib/cjs/locale/vi-VN.js +1 -1
  20. package/lib/cjs/locale/zh-CN.js +1 -1
  21. package/lib/cjs/locale/zh-HK.js +1 -1
  22. package/lib/cjs/locale/zh-TW.js +1 -1
  23. package/lib/es/facade.js +1 -1
  24. package/lib/es/index.js +1 -1
  25. package/lib/es/locale/ar-SA.js +1 -1
  26. package/lib/es/locale/ca-ES.js +1 -1
  27. package/lib/es/locale/de-DE.js +1 -1
  28. package/lib/es/locale/en-US.js +1 -1
  29. package/lib/es/locale/es-ES.js +1 -1
  30. package/lib/es/locale/fa-IR.js +1 -1
  31. package/lib/es/locale/fr-FR.js +1 -1
  32. package/lib/es/locale/id-ID.js +1 -1
  33. package/lib/es/locale/it-IT.js +1 -1
  34. package/lib/es/locale/ja-JP.js +1 -1
  35. package/lib/es/locale/ko-KR.js +1 -1
  36. package/lib/es/locale/pl-PL.js +1 -1
  37. package/lib/es/locale/pt-BR.js +1 -1
  38. package/lib/es/locale/ru-RU.js +1 -1
  39. package/lib/es/locale/sk-SK.js +1 -1
  40. package/lib/es/locale/vi-VN.js +1 -1
  41. package/lib/es/locale/zh-CN.js +1 -1
  42. package/lib/es/locale/zh-HK.js +1 -1
  43. package/lib/es/locale/zh-TW.js +1 -1
  44. package/lib/facade.js +1 -1
  45. package/lib/index.js +1 -1
  46. package/lib/locale/ar-SA.js +1 -1
  47. package/lib/locale/ca-ES.js +1 -1
  48. package/lib/locale/de-DE.js +1 -1
  49. package/lib/locale/en-US.js +1 -1
  50. package/lib/locale/es-ES.js +1 -1
  51. package/lib/locale/fa-IR.js +1 -1
  52. package/lib/locale/fr-FR.js +1 -1
  53. package/lib/locale/id-ID.js +1 -1
  54. package/lib/locale/it-IT.js +1 -1
  55. package/lib/locale/ja-JP.js +1 -1
  56. package/lib/locale/ko-KR.js +1 -1
  57. package/lib/locale/pl-PL.js +1 -1
  58. package/lib/locale/pt-BR.js +1 -1
  59. package/lib/locale/ru-RU.js +1 -1
  60. package/lib/locale/sk-SK.js +1 -1
  61. package/lib/locale/vi-VN.js +1 -1
  62. package/lib/locale/zh-CN.js +1 -1
  63. package/lib/locale/zh-HK.js +1 -1
  64. package/lib/locale/zh-TW.js +1 -1
  65. package/lib/types/chart-builder/chart-builder-adapter.d.ts +1 -3
  66. package/lib/types/chart-builder/chart-builder.d.ts +2 -5
  67. package/lib/types/chart-builder/chart-live-adapter.d.ts +15 -0
  68. package/lib/types/chart-builder/chart-types.d.ts +21 -0
  69. package/lib/types/chart-builder/configuration/cartesian-series.d.ts +1 -0
  70. package/lib/types/chart-builder/configuration/chart-config-group.d.ts +38 -0
  71. package/lib/types/chart-builder/configuration/chart-config-operation.d.ts +1 -38
  72. package/lib/types/chart-builder/configuration/gauge.d.ts +1 -1
  73. package/lib/types/chart-builder/conversion/chart-config-converter.d.ts +24 -11
  74. package/lib/types/chart-builder/conversion/chart-create-config.d.ts +6 -0
  75. package/lib/types/chart-builder/conversion/chart-model-fields.d.ts +20 -0
  76. package/lib/types/chart-builder/conversion/chart-type-converter.d.ts +1 -3
  77. package/lib/types/chart-builder/conversion/describe-chart-model.d.ts +0 -127
  78. package/lib/types/chart-builder/detached-chart-builder-adapter.d.ts +1 -10
  79. package/lib/types/chart-builder/internal/apply-pending-to-description.d.ts +2 -0
  80. package/lib/types/chart-builder/internal/chart-host-config-adapter.d.ts +3 -0
  81. package/lib/types/chart-builder/internal/chart-pending-patch.d.ts +11 -0
  82. package/lib/types/chart-builder/internal/patch-interpreter.d.ts +17 -0
  83. package/lib/types/facade/builders/f-area-chart-builder.d.ts +52 -7
  84. package/lib/types/facade/builders/f-boxplot-chart-builder.d.ts +88 -3
  85. package/lib/types/facade/builders/f-bubble-chart-builder.d.ts +59 -6
  86. package/lib/types/facade/builders/f-candlestick-chart-builder.d.ts +90 -31
  87. package/lib/types/facade/builders/f-chord-chart-builder.d.ts +180 -8
  88. package/lib/types/facade/builders/f-combination-chart-builder.d.ts +55 -10
  89. package/lib/types/facade/builders/f-funnel-chart-builder.d.ts +55 -9
  90. package/lib/types/facade/builders/f-gauge-chart-builder.d.ts +378 -10
  91. package/lib/types/facade/builders/f-heatmap-chart-builder.d.ts +83 -26
  92. package/lib/types/facade/builders/f-histogram-chart-builder.d.ts +142 -16
  93. package/lib/types/facade/builders/f-line-chart-builder.d.ts +51 -6
  94. package/lib/types/facade/builders/f-pareto-chart-builder.d.ts +83 -20
  95. package/lib/types/facade/builders/f-pie-chart-builder.d.ts +131 -47
  96. package/lib/types/facade/builders/f-radar-chart-builder.d.ts +64 -11
  97. package/lib/types/facade/builders/f-relation-chart-builder.d.ts +72 -38
  98. package/lib/types/facade/builders/f-scatter-chart-builder.d.ts +58 -6
  99. package/lib/types/facade/builders/f-sunburst-chart-builder.d.ts +122 -8
  100. package/lib/types/facade/builders/f-treemap-chart-builder.d.ts +115 -13
  101. package/lib/types/facade/builders/f-waterfall-chart-builder.d.ts +87 -53
  102. package/lib/types/facade/builders/f-word-cloud-chart-builder.d.ts +64 -15
  103. package/lib/types/facade/chart-builder-registry.d.ts +4 -4
  104. package/lib/types/facade/chart-builder-type-map.d.ts +35 -32
  105. package/lib/types/facade/chart-host-builder-types.d.ts +2 -21
  106. package/lib/types/facade/create-chart-builder.d.ts +46 -0
  107. package/lib/types/facade/f-axis-chart-builder.d.ts +21 -38
  108. package/lib/types/facade/f-cartesian-chart-builder.d.ts +32 -20
  109. package/lib/types/facade/f-chart-builder-base.d.ts +240 -73
  110. package/lib/types/facade/f-chart.d.ts +686 -0
  111. package/lib/types/facade/f-enum.d.ts +684 -31
  112. package/lib/types/facade/f-univer.d.ts +51 -0
  113. package/lib/types/facade/index.d.ts +7 -9
  114. package/lib/types/facade/internal/category-fields.d.ts +3 -0
  115. package/lib/types/facade/internal/chart-builder-facade-context.d.ts +11 -10
  116. package/lib/types/index.d.ts +28 -17
  117. package/lib/types/models/chart-context/chart-field-selection.d.ts +1 -1
  118. package/lib/types/models/chart-context/resolve-chart-context.d.ts +3 -0
  119. package/lib/types/models/chart-data/chart-field-consumption-validator.d.ts +1 -1
  120. package/lib/types/models/chart-data/internal/category-series-aggregation.d.ts +1 -2
  121. package/lib/types/models/chart-data/internal/data-set-category-spans.d.ts +7 -0
  122. package/lib/types/models/chart-data/internal/multi-level-category-axis.d.ts +10 -0
  123. package/lib/types/models/chart-host/config/chart-config-interpreter.d.ts +13 -0
  124. package/lib/types/models/chart-host/resource/chart-data-source-resolver.d.ts +58 -0
  125. package/lib/types/models/chart-host/resource/chart-resource-repository.d.ts +111 -0
  126. package/lib/types/models/chart-host/resource/chart-resource-serializer.d.ts +2 -1
  127. package/lib/types/models/chart-host/resource/inline-chart-table.d.ts +4 -3
  128. package/lib/types/models/chart-host/resource/persisted-chart-style.d.ts +3 -0
  129. package/lib/types/models/chart-host/resource/resource-ref-chart-data-source.adapter.d.ts +22 -0
  130. package/lib/types/models/chart-host/resource/resource-ref-chart-data-source.provider.d.ts +12 -0
  131. package/lib/types/models/chart-host/static/chart-model-store.d.ts +56 -0
  132. package/lib/types/models/chart-host/static/{static-chart-runtime.d.ts → chart-runtime.d.ts} +6 -5
  133. package/lib/types/models/chart-model/chart-model.d.ts +2 -383
  134. package/lib/types/models/chart-render/axes/chart-runtime-axes.d.ts +2 -2
  135. package/lib/types/models/chart-render/chart-render-input-resolver.d.ts +2 -2
  136. package/lib/types/models/chart-render/converter/category-axis-domain.d.ts +6 -0
  137. package/lib/types/models/chart-render/converter/converters/gauge-chart-converter.d.ts +5 -3
  138. package/lib/types/models/chart-render/converter/echart-text-overflow.d.ts +7 -0
  139. package/lib/types/models/chart-render/converter/render-spec-operators/grid-operator.d.ts +3 -3
  140. package/lib/types/models/chart-render/converter/render-spec-operators/legend-size.d.ts +1 -2
  141. package/lib/types/models/chart-render/converter/render-spec-operators/multi-level-category-axis-grid.operator.d.ts +2 -0
  142. package/lib/types/models/chart-render/converter/render-spec-operators/multi-level-category-axis-layout.d.ts +23 -0
  143. package/lib/types/models/chart-render/converter/render-spec-operators/multi-level-category-axis-overlay.operator.d.ts +12 -0
  144. package/lib/types/models/chart-render/converter/render-spec-operators/series-style-operator/series-style-operator.d.ts +2 -2
  145. package/lib/types/models/chart-render/converter/render-spec-operators/tool-tip-operator.d.ts +3 -13
  146. package/lib/types/models/chart-render/converter/render-spec-operators/tools.d.ts +4 -4
  147. package/lib/types/models/chart-render/converter/render-spec-operators/visual-map-operator.d.ts +4 -0
  148. package/lib/types/models/chart-render/echart-render-model.d.ts +7 -3
  149. package/lib/types/models/chart-render/edit-overlay/chart-element-edit-overlay.d.ts +1 -1
  150. package/lib/types/models/chart-render/edit-overlay/resolve-chart-element-hit-layout.d.ts +1 -1
  151. package/lib/types/models/chart-render/style/chart-runtime-style.d.ts +0 -1
  152. package/lib/types/models/common/constants/default-chart-style.d.ts +53 -53
  153. package/lib/types/models/common/constants/default.d.ts +3 -2
  154. package/lib/types/plugin.d.ts +1 -1
  155. package/lib/types/types.d.ts +46 -6
  156. package/lib/types/util.d.ts +0 -1
  157. package/lib/types/utils/compact.d.ts +6 -0
  158. package/lib/types/utils/device-pixel-ratio.d.ts +1 -0
  159. package/lib/umd/facade.js +1 -1
  160. package/lib/umd/index.js +1 -1
  161. package/lib/umd/locale/ar-SA.js +1 -1
  162. package/lib/umd/locale/ca-ES.js +1 -1
  163. package/lib/umd/locale/de-DE.js +1 -1
  164. package/lib/umd/locale/en-US.js +1 -1
  165. package/lib/umd/locale/es-ES.js +1 -1
  166. package/lib/umd/locale/fa-IR.js +1 -1
  167. package/lib/umd/locale/fr-FR.js +1 -1
  168. package/lib/umd/locale/id-ID.js +1 -1
  169. package/lib/umd/locale/it-IT.js +1 -1
  170. package/lib/umd/locale/ja-JP.js +1 -1
  171. package/lib/umd/locale/ko-KR.js +1 -1
  172. package/lib/umd/locale/pl-PL.js +1 -1
  173. package/lib/umd/locale/pt-BR.js +1 -1
  174. package/lib/umd/locale/ru-RU.js +1 -1
  175. package/lib/umd/locale/sk-SK.js +1 -1
  176. package/lib/umd/locale/vi-VN.js +1 -1
  177. package/lib/umd/locale/zh-CN.js +1 -1
  178. package/lib/umd/locale/zh-HK.js +1 -1
  179. package/lib/umd/locale/zh-TW.js +1 -1
  180. package/package.json +7 -6
  181. package/lib/types/chart-builder/internal/host-builder-runtime.d.ts +0 -3
  182. package/lib/types/chart-builder/internal/merge-description.d.ts +0 -2
  183. package/lib/types/facade/f-chart-base.d.ts +0 -82
  184. package/lib/types/facade/f-charts-base.d.ts +0 -74
  185. package/lib/types/facade/internal/host-builder-composer.d.ts +0 -16
  186. package/lib/types/models/chart-host/resource/static-chart-resource-repository.d.ts +0 -75
  187. package/lib/types/models/chart-host/static/static-chart-model-store.d.ts +0 -43
@@ -1,6 +1,59 @@
1
- import type { ChartPublicSeriesSelector, ChartSeriesAxis, ChartSeriesTypeString } from '@univerjs-pro/engine-chart';
1
+ import type { ChartPublicSeriesSelector, ChartSeriesAxis, ChartSeriesTypeString, IChartInfo, IChartSeriesPatch, IChartSeriesStyleSpec } from '@univerjs-pro/engine-chart';
2
2
  import { FCartesianChartBuilder } from '../f-cartesian-chart-builder';
3
- export declare class FCombinationChartBuilder extends FCartesianChartBuilder {
3
+ /**
4
+ * Fluent, type-specific Builder for mixed Column, Line, and Area Combination Charts.
5
+ *
6
+ * @example Sheet
7
+ * ```ts
8
+ * const fWorkbook = univerAPI.getActiveWorkbook();
9
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
10
+ * const chartInfo = fWorksheet
11
+ * .newChart(univerAPI.Enum.ChartTypeString.Combination)
12
+ * .setSource('A1:D8')
13
+ * .setSeriesType(0, univerAPI.Enum.ChartSeriesTypeString.Line)
14
+ * .setSeriesAxis(0, univerAPI.Enum.ChartSeriesAxis.Right)
15
+ * .build();
16
+ * await fWorksheet.insertChart(chartInfo);
17
+ * ```
18
+ *
19
+ * @example Doc
20
+ * ```ts
21
+ * const fDocument = univerAPI.getActiveDocument();
22
+ * const chartInfo = fDocument
23
+ * .newChart(univerAPI.Enum.ChartTypeString.Combination)
24
+ * .setSource([['Month', 'Sales', 'Profit'], ['Jan', 120, 24], ['Feb', 180, 38]])
25
+ * .setSeriesType(0, univerAPI.Enum.ChartSeriesTypeString.Line)
26
+ * .setSeriesAxis(0, univerAPI.Enum.ChartSeriesAxis.Right)
27
+ * .build();
28
+ * await fDocument.insertChart(chartInfo);
29
+ * ```
30
+ *
31
+ * @example Slide
32
+ * ```ts
33
+ * const fPresentation = univerAPI.getActivePresentation();
34
+ * const fSlide = fPresentation.getSlideByIndex(0);
35
+ * const chartInfo = fSlide
36
+ * .newChart(univerAPI.Enum.ChartTypeString.Combination)
37
+ * .setSource([['Month', 'Sales', 'Profit'], ['Jan', 120, 24], ['Feb', 180, 38]])
38
+ * .setSeriesType(0, univerAPI.Enum.ChartSeriesTypeString.Line)
39
+ * .setSeriesAxis(0, univerAPI.Enum.ChartSeriesAxis.Right)
40
+ * .build();
41
+ * await fSlide.insertChart(chartInfo);
42
+ * ```
43
+ *
44
+ * @example Board
45
+ * ```ts
46
+ * const fBoard = univerAPI.getActiveBoard();
47
+ * const chartInfo = fBoard
48
+ * .newChart(univerAPI.Enum.ChartTypeString.Combination)
49
+ * .setSource([['Month', 'Sales', 'Profit'], ['Jan', 120, 24], ['Feb', 180, 38]])
50
+ * .setSeriesType(0, univerAPI.Enum.ChartSeriesTypeString.Line)
51
+ * .setSeriesAxis(0, univerAPI.Enum.ChartSeriesAxis.Right)
52
+ * .build();
53
+ * await fBoard.insertChart(chartInfo);
54
+ * ```
55
+ */
56
+ export declare class FCombinationChartBuilder<TSource = never[], TDataSource = TSource, TInfo extends IChartInfo<TDataSource> = IChartInfo<TDataSource>> extends FCartesianChartBuilder<Omit<IChartSeriesPatch, 'selector'>, IChartSeriesStyleSpec, TSource, TDataSource, TInfo> {
4
57
  /**
5
58
  * Sets the series type configuration and returns this builder for chaining.
6
59
  *
@@ -11,8 +64,6 @@ export declare class FCombinationChartBuilder extends FCartesianChartBuilder {
11
64
  * @returns This builder for chaining.
12
65
  * @example
13
66
  * ```ts
14
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
15
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Combination);
16
67
  * builder.setSeriesType(0, univerAPI.Enum.ChartSeriesTypeString.Line);
17
68
  * ```
18
69
  */
@@ -26,8 +77,6 @@ export declare class FCombinationChartBuilder extends FCartesianChartBuilder {
26
77
  * @returns This builder for chaining.
27
78
  * @example
28
79
  * ```ts
29
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
30
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Combination);
31
80
  * builder.resetSeriesType(0);
32
81
  * ```
33
82
  */
@@ -42,8 +91,6 @@ export declare class FCombinationChartBuilder extends FCartesianChartBuilder {
42
91
  * @returns This builder for chaining.
43
92
  * @example
44
93
  * ```ts
45
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
46
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Combination);
47
94
  * builder.setSeriesAxis(0, univerAPI.Enum.ChartSeriesAxis.Right);
48
95
  * ```
49
96
  */
@@ -57,8 +104,6 @@ export declare class FCombinationChartBuilder extends FCartesianChartBuilder {
57
104
  * @returns This builder for chaining.
58
105
  * @example
59
106
  * ```ts
60
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
61
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Combination);
62
107
  * builder.resetSeriesAxis(0);
63
108
  * ```
64
109
  */
@@ -1,5 +1,59 @@
1
+ import type { IChartInfo } from '@univerjs-pro/engine-chart';
1
2
  import { FChartBuilderBase } from '../f-chart-builder-base';
2
- export declare class FFunnelChartBuilder extends FChartBuilderBase {
3
+ /**
4
+ * Fluent, type-specific Builder for Funnel Charts.
5
+ *
6
+ * @example Sheet
7
+ * ```ts
8
+ * const fWorkbook = univerAPI.getActiveWorkbook();
9
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
10
+ * const chartInfo = fWorksheet
11
+ * .newChart(univerAPI.Enum.ChartTypeString.Funnel)
12
+ * .setSource('A1:B8')
13
+ * .setGap(4)
14
+ * .setUseAbsoluteValue(true)
15
+ * .build();
16
+ * await fWorksheet.insertChart(chartInfo);
17
+ * ```
18
+ *
19
+ * @example Doc
20
+ * ```ts
21
+ * const fDocument = univerAPI.getActiveDocument();
22
+ * const chartInfo = fDocument
23
+ * .newChart(univerAPI.Enum.ChartTypeString.Funnel)
24
+ * .setSource([['Stage', 'Users'], ['Visited', 1000], ['Signed up', 420], ['Purchased', 160]])
25
+ * .setGap(4)
26
+ * .setUseAbsoluteValue(true)
27
+ * .build();
28
+ * await fDocument.insertChart(chartInfo);
29
+ * ```
30
+ *
31
+ * @example Slide
32
+ * ```ts
33
+ * const fPresentation = univerAPI.getActivePresentation();
34
+ * const fSlide = fPresentation.getSlideByIndex(0);
35
+ * const chartInfo = fSlide
36
+ * .newChart(univerAPI.Enum.ChartTypeString.Funnel)
37
+ * .setSource([['Stage', 'Users'], ['Visited', 1000], ['Signed up', 420], ['Purchased', 160]])
38
+ * .setGap(4)
39
+ * .setUseAbsoluteValue(true)
40
+ * .build();
41
+ * await fSlide.insertChart(chartInfo);
42
+ * ```
43
+ *
44
+ * @example Board
45
+ * ```ts
46
+ * const fBoard = univerAPI.getActiveBoard();
47
+ * const chartInfo = fBoard
48
+ * .newChart(univerAPI.Enum.ChartTypeString.Funnel)
49
+ * .setSource([['Stage', 'Users'], ['Visited', 1000], ['Signed up', 420], ['Purchased', 160]])
50
+ * .setGap(4)
51
+ * .setUseAbsoluteValue(true)
52
+ * .build();
53
+ * await fBoard.insertChart(chartInfo);
54
+ * ```
55
+ */
56
+ export declare class FFunnelChartBuilder<TSource = never[], TDataSource = TSource, TInfo extends IChartInfo<TDataSource> = IChartInfo<TDataSource>> extends FChartBuilderBase<TSource, TDataSource, TInfo> {
3
57
  /**
4
58
  * Sets the gap configuration and returns this builder for chaining.
5
59
  *
@@ -9,8 +63,6 @@ export declare class FFunnelChartBuilder extends FChartBuilderBase {
9
63
  * @returns This builder for chaining.
10
64
  * @example
11
65
  * ```ts
12
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
13
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Funnel);
14
66
  * builder.setGap(8);
15
67
  * ```
16
68
  */
@@ -23,8 +75,6 @@ export declare class FFunnelChartBuilder extends FChartBuilderBase {
23
75
  * @returns This builder for chaining.
24
76
  * @example
25
77
  * ```ts
26
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
27
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Funnel);
28
78
  * builder.resetGap();
29
79
  * ```
30
80
  */
@@ -38,8 +88,6 @@ export declare class FFunnelChartBuilder extends FChartBuilderBase {
38
88
  * @returns This builder for chaining.
39
89
  * @example
40
90
  * ```ts
41
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
42
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Funnel);
43
91
  * builder.setUseAbsoluteValue(true);
44
92
  * ```
45
93
  */
@@ -52,8 +100,6 @@ export declare class FFunnelChartBuilder extends FChartBuilderBase {
52
100
  * @returns This builder for chaining.
53
101
  * @example
54
102
  * ```ts
55
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
56
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Funnel);
57
103
  * builder.resetUseAbsoluteValue();
58
104
  * ```
59
105
  */
@@ -1,4 +1,4 @@
1
- import type { ChartGaugeMode, DeepNullish, IChartGaugeAnchorSpec, IChartGaugeAnglesSpec, IChartGaugeAxisLabelSpec, IChartGaugeAxisLineSpec, IChartGaugeAxisTickSpec, IChartGaugeDetailSpec, IChartGaugePointerSpec, IChartGaugeProgressSpec, IChartGaugeRangeSpec, IChartGaugeScaleSpec, IChartGaugeSplitLineSpec, IChartGaugeTicksPatch, IChartGaugeTitleSpec } from '@univerjs-pro/engine-chart';
1
+ import type { ChartGaugeMode, DeepNullish, IChartGaugeAnchorSpec, IChartGaugeAnglesSpec, IChartGaugeAxisLabelSpec, IChartGaugeAxisLineSpec, IChartGaugeAxisTickSpec, IChartGaugeDetailSpec, IChartGaugePointerSpec, IChartGaugeProgressSpec, IChartGaugeRangeSpec, IChartGaugeScaleSpec, IChartGaugeSplitLineSpec, IChartGaugeTicksPatch, IChartGaugeTitleSpec, IChartInfo } from '@univerjs-pro/engine-chart';
2
2
  import { FChartBuilderBase } from '../f-chart-builder-base';
3
3
  /**
4
4
  * Fluent semantic builder for Google-style label/value Gauge data.
@@ -11,42 +11,410 @@ import { FChartBuilderBase } from '../f-chart-builder-base';
11
11
  * 0–1 units, and range bounds use scale-domain values. All style is chart-wide.
12
12
  * Layout is derived at render time and is never part of this builder's state.
13
13
  *
14
- * @example
15
- * chart.setType(ChartTypeString.Gauge)
16
- * .setCategoryField(0)
17
- * .setGaugeValueField(1)
18
- * .setGaugeRanges([{ from: 0, to: 60, color: '#dc2626' }]);
14
+ * @example Sheet
15
+ * ```ts
16
+ * const fWorkbook = univerAPI.getActiveWorkbook();
17
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
18
+ * const chartInfo = fWorksheet
19
+ * .newChart(univerAPI.Enum.ChartTypeString.Gauge)
20
+ * .setSource('A1:B4')
21
+ * .setCategoryField(0)
22
+ * .setGaugeValueField(1)
23
+ * .setGaugeMode(univerAPI.Enum.ChartGaugeMode.Modern)
24
+ * .setGaugeScale({ min: 0, max: 100 })
25
+ * .setGaugeTicks({ majorDivisions: 10, minorDivisionsPerMajor: 5 })
26
+ * .setGaugeAngles({ startAngle: 225, endAngle: -45 })
27
+ * .setGaugeRanges([{ from: 0, to: 60, color: '#dc2626' }])
28
+ * .setGaugeAxisLine({ visible: true, width: 12 })
29
+ * .setGaugeAxisTick({ visible: true, length: 6 })
30
+ * .setGaugeSplitLine({ visible: true, length: 12 })
31
+ * .setGaugeAxisLabel({ visible: true, color: '#334155' })
32
+ * .setGaugePointer({ visible: true, shape: univerAPI.Enum.ChartGaugePointerShape.Needle, color: '#2563eb' })
33
+ * .setGaugeAnchor({ visible: true, size: 8 })
34
+ * .setGaugeProgress({ visible: true, width: 12 })
35
+ * .setGaugeTitle({ visible: true, color: '#334155' })
36
+ * .setGaugeDetail({ visible: true, color: '#0f172a' })
37
+ * .build();
38
+ * await fWorksheet.insertChart(chartInfo);
39
+ * ```
40
+ *
41
+ * @example Doc
42
+ * ```ts
43
+ * const fDocument = univerAPI.getActiveDocument();
44
+ * const chartInfo = fDocument
45
+ * .newChart(univerAPI.Enum.ChartTypeString.Gauge)
46
+ * .setSource([['Metric', 'Value'], ['Completion', 72]])
47
+ * .setCategoryField(0)
48
+ * .setGaugeValueField(1)
49
+ * .setGaugeMode(univerAPI.Enum.ChartGaugeMode.Modern)
50
+ * .setGaugeScale({ min: 0, max: 100 })
51
+ * .setGaugeTicks({ majorDivisions: 10, minorDivisionsPerMajor: 5 })
52
+ * .setGaugeAngles({ startAngle: 225, endAngle: -45 })
53
+ * .setGaugeRanges([{ from: 0, to: 60, color: '#dc2626' }])
54
+ * .setGaugeAxisLine({ visible: true, width: 12 })
55
+ * .setGaugeAxisTick({ visible: true, length: 6 })
56
+ * .setGaugeSplitLine({ visible: true, length: 12 })
57
+ * .setGaugeAxisLabel({ visible: true, color: '#334155' })
58
+ * .setGaugePointer({ visible: true, shape: univerAPI.Enum.ChartGaugePointerShape.Needle, color: '#2563eb' })
59
+ * .setGaugeAnchor({ visible: true, size: 8 })
60
+ * .setGaugeProgress({ visible: true, width: 12 })
61
+ * .setGaugeTitle({ visible: true, color: '#334155' })
62
+ * .setGaugeDetail({ visible: true, color: '#0f172a' })
63
+ * .build();
64
+ * await fDocument.insertChart(chartInfo);
65
+ * ```
66
+ *
67
+ * @example Slide
68
+ * ```ts
69
+ * const fPresentation = univerAPI.getActivePresentation();
70
+ * const fSlide = fPresentation.getSlideByIndex(0);
71
+ * const chartInfo = fSlide
72
+ * .newChart(univerAPI.Enum.ChartTypeString.Gauge)
73
+ * .setSource([['Metric', 'Value'], ['Completion', 72]])
74
+ * .setCategoryField(0)
75
+ * .setGaugeValueField(1)
76
+ * .setGaugeMode(univerAPI.Enum.ChartGaugeMode.Modern)
77
+ * .setGaugeScale({ min: 0, max: 100 })
78
+ * .setGaugeTicks({ majorDivisions: 10, minorDivisionsPerMajor: 5 })
79
+ * .setGaugeAngles({ startAngle: 225, endAngle: -45 })
80
+ * .setGaugeRanges([{ from: 0, to: 60, color: '#dc2626' }])
81
+ * .setGaugeAxisLine({ visible: true, width: 12 })
82
+ * .setGaugeAxisTick({ visible: true, length: 6 })
83
+ * .setGaugeSplitLine({ visible: true, length: 12 })
84
+ * .setGaugeAxisLabel({ visible: true, color: '#334155' })
85
+ * .setGaugePointer({ visible: true, shape: univerAPI.Enum.ChartGaugePointerShape.Needle, color: '#2563eb' })
86
+ * .setGaugeAnchor({ visible: true, size: 8 })
87
+ * .setGaugeProgress({ visible: true, width: 12 })
88
+ * .setGaugeTitle({ visible: true, color: '#334155' })
89
+ * .setGaugeDetail({ visible: true, color: '#0f172a' })
90
+ * .build();
91
+ * await fSlide.insertChart(chartInfo);
92
+ * ```
93
+ *
94
+ * @example Board
95
+ * ```ts
96
+ * const fBoard = univerAPI.getActiveBoard();
97
+ * const chartInfo = fBoard
98
+ * .newChart(univerAPI.Enum.ChartTypeString.Gauge)
99
+ * .setSource([['Metric', 'Value'], ['Completion', 72]])
100
+ * .setCategoryField(0)
101
+ * .setGaugeValueField(1)
102
+ * .setGaugeMode(univerAPI.Enum.ChartGaugeMode.Modern)
103
+ * .setGaugeScale({ min: 0, max: 100 })
104
+ * .setGaugeTicks({ majorDivisions: 10, minorDivisionsPerMajor: 5 })
105
+ * .setGaugeAngles({ startAngle: 225, endAngle: -45 })
106
+ * .setGaugeRanges([{ from: 0, to: 60, color: '#dc2626' }])
107
+ * .setGaugeAxisLine({ visible: true, width: 12 })
108
+ * .setGaugeAxisTick({ visible: true, length: 6 })
109
+ * .setGaugeSplitLine({ visible: true, length: 12 })
110
+ * .setGaugeAxisLabel({ visible: true, color: '#334155' })
111
+ * .setGaugePointer({ visible: true, shape: univerAPI.Enum.ChartGaugePointerShape.Needle, color: '#2563eb' })
112
+ * .setGaugeAnchor({ visible: true, size: 8 })
113
+ * .setGaugeProgress({ visible: true, width: 12 })
114
+ * .setGaugeTitle({ visible: true, color: '#334155' })
115
+ * .setGaugeDetail({ visible: true, color: '#0f172a' })
116
+ * .build();
117
+ * await fBoard.insertChart(chartInfo);
118
+ * ```
19
119
  */
20
- export declare class FGaugeChartBuilder extends FChartBuilderBase {
21
- /** Selects the only value field; labels use `setCategoryField()`. */
120
+ export declare class FGaugeChartBuilder<TSource = never[], TDataSource = TSource, TInfo extends IChartInfo<TDataSource> = IChartInfo<TDataSource>> extends FChartBuilderBase<TSource, TDataSource, TInfo> {
121
+ /**
122
+ * Selects the only value field; labels use `setCategoryField()`.
123
+ *
124
+ * @param index Zero-based value field index.
125
+ * @returns This builder for chaining.
126
+ * @example
127
+ * ```ts
128
+ * builder.setGaugeValueField(1);
129
+ * ```
130
+ */
22
131
  setGaugeValueField(index: number): this;
132
+ /**
133
+ * Sets the Gauge display mode.
134
+ *
135
+ * @param value Gauge display mode.
136
+ * @returns This builder for chaining.
137
+ * @example
138
+ * ```ts
139
+ * builder.setGaugeMode(univerAPI.Enum.ChartGaugeMode.Modern);
140
+ * ```
141
+ */
23
142
  setGaugeMode(value: ChartGaugeMode): this;
143
+ /**
144
+ * Resets the Gauge display mode to its default.
145
+ *
146
+ * @returns This builder for chaining.
147
+ * @example
148
+ * ```ts
149
+ * builder.resetGaugeMode();
150
+ * ```
151
+ */
24
152
  resetGaugeMode(): this;
153
+ /**
154
+ * Sets the Gauge minimum, maximum, and optional major-division count.
155
+ *
156
+ * @param value Gauge scale settings.
157
+ * @returns This builder for chaining.
158
+ * @example
159
+ * ```ts
160
+ * builder.setGaugeScale({ min: 0, max: 100, splitNumber: 10 });
161
+ * ```
162
+ */
25
163
  setGaugeScale(value: IChartGaugeScaleSpec): this;
164
+ /**
165
+ * Resets the Gauge scale to 0 through 100.
166
+ *
167
+ * @returns This builder for chaining.
168
+ * @example
169
+ * ```ts
170
+ * builder.resetGaugeScale();
171
+ * ```
172
+ */
26
173
  resetGaugeScale(): this;
27
- /** Sets regular major scale divisions and minor divisions per major interval. */
174
+ /**
175
+ * Sets regular major scale divisions and minor divisions per major interval.
176
+ *
177
+ * @param value Gauge tick settings.
178
+ * @returns This builder for chaining.
179
+ * @example
180
+ * ```ts
181
+ * builder.setGaugeTicks({ majorDivisions: 10, minorDivisionsPerMajor: 5 });
182
+ * ```
183
+ */
28
184
  setGaugeTicks(value: IChartGaugeTicksPatch): this;
185
+ /**
186
+ * Sets the Gauge start and end angles.
187
+ *
188
+ * @param value Gauge angle settings in degrees.
189
+ * @returns This builder for chaining.
190
+ * @example
191
+ * ```ts
192
+ * builder.setGaugeAngles({ startAngle: 225, endAngle: -45 });
193
+ * ```
194
+ */
29
195
  setGaugeAngles(value: IChartGaugeAnglesSpec): this;
196
+ /**
197
+ * Resets Gauge angles to renderer defaults.
198
+ *
199
+ * @returns This builder for chaining.
200
+ * @example
201
+ * ```ts
202
+ * builder.resetGaugeAngles();
203
+ * ```
204
+ */
30
205
  resetGaugeAngles(): this;
206
+ /**
207
+ * Sets colored Gauge scale ranges in scale-domain units.
208
+ *
209
+ * @param value Gauge scale ranges.
210
+ * @returns This builder for chaining.
211
+ * @example
212
+ * ```ts
213
+ * builder.setGaugeRanges([{ from: 0, to: 60, color: '#dc2626' }]);
214
+ * ```
215
+ */
31
216
  setGaugeRanges(value: readonly IChartGaugeRangeSpec[]): this;
217
+ /**
218
+ * Clears authored Gauge scale ranges.
219
+ *
220
+ * @returns This builder for chaining.
221
+ * @example
222
+ * ```ts
223
+ * builder.resetGaugeRanges();
224
+ * ```
225
+ */
32
226
  resetGaugeRanges(): this;
227
+ /**
228
+ * Sets Gauge axis-line visibility and styling.
229
+ *
230
+ * @param value Gauge axis-line settings.
231
+ * @returns This builder for chaining.
232
+ * @example
233
+ * ```ts
234
+ * builder.setGaugeAxisLine({ visible: true, width: 12 });
235
+ * ```
236
+ */
33
237
  setGaugeAxisLine(value: IChartGaugeAxisLineSpec): this;
238
+ /**
239
+ * Resets Gauge axis-line styling to renderer defaults.
240
+ *
241
+ * @returns This builder for chaining.
242
+ * @example
243
+ * ```ts
244
+ * builder.resetGaugeAxisLine();
245
+ * ```
246
+ */
34
247
  resetGaugeAxisLine(): this;
248
+ /**
249
+ * Sets Gauge minor tick visibility and styling.
250
+ *
251
+ * @param value Gauge minor-tick settings.
252
+ * @returns This builder for chaining.
253
+ * @example
254
+ * ```ts
255
+ * builder.setGaugeAxisTick({ visible: true, length: 6 });
256
+ * ```
257
+ */
35
258
  setGaugeAxisTick(value: IChartGaugeAxisTickSpec): this;
259
+ /**
260
+ * Resets Gauge minor ticks to renderer defaults.
261
+ *
262
+ * @returns This builder for chaining.
263
+ * @example
264
+ * ```ts
265
+ * builder.resetGaugeAxisTick();
266
+ * ```
267
+ */
36
268
  resetGaugeAxisTick(): this;
269
+ /**
270
+ * Sets Gauge major division-line visibility and styling.
271
+ *
272
+ * @param value Gauge division-line settings.
273
+ * @returns This builder for chaining.
274
+ * @example
275
+ * ```ts
276
+ * builder.setGaugeSplitLine({ visible: true, length: 12 });
277
+ * ```
278
+ */
37
279
  setGaugeSplitLine(value: IChartGaugeSplitLineSpec): this;
280
+ /**
281
+ * Resets Gauge major division lines to renderer defaults.
282
+ *
283
+ * @returns This builder for chaining.
284
+ * @example
285
+ * ```ts
286
+ * builder.resetGaugeSplitLine();
287
+ * ```
288
+ */
38
289
  resetGaugeSplitLine(): this;
290
+ /**
291
+ * Sets Gauge scale-label visibility, formatting, and styling.
292
+ *
293
+ * @param value Gauge scale-label settings.
294
+ * @returns This builder for chaining.
295
+ * @example
296
+ * ```ts
297
+ * builder.setGaugeAxisLabel({ visible: true, color: '#334155' });
298
+ * ```
299
+ */
39
300
  setGaugeAxisLabel(value: DeepNullish<IChartGaugeAxisLabelSpec>): this;
301
+ /**
302
+ * Resets Gauge scale labels to renderer defaults.
303
+ *
304
+ * @returns This builder for chaining.
305
+ * @example
306
+ * ```ts
307
+ * builder.resetGaugeAxisLabel();
308
+ * ```
309
+ */
40
310
  resetGaugeAxisLabel(): this;
41
- /** Sets the pointer visibility, dimensions, color, and semantic shape preset. */
311
+ /**
312
+ * Sets the pointer visibility, dimensions, color, and semantic shape preset.
313
+ *
314
+ * @param value Gauge pointer settings.
315
+ * @returns This builder for chaining.
316
+ * @example
317
+ * ```ts
318
+ * builder.setGaugePointer({
319
+ * visible: true,
320
+ * shape: univerAPI.Enum.ChartGaugePointerShape.Needle,
321
+ * color: '#2563eb',
322
+ * });
323
+ * ```
324
+ */
42
325
  setGaugePointer(value: IChartGaugePointerSpec): this;
326
+ /**
327
+ * Resets the Gauge pointer to renderer defaults.
328
+ *
329
+ * @returns This builder for chaining.
330
+ * @example
331
+ * ```ts
332
+ * builder.resetGaugePointer();
333
+ * ```
334
+ */
43
335
  resetGaugePointer(): this;
336
+ /**
337
+ * Sets the center anchor rendered beneath the Gauge pointer.
338
+ *
339
+ * @param value Gauge anchor settings.
340
+ * @returns This builder for chaining.
341
+ * @example
342
+ * ```ts
343
+ * builder.setGaugeAnchor({ visible: true, size: 8 });
344
+ * ```
345
+ */
44
346
  setGaugeAnchor(value: IChartGaugeAnchorSpec): this;
347
+ /**
348
+ * Resets the Gauge center anchor to renderer defaults.
349
+ *
350
+ * @returns This builder for chaining.
351
+ * @example
352
+ * ```ts
353
+ * builder.resetGaugeAnchor();
354
+ * ```
355
+ */
45
356
  resetGaugeAnchor(): this;
357
+ /**
358
+ * Sets Gauge progress-arc visibility and styling.
359
+ *
360
+ * @param value Gauge progress-arc settings.
361
+ * @returns This builder for chaining.
362
+ * @example
363
+ * ```ts
364
+ * builder.setGaugeProgress({ visible: true, width: 12 });
365
+ * ```
366
+ */
46
367
  setGaugeProgress(value: IChartGaugeProgressSpec): this;
368
+ /**
369
+ * Resets Gauge progress-arc settings to renderer defaults.
370
+ *
371
+ * @returns This builder for chaining.
372
+ * @example
373
+ * ```ts
374
+ * builder.resetGaugeProgress();
375
+ * ```
376
+ */
47
377
  resetGaugeProgress(): this;
378
+ /**
379
+ * Sets the per-observation Gauge title styling and offset.
380
+ *
381
+ * @param value Gauge title settings.
382
+ * @returns This builder for chaining.
383
+ * @example
384
+ * ```ts
385
+ * builder.setGaugeTitle({ visible: true, color: '#334155' });
386
+ * ```
387
+ */
48
388
  setGaugeTitle(value: IChartGaugeTitleSpec): this;
389
+ /**
390
+ * Resets the Gauge title to renderer defaults.
391
+ *
392
+ * @returns This builder for chaining.
393
+ * @example
394
+ * ```ts
395
+ * builder.resetGaugeTitle();
396
+ * ```
397
+ */
49
398
  resetGaugeTitle(): this;
399
+ /**
400
+ * Sets the Gauge value-detail formatter, styling, and offset.
401
+ *
402
+ * @param value Gauge detail settings.
403
+ * @returns This builder for chaining.
404
+ * @example
405
+ * ```ts
406
+ * builder.setGaugeDetail({ visible: true, color: '#0f172a' });
407
+ * ```
408
+ */
50
409
  setGaugeDetail(value: DeepNullish<IChartGaugeDetailSpec>): this;
410
+ /**
411
+ * Resets the Gauge value detail to renderer defaults.
412
+ *
413
+ * @returns This builder for chaining.
414
+ * @example
415
+ * ```ts
416
+ * builder.resetGaugeDetail();
417
+ * ```
418
+ */
51
419
  resetGaugeDetail(): this;
52
420
  }