@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,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;
@@ -1,27 +1,97 @@
1
+ import type { IChartInfo, IChartSeriesPatch, IChartSeriesStyleSpec } from '@univerjs-pro/engine-chart';
1
2
  import { FCartesianChartBuilder } from '../f-cartesian-chart-builder';
2
3
  /**
3
4
  * Fluent builder for a one-field raw-sample Histogram.
4
5
  *
6
+ * Select exactly one numeric field containing individual observations. The renderer
7
+ * computes bins from those raw samples; do not pass pre-binned ranges or frequencies.
8
+ *
5
9
  * Histogram settings are persisted as authored. Rendering uses Scott Auto when explicit
6
10
  * binning is ineffective, never emits more than 1000 visible bins, and falls back to a
7
11
  * zero visual gap for ineffective gap values.
8
12
  *
9
- * @example
10
- * const chart = worksheet.charts.create()
11
- * .setType(univerAPI.Enum.ChartTypeString.Histogram)
13
+ * @example Sheet
14
+ * ```ts
15
+ * const fWorkbook = univerAPI.getActiveWorkbook();
16
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
17
+ * const chartInfo = fWorksheet
18
+ * .newChart(univerAPI.Enum.ChartTypeString.Histogram)
19
+ * .setSource('A1:A100')
20
+ * .setHistogramField(0)
21
+ * .setBinCount(12)
22
+ * .setUnderflowThreshold(0)
23
+ * .setOverflowThreshold(100)
24
+ * .setBinGap(0.1)
25
+ * .build();
26
+ * await fWorksheet.insertChart(chartInfo);
27
+ * ```
28
+ *
29
+ * @example Doc
30
+ * ```ts
31
+ * const fDocument = univerAPI.getActiveDocument();
32
+ * const chartInfo = fDocument
33
+ * .newChart(univerAPI.Enum.ChartTypeString.Histogram)
34
+ * .setSource([['Duration'], [12], [18], [19], [25], [31], [35]])
35
+ * .setHistogramField(0)
36
+ * .setBinCount(12)
37
+ * .setUnderflowThreshold(0)
38
+ * .setOverflowThreshold(100)
39
+ * .setBinGap(0.1)
40
+ * .build();
41
+ * await fDocument.insertChart(chartInfo);
42
+ * ```
43
+ *
44
+ * @example Slide
45
+ * ```ts
46
+ * const fPresentation = univerAPI.getActivePresentation();
47
+ * const fSlide = fPresentation.getSlideByIndex(0);
48
+ * const chartInfo = fSlide
49
+ * .newChart(univerAPI.Enum.ChartTypeString.Histogram)
50
+ * .setSource([['Duration'], [12], [18], [19], [25], [31], [35]])
12
51
  * .setHistogramField(0)
13
52
  * .setBinCount(12)
14
- * .setBinGap(0.1);
53
+ * .setUnderflowThreshold(0)
54
+ * .setOverflowThreshold(100)
55
+ * .setBinGap(0.1)
56
+ * .build();
57
+ * await fSlide.insertChart(chartInfo);
58
+ * ```
59
+ *
60
+ * @example Board
61
+ * ```ts
62
+ * const fBoard = univerAPI.getActiveBoard();
63
+ * const chartInfo = fBoard
64
+ * .newChart(univerAPI.Enum.ChartTypeString.Histogram)
65
+ * .setSource([['Duration'], [12], [18], [19], [25], [31], [35]])
66
+ * .setHistogramField(0)
67
+ * .setBinCount(12)
68
+ * .setUnderflowThreshold(0)
69
+ * .setOverflowThreshold(100)
70
+ * .setBinGap(0.1)
71
+ * .build();
72
+ * await fBoard.insertChart(chartInfo);
73
+ * ```
15
74
  */
16
- export declare class FHistogramChartBuilder extends FCartesianChartBuilder {
75
+ export declare class FHistogramChartBuilder<TSource = never[], TDataSource = TSource, TInfo extends IChartInfo<TDataSource> = IChartInfo<TDataSource>> extends FCartesianChartBuilder<Omit<IChartSeriesPatch, 'selector'>, IChartSeriesStyleSpec, TSource, TDataSource, TInfo> {
17
76
  /**
18
77
  * Selects the only active Histogram value field by zero-based source index.
19
- * @example `builder.setHistogramField(2)`
78
+ *
79
+ * @param index Zero-based source field index.
80
+ * @returns This builder for chaining.
81
+ * @example
82
+ * ```ts
83
+ * builder.setHistogramField(2);
84
+ * ```
20
85
  */
21
86
  setHistogramField(index: number): this;
22
87
  /**
23
88
  * Clears the active Histogram value field.
24
- * @example `builder.clearHistogramField()`
89
+ *
90
+ * @returns This builder for chaining.
91
+ * @example
92
+ * ```ts
93
+ * builder.clearHistogramField();
94
+ * ```
25
95
  */
26
96
  clearHistogramField(): this;
27
97
  /**
@@ -29,46 +99,102 @@ export declare class FHistogramChartBuilder extends FCartesianChartBuilder {
29
99
  * when enabled edge bins still leave room for a regular bin. Other finite values remain
30
100
  * persisted and visible through `describe()` but render with Scott Auto. Non-finite calls
31
101
  * produce no Pending change.
32
- * @example `builder.setBinCount(20)`
102
+ *
103
+ * @param count Total visible-bin count.
104
+ * @returns This builder for chaining.
105
+ * @example
106
+ * ```ts
107
+ * builder.setBinCount(20);
108
+ * ```
33
109
  */
34
110
  setBinCount(count: number): this;
35
111
  /**
36
112
  * Stores an explicit width. A positive finite width is effective only when the current
37
113
  * range produces at most 1000 visible bins; otherwise rendering uses Scott Auto without
38
114
  * rewriting the stored value. Non-finite calls produce no Pending change.
39
- * @example `builder.setBinWidth(2.5)`
115
+ *
116
+ * @param width Bin width in source-value units.
117
+ * @returns This builder for chaining.
118
+ * @example
119
+ * ```ts
120
+ * builder.setBinWidth(2.5);
121
+ * ```
40
122
  */
41
123
  setBinWidth(width: number): this;
42
124
  /**
43
125
  * Removes explicit binning and restores runtime-only Scott Auto.
44
- * @example `builder.resetBinning()`
126
+ *
127
+ * @returns This builder for chaining.
128
+ * @example
129
+ * ```ts
130
+ * builder.resetBinning();
131
+ * ```
45
132
  */
46
133
  resetBinning(): this;
47
134
  /**
48
135
  * Enables the inclusive `x <= threshold` Underflow bin. If both thresholds are present,
49
136
  * they are effective only when Underflow is less than Overflow. Non-finite calls are no-op.
50
- * @example `builder.setUnderflowThreshold(0)`
137
+ *
138
+ * @param value Inclusive Underflow threshold.
139
+ * @returns This builder for chaining.
140
+ * @example
141
+ * ```ts
142
+ * builder.setUnderflowThreshold(0);
143
+ * ```
51
144
  */
52
145
  setUnderflowThreshold(value: number): this;
53
- /** Disables Underflow. @example `builder.clearUnderflowThreshold()` */
146
+ /**
147
+ * Disables Underflow.
148
+ *
149
+ * @returns This builder for chaining.
150
+ * @example
151
+ * ```ts
152
+ * builder.clearUnderflowThreshold();
153
+ * ```
154
+ */
54
155
  clearUnderflowThreshold(): this;
55
156
  /**
56
157
  * Enables the exclusive `x > threshold` Overflow bin. An ineffective finite threshold
57
158
  * pair remains persisted but both thresholds are ignored for rendering. Non-finite calls are no-op.
58
- * @example `builder.setOverflowThreshold(100)`
159
+ *
160
+ * @param value Exclusive Overflow threshold.
161
+ * @returns This builder for chaining.
162
+ * @example
163
+ * ```ts
164
+ * builder.setOverflowThreshold(100);
165
+ * ```
59
166
  */
60
167
  setOverflowThreshold(value: number): this;
61
- /** Disables Overflow. @example `builder.clearOverflowThreshold()` */
168
+ /**
169
+ * Disables Overflow.
170
+ *
171
+ * @returns This builder for chaining.
172
+ * @example
173
+ * ```ts
174
+ * builder.clearOverflowThreshold();
175
+ * ```
176
+ */
62
177
  clearOverflowThreshold(): this;
63
178
  /**
64
179
  * Stores the visual gap ratio. Values from 0 through 0.9 are effective; other finite values
65
180
  * remain persisted but render with the 0.007-gap default. Non-finite calls are no-op.
66
- * @example `builder.setBinGap(0.15)`
181
+ *
182
+ * @param value Gap ratio between adjacent bins.
183
+ * @returns This builder for chaining.
184
+ * @example
185
+ * ```ts
186
+ * builder.setBinGap(0.15);
187
+ * ```
67
188
  */
68
189
  setBinGap(value: number): this;
69
190
  /**
70
191
  * Removes the explicit gap and restores the 0.007 runtime default.
71
- * @example `builder.resetBinGap()`
192
+ *
193
+ * @returns This builder for chaining.
194
+ * @example
195
+ * ```ts
196
+ * builder.resetBinGap();
197
+ * ```
72
198
  */
73
199
  resetBinGap(): this;
74
200
  }
@@ -1,6 +1,55 @@
1
- import type { IChartLineSeriesPatch, IChartSeriesBorderSpec } from '@univerjs-pro/engine-chart';
1
+ import type { IChartInfo, IChartLineSeriesPatch, IChartSeriesBorderSpec, IChartSeriesStyleSpec } from '@univerjs-pro/engine-chart';
2
2
  import { FCartesianChartBuilder } from '../f-cartesian-chart-builder';
3
- export declare class FLineChartBuilder extends FCartesianChartBuilder<Omit<IChartLineSeriesPatch, 'selector'>> {
3
+ /**
4
+ * Fluent, type-specific Builder for Line 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.Line)
12
+ * .setSource('A1:D8')
13
+ * .setLineStyle({ width: 2 })
14
+ * .build();
15
+ * await fWorksheet.insertChart(chartInfo);
16
+ * ```
17
+ *
18
+ * @example Doc
19
+ * ```ts
20
+ * const fDocument = univerAPI.getActiveDocument();
21
+ * const chartInfo = fDocument
22
+ * .newChart(univerAPI.Enum.ChartTypeString.Line)
23
+ * .setSource([['Month', 'Sales'], ['Jan', 120], ['Feb', 180]])
24
+ * .setLineStyle({ width: 2 })
25
+ * .build();
26
+ * await fDocument.insertChart(chartInfo);
27
+ * ```
28
+ *
29
+ * @example Slide
30
+ * ```ts
31
+ * const fPresentation = univerAPI.getActivePresentation();
32
+ * const fSlide = fPresentation.getSlideByIndex(0);
33
+ * const chartInfo = fSlide
34
+ * .newChart(univerAPI.Enum.ChartTypeString.Line)
35
+ * .setSource([['Month', 'Sales'], ['Jan', 120], ['Feb', 180]])
36
+ * .setLineStyle({ width: 2 })
37
+ * .build();
38
+ * await fSlide.insertChart(chartInfo);
39
+ * ```
40
+ *
41
+ * @example Board
42
+ * ```ts
43
+ * const fBoard = univerAPI.getActiveBoard();
44
+ * const chartInfo = fBoard
45
+ * .newChart(univerAPI.Enum.ChartTypeString.Line)
46
+ * .setSource([['Month', 'Sales'], ['Jan', 120], ['Feb', 180]])
47
+ * .setLineStyle({ width: 2 })
48
+ * .build();
49
+ * await fBoard.insertChart(chartInfo);
50
+ * ```
51
+ */
52
+ export declare class FLineChartBuilder<TSource = never[], TDataSource = TSource, TInfo extends IChartInfo<TDataSource> = IChartInfo<TDataSource>> extends FCartesianChartBuilder<Omit<IChartLineSeriesPatch, 'selector'>, IChartSeriesStyleSpec, TSource, TDataSource, TInfo> {
4
53
  /**
5
54
  * Sets the line style configuration and returns this builder for chaining.
6
55
  *
@@ -13,8 +62,6 @@ export declare class FLineChartBuilder extends FCartesianChartBuilder<Omit<IChar
13
62
  * @returns This builder for chaining.
14
63
  * @example
15
64
  * ```ts
16
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
17
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Line);
18
65
  * builder.setLineStyle({ width: 2, color: '#1677ff' });
19
66
  * ```
20
67
  */
@@ -27,8 +74,6 @@ export declare class FLineChartBuilder extends FCartesianChartBuilder<Omit<IChar
27
74
  * @returns This builder for chaining.
28
75
  * @example
29
76
  * ```ts
30
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
31
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Line);
32
77
  * builder.clearLineStyle();
33
78
  * ```
34
79
  */
@@ -1,6 +1,81 @@
1
- import type { IChartParetoBarStyleSpec, IChartParetoLineStyleSpec } from '@univerjs-pro/engine-chart';
1
+ import type { IChartInfo, IChartParetoBarStyleSpec, IChartParetoLineStyleSpec, IChartSeriesPatch, IChartSeriesStyleSpec } from '@univerjs-pro/engine-chart';
2
2
  import { FCartesianChartBuilder } from '../f-cartesian-chart-builder';
3
- export declare class FParetoChartBuilder extends FCartesianChartBuilder {
3
+ /**
4
+ * Fluent, type-specific Builder for Pareto Charts.
5
+ *
6
+ * Select one category field with `setCategoryField()` and one numeric value field with
7
+ * `setValueFields([index])`. Field indexes are zero-based in the normalized data source.
8
+ * Explicit mapping is necessary when the source shape is ambiguous, such as a Sheet range
9
+ * containing only numeric values; without both roles, the Chart has no renderable series.
10
+ *
11
+ * Rows with the same category are aggregated. By default, zero and negative totals are
12
+ * excluded, the remaining categories are sorted from largest to smallest, and the renderer
13
+ * derives the cumulative-percentage line from the selected value field. Use
14
+ * `setIncludeZeroValues(true)` to retain zero totals; negative totals remain excluded.
15
+ *
16
+ * @example Sheet
17
+ * ```ts
18
+ * const fWorkbook = univerAPI.getActiveWorkbook();
19
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
20
+ * const chartInfo = fWorksheet
21
+ * .newChart(univerAPI.Enum.ChartTypeString.Pareto)
22
+ * .setSource('A1:B8')
23
+ * .setCategoryField(0)
24
+ * .setValueFields([1])
25
+ * .setBarStyle({ color: '#2563eb', opacity: 0.8 })
26
+ * .setCumulativeLineStyle({ color: '#dc2626', width: 2 })
27
+ * .setIncludeZeroValues(false)
28
+ * .build();
29
+ * await fWorksheet.insertChart(chartInfo);
30
+ * ```
31
+ *
32
+ * @example Doc
33
+ * ```ts
34
+ * const fDocument = univerAPI.getActiveDocument();
35
+ * const chartInfo = fDocument
36
+ * .newChart(univerAPI.Enum.ChartTypeString.Pareto)
37
+ * .setSource([['Cause', 'Count'], ['A', 42], ['B', 28], ['C', 15]])
38
+ * .setCategoryField(0)
39
+ * .setValueFields([1])
40
+ * .setBarStyle({ color: '#2563eb', opacity: 0.8 })
41
+ * .setCumulativeLineStyle({ color: '#dc2626', width: 2 })
42
+ * .setIncludeZeroValues(false)
43
+ * .build();
44
+ * await fDocument.insertChart(chartInfo);
45
+ * ```
46
+ *
47
+ * @example Slide
48
+ * ```ts
49
+ * const fPresentation = univerAPI.getActivePresentation();
50
+ * const fSlide = fPresentation.getSlideByIndex(0);
51
+ * const chartInfo = fSlide
52
+ * .newChart(univerAPI.Enum.ChartTypeString.Pareto)
53
+ * .setSource([['Cause', 'Count'], ['A', 42], ['B', 28], ['C', 15]])
54
+ * .setCategoryField(0)
55
+ * .setValueFields([1])
56
+ * .setBarStyle({ color: '#2563eb', opacity: 0.8 })
57
+ * .setCumulativeLineStyle({ color: '#dc2626', width: 2 })
58
+ * .setIncludeZeroValues(false)
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.Pareto)
68
+ * .setSource([['Cause', 'Count'], ['A', 42], ['B', 28], ['C', 15]])
69
+ * .setCategoryField(0)
70
+ * .setValueFields([1])
71
+ * .setBarStyle({ color: '#2563eb', opacity: 0.8 })
72
+ * .setCumulativeLineStyle({ color: '#dc2626', width: 2 })
73
+ * .setIncludeZeroValues(false)
74
+ * .build();
75
+ * await fBoard.insertChart(chartInfo);
76
+ * ```
77
+ */
78
+ export declare class FParetoChartBuilder<TSource = never[], TDataSource = TSource, TInfo extends IChartInfo<TDataSource> = IChartInfo<TDataSource>> extends FCartesianChartBuilder<Omit<IChartSeriesPatch, 'selector'>, IChartSeriesStyleSpec, TSource, TDataSource, TInfo> {
4
79
  /**
5
80
  * Deep-merges supported Pareto bar appearance.
6
81
  *
@@ -9,16 +84,14 @@ export declare class FParetoChartBuilder extends FCartesianChartBuilder {
9
84
  *
10
85
  * This method executes synchronously.
11
86
  *
12
- * Read the current value from `builder.describe().pareto?.barStyle`.
87
+ * Read the current value from `builder.build().config.pareto?.barStyle`.
13
88
  *
14
89
  * @param value Supported bar appearance fields.
15
90
  * @returns This builder for chaining.
16
91
  * @example
17
92
  * ```ts
18
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
19
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Pareto);
20
93
  * builder.setBarStyle({ color: '#1677ff', opacity: 0.8 });
21
- * const barStyle = builder.describe().pareto?.barStyle;
94
+ * const barStyle = builder.build().config.pareto?.barStyle;
22
95
  * ```
23
96
  */
24
97
  setBarStyle(value: IChartParetoBarStyleSpec): this;
@@ -33,10 +106,8 @@ export declare class FParetoChartBuilder extends FCartesianChartBuilder {
33
106
  * @returns This builder for chaining.
34
107
  * @example
35
108
  * ```ts
36
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
37
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Pareto);
38
109
  * builder.clearBarStyle();
39
- * const barStyle = builder.describe().pareto?.barStyle;
110
+ * const barStyle = builder.build().config.pareto?.barStyle;
40
111
  * ```
41
112
  */
42
113
  clearBarStyle(): this;
@@ -49,16 +120,14 @@ export declare class FParetoChartBuilder extends FCartesianChartBuilder {
49
120
  * This method executes synchronously.
50
121
  *
51
122
  * Non-positive widths are ignored because the cumulative line remains part of Pareto.
52
- * Read the current value from `builder.describe().pareto?.cumulativeLineStyle`.
123
+ * Read the current value from `builder.build().config.pareto?.cumulativeLineStyle`.
53
124
  *
54
125
  * @param value Supported cumulative-line appearance fields.
55
126
  * @returns This builder for chaining.
56
127
  * @example
57
128
  * ```ts
58
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
59
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Pareto);
60
129
  * builder.setCumulativeLineStyle({ color: '#f5222d', width: 2 });
61
- * const lineStyle = builder.describe().pareto?.cumulativeLineStyle;
130
+ * const lineStyle = builder.build().config.pareto?.cumulativeLineStyle;
62
131
  * ```
63
132
  */
64
133
  setCumulativeLineStyle(value: IChartParetoLineStyleSpec): this;
@@ -73,10 +142,8 @@ export declare class FParetoChartBuilder extends FCartesianChartBuilder {
73
142
  * @returns This builder for chaining.
74
143
  * @example
75
144
  * ```ts
76
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
77
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Pareto);
78
145
  * builder.clearCumulativeLineStyle();
79
- * const lineStyle = builder.describe().pareto?.cumulativeLineStyle;
146
+ * const lineStyle = builder.build().config.pareto?.cumulativeLineStyle;
80
147
  * ```
81
148
  */
82
149
  clearCumulativeLineStyle(): this;
@@ -89,8 +156,6 @@ export declare class FParetoChartBuilder extends FCartesianChartBuilder {
89
156
  * @returns This builder for chaining.
90
157
  * @example
91
158
  * ```ts
92
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
93
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Pareto);
94
159
  * builder.setIncludeZeroValues(true);
95
160
  * ```
96
161
  */
@@ -103,8 +168,6 @@ export declare class FParetoChartBuilder extends FCartesianChartBuilder {
103
168
  * @returns This builder for chaining.
104
169
  * @example
105
170
  * ```ts
106
- * const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
107
- * const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Pareto);
108
171
  * builder.resetIncludeZeroValues();
109
172
  * ```
110
173
  */