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

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 (175) 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 +17 -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 +17 -0
  76. package/lib/types/chart-builder/conversion/describe-chart-model.d.ts +0 -127
  77. package/lib/types/chart-builder/detached-chart-builder-adapter.d.ts +1 -10
  78. package/lib/types/chart-builder/internal/apply-pending-to-description.d.ts +2 -0
  79. package/lib/types/chart-builder/internal/chart-host-config-adapter.d.ts +3 -0
  80. package/lib/types/chart-builder/internal/chart-pending-patch.d.ts +11 -0
  81. package/lib/types/chart-builder/internal/patch-interpreter.d.ts +17 -0
  82. package/lib/types/facade/builders/f-area-chart-builder.d.ts +52 -7
  83. package/lib/types/facade/builders/f-boxplot-chart-builder.d.ts +88 -3
  84. package/lib/types/facade/builders/f-bubble-chart-builder.d.ts +59 -6
  85. package/lib/types/facade/builders/f-candlestick-chart-builder.d.ts +90 -31
  86. package/lib/types/facade/builders/f-chord-chart-builder.d.ts +180 -8
  87. package/lib/types/facade/builders/f-combination-chart-builder.d.ts +55 -10
  88. package/lib/types/facade/builders/f-funnel-chart-builder.d.ts +55 -9
  89. package/lib/types/facade/builders/f-gauge-chart-builder.d.ts +378 -10
  90. package/lib/types/facade/builders/f-heatmap-chart-builder.d.ts +83 -26
  91. package/lib/types/facade/builders/f-histogram-chart-builder.d.ts +142 -16
  92. package/lib/types/facade/builders/f-line-chart-builder.d.ts +51 -6
  93. package/lib/types/facade/builders/f-pareto-chart-builder.d.ts +83 -20
  94. package/lib/types/facade/builders/f-pie-chart-builder.d.ts +131 -47
  95. package/lib/types/facade/builders/f-radar-chart-builder.d.ts +64 -11
  96. package/lib/types/facade/builders/f-relation-chart-builder.d.ts +72 -38
  97. package/lib/types/facade/builders/f-scatter-chart-builder.d.ts +58 -6
  98. package/lib/types/facade/builders/f-sunburst-chart-builder.d.ts +122 -8
  99. package/lib/types/facade/builders/f-treemap-chart-builder.d.ts +115 -13
  100. package/lib/types/facade/builders/f-waterfall-chart-builder.d.ts +87 -53
  101. package/lib/types/facade/builders/f-word-cloud-chart-builder.d.ts +64 -15
  102. package/lib/types/facade/chart-builder-registry.d.ts +4 -4
  103. package/lib/types/facade/chart-builder-type-map.d.ts +35 -32
  104. package/lib/types/facade/chart-host-builder-types.d.ts +2 -21
  105. package/lib/types/facade/create-chart-builder.d.ts +46 -0
  106. package/lib/types/facade/f-axis-chart-builder.d.ts +21 -38
  107. package/lib/types/facade/f-cartesian-chart-builder.d.ts +32 -20
  108. package/lib/types/facade/f-chart-builder-base.d.ts +202 -73
  109. package/lib/types/facade/f-chart.d.ts +652 -0
  110. package/lib/types/facade/f-enum.d.ts +684 -31
  111. package/lib/types/facade/f-univer.d.ts +51 -0
  112. package/lib/types/facade/index.d.ts +7 -9
  113. package/lib/types/facade/internal/chart-builder-facade-context.d.ts +11 -10
  114. package/lib/types/index.d.ts +25 -15
  115. package/lib/types/models/chart-context/resolve-chart-context.d.ts +3 -0
  116. package/lib/types/models/chart-data/chart-field-consumption-validator.d.ts +1 -1
  117. package/lib/types/models/chart-host/config/chart-config-interpreter.d.ts +13 -0
  118. package/lib/types/models/chart-host/resource/chart-data-source-resolver.d.ts +58 -0
  119. package/lib/types/models/chart-host/resource/chart-resource-repository.d.ts +111 -0
  120. package/lib/types/models/chart-host/resource/chart-resource-serializer.d.ts +2 -1
  121. package/lib/types/models/chart-host/resource/inline-chart-table.d.ts +4 -3
  122. package/lib/types/models/chart-host/resource/persisted-chart-style.d.ts +3 -0
  123. package/lib/types/models/chart-host/resource/resource-ref-chart-data-source.adapter.d.ts +22 -0
  124. package/lib/types/models/chart-host/resource/resource-ref-chart-data-source.provider.d.ts +12 -0
  125. package/lib/types/models/chart-host/static/chart-model-store.d.ts +56 -0
  126. package/lib/types/models/chart-host/static/{static-chart-runtime.d.ts → chart-runtime.d.ts} +6 -5
  127. package/lib/types/models/chart-model/chart-model.d.ts +2 -383
  128. package/lib/types/models/chart-render/axes/chart-runtime-axes.d.ts +2 -2
  129. package/lib/types/models/chart-render/chart-render-input-resolver.d.ts +2 -2
  130. package/lib/types/models/chart-render/converter/converters/gauge-chart-converter.d.ts +5 -3
  131. package/lib/types/models/chart-render/converter/echart-text-overflow.d.ts +7 -0
  132. package/lib/types/models/chart-render/converter/render-spec-operators/grid-operator.d.ts +3 -3
  133. package/lib/types/models/chart-render/converter/render-spec-operators/legend-size.d.ts +1 -2
  134. package/lib/types/models/chart-render/converter/render-spec-operators/series-style-operator/series-style-operator.d.ts +2 -2
  135. package/lib/types/models/chart-render/converter/render-spec-operators/tool-tip-operator.d.ts +3 -13
  136. package/lib/types/models/chart-render/converter/render-spec-operators/tools.d.ts +4 -4
  137. package/lib/types/models/chart-render/converter/render-spec-operators/visual-map-operator.d.ts +4 -0
  138. package/lib/types/models/chart-render/echart-render-model.d.ts +7 -0
  139. package/lib/types/models/chart-render/edit-overlay/chart-element-edit-overlay.d.ts +1 -1
  140. package/lib/types/models/chart-render/edit-overlay/resolve-chart-element-hit-layout.d.ts +1 -1
  141. package/lib/types/models/chart-render/style/chart-runtime-style.d.ts +0 -1
  142. package/lib/types/models/common/constants/default-chart-style.d.ts +53 -53
  143. package/lib/types/models/common/constants/default.d.ts +3 -2
  144. package/lib/types/plugin.d.ts +1 -1
  145. package/lib/types/types.d.ts +2 -4
  146. package/lib/types/utils/compact.d.ts +6 -0
  147. package/lib/umd/facade.js +1 -1
  148. package/lib/umd/index.js +1 -1
  149. package/lib/umd/locale/ar-SA.js +1 -1
  150. package/lib/umd/locale/ca-ES.js +1 -1
  151. package/lib/umd/locale/de-DE.js +1 -1
  152. package/lib/umd/locale/en-US.js +1 -1
  153. package/lib/umd/locale/es-ES.js +1 -1
  154. package/lib/umd/locale/fa-IR.js +1 -1
  155. package/lib/umd/locale/fr-FR.js +1 -1
  156. package/lib/umd/locale/id-ID.js +1 -1
  157. package/lib/umd/locale/it-IT.js +1 -1
  158. package/lib/umd/locale/ja-JP.js +1 -1
  159. package/lib/umd/locale/ko-KR.js +1 -1
  160. package/lib/umd/locale/pl-PL.js +1 -1
  161. package/lib/umd/locale/pt-BR.js +1 -1
  162. package/lib/umd/locale/ru-RU.js +1 -1
  163. package/lib/umd/locale/sk-SK.js +1 -1
  164. package/lib/umd/locale/vi-VN.js +1 -1
  165. package/lib/umd/locale/zh-CN.js +1 -1
  166. package/lib/umd/locale/zh-HK.js +1 -1
  167. package/lib/umd/locale/zh-TW.js +1 -1
  168. package/package.json +6 -5
  169. package/lib/types/chart-builder/internal/host-builder-runtime.d.ts +0 -3
  170. package/lib/types/chart-builder/internal/merge-description.d.ts +0 -2
  171. package/lib/types/facade/f-chart-base.d.ts +0 -82
  172. package/lib/types/facade/f-charts-base.d.ts +0 -74
  173. package/lib/types/facade/internal/host-builder-composer.d.ts +0 -16
  174. package/lib/types/models/chart-host/resource/static-chart-resource-repository.d.ts +0 -75
  175. package/lib/types/models/chart-host/static/static-chart-model-store.d.ts +0 -43
@@ -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
  }
@@ -1,6 +1,82 @@
1
- import type { ChartVisualMapType, IChartHeatmapLabelSpec } from '@univerjs-pro/engine-chart';
1
+ import type { ChartVisualMapType, IChartHeatmapLabelSpec, IChartInfo } from '@univerjs-pro/engine-chart';
2
2
  import { FAxisChartBuilder } from '../f-axis-chart-builder';
3
- export declare class FHeatmapChartBuilder extends FAxisChartBuilder {
3
+ /**
4
+ * Fluent, type-specific Builder for Heatmap Charts.
5
+ *
6
+ * The data source is a matrix-shaped table expressed as one category field plus one or
7
+ * more numeric value fields. Category values become Y-axis rows, value-field headers
8
+ * become X-axis columns, and each aligned numeric observation becomes one cell.
9
+ *
10
+ * @example Sheet
11
+ * ```ts
12
+ * const fWorkbook = univerAPI.getActiveWorkbook();
13
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
14
+ * const chartInfo = fWorksheet
15
+ * .newChart(univerAPI.Enum.ChartTypeString.Heatmap)
16
+ * .setSource({
17
+ * range: 'A1:D8',
18
+ * orientation: univerAPI.Enum.ChartSourceOrientation.Columns,
19
+ * })
20
+ * .setCategoryField(0)
21
+ * .setValueFields([1, 2, 3])
22
+ * .setVisualMapType(univerAPI.Enum.ChartVisualMapType.Continuous)
23
+ * .setValueRange(0, 100)
24
+ * .setCellLabel({ visible: true, position: univerAPI.Enum.ChartSeriesLabelPosition.Inside })
25
+ * .setValueUnit('tickets')
26
+ * .build();
27
+ * await fWorksheet.insertChart(chartInfo);
28
+ * ```
29
+ *
30
+ * @example Doc
31
+ * ```ts
32
+ * const fDocument = univerAPI.getActiveDocument();
33
+ * const chartInfo = fDocument
34
+ * .newChart(univerAPI.Enum.ChartTypeString.Heatmap)
35
+ * .setSource([['Day', 'Morning', 'Evening'], ['Mon', 24, 62], ['Tue', 38, 81]])
36
+ * .setCategoryField(0)
37
+ * .setValueFields([1, 2])
38
+ * .setVisualMapType(univerAPI.Enum.ChartVisualMapType.Continuous)
39
+ * .setValueRange(0, 100)
40
+ * .setCellLabel({ visible: true, position: univerAPI.Enum.ChartSeriesLabelPosition.Inside })
41
+ * .setValueUnit('tickets')
42
+ * .build();
43
+ * await fDocument.insertChart(chartInfo);
44
+ * ```
45
+ *
46
+ * @example Slide
47
+ * ```ts
48
+ * const fPresentation = univerAPI.getActivePresentation();
49
+ * const fSlide = fPresentation.getSlideByIndex(0);
50
+ * const chartInfo = fSlide
51
+ * .newChart(univerAPI.Enum.ChartTypeString.Heatmap)
52
+ * .setSource([['Day', 'Morning', 'Evening'], ['Mon', 24, 62], ['Tue', 38, 81]])
53
+ * .setCategoryField(0)
54
+ * .setValueFields([1, 2])
55
+ * .setVisualMapType(univerAPI.Enum.ChartVisualMapType.Continuous)
56
+ * .setValueRange(0, 100)
57
+ * .setCellLabel({ visible: true, position: univerAPI.Enum.ChartSeriesLabelPosition.Inside })
58
+ * .setValueUnit('tickets')
59
+ * .build();
60
+ * await fSlide.insertChart(chartInfo);
61
+ * ```
62
+ *
63
+ * @example Board
64
+ * ```ts
65
+ * const fBoard = univerAPI.getActiveBoard();
66
+ * const chartInfo = fBoard
67
+ * .newChart(univerAPI.Enum.ChartTypeString.Heatmap)
68
+ * .setSource([['Day', 'Morning', 'Evening'], ['Mon', 24, 62], ['Tue', 38, 81]])
69
+ * .setCategoryField(0)
70
+ * .setValueFields([1, 2])
71
+ * .setVisualMapType(univerAPI.Enum.ChartVisualMapType.Continuous)
72
+ * .setValueRange(0, 100)
73
+ * .setCellLabel({ visible: true, position: univerAPI.Enum.ChartSeriesLabelPosition.Inside })
74
+ * .setValueUnit('tickets')
75
+ * .build();
76
+ * await fBoard.insertChart(chartInfo);
77
+ * ```
78
+ */
79
+ export declare class FHeatmapChartBuilder<TSource = never[], TDataSource = TSource, TInfo extends IChartInfo<TDataSource> = IChartInfo<TDataSource>> extends FAxisChartBuilder<TSource, TDataSource, TInfo> {
4
80
  /**
5
81
  * Sets the visual map type configuration and returns this builder for chaining.
6
82
  *
@@ -10,8 +86,6 @@ export declare class FHeatmapChartBuilder extends FAxisChartBuilder {
10
86
  * @returns This builder for chaining.
11
87
  * @example
12
88
  * ```ts
13
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
14
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Heatmap);
15
89
  * builder.setVisualMapType(univerAPI.Enum.ChartVisualMapType.Continuous);
16
90
  * ```
17
91
  */
@@ -24,8 +98,6 @@ export declare class FHeatmapChartBuilder extends FAxisChartBuilder {
24
98
  * @returns This builder for chaining.
25
99
  * @example
26
100
  * ```ts
27
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
28
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Heatmap);
29
101
  * builder.resetVisualMapType();
30
102
  * ```
31
103
  */
@@ -40,8 +112,6 @@ export declare class FHeatmapChartBuilder extends FAxisChartBuilder {
40
112
  * @returns This builder for chaining.
41
113
  * @example
42
114
  * ```ts
43
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
44
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Heatmap);
45
115
  * builder.setValueRange(0, 100);
46
116
  * ```
47
117
  */
@@ -54,8 +124,6 @@ export declare class FHeatmapChartBuilder extends FAxisChartBuilder {
54
124
  * @returns This builder for chaining.
55
125
  * @example
56
126
  * ```ts
57
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
58
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Heatmap);
59
127
  * builder.clearValueRange();
60
128
  * ```
61
129
  */
@@ -70,14 +138,11 @@ export declare class FHeatmapChartBuilder extends FAxisChartBuilder {
70
138
  * @returns This builder for chaining.
71
139
  * @example
72
140
  * ```ts
73
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
74
- * worksheet.charts.registerTheme('support-demand', { color: ['#eff6ff', '#1d4ed8'] });
75
- * const builder = worksheet.charts.create()
76
- * .setType(univerAPI.Enum.ChartTypeString.Heatmap)
77
- * .setTheme('support-demand')
141
+ * builder
142
+ * .setPalette(['#eff6ff', '#1d4ed8'])
78
143
  * .setValueRange(0, 80)
79
144
  * .setValueUnit('tickets')
80
- * .setCellLabel({ visible: true, position: univerAPI.Enum.SeriesLabelPosition.Inside });
145
+ * .setCellLabel({ visible: true, position: univerAPI.Enum.ChartSeriesLabelPosition.Inside });
81
146
  * ```
82
147
  */
83
148
  setCellLabel(value: IChartHeatmapLabelSpec): this;
@@ -88,8 +153,6 @@ export declare class FHeatmapChartBuilder extends FAxisChartBuilder {
88
153
  * @returns This builder for chaining.
89
154
  * @example
90
155
  * ```ts
91
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
92
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Heatmap);
93
156
  * builder.clearCellLabel();
94
157
  * ```
95
158
  */
@@ -101,10 +164,7 @@ export declare class FHeatmapChartBuilder extends FAxisChartBuilder {
101
164
  * @returns This builder for chaining.
102
165
  * @example
103
166
  * ```ts
104
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
105
- * worksheet.charts.create()
106
- * .setType(univerAPI.Enum.ChartTypeString.Heatmap)
107
- * .setValueUnit('tickets');
167
+ * builder.setValueUnit('tickets');
108
168
  * ```
109
169
  */
110
170
  setValueUnit(value: string): this;
@@ -114,10 +174,7 @@ export declare class FHeatmapChartBuilder extends FAxisChartBuilder {
114
174
  * @returns This builder for chaining.
115
175
  * @example
116
176
  * ```ts
117
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
118
- * worksheet.charts.create()
119
- * .setType(univerAPI.Enum.ChartTypeString.Heatmap)
120
- * .clearValueUnit();
177
+ * builder.clearValueUnit();
121
178
  * ```
122
179
  */
123
180
  clearValueUnit(): this;