@univerjs-pro/engine-chart 1.0.0-alpha.6 → 1.0.0-alpha.8

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 (93) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/es/facade.js +1 -1
  4. package/lib/es/index.js +1 -1
  5. package/lib/facade.js +1 -1
  6. package/lib/index.js +1 -1
  7. package/lib/types/chart-builder/candlestick-inline-table.d.ts +4 -0
  8. package/lib/types/chart-builder/chart-builder-adapter.d.ts +3 -3
  9. package/lib/types/chart-builder/chart-builder.d.ts +3 -3
  10. package/lib/types/chart-builder/chart-color.d.ts +49 -0
  11. package/lib/types/chart-builder/chart-starter-data.d.ts +3 -0
  12. package/lib/types/chart-builder/chart-types.d.ts +109 -68
  13. package/lib/types/chart-builder/configuration/assertions.d.ts +3 -0
  14. package/lib/types/chart-builder/configuration/auto-gradient-fill.d.ts +4 -0
  15. package/lib/types/chart-builder/configuration/candlestick.d.ts +9 -0
  16. package/lib/types/chart-builder/configuration/chart-config-operation.d.ts +4 -0
  17. package/lib/types/chart-builder/configuration/histogram.d.ts +11 -0
  18. package/lib/types/chart-builder/configuration/index.d.ts +5 -0
  19. package/lib/types/chart-builder/configuration/pie.d.ts +5 -1
  20. package/lib/types/chart-builder/configuration/point-mapping.d.ts +3 -0
  21. package/lib/types/chart-builder/configuration/treemap.d.ts +8 -0
  22. package/lib/types/chart-builder/conversion/chart-config-converter.d.ts +8 -3
  23. package/lib/types/chart-builder/conversion/chart-context-patch.d.ts +5 -0
  24. package/lib/types/chart-builder/conversion/chart-model-fields.d.ts +6 -0
  25. package/lib/types/chart-builder/conversion/resolve-chart-model-data.d.ts +3 -3
  26. package/lib/types/chart-builder/index.d.ts +5 -0
  27. package/lib/types/chart-builder/internal/host-builder-runtime.d.ts +0 -2
  28. package/lib/types/chart-text-measure-canvas.d.ts +6 -0
  29. package/lib/types/enum.d.ts +34 -1
  30. package/lib/types/facade/builders/f-area-chart-builder.d.ts +2 -2
  31. package/lib/types/facade/builders/f-boxplot-chart-builder.d.ts +5 -0
  32. package/lib/types/facade/builders/f-bubble-chart-builder.d.ts +2 -2
  33. package/lib/types/facade/builders/f-candlestick-chart-builder.d.ts +133 -0
  34. package/lib/types/facade/builders/f-histogram-chart-builder.d.ts +74 -0
  35. package/lib/types/facade/builders/f-line-chart-builder.d.ts +2 -2
  36. package/lib/types/facade/builders/f-pie-chart-builder.d.ts +42 -1
  37. package/lib/types/facade/builders/f-relation-chart-builder.d.ts +38 -0
  38. package/lib/types/facade/builders/f-scatter-chart-builder.d.ts +2 -2
  39. package/lib/types/facade/builders/f-treemap-chart-builder.d.ts +34 -0
  40. package/lib/types/facade/builders/index.d.ts +4 -0
  41. package/lib/types/facade/chart-builder-type-map.d.ts +5 -2
  42. package/lib/types/facade/f-cartesian-chart-builder.d.ts +14 -4
  43. package/lib/types/facade/f-chart-base.d.ts +2 -2
  44. package/lib/types/facade/f-chart-builder-base.d.ts +31 -0
  45. package/lib/types/index.d.ts +10 -9
  46. package/lib/types/models/chart-data-operators/histogram-data.d.ts +10 -0
  47. package/lib/types/models/chart-data-operators/index.d.ts +1 -0
  48. package/lib/types/models/chart-data-operators/operators.d.ts +7 -1
  49. package/lib/types/models/chart-data-operators/treemap-data.d.ts +3 -0
  50. package/lib/types/models/chart-element-edit-overlay/chart-element-edit-overlay.d.ts +2 -1
  51. package/lib/types/models/chart-locale-texts.d.ts +15 -1
  52. package/lib/types/models/chart-model.d.ts +368 -164
  53. package/lib/types/models/constants/default-chart-style.d.ts +45 -0
  54. package/lib/types/models/constants/histogram-defaults.d.ts +4 -0
  55. package/lib/types/models/constants/treemap.d.ts +1 -0
  56. package/lib/types/models/data-context-transformers/candlestick-data-context-transformer.d.ts +4 -0
  57. package/lib/types/models/data-context-transformers/histogram-data-context-transformer.d.ts +7 -0
  58. package/lib/types/models/data-context-transformers/treemap-data-context-transformer.d.ts +11 -0
  59. package/lib/types/models/echart-render-model.d.ts +10 -7
  60. package/lib/types/models/echart-to-chart-model-init.d.ts +2 -1
  61. package/lib/types/models/mode-converter/converters/boxplot-chart-converter.d.ts +3 -2
  62. package/lib/types/models/mode-converter/converters/bubble-chart-converter.d.ts +3 -2
  63. package/lib/types/models/mode-converter/converters/candlestick-chart-converter.d.ts +5 -0
  64. package/lib/types/models/mode-converter/converters/combination-chart-converter.d.ts +3 -2
  65. package/lib/types/models/mode-converter/converters/funnel-chart-converter.d.ts +3 -2
  66. package/lib/types/models/mode-converter/converters/heatmap-chart-convert.d.ts +3 -2
  67. package/lib/types/models/mode-converter/converters/histogram-chart-converter.d.ts +4 -0
  68. package/lib/types/models/mode-converter/converters/pareto-chart-converter.d.ts +3 -2
  69. package/lib/types/models/mode-converter/converters/pie-chart-converter.d.ts +3 -2
  70. package/lib/types/models/mode-converter/converters/radar-chart-converter.d.ts +3 -2
  71. package/lib/types/models/mode-converter/converters/relation-chart-converter.d.ts +3 -2
  72. package/lib/types/models/mode-converter/converters/sankey-chart-converter.d.ts +3 -2
  73. package/lib/types/models/mode-converter/converters/scatter-chart-converter.d.ts +3 -2
  74. package/lib/types/models/mode-converter/converters/treemap-chart-converter.d.ts +4 -0
  75. package/lib/types/models/mode-converter/converters/waterfall-chart-converter.d.ts +3 -2
  76. package/lib/types/models/mode-converter/converters/word-cloud-converter.d.ts +3 -2
  77. package/lib/types/models/mode-converter/render-spec-operators/auto-gradient-presets.d.ts +5 -0
  78. package/lib/types/models/mode-converter/render-spec-operators/chart-color.d.ts +23 -0
  79. package/lib/types/models/mode-converter/render-spec-operators/rich-text-inheritance.operator.d.ts +2 -0
  80. package/lib/types/models/mode-converter/render-spec-operators/tool-tip-operator.d.ts +8 -2
  81. package/lib/types/models/mode-converter/render-spec-operators/tools.d.ts +3 -2
  82. package/lib/types/types.d.ts +147 -13
  83. package/lib/types/util.d.ts +1 -7
  84. package/lib/types/wordcloud-chart/canvas.d.ts +3 -3
  85. package/lib/types/wordcloud-chart/core/layout/word-shrink.d.ts +5 -8
  86. package/lib/types/wordcloud-chart/core/text/formatter.d.ts +2 -2
  87. package/lib/types/wordcloud-chart/core/text/normalize.d.ts +2 -2
  88. package/lib/types/wordcloud-chart/defaults.d.ts +2 -2
  89. package/lib/types/wordcloud-chart/index.d.ts +1 -1
  90. package/lib/types/wordcloud-chart/types.d.ts +0 -3
  91. package/lib/umd/facade.js +1 -1
  92. package/lib/umd/index.js +1 -1
  93. package/package.json +5 -5
@@ -0,0 +1,4 @@
1
+ import { ChartTypeBits } from '../enum';
2
+ export declare const CANDLESTICK_INLINE_COLUMN_COUNT = 5;
3
+ /** Enforces the fixed Category/Open/High/Low/Close inline-host contract. */
4
+ export declare function normalizeCandlestickInlineTable<T>(chartType: ChartTypeBits, values: T[][]): T[][] | undefined;
@@ -1,5 +1,5 @@
1
- import type { IChartRenderModelImageExportOptions, IChartRenderModelImageExportResult, IUniverDataSet } from '../types';
2
- import type { ChartPendingConfig, IChartDescription, IResolvedChartData } from './chart-types';
1
+ import type { IChartData, IChartRenderModelImageExportOptions, IChartRenderModelImageExportResult, IUniverDataSet } from '../types';
2
+ import type { ChartPendingConfig, IChartDescription } from './chart-types';
3
3
  /** Host-owned persistence and rendering capabilities used by a chart builder. */
4
4
  export interface IChartBuilderAdapter<THostDescription extends object = object> {
5
5
  /** Reads the canonical host description, optionally evaluating pending config against an alternate data set without persisting either. */
@@ -7,7 +7,7 @@ export interface IChartBuilderAdapter<THostDescription extends object = object>
7
7
  /** Persists one pending semantic configuration patch. */
8
8
  commit(config: ChartPendingConfig): void;
9
9
  /** Materializes fresh engine semantic data for the effective pending state without mutating the host. */
10
- resolveData(config: ChartPendingConfig): IResolvedChartData;
10
+ resolveData(config: ChartPendingConfig): IChartData;
11
11
  /** Renders the hosted chart as an image when rendering is available. */
12
12
  exportImage(options?: IChartRenderModelImageExportOptions): Promise<IChartRenderModelImageExportResult | null>;
13
13
  }
@@ -1,8 +1,8 @@
1
1
  import type { DeepReadonly } from '@univerjs/core';
2
2
  import type { IChartBuilderAdapter } from './chart-builder-adapter';
3
- import type { ChartPendingConfig, IChartDescription, IResolvedChartData } from './chart-types';
3
+ import type { IChartData, IUniverDataSet } from '../types';
4
+ import type { ChartPendingConfig, IChartDescription } from './chart-types';
4
5
  import type { IChartConfigOperation } from './configuration/chart-config-operation';
5
- import type { IUniverDataSet } from '../types';
6
6
  import { ChartTypeString } from './chart-types';
7
7
  /** Maintains an immutable chart baseline plus pending semantic configuration changes. */
8
8
  export declare class ChartBuilder<THostDescription extends object = object> {
@@ -23,7 +23,7 @@ export declare class ChartBuilder<THostDescription extends object = object> {
23
23
  /** Returns a frozen description composed from the baseline and pending state. */
24
24
  describe(): DeepReadonly<IChartDescription & THostDescription>;
25
25
  /** Materializes a fresh deeply read-only engine data result for this hosted builder. */
26
- resolveData(): DeepReadonly<IResolvedChartData>;
26
+ resolveData(): DeepReadonly<IChartData>;
27
27
  /** Persists pending changes through the host adapter and refreshes the baseline. */
28
28
  commit(): void;
29
29
  protected refreshBaseline(): void;
@@ -0,0 +1,49 @@
1
+ /** Stable discriminator used by serializable linear-gradient chart colors. */
2
+ export declare const CHART_LINEAR_GRADIENT_TYPE: "linear-gradient";
3
+ /** A mark-local normalized coordinate used by a chart gradient. */
4
+ export interface IChartGradientPoint {
5
+ /** Horizontal coordinate, where `0` is the mark's left edge and `1` is its right edge. */
6
+ x: number;
7
+ /** Vertical coordinate, where `0` is the mark's top edge and `1` is its bottom edge. */
8
+ y: number;
9
+ }
10
+ /** One color stop in a serializable chart gradient. */
11
+ export interface IChartGradientStop {
12
+ /** Position along the gradient vector. Values are forwarded to the renderer. */
13
+ offset: number;
14
+ /** CSS color string, including `rgba(...)` when desired. */
15
+ color: string;
16
+ /** Optional alpha multiplier applied to the alpha already present in `color`. */
17
+ opacity?: number;
18
+ }
19
+ /** A mark-local linear gradient with at least two stops. */
20
+ export interface IChartLinearGradient {
21
+ type: typeof CHART_LINEAR_GRADIENT_TYPE;
22
+ start: IChartGradientPoint;
23
+ end: IChartGradientPoint;
24
+ stops: IChartGradientStop[];
25
+ }
26
+ /** A solid CSS color or a serializable mark-local linear gradient. */
27
+ export type ChartColor = string | IChartLinearGradient;
28
+ /** Input accepted by {@link chartLinearGradient}; the discriminator is added automatically. */
29
+ export type ChartLinearGradientInput = Omit<IChartLinearGradient, 'type'>;
30
+ /**
31
+ * Creates and validates a serializable linear-gradient chart color.
32
+ *
33
+ * @param gradient Gradient coordinates and at least two color stops.
34
+ * @returns A plain-data gradient carrying the stable chart-color discriminator.
35
+ * @example
36
+ * ```ts
37
+ * import { chartLinearGradient } from '@univerjs-pro/engine-chart';
38
+ *
39
+ * const color = chartLinearGradient({
40
+ * start: { x: 0, y: 1 },
41
+ * end: { x: 0, y: 0 },
42
+ * stops: [
43
+ * { offset: 0, color: 'rgba(22, 119, 255, 0)' },
44
+ * { offset: 1, color: '#1677ff' },
45
+ * ],
46
+ * });
47
+ * ```
48
+ */
49
+ export declare function chartLinearGradient(gradient: ChartLinearGradientInput): IChartLinearGradient;
@@ -0,0 +1,3 @@
1
+ import { ChartTypeBits } from '../enum';
2
+ /** Returns fresh numeric starter rows for chart types with specialized table semantics. */
3
+ export declare function createChartStarterRows(chartType: ChartTypeBits): number[][] | undefined;
@@ -1,6 +1,6 @@
1
1
  import type { AreaLineStyle, BarShape, ChartAxisDimension, ChartBorderDashType, ChartMarkLineLabelPosition, ChartSemanticAxis, ChartTrendlineType, ChartWaterfallPointRole, InvalidValueType, IRuntimeAxisPosition, LabelAlignEnum, LabelContentType, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, RelationChartLayoutEnum, SelectModeEnum, SeriesLabelPosition, TitlePositionEnum, WaterfallStackTypeEnum, WordCloudShapeEnum } from '../enum';
2
- import type { IChartData } from '../types';
3
- export { ChartAxisDimension, ChartMarkLineLabelPosition, ChartSemanticAxis, ChartWaterfallPointRole } from '../enum';
2
+ import type { DeepNullish, IChartCandlestickMappingSpec, IChartCandlestickSpec, IChartHistogramSpec, IChartTreemapSpec } from '../types';
3
+ import type { ChartColor } from './chart-color';
4
4
  /** Canonical semantic chart type names exposed by the chart facade. */
5
5
  export declare enum ChartTypeString {
6
6
  Line = "line",
@@ -26,7 +26,10 @@ export declare enum ChartTypeString {
26
26
  Pareto = "pareto",
27
27
  Sankey = "sankey",
28
28
  Heatmap = "heatmap",
29
- Boxplot = "boxplot"
29
+ Boxplot = "boxplot",
30
+ Candlestick = "candlestick",
31
+ Histogram = "histogram",
32
+ Treemap = "treemap"
30
33
  }
31
34
  export declare enum ChartSeriesTypeString {
32
35
  Column = "column",
@@ -86,8 +89,8 @@ export interface IChartAxisLabelSpec extends IChartFontSpec {
86
89
  }
87
90
  export interface IChartAxisSpec {
88
91
  title?: string;
89
- min?: number | null;
90
- max?: number | null;
92
+ min?: number;
93
+ max?: number;
91
94
  reverse?: boolean;
92
95
  line?: {
93
96
  visible?: boolean;
@@ -101,7 +104,7 @@ export interface IChartAxisSpec {
101
104
  length?: number;
102
105
  position?: ChartAxisTickPosition;
103
106
  };
104
- format?: string | null;
107
+ format?: string;
105
108
  titleStyle?: IChartFontSpec;
106
109
  label?: IChartAxisLabelSpec;
107
110
  gridLine?: {
@@ -158,7 +161,7 @@ export type ChartSeriesSelector = {
158
161
  name: string;
159
162
  };
160
163
  export interface IChartSeriesBorderSpec {
161
- color?: string | null;
164
+ color?: string;
162
165
  width?: number;
163
166
  opacity?: number;
164
167
  dashType?: ChartBorderDashType;
@@ -166,7 +169,7 @@ export interface IChartSeriesBorderSpec {
166
169
  export interface IChartSeriesPointSpec {
167
170
  shape?: LinePointShape;
168
171
  size?: number;
169
- color?: string | null;
172
+ color?: string;
170
173
  }
171
174
  export interface IChartSeriesLabelSpec extends IChartFontSpec {
172
175
  visible?: boolean;
@@ -178,24 +181,41 @@ export interface IChartHeatmapLabelSpec extends IChartFontSpec {
178
181
  position?: SeriesLabelPosition;
179
182
  }
180
183
  export interface IChartSeriesStyleSpec {
181
- color?: string;
184
+ color?: ChartColor;
182
185
  fillOpacity?: number;
183
186
  border?: IChartSeriesBorderSpec;
184
187
  point?: IChartSeriesPointSpec;
185
188
  rightAxis?: boolean;
186
189
  label?: IChartSeriesLabelSpec;
187
190
  }
191
+ /** Style fields accepted by fill-capable chart data points. */
192
+ export interface IChartSeriesDataPointStyleSpec {
193
+ shape?: LinePointShape;
194
+ size?: number;
195
+ color?: ChartColor;
196
+ fillOpacity?: number;
197
+ }
198
+ /** Style fields accepted by symbol data points, whose color remains solid-only. */
199
+ export interface IChartSymbolDataPointStyleSpec extends Omit<IChartSeriesDataPointStyleSpec, 'color'> {
200
+ color?: string;
201
+ }
188
202
  export interface IChartSeriesPatch extends IChartSeriesStyleSpec {
189
203
  selector: ChartSeriesSelector;
190
204
  type?: ChartSeriesTypeString;
191
- dataPoints?: Record<number, {
192
- shape?: LinePointShape;
193
- size?: number;
194
- color?: string | null;
195
- fillOpacity?: number;
196
- }>;
205
+ dataPoints?: Record<number, IChartSeriesDataPointStyleSpec>;
197
206
  waterfallStyles?: Partial<Record<ChartWaterfallStyleTarget, Omit<IChartSeriesPatch, 'selector' | 'waterfallStyles'>>>;
198
207
  }
208
+ /** Series patch for line-like marks whose data points are symbols. */
209
+ export interface IChartLineSeriesPatch extends Omit<IChartSeriesPatch, 'dataPoints'> {
210
+ dataPoints?: Record<number, IChartSymbolDataPointStyleSpec>;
211
+ }
212
+ /** Series style for chart types that do not accept explicit gradients in the first release. */
213
+ export interface IChartSolidSeriesStyleSpec extends Omit<IChartSeriesStyleSpec, 'color'> {
214
+ color?: string;
215
+ }
216
+ /** Series patch for chart marks that expose only solid colors. */
217
+ export interface IChartSolidSeriesPatch extends Omit<IChartLineSeriesPatch, keyof IChartSeriesStyleSpec>, IChartSolidSeriesStyleSpec {
218
+ }
199
219
  export interface IChartTrendlineSpec {
200
220
  selector: ChartSeriesSelector;
201
221
  type: ChartTrendlineType;
@@ -222,7 +242,7 @@ export interface IChartHeatmapSpec {
222
242
  }
223
243
  export interface IChartWordCloudSpec {
224
244
  shape?: WordCloudShapeEnum;
225
- maskImageId?: string | null;
245
+ maskImageId?: string;
226
246
  repeat?: boolean;
227
247
  }
228
248
  export interface IChartWordCloudDescription {
@@ -234,11 +254,10 @@ export interface IChartWordCloudDescription {
234
254
  export interface IChartAppearanceSpec {
235
255
  background?: {
236
256
  /** CSS background color. Use `'transparent'` for an explicit transparent chart and host background. */
237
- color?: string | null;
238
- gradient?: boolean;
257
+ color?: string;
239
258
  };
240
259
  border?: {
241
- color?: string | null;
260
+ color?: string;
242
261
  /** Persisted host-border width. Use `0` to hide the host border without changing host-owned stroke state. */
243
262
  width?: number;
244
263
  };
@@ -251,30 +270,38 @@ export interface IChartAppearanceSpec {
251
270
  export interface IChartScatterMappingSpec {
252
271
  xIndex: number;
253
272
  yIndex: number;
254
- labelIndex?: number | null;
273
+ labelIndex?: number;
255
274
  }
256
275
  export interface IChartBubbleMappingSpec extends IChartScatterMappingSpec {
257
- sizeIndex?: number | null;
258
- seriesIndex?: number | null;
276
+ sizeIndex?: number;
277
+ seriesIndex?: number;
259
278
  }
260
279
  export interface IChartMappingSpec {
261
- categoryIndex?: number | null;
262
- seriesIndexes?: number[] | null;
263
- useDateAxis?: boolean | null;
264
- scatter?: IChartScatterMappingSpec | null;
265
- bubble?: IChartBubbleMappingSpec | null;
280
+ categoryIndex?: number;
281
+ /** Ordered root-to-leaf hierarchy fields for hierarchy charts. */
282
+ hierarchyIndexes?: number[];
283
+ seriesIndexes?: number[];
284
+ useDateAxis?: boolean;
285
+ scatter?: IChartScatterMappingSpec;
286
+ bubble?: IChartBubbleMappingSpec;
287
+ candlestick?: IChartCandlestickMappingSpec;
266
288
  }
267
289
  export interface IChartAggregationSpec {
268
- aggregate?: boolean | null;
269
- topN?: number | null;
290
+ aggregate?: boolean;
291
+ topN?: number;
270
292
  }
271
293
  export interface IChartPieLabelSpec extends IChartFontSpec {
272
294
  visible?: boolean;
273
295
  position?: PieLabelPosition;
274
296
  contentType?: LabelContentType;
275
297
  }
298
+ /** Authored style for one materialized Pie or Donut slice. */
299
+ export interface IChartSliceStyleSpec {
300
+ color?: ChartColor;
301
+ fillOpacity?: number;
302
+ }
276
303
  export interface IChartPieSpec {
277
- doughnutHole?: number | null;
304
+ doughnutHole?: number;
278
305
  explosion?: number;
279
306
  borderColor?: string;
280
307
  hasPaddingAngle?: boolean;
@@ -285,6 +312,8 @@ export interface IChartPieSpec {
285
312
  valueSuffix?: string;
286
313
  digitalFixed?: number;
287
314
  label?: IChartPieLabelSpec;
315
+ /** Sparse authored slice styles keyed by materialized slice index. */
316
+ sliceStyles?: Partial<Record<number, IChartSliceStyleSpec>>;
288
317
  }
289
318
  export interface IChartRadarSpec {
290
319
  shape?: RadarShape;
@@ -316,14 +345,14 @@ export interface IChartParetoLineLabelStyleSpec extends IChartParetoLabelStyleBa
316
345
  }
317
346
  /** Supported appearance for the Pareto business bars. */
318
347
  export interface IChartParetoBarStyleSpec {
319
- color?: string;
348
+ color?: ChartColor;
320
349
  opacity?: number;
321
350
  border?: IChartParetoBorderStyleSpec;
322
351
  label?: IChartParetoBarLabelStyleSpec;
323
352
  }
324
353
  /** Supported appearance for the derived Pareto cumulative line. */
325
354
  export interface IChartParetoLineStyleSpec {
326
- color?: string;
355
+ color?: ChartColor;
327
356
  opacity?: number;
328
357
  width?: number;
329
358
  dashType?: ChartBorderDashType;
@@ -343,7 +372,7 @@ export interface IChartAxisPointerSpec {
343
372
  indicatorLabelTextColor?: string;
344
373
  }
345
374
  export interface IChartAreaSpec {
346
- lineStyle?: AreaLineStyle | null;
375
+ lineStyle?: AreaLineStyle;
347
376
  }
348
377
  export interface IChartBarSpec {
349
378
  is3D?: boolean;
@@ -352,8 +381,8 @@ export interface IChartBarSpec {
352
381
  rotY?: number;
353
382
  }
354
383
  export interface IChartFunnelSpec {
355
- gap?: number | null;
356
- useAbsoluteValue?: boolean | null;
384
+ gap?: number;
385
+ useAbsoluteValue?: boolean;
357
386
  }
358
387
  export interface IChartRelationForceSpec {
359
388
  gravity?: number;
@@ -361,12 +390,12 @@ export interface IChartRelationForceSpec {
361
390
  edgeLength?: number;
362
391
  }
363
392
  export interface IChartRelationSpec {
364
- layout?: RelationChartLayoutEnum | null;
365
- useValueAsSymbolSize?: boolean | null;
366
- emphasisEnabled?: boolean | null;
367
- force?: IChartRelationForceSpec | null;
368
- circularLabelRotation?: boolean | null;
369
- nodeShape?: LinePointShape | null;
393
+ layout?: RelationChartLayoutEnum;
394
+ useValueAsSymbolSize?: boolean;
395
+ emphasisEnabled?: boolean;
396
+ force?: IChartRelationForceSpec;
397
+ circularLabelRotation?: boolean;
398
+ nodeShape?: LinePointShape;
370
399
  }
371
400
  /** Waterfall semantic configuration exposed through the Facade. */
372
401
  export interface IChartWaterfallSpec {
@@ -395,33 +424,43 @@ export interface IChartWaterfallConnectorStyleSpec {
395
424
  }
396
425
  interface IChartSemanticConfig {
397
426
  type?: ChartTypeString;
398
- title?: ChartTitleSpec | null;
399
- subtitle?: ChartSubtitleSpec | null;
400
- trendlines?: IChartTrendlineSpec[] | null;
401
- heatmap?: IChartHeatmapSpec | null;
402
- invalidValueStrategy?: InvalidValueType | null;
403
- legend?: ChartLegendSpec | null;
404
- axes?: IChartAxesSpec | null;
405
- allSeriesStyle?: IChartSeriesStyleSpec | null;
406
- series?: IChartSeriesPatch[] | null;
407
- wordCloud?: IChartWordCloudSpec | null;
408
- appearance?: IChartAppearanceSpec | null;
409
- mapping?: IChartMappingSpec | null;
410
- aggregation?: IChartAggregationSpec | null;
411
- pie?: IChartPieSpec | null;
412
- radar?: IChartRadarSpec | null;
413
- pareto?: IChartParetoSpec | null;
414
- axisPointer?: IChartAxisPointerSpec | null;
415
- area?: IChartAreaSpec | null;
416
- bar?: IChartBarSpec | null;
417
- funnel?: IChartFunnelSpec | null;
418
- relation?: IChartRelationSpec | null;
419
- waterfall?: IChartWaterfallSpec | null;
420
- markLines?: IChartMarkLineSpec[] | null;
421
- theme?: string | null;
427
+ autoGradientFill?: boolean;
428
+ title?: ChartTitleSpec;
429
+ subtitle?: ChartSubtitleSpec;
430
+ trendlines?: IChartTrendlineSpec[];
431
+ heatmap?: IChartHeatmapSpec;
432
+ invalidValueStrategy?: InvalidValueType;
433
+ legend?: ChartLegendSpec;
434
+ axes?: IChartAxesSpec;
435
+ allSeriesStyle?: IChartSeriesStyleSpec;
436
+ series?: IChartSeriesPatch[];
437
+ wordCloud?: IChartWordCloudSpec;
438
+ appearance?: IChartAppearanceSpec;
439
+ mapping?: IChartMappingSpec;
440
+ aggregation?: IChartAggregationSpec;
441
+ pie?: IChartPieSpec;
442
+ radar?: IChartRadarSpec;
443
+ pareto?: IChartParetoSpec;
444
+ axisPointer?: IChartAxisPointerSpec;
445
+ area?: IChartAreaSpec;
446
+ bar?: IChartBarSpec;
447
+ funnel?: IChartFunnelSpec;
448
+ relation?: IChartRelationSpec;
449
+ waterfall?: IChartWaterfallSpec;
450
+ candlestick?: IChartCandlestickSpec;
451
+ histogram?: IChartHistogramSpec;
452
+ treemap?: IChartTreemapSpec;
453
+ markLines?: IChartMarkLineSpec[];
454
+ theme?: string;
422
455
  /** Persisted absolute series colors. A non-empty value overrides theme colors. */
423
- palette?: string[] | null;
456
+ palette?: string[];
424
457
  }
458
+ /** Pending chart edits; `null` is a runtime-only delete marker consumed before persistence. */
459
+ export type ChartPendingConfig = Pick<IChartSemanticConfig, 'type'> & DeepNullish<Omit<IChartSemanticConfig, 'type' | 'series'>> & {
460
+ series?: Array<{
461
+ selector: ChartSeriesSelector;
462
+ } & DeepNullish<Omit<IChartSeriesPatch, 'selector'>>> | null;
463
+ };
425
464
  /** Data-free metadata and semantic styling for one source series. */
426
465
  export interface IChartSeriesDescription extends IChartSeriesStyleSpec {
427
466
  name: string;
@@ -434,10 +473,11 @@ export interface IChartCategoryDescription {
434
473
  name: string;
435
474
  }
436
475
  /** Materialized engine semantic data returned explicitly by hosted builders. */
437
- export type IResolvedChartData = IChartData;
438
- export interface IChartDescription extends Omit<IChartSemanticConfig, 'series'> {
476
+ export interface IChartDescription extends Omit<IChartSemanticConfig, 'autoGradientFill' | 'series'> {
439
477
  id: string;
440
478
  type: ChartTypeString;
479
+ /** Effective automatic-gradient state after applying chart-type defaults. */
480
+ autoGradientFill: boolean;
441
481
  /** Series metadata keyed by source field index; materialized values are available from `resolveData()`. */
442
482
  series: Partial<Record<number, IChartSeriesDescription>>;
443
483
  /** Category metadata only; materialized category values are available from `resolveData()`. */
@@ -457,3 +497,4 @@ export interface IChartDescription extends Omit<IChartSemanticConfig, 'series'>
457
497
  */
458
498
  axisBindings?: Partial<Record<ChartSemanticAxis, IChartAxisBindingDescription>>;
459
499
  }
500
+ export {};
@@ -0,0 +1,3 @@
1
+ /** Validates semantic indexes before a Facade operation can mutate Pending state. */
2
+ export declare function assertChartIndex(value: number, name: string): void;
3
+ export declare function assertChartIndexes(values: readonly number[], name: string): void;
@@ -0,0 +1,4 @@
1
+ /** Records whether solid mark colors should use the chart's automatic gradient preset. */
2
+ export declare const setAutoGradientFill: (value: boolean) => import("./chart-config-operation").IChartConfigOperation;
3
+ /** Clears an authored automatic-gradient override so the chart-type default applies. */
4
+ export declare const resetAutoGradientFill: () => import("./chart-config-operation").IChartConfigOperation;
@@ -0,0 +1,9 @@
1
+ import type { IChartCandlestickStateStyleSpec } from '../../types';
2
+ export declare const setRisingStyle: (value: IChartCandlestickStateStyleSpec) => import("./chart-config-operation").IChartConfigOperation;
3
+ export declare const clearRisingStyle: () => import("./chart-config-operation").IChartConfigOperation;
4
+ export declare const setFallingStyle: (value: IChartCandlestickStateStyleSpec) => import("./chart-config-operation").IChartConfigOperation;
5
+ export declare const clearFallingStyle: () => import("./chart-config-operation").IChartConfigOperation;
6
+ export declare const setDojiStyle: (value: IChartCandlestickStateStyleSpec) => import("./chart-config-operation").IChartConfigOperation;
7
+ export declare const clearDojiStyle: () => import("./chart-config-operation").IChartConfigOperation;
8
+ export declare const setCandleWidth: (value: number) => import("./chart-config-operation").IChartConfigOperation;
9
+ export declare const resetCandleWidth: () => import("./chart-config-operation").IChartConfigOperation;
@@ -3,9 +3,13 @@ import type { ChartPendingConfig } from '../chart-types';
3
3
  export declare enum ChartConfigGroup {
4
4
  AllSeriesStyle = "allSeriesStyle",
5
5
  Area = "area",
6
+ AutoGradientFill = "autoGradientFill",
6
7
  AxisPointer = "axisPointer",
7
8
  Aggregation = "aggregation",
8
9
  Appearance = "appearance",
10
+ Candlestick = "candlestick",
11
+ Histogram = "histogram",
12
+ Treemap = "treemap",
9
13
  Axes = "axes",
10
14
  Bar = "bar",
11
15
  Heatmap = "heatmap",
@@ -0,0 +1,11 @@
1
+ export declare const setHistogramField: (index: number) => import("./chart-config-operation").IChartConfigOperation;
2
+ export declare const clearHistogramField: () => import("./chart-config-operation").IChartConfigOperation;
3
+ export declare const setHistogramBinCount: (count: number) => import("./chart-config-operation").IChartConfigOperation;
4
+ export declare const setHistogramBinWidth: (width: number) => import("./chart-config-operation").IChartConfigOperation;
5
+ export declare const resetHistogramBinning: () => import("./chart-config-operation").IChartConfigOperation;
6
+ export declare const setHistogramUnderflowThreshold: (value: number) => import("./chart-config-operation").IChartConfigOperation;
7
+ export declare const clearHistogramUnderflowThreshold: () => import("./chart-config-operation").IChartConfigOperation;
8
+ export declare const setHistogramOverflowThreshold: (value: number) => import("./chart-config-operation").IChartConfigOperation;
9
+ export declare const clearHistogramOverflowThreshold: () => import("./chart-config-operation").IChartConfigOperation;
10
+ export declare const setHistogramBinGap: (value: number) => import("./chart-config-operation").IChartConfigOperation;
11
+ export declare const resetHistogramBinGap: () => import("./chart-config-operation").IChartConfigOperation;
@@ -3,13 +3,17 @@ export { ChartWaterfallStyleTarget } from '../chart-types';
3
3
  export * from './aggregation';
4
4
  export * from './appearance';
5
5
  export * from './area';
6
+ export * from './auto-gradient-fill';
6
7
  export * from './axes';
7
8
  export * from './axis-pointer';
8
9
  export * from './bar';
10
+ export * from './candlestick';
9
11
  export * from './cartesian-series';
12
+ export type { IChartConfigOperation } from './chart-config-operation';
10
13
  export * from './combination';
11
14
  export * from './funnel';
12
15
  export * from './heatmap';
16
+ export * from './histogram';
13
17
  export * from './invalid-value';
14
18
  export * from './legend';
15
19
  export * from './line';
@@ -24,6 +28,7 @@ export * from './relation';
24
28
  export * from './subtitle';
25
29
  export * from './theme';
26
30
  export * from './title';
31
+ export * from './treemap';
27
32
  export * from './trendline';
28
33
  export * from './waterfall';
29
34
  export * from './word-cloud';
@@ -1,4 +1,4 @@
1
- import type { IChartPieLabelSpec } from '../chart-types';
1
+ import type { IChartPieLabelSpec, IChartSliceStyleSpec } from '../chart-types';
2
2
  export declare const setDoughnutHole: (value: number) => import("./chart-config-operation").IChartConfigOperation;
3
3
  export declare const clearDoughnutHole: () => import("./chart-config-operation").IChartConfigOperation;
4
4
  export declare const setExplosion: (value: number) => import("./chart-config-operation").IChartConfigOperation;
@@ -21,3 +21,7 @@ export declare const setDecimalPlaces: (value: number) => import("./chart-config
21
21
  export declare const resetDecimalPlaces: () => import("./chart-config-operation").IChartConfigOperation;
22
22
  export declare const setPieLabel: (value: IChartPieLabelSpec) => import("./chart-config-operation").IChartConfigOperation;
23
23
  export declare const clearPieLabel: () => import("./chart-config-operation").IChartConfigOperation;
24
+ /** Records the authored style for one materialized Pie or Donut slice. */
25
+ export declare const setSliceStyle: (index: number, value: IChartSliceStyleSpec) => import("./chart-config-operation").IChartConfigOperation;
26
+ /** Clears the authored style for one materialized Pie or Donut slice. */
27
+ export declare const clearSliceStyle: (index: number) => import("./chart-config-operation").IChartConfigOperation;
@@ -1,5 +1,8 @@
1
+ import type { IChartCandlestickMappingSpec } from '../../types';
1
2
  import type { IChartBubbleMappingSpec, IChartScatterMappingSpec } from '../chart-types';
2
3
  export declare const setScatterMapping: (value: IChartScatterMappingSpec) => import("./chart-config-operation").IChartConfigOperation;
3
4
  export declare const clearScatterMapping: () => import("./chart-config-operation").IChartConfigOperation;
4
5
  export declare const setBubbleMapping: (value: IChartBubbleMappingSpec) => import("./chart-config-operation").IChartConfigOperation;
5
6
  export declare const clearBubbleMapping: () => import("./chart-config-operation").IChartConfigOperation;
7
+ export declare function setCandlestickFields(value: IChartCandlestickMappingSpec): import("./chart-config-operation").IChartConfigOperation;
8
+ export declare const clearCandlestickFields: () => import("./chart-config-operation").IChartConfigOperation;
@@ -0,0 +1,8 @@
1
+ import type { TreemapParentLabelLayout } from '../../enum';
2
+ import type { IChartTreemapLabelSpec } from '../../types';
3
+ export declare const setTreemapHierarchyFields: (indexes: readonly number[]) => import("./chart-config-operation").IChartConfigOperation;
4
+ export declare const setTreemapValueField: (index: number) => import("./chart-config-operation").IChartConfigOperation;
5
+ export declare const setTreemapParentLabelLayout: (layout: TreemapParentLabelLayout) => import("./chart-config-operation").IChartConfigOperation;
6
+ export declare const resetTreemapParentLabelLayout: () => import("./chart-config-operation").IChartConfigOperation;
7
+ export declare const setTreemapLabel: (label: IChartTreemapLabelSpec) => import("./chart-config-operation").IChartConfigOperation;
8
+ export declare const resetTreemapLabel: () => import("./chart-config-operation").IChartConfigOperation;
@@ -1,18 +1,23 @@
1
- import type { ChartStyle, IChartContext, IChartDataAggregation, IChartDataSeries } from '../../types';
1
+ import type { ChartStyle, DeepNullish, IChartContext, IChartDataAggregation, IChartDataSeries } from '../../types';
2
2
  import type { ChartPendingConfig, IChartDescription } from '../chart-types';
3
3
  import { ChartTypeBits } from '../../enum';
4
4
  interface IChartConfigConversionOptions {
5
5
  series?: IChartDataSeries[];
6
+ currentChartType?: ChartTypeBits;
6
7
  currentStyle?: ChartStyle;
7
8
  currentContext?: IChartContext;
8
9
  currentDataAggregation?: IChartDataAggregation;
9
10
  }
10
- interface IChartModelConfigUpdate {
11
+ type ChartContextPendingPatch = DeepNullish<IChartContext>;
12
+ interface IChartModelConfigPendingUpdate {
11
13
  chartType?: ChartTypeBits;
12
14
  style?: ChartStyle;
13
- context?: IChartContext;
15
+ context?: ChartContextPendingPatch;
14
16
  dataAggregation?: Partial<IChartDataAggregation>;
15
17
  }
18
+ interface IChartModelConfigUpdate extends Omit<IChartModelConfigPendingUpdate, 'context'> {
19
+ context?: IChartContext;
20
+ }
16
21
  export interface ICompleteChartModelConfig {
17
22
  chartType?: ChartTypeBits;
18
23
  style?: ChartStyle;
@@ -0,0 +1,5 @@
1
+ import type { DeepNullish, IChartContext } from '../../types';
2
+ /** Validates and clones a complete context received at a replacement boundary. */
3
+ export declare function canonicalizeChartContext(value: unknown): IChartContext;
4
+ /** Internal Pending boundary used before a command payload is created. */
5
+ export declare function applyPendingChartContext(current: IChartContext | undefined, value: DeepNullish<IChartContext>): IChartContext;
@@ -6,12 +6,15 @@ export declare enum ChartStyleField {
6
6
  BackgroundColor = "backgroundColor",
7
7
  BorderColor = "borderColor",
8
8
  BorderWidth = "borderWidth",
9
+ Candlestick = "candlestick",
9
10
  FontColor = "fontColor",
10
11
  FontFamily = "fontFamily",
11
12
  FontSize = "fontSize",
12
13
  Funnel = "funnel",
13
14
  GradientFill = "gradientFill",
14
15
  Heatmap = "heatmap",
16
+ Histogram = "histogram",
17
+ Treemap = "treemap",
15
18
  InvalidValueType = "invalidValueType",
16
19
  MarkLines = "markLines",
17
20
  Palette = "palette",
@@ -33,6 +36,9 @@ export declare enum ChartContextField {
33
36
  BubbleSeriesIndex = "bubbleSeriesIndex",
34
37
  BubbleSizeIndex = "bubbleSizeIndex",
35
38
  CategoryIndex = "categoryIndex",
39
+ Candlestick = "candlestick",
40
+ Histogram = "histogram",
41
+ HierarchyIndexes = "hierarchyIndexes",
36
42
  ScatterLabelIndex = "scatterLabelIndex",
37
43
  ScatterXIndex = "scatterXIndex",
38
44
  ScatterYIndex = "scatterYIndex",
@@ -1,5 +1,5 @@
1
1
  import type { ChartModel } from '../../models/chart-model';
2
- import type { IUniverDataSet } from '../../types';
3
- import type { ChartPendingConfig, IResolvedChartData } from '../chart-types';
2
+ import type { IChartData, IUniverDataSet } from '../../types';
3
+ import type { ChartPendingConfig } from '../chart-types';
4
4
  /** Resolves fresh engine semantic data from the model plus an uncommitted Facade patch. */
5
- export declare function resolveChartModelData(model: ChartModel, pending: ChartPendingConfig, dataSet?: IUniverDataSet, isRowDirection?: boolean): IResolvedChartData;
5
+ export declare function resolveChartModelData(model: ChartModel, pending: ChartPendingConfig, dataSet?: IUniverDataSet, isRowDirection?: boolean): IChartData;
@@ -1,9 +1,14 @@
1
+ export type { IChartCandlestickMappingSpec, IChartCandlestickSpec, IChartCandlestickStateStyleSpec, IChartHistogramBinningSpec, IChartHistogramDataSpec, IChartHistogramSpec, IChartHistogramStyleSpec, IChartTreemapLabelSpec, IChartTreemapSpec, } from '../types';
1
2
  export { ChartBuilder } from './chart-builder';
2
3
  export type { IChartBuilderAdapter } from './chart-builder-adapter';
4
+ export { CHART_LINEAR_GRADIENT_TYPE, chartLinearGradient } from './chart-color';
5
+ export type { ChartColor, ChartLinearGradientInput, IChartGradientPoint, IChartGradientStop, IChartLinearGradient, } from './chart-color';
3
6
  export type { ChartDescription } from './chart-description';
7
+ export { createChartStarterRows } from './chart-starter-data';
4
8
  export * from './chart-types';
5
9
  export * from './configuration';
6
10
  export { toChartModelConfig, toCompleteChartModelConfig } from './conversion/chart-config-converter';
11
+ export { canonicalizeChartContext } from './conversion/chart-context-patch';
7
12
  export { chartBitsToType, chartTypeToBits } from './conversion/chart-type-converter';
8
13
  export { describeChartModel, resolveChartDescriptionMetadata } from './conversion/describe-chart-model';
9
14
  export { resolveChartModelData } from './conversion/resolve-chart-model-data';
@@ -1,5 +1,3 @@
1
1
  import type { IUniverDataSet } from '../../types';
2
- export { resolveChartDescriptionMetadata } from '../conversion/describe-chart-model';
3
- export { resolveChartModelData } from '../conversion/resolve-chart-model-data';
4
2
  /** Builds a detached data set from raw inline values and disposes the temporary source. */
5
3
  export declare function resolveInlineChartDataSet<TCell>(values: TCell[][], buildDataSet: (data: TCell[][]) => IUniverDataSet, isRowDirection?: boolean): IUniverDataSet;
@@ -0,0 +1,6 @@
1
+ interface ISize {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ export declare const calcPosition: (text: string, font: string) => ISize;
6
+ export {};