@univerjs-pro/engine-chart 1.0.0-alpha.5 → 1.0.0-alpha.7
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.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/chart-builder/chart-color.d.ts +49 -0
- package/lib/types/chart-builder/chart-types.d.ts +38 -11
- package/lib/types/chart-builder/configuration/assertions.d.ts +2 -0
- package/lib/types/chart-builder/configuration/auto-gradient-fill.d.ts +4 -0
- package/lib/types/chart-builder/configuration/chart-config-operation.d.ts +1 -0
- package/lib/types/chart-builder/configuration/index.d.ts +1 -0
- package/lib/types/chart-builder/configuration/pie.d.ts +5 -1
- package/lib/types/chart-builder/conversion/chart-config-converter.d.ts +1 -0
- package/lib/types/chart-builder/index.d.ts +2 -0
- package/lib/types/facade/builders/f-area-chart-builder.d.ts +2 -2
- package/lib/types/facade/builders/f-boxplot-chart-builder.d.ts +5 -0
- package/lib/types/facade/builders/f-bubble-chart-builder.d.ts +2 -2
- package/lib/types/facade/builders/f-line-chart-builder.d.ts +2 -2
- package/lib/types/facade/builders/f-pie-chart-builder.d.ts +42 -1
- package/lib/types/facade/builders/f-relation-chart-builder.d.ts +38 -0
- package/lib/types/facade/builders/f-scatter-chart-builder.d.ts +2 -2
- package/lib/types/facade/builders/index.d.ts +1 -0
- package/lib/types/facade/chart-builder-type-map.d.ts +2 -2
- package/lib/types/facade/f-cartesian-chart-builder.d.ts +14 -4
- package/lib/types/facade/f-chart-builder-base.d.ts +31 -0
- package/lib/types/index.d.ts +4 -4
- package/lib/types/models/chart-element-edit-overlay/chart-element-edit-overlay.d.ts +2 -1
- package/lib/types/models/chart-model.d.ts +156 -138
- package/lib/types/models/constants/default-chart-style.d.ts +2 -0
- package/lib/types/models/echart-to-chart-model-init.d.ts +2 -1
- package/lib/types/models/mode-converter/render-spec-operators/auto-gradient-presets.d.ts +5 -0
- package/lib/types/models/mode-converter/render-spec-operators/chart-color.d.ts +23 -0
- package/lib/types/models/mode-converter/render-spec-operators/rich-text-inheritance.operator.d.ts +2 -0
- package/lib/types/types.d.ts +15 -6
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
|
@@ -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;
|
|
@@ -1,5 +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
2
|
import type { IChartData } from '../types';
|
|
3
|
+
import type { ChartColor } from './chart-color';
|
|
3
4
|
export { ChartAxisDimension, ChartMarkLineLabelPosition, ChartSemanticAxis, ChartWaterfallPointRole } from '../enum';
|
|
4
5
|
/** Canonical semantic chart type names exposed by the chart facade. */
|
|
5
6
|
export declare enum ChartTypeString {
|
|
@@ -178,24 +179,41 @@ export interface IChartHeatmapLabelSpec extends IChartFontSpec {
|
|
|
178
179
|
position?: SeriesLabelPosition;
|
|
179
180
|
}
|
|
180
181
|
export interface IChartSeriesStyleSpec {
|
|
181
|
-
color?:
|
|
182
|
+
color?: ChartColor;
|
|
182
183
|
fillOpacity?: number;
|
|
183
184
|
border?: IChartSeriesBorderSpec;
|
|
184
185
|
point?: IChartSeriesPointSpec;
|
|
185
186
|
rightAxis?: boolean;
|
|
186
187
|
label?: IChartSeriesLabelSpec;
|
|
187
188
|
}
|
|
189
|
+
/** Style fields accepted by fill-capable chart data points. */
|
|
190
|
+
export interface IChartSeriesDataPointStyleSpec {
|
|
191
|
+
shape?: LinePointShape;
|
|
192
|
+
size?: number;
|
|
193
|
+
color?: ChartColor;
|
|
194
|
+
fillOpacity?: number;
|
|
195
|
+
}
|
|
196
|
+
/** Style fields accepted by symbol data points, whose color remains solid-only. */
|
|
197
|
+
export interface IChartSymbolDataPointStyleSpec extends Omit<IChartSeriesDataPointStyleSpec, 'color'> {
|
|
198
|
+
color?: string;
|
|
199
|
+
}
|
|
188
200
|
export interface IChartSeriesPatch extends IChartSeriesStyleSpec {
|
|
189
201
|
selector: ChartSeriesSelector;
|
|
190
202
|
type?: ChartSeriesTypeString;
|
|
191
|
-
dataPoints?: Record<number,
|
|
192
|
-
shape?: LinePointShape;
|
|
193
|
-
size?: number;
|
|
194
|
-
color?: string | null;
|
|
195
|
-
fillOpacity?: number;
|
|
196
|
-
}>;
|
|
203
|
+
dataPoints?: Record<number, IChartSeriesDataPointStyleSpec>;
|
|
197
204
|
waterfallStyles?: Partial<Record<ChartWaterfallStyleTarget, Omit<IChartSeriesPatch, 'selector' | 'waterfallStyles'>>>;
|
|
198
205
|
}
|
|
206
|
+
/** Series patch for line-like marks whose data points are symbols. */
|
|
207
|
+
export interface IChartLineSeriesPatch extends Omit<IChartSeriesPatch, 'dataPoints'> {
|
|
208
|
+
dataPoints?: Record<number, IChartSymbolDataPointStyleSpec>;
|
|
209
|
+
}
|
|
210
|
+
/** Series style for chart types that do not accept explicit gradients in the first release. */
|
|
211
|
+
export interface IChartSolidSeriesStyleSpec extends Omit<IChartSeriesStyleSpec, 'color'> {
|
|
212
|
+
color?: string;
|
|
213
|
+
}
|
|
214
|
+
/** Series patch for chart marks that expose only solid colors. */
|
|
215
|
+
export interface IChartSolidSeriesPatch extends Omit<IChartLineSeriesPatch, keyof IChartSeriesStyleSpec>, IChartSolidSeriesStyleSpec {
|
|
216
|
+
}
|
|
199
217
|
export interface IChartTrendlineSpec {
|
|
200
218
|
selector: ChartSeriesSelector;
|
|
201
219
|
type: ChartTrendlineType;
|
|
@@ -235,7 +253,6 @@ export interface IChartAppearanceSpec {
|
|
|
235
253
|
background?: {
|
|
236
254
|
/** CSS background color. Use `'transparent'` for an explicit transparent chart and host background. */
|
|
237
255
|
color?: string | null;
|
|
238
|
-
gradient?: boolean;
|
|
239
256
|
};
|
|
240
257
|
border?: {
|
|
241
258
|
color?: string | null;
|
|
@@ -273,6 +290,11 @@ export interface IChartPieLabelSpec extends IChartFontSpec {
|
|
|
273
290
|
position?: PieLabelPosition;
|
|
274
291
|
contentType?: LabelContentType;
|
|
275
292
|
}
|
|
293
|
+
/** Authored style for one materialized Pie or Donut slice. */
|
|
294
|
+
export interface IChartSliceStyleSpec {
|
|
295
|
+
color?: ChartColor;
|
|
296
|
+
fillOpacity?: number;
|
|
297
|
+
}
|
|
276
298
|
export interface IChartPieSpec {
|
|
277
299
|
doughnutHole?: number | null;
|
|
278
300
|
explosion?: number;
|
|
@@ -285,6 +307,8 @@ export interface IChartPieSpec {
|
|
|
285
307
|
valueSuffix?: string;
|
|
286
308
|
digitalFixed?: number;
|
|
287
309
|
label?: IChartPieLabelSpec;
|
|
310
|
+
/** Sparse authored slice styles keyed by materialized slice index. */
|
|
311
|
+
sliceStyles?: Partial<Record<number, IChartSliceStyleSpec>>;
|
|
288
312
|
}
|
|
289
313
|
export interface IChartRadarSpec {
|
|
290
314
|
shape?: RadarShape;
|
|
@@ -316,14 +340,14 @@ export interface IChartParetoLineLabelStyleSpec extends IChartParetoLabelStyleBa
|
|
|
316
340
|
}
|
|
317
341
|
/** Supported appearance for the Pareto business bars. */
|
|
318
342
|
export interface IChartParetoBarStyleSpec {
|
|
319
|
-
color?:
|
|
343
|
+
color?: ChartColor;
|
|
320
344
|
opacity?: number;
|
|
321
345
|
border?: IChartParetoBorderStyleSpec;
|
|
322
346
|
label?: IChartParetoBarLabelStyleSpec;
|
|
323
347
|
}
|
|
324
348
|
/** Supported appearance for the derived Pareto cumulative line. */
|
|
325
349
|
export interface IChartParetoLineStyleSpec {
|
|
326
|
-
color?:
|
|
350
|
+
color?: ChartColor;
|
|
327
351
|
opacity?: number;
|
|
328
352
|
width?: number;
|
|
329
353
|
dashType?: ChartBorderDashType;
|
|
@@ -395,6 +419,7 @@ export interface IChartWaterfallConnectorStyleSpec {
|
|
|
395
419
|
}
|
|
396
420
|
interface IChartSemanticConfig {
|
|
397
421
|
type?: ChartTypeString;
|
|
422
|
+
autoGradientFill?: boolean;
|
|
398
423
|
title?: ChartTitleSpec | null;
|
|
399
424
|
subtitle?: ChartSubtitleSpec | null;
|
|
400
425
|
trendlines?: IChartTrendlineSpec[] | null;
|
|
@@ -435,9 +460,11 @@ export interface IChartCategoryDescription {
|
|
|
435
460
|
}
|
|
436
461
|
/** Materialized engine semantic data returned explicitly by hosted builders. */
|
|
437
462
|
export type IResolvedChartData = IChartData;
|
|
438
|
-
export interface IChartDescription extends Omit<IChartSemanticConfig, 'series'> {
|
|
463
|
+
export interface IChartDescription extends Omit<IChartSemanticConfig, 'autoGradientFill' | 'series'> {
|
|
439
464
|
id: string;
|
|
440
465
|
type: ChartTypeString;
|
|
466
|
+
/** Effective automatic-gradient state after applying chart-type defaults. */
|
|
467
|
+
autoGradientFill: boolean;
|
|
441
468
|
/** Series metadata keyed by source field index; materialized values are available from `resolveData()`. */
|
|
442
469
|
series: Partial<Record<number, IChartSeriesDescription>>;
|
|
443
470
|
/** Category metadata only; materialized category values are available from `resolveData()`. */
|
|
@@ -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;
|
|
@@ -3,6 +3,7 @@ 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",
|
|
@@ -3,6 +3,7 @@ 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';
|
|
@@ -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;
|
|
@@ -3,6 +3,7 @@ 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;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { ChartBuilder } from './chart-builder';
|
|
2
2
|
export type { IChartBuilderAdapter } from './chart-builder-adapter';
|
|
3
|
+
export { CHART_LINEAR_GRADIENT_TYPE, chartLinearGradient } from './chart-color';
|
|
4
|
+
export type { ChartColor, ChartLinearGradientInput, IChartGradientPoint, IChartGradientStop, IChartLinearGradient } from './chart-color';
|
|
3
5
|
export type { ChartDescription } from './chart-description';
|
|
4
6
|
export * from './chart-types';
|
|
5
7
|
export * from './configuration';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AreaLineStyle } from '@univerjs-pro/engine-chart';
|
|
1
|
+
import type { AreaLineStyle, IChartLineSeriesPatch } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import { FCartesianChartBuilder } from '../f-cartesian-chart-builder';
|
|
3
|
-
export declare class FAreaChartBuilder extends FCartesianChartBuilder {
|
|
3
|
+
export declare class FAreaChartBuilder extends FCartesianChartBuilder<Omit<IChartLineSeriesPatch, 'selector'>> {
|
|
4
4
|
/**
|
|
5
5
|
* Sets the area line style configuration and returns this builder for chaining.
|
|
6
6
|
*
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IChartSolidSeriesPatch, IChartSolidSeriesStyleSpec } from '@univerjs-pro/engine-chart';
|
|
2
|
+
import { FCartesianChartBuilder } from '../f-cartesian-chart-builder';
|
|
3
|
+
/** Boxplot keeps its existing automatic preset but does not expose explicit gradients. */
|
|
4
|
+
export declare class FBoxplotChartBuilder extends FCartesianChartBuilder<Omit<IChartSolidSeriesPatch, 'selector'>, IChartSolidSeriesStyleSpec> {
|
|
5
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IChartBubbleMappingSpec } from '@univerjs-pro/engine-chart';
|
|
1
|
+
import type { IChartBubbleMappingSpec, IChartSolidSeriesPatch, IChartSolidSeriesStyleSpec } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import { FCartesianChartBuilder } from '../f-cartesian-chart-builder';
|
|
3
|
-
export declare class FBubbleChartBuilder extends FCartesianChartBuilder {
|
|
3
|
+
export declare class FBubbleChartBuilder extends FCartesianChartBuilder<Omit<IChartSolidSeriesPatch, 'selector'>, IChartSolidSeriesStyleSpec> {
|
|
4
4
|
/**
|
|
5
5
|
* Sets the bubble mapping configuration and returns this builder for chaining.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IChartSeriesBorderSpec } from '@univerjs-pro/engine-chart';
|
|
1
|
+
import type { IChartLineSeriesPatch, IChartSeriesBorderSpec } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import { FCartesianChartBuilder } from '../f-cartesian-chart-builder';
|
|
3
|
-
export declare class FLineChartBuilder extends FCartesianChartBuilder {
|
|
3
|
+
export declare class FLineChartBuilder extends FCartesianChartBuilder<Omit<IChartLineSeriesPatch, 'selector'>> {
|
|
4
4
|
/**
|
|
5
5
|
* Sets the line style configuration and returns this builder for chaining.
|
|
6
6
|
*
|
|
@@ -1,6 +1,47 @@
|
|
|
1
|
-
import type { IChartPieLabelSpec } from '@univerjs-pro/engine-chart';
|
|
1
|
+
import type { IChartPieLabelSpec, IChartSliceStyleSpec } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import { FChartBuilderBase } from '../f-chart-builder-base';
|
|
3
3
|
export declare class FPieChartBuilder extends FChartBuilderBase {
|
|
4
|
+
/**
|
|
5
|
+
* Sets the style for the materialized slice at `index`.
|
|
6
|
+
*
|
|
7
|
+
* This method executes synchronously.
|
|
8
|
+
*
|
|
9
|
+
* @param index The zero-based slice index.
|
|
10
|
+
* @param value The slice style patch.
|
|
11
|
+
* @returns This builder for chaining.
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { chartLinearGradient } from '@univerjs-pro/engine-chart';
|
|
15
|
+
*
|
|
16
|
+
* const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
17
|
+
* const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Pie);
|
|
18
|
+
* const color = chartLinearGradient({
|
|
19
|
+
* start: { x: 0, y: 0 },
|
|
20
|
+
* end: { x: 1, y: 1 },
|
|
21
|
+
* stops: [
|
|
22
|
+
* { offset: 0, color: '#fff1b8' },
|
|
23
|
+
* { offset: 1, color: '#faad14' },
|
|
24
|
+
* ],
|
|
25
|
+
* });
|
|
26
|
+
* builder.setSliceStyle(0, { color });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
setSliceStyle(index: number, value: IChartSliceStyleSpec): this;
|
|
30
|
+
/**
|
|
31
|
+
* Clears the authored style for the materialized slice at `index`.
|
|
32
|
+
*
|
|
33
|
+
* This method executes synchronously.
|
|
34
|
+
*
|
|
35
|
+
* @param index The zero-based slice index.
|
|
36
|
+
* @returns This builder for chaining.
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
40
|
+
* const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Pie);
|
|
41
|
+
* builder.clearSliceStyle(0);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
clearSliceStyle(index: number): this;
|
|
4
45
|
/**
|
|
5
46
|
* Sets the doughnut hole configuration and returns this builder for chaining.
|
|
6
47
|
*
|
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
import type { IChartRelationForceSpec, LinePointShape, RelationChartLayoutEnum } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import { FChartBuilderBase } from '../f-chart-builder-base';
|
|
3
|
+
/**
|
|
4
|
+
* Configures a relation chart.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Relation chart sources are recognized in the following order:
|
|
8
|
+
*
|
|
9
|
+
* 1. **Co-word matrix**. For `N` node rows, the converted chart data must contain `N + 2`
|
|
10
|
+
* dimension headers and `N + 1` source columns. Headers starting at index `2`
|
|
11
|
+
* provide node names, source column `1` provides each node's category, and numeric matrix cells
|
|
12
|
+
* provide link weights. This format is checked before the edge-list format.
|
|
13
|
+
* Use this format when nodes need different categories.
|
|
14
|
+
* 2. **Edge list**. Column `0` is the source node and column `1` is the target node. Both must
|
|
15
|
+
* contain non-empty strings. An optional numeric weight column must contain finite, non-negative
|
|
16
|
+
* values; without one, every link has weight `1`.
|
|
17
|
+
*
|
|
18
|
+
* A two-column edge list is treated as unweighted. A three-column edge list uses column `2` as its
|
|
19
|
+
* weight automatically. If the range has more than three columns, select exactly one weight column
|
|
20
|
+
* with {@link FChartBuilderBase.setValueFields}; selecting multiple weight columns or either endpoint
|
|
21
|
+
* column makes the source invalid. A weighted edge list creates at most one category, named after
|
|
22
|
+
* the selected weight column when that column has a non-empty header. An unweighted edge list
|
|
23
|
+
* creates no categories.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* A worksheet range `A1:C4` can contain this weighted edge list:
|
|
27
|
+
*
|
|
28
|
+
* | Source | Target | Weight |
|
|
29
|
+
* | --- | --- | ---: |
|
|
30
|
+
* | A | B | 5 |
|
|
31
|
+
* | A | C | 3 |
|
|
32
|
+
* | C | B | 2 |
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* worksheet.charts.create()
|
|
36
|
+
* .setSource('A1:C4')
|
|
37
|
+
* .setType(univerAPI.Enum.ChartTypeString.Relation)
|
|
38
|
+
* .setValueFields([2]);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
3
41
|
export declare class FRelationChartBuilder extends FChartBuilderBase {
|
|
4
42
|
/**
|
|
5
43
|
* Sets the layout configuration and returns this builder for chaining.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IChartScatterMappingSpec } from '@univerjs-pro/engine-chart';
|
|
1
|
+
import type { IChartScatterMappingSpec, IChartSolidSeriesPatch, IChartSolidSeriesStyleSpec } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import { FCartesianChartBuilder } from '../f-cartesian-chart-builder';
|
|
3
|
-
export declare class FScatterChartBuilder extends FCartesianChartBuilder {
|
|
3
|
+
export declare class FScatterChartBuilder extends FCartesianChartBuilder<Omit<IChartSolidSeriesPatch, 'selector'>, IChartSolidSeriesStyleSpec> {
|
|
4
4
|
/**
|
|
5
5
|
* Sets the scatter mapping configuration and returns this builder for chaining.
|
|
6
6
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { FAreaChartBuilder } from './f-area-chart-builder';
|
|
2
|
+
export { FBoxplotChartBuilder } from './f-boxplot-chart-builder';
|
|
2
3
|
export { FBubbleChartBuilder } from './f-bubble-chart-builder';
|
|
3
4
|
export { FCombinationChartBuilder } from './f-combination-chart-builder';
|
|
4
5
|
export { FFunnelChartBuilder } from './f-funnel-chart-builder';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChartTypeString } from '@univerjs-pro/engine-chart';
|
|
2
|
-
import type { FAreaChartBuilder, FBubbleChartBuilder, FCombinationChartBuilder, FFunnelChartBuilder, FHeatmapChartBuilder, FLineChartBuilder, FParetoChartBuilder, FPieChartBuilder, FRadarChartBuilder, FRelationChartBuilder, FScatterChartBuilder, FWaterfallChartBuilder, FWordCloudChartBuilder } from './builders';
|
|
2
|
+
import type { FAreaChartBuilder, FBoxplotChartBuilder, FBubbleChartBuilder, FCombinationChartBuilder, FFunnelChartBuilder, FHeatmapChartBuilder, FLineChartBuilder, FParetoChartBuilder, FPieChartBuilder, FRadarChartBuilder, FRelationChartBuilder, FScatterChartBuilder, FWaterfallChartBuilder, FWordCloudChartBuilder } from './builders';
|
|
3
3
|
import type { FCartesianChartBuilder } from './f-cartesian-chart-builder';
|
|
4
4
|
import type { FChartBuilderBase } from './f-chart-builder-base';
|
|
5
5
|
export interface IChartBuilderTypeMap {
|
|
@@ -26,5 +26,5 @@ export interface IChartBuilderTypeMap {
|
|
|
26
26
|
[ChartTypeString.Pareto]: FParetoChartBuilder;
|
|
27
27
|
[ChartTypeString.Sankey]: FChartBuilderBase;
|
|
28
28
|
[ChartTypeString.Heatmap]: FHeatmapChartBuilder;
|
|
29
|
-
[ChartTypeString.Boxplot]:
|
|
29
|
+
[ChartTypeString.Boxplot]: FBoxplotChartBuilder;
|
|
30
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChartAllSeriesStyleTarget, ChartAxisPointerTarget, ChartPublicSeriesSelector, ChartSeriesClearTarget, ChartSeriesTrendlineSelector, ChartTrendlineSelector, ChartTrendlineValue, IChartAxisPointerSpec, IChartBarSpec, IChartSeriesPatch, IChartSeriesStyleSpec } from '@univerjs-pro/engine-chart';
|
|
2
2
|
import { FAxisChartBuilder } from './f-axis-chart-builder';
|
|
3
|
-
export declare class FCartesianChartBuilder<TSeriesPatch extends Omit<IChartSeriesPatch, 'selector'> = Omit<IChartSeriesPatch, 'selector'
|
|
3
|
+
export declare class FCartesianChartBuilder<TSeriesPatch extends Omit<IChartSeriesPatch, 'selector'> = Omit<IChartSeriesPatch, 'selector'>, TSeriesStyle extends IChartSeriesStyleSpec = IChartSeriesStyleSpec> extends FAxisChartBuilder {
|
|
4
4
|
readonly __seriesPatchType?: TSeriesPatch;
|
|
5
5
|
setBar(value: IChartBarSpec): this;
|
|
6
6
|
clearBar(): this;
|
|
@@ -14,9 +14,19 @@ export declare class FCartesianChartBuilder<TSeriesPatch extends Omit<IChartSeri
|
|
|
14
14
|
* @returns This builder for chaining.
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
|
+
* import { chartLinearGradient } from '@univerjs-pro/engine-chart';
|
|
18
|
+
*
|
|
17
19
|
* const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
18
|
-
* const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.
|
|
19
|
-
*
|
|
20
|
+
* const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Column);
|
|
21
|
+
* const color = chartLinearGradient({
|
|
22
|
+
* start: { x: 0, y: 1 },
|
|
23
|
+
* end: { x: 0, y: 0 },
|
|
24
|
+
* stops: [
|
|
25
|
+
* { offset: 0, color: 'rgba(22, 119, 255, 0)' },
|
|
26
|
+
* { offset: 1, color: '#1677ff' },
|
|
27
|
+
* ],
|
|
28
|
+
* });
|
|
29
|
+
* builder.setSeries(0, { color });
|
|
20
30
|
* ```
|
|
21
31
|
*/
|
|
22
32
|
setSeries(selector: ChartPublicSeriesSelector, patch: TSeriesPatch): this;
|
|
@@ -50,7 +60,7 @@ export declare class FCartesianChartBuilder<TSeriesPatch extends Omit<IChartSeri
|
|
|
50
60
|
* builder.setAllSeriesStyle({ color: '#1677ff', fillOpacity: 0.8 });
|
|
51
61
|
* ```
|
|
52
62
|
*/
|
|
53
|
-
setAllSeriesStyle(style:
|
|
63
|
+
setAllSeriesStyle(style: TSeriesStyle): this;
|
|
54
64
|
/**
|
|
55
65
|
* Clears persistent defaults inherited by every series.
|
|
56
66
|
*
|
|
@@ -195,6 +195,37 @@ export declare class FChartBuilderBase<TBuilder extends ChartBuilder = ChartBuil
|
|
|
195
195
|
* ```
|
|
196
196
|
*/
|
|
197
197
|
clearAppearance(target?: ChartAppearanceTarget): this;
|
|
198
|
+
/**
|
|
199
|
+
* Enables or disables the automatic gradient preset for supported chart marks.
|
|
200
|
+
*
|
|
201
|
+
* Explicit gradient colors configured on a series or slice take precedence over this preset.
|
|
202
|
+
* This method executes synchronously.
|
|
203
|
+
*
|
|
204
|
+
* @param value Whether to apply the chart type's automatic gradient preset.
|
|
205
|
+
* @returns This builder for chaining.
|
|
206
|
+
* @example
|
|
207
|
+
* ```ts
|
|
208
|
+
* const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
209
|
+
* const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Column);
|
|
210
|
+
* builder.setAutoGradientFill(true);
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
setAutoGradientFill(value: boolean): this;
|
|
214
|
+
/**
|
|
215
|
+
* Clears the automatic-gradient override and restores the chart type's default behavior.
|
|
216
|
+
*
|
|
217
|
+
* This method executes synchronously.
|
|
218
|
+
*
|
|
219
|
+
* @returns This builder for chaining.
|
|
220
|
+
* @example
|
|
221
|
+
* ```ts
|
|
222
|
+
* const worksheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
223
|
+
* const builder = worksheet.charts.create().setType(univerAPI.Enum.ChartTypeString.Column);
|
|
224
|
+
* builder.setAutoGradientFill(true);
|
|
225
|
+
* builder.resetAutoGradientFill();
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
resetAutoGradientFill(): this;
|
|
198
229
|
/**
|
|
199
230
|
* Sets the invalid value strategy configuration and returns this builder for chaining.
|
|
200
231
|
*
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { ChartDescription, ChartLegendSpec, ChartPublicSeriesSelector, ChartSeriesSelector, ChartSeriesTrendlineSelector, ChartSubtitleSpec, ChartTitleSpec, IChartAggregationSpec, IChartAppearanceSpec, IChartAreaSpec, IChartAxesSpec, IChartAxisBindingDescription, IChartAxisLabelSpec, IChartAxisPointerSpec, IChartAxisSpec, IChartBarSpec, IChartBubbleMappingSpec, IChartDescription, IChartFontSpec, IChartFunnelSpec, IChartHeatmapLabelSpec, IChartHeatmapSpec, IChartLegendOptions, IChartMappingSpec, IChartMarkLineLabelSpec, IChartMarkLineSpec, IChartParetoBarLabelStyleSpec, IChartParetoBarStyleSpec, IChartParetoBorderStyleSpec, IChartParetoLineLabelStyleSpec, IChartParetoLineStyleSpec, IChartParetoPointStyleSpec, IChartParetoSpec, IChartPieLabelSpec, IChartPieSpec, IChartRadarSpec, IChartRelationForceSpec, IChartRelationSpec, IChartScatterMappingSpec, IChartSeriesBorderSpec, IChartSeriesDescription, IChartSeriesLabelSpec, IChartSeriesPatch, IChartSeriesPointSpec, IChartSeriesStyleSpec, IChartSubtitleOptions, IChartTitleOptions, IChartTrendlineSpec, IChartWaterfallConnectorStyleSpec, IChartWaterfallPointRoleSpec, IChartWaterfallSpec, IChartWordCloudDescription, IChartWordCloudSpec, IInlineChartBuilderAdapter, IInlineChartHostPatch, IResolvedChartData, } from './chart-builder';
|
|
2
|
-
export { AREA_CHART_TYPES, AXIS_CHART_TYPES, CARTESIAN_CHART_TYPES, ChartAggregationTarget, ChartAllSeriesStyleTarget, ChartAppearanceTarget, ChartAxisName, ChartAxisPointerTarget, ChartAxisTarget, ChartAxisTickPosition, ChartSeriesAxis, ChartSeriesClearTarget, ChartSeriesTypeString, ChartTypeString, ChartVisualMapType, ChartWaterfallStyleTarget, ChartWordCloudShapeSource, DEFAULT_CHART_TYPE, } from './chart-builder';
|
|
3
|
-
export { ChartBuilder, chartTypeToBits, clearAggregation, clearAllSeriesStyle, clearAppearance, clearAreaLineStyle, clearAxisPointer, clearAxisTitle, clearBar, clearBubbleMapping, clearCategoryField, clearCellLabel, clearCumulativeLineStyle, clearDoughnutHole, clearLegend, clearLineStyle, clearMarkLines,
|
|
1
|
+
export type { ChartColor, ChartDescription, ChartLegendSpec, ChartLinearGradientInput, ChartPublicSeriesSelector, ChartSeriesSelector, ChartSeriesTrendlineSelector, ChartSubtitleSpec, ChartTitleSpec, IChartAggregationSpec, IChartAppearanceSpec, IChartAreaSpec, IChartAxesSpec, IChartAxisBindingDescription, IChartAxisLabelSpec, IChartAxisPointerSpec, IChartAxisSpec, IChartBarSpec, IChartBubbleMappingSpec, IChartDescription, IChartFontSpec, IChartFunnelSpec, IChartGradientPoint, IChartGradientStop, IChartHeatmapLabelSpec, IChartHeatmapSpec, IChartLegendOptions, IChartLinearGradient, IChartLineSeriesPatch, IChartMappingSpec, IChartMarkLineLabelSpec, IChartMarkLineSpec, IChartParetoBarLabelStyleSpec, IChartParetoBarStyleSpec, IChartParetoBorderStyleSpec, IChartParetoLineLabelStyleSpec, IChartParetoLineStyleSpec, IChartParetoPointStyleSpec, IChartParetoSpec, IChartPieLabelSpec, IChartPieSpec, IChartRadarSpec, IChartRelationForceSpec, IChartRelationSpec, IChartScatterMappingSpec, IChartSeriesBorderSpec, IChartSeriesDataPointStyleSpec, IChartSeriesDescription, IChartSeriesLabelSpec, IChartSeriesPatch, IChartSeriesPointSpec, IChartSeriesStyleSpec, IChartSliceStyleSpec, IChartSolidSeriesPatch, IChartSolidSeriesStyleSpec, IChartSubtitleOptions, IChartSymbolDataPointStyleSpec, IChartTitleOptions, IChartTrendlineSpec, IChartWaterfallConnectorStyleSpec, IChartWaterfallPointRoleSpec, IChartWaterfallSpec, IChartWordCloudDescription, IChartWordCloudSpec, IInlineChartBuilderAdapter, IInlineChartHostPatch, IResolvedChartData, } from './chart-builder';
|
|
2
|
+
export { AREA_CHART_TYPES, AXIS_CHART_TYPES, CARTESIAN_CHART_TYPES, CHART_LINEAR_GRADIENT_TYPE, ChartAggregationTarget, ChartAllSeriesStyleTarget, ChartAppearanceTarget, ChartAxisName, ChartAxisPointerTarget, ChartAxisTarget, ChartAxisTickPosition, chartLinearGradient, ChartSeriesAxis, ChartSeriesClearTarget, ChartSeriesTypeString, ChartTypeString, ChartVisualMapType, ChartWaterfallStyleTarget, ChartWordCloudShapeSource, DEFAULT_CHART_TYPE, } from './chart-builder';
|
|
3
|
+
export { ChartBuilder, chartTypeToBits, clearAggregation, clearAllSeriesStyle, clearAppearance, clearAreaLineStyle, clearAxisPointer, clearAxisTitle, clearBar, clearBubbleMapping, clearCategoryField, clearCellLabel, clearCumulativeLineStyle, clearDoughnutHole, clearLegend, clearLineStyle, clearMarkLines, clearMaskImage, clearPalette, clearParetoBarStyle, clearPieLabel, clearRelationForce, clearRightYAxis, clearScatterMapping, clearSeries, clearSliceBorderColor, clearSliceStyle, clearSubtitle, clearTheme, clearTitle, clearTrendlines, clearValueFields, clearValueRange, clearValueSuffix, clearValueUnit, clearWaterfallConnector, clearWaterfallStyle, clearXAxis, clearYAxis, describeChartModel, DetachedChartBuilderAdapter, InlineChartBuilder, removeTrendline, resetAutoGradientFill, resetCircularLabelRotation, resetCombinationSeriesAxis, resetCombinationSeriesType, resetDecimalPlaces, resetEmphasisEnabled, resetExplosion, resetFunnelGap, resetHalfPie, resetIncludeZeroValues, resetInvalidValueStrategy, resetLabelLineVisible, resetPaddingAngleEnabled, resetRadarFill, resetRadarShape, resetRelationLayout, resetRelationNodeShape, resetRosePie, resetUseAbsoluteValue, resetUseDateAxis, resetUseSubtotal, resetUseValueAsSymbolSize, resetValueScale, resetVisualMapType, resetWaterfallStackType, resetWordCloudRepeat, resetWordCloudShape, resolveChartDescriptionMetadata, resolveChartModelData, resolveInlineChartDataSet, setAggregation, setAllSeriesStyle, setAppearance, setAreaLineStyle, setAutoGradientFill, setAxisPointer, setAxisTitle, setBar, setBubbleMapping, setCategoryField, setCellLabel, setCircularLabelRotation, setCombinationSeriesAxis, setCombinationSeriesType, setCumulativeLineStyle, setDecimalPlaces, setDoughnutHole, setEmphasisEnabled, setExplosion, setFunnelGap, setHalfPie, setIncludeZeroValues, setInvalidValueStrategy, setLabelLineVisible, setLegend, setLineStyle, setMarkLines, setMaskImage, setPaddingAngleEnabled, setPalette, setParetoBarStyle, setPieLabel, setRadarFill, setRadarShape, setRelationForce, setRelationLayout, setRelationNodeShape, setRightYAxis, setRosePie, setScatterMapping, setSeries, setSliceBorderColor, setSliceStyle, setSubtitle, setTheme, setTitle, setTrendline, setUseAbsoluteValue, setUseDateAxis, setUseSubtotal, setUseValueAsSymbolSize, setValueFields, setValueRange, setValueScale, setValueSuffix, setValueUnit, setVisualMapType, setWaterfallConnector, setWaterfallPointRoles, setWaterfallStackType, setWaterfallStyle, setWordCloudRepeat, setWordCloudShape, setXAxis, setYAxis, toChartModelConfig, toCompleteChartModelConfig, } from './chart-builder';
|
|
4
4
|
export type { ChartPendingConfig, ChartTrendlineSelector, ChartTrendlineValue, IChartBuilderAdapter, IChartCreateConfig, } from './chart-builder';
|
|
5
|
-
export { AreaLineStyle,
|
|
5
|
+
export { AreaLineStyle, AxisAlignEnum, AxisValueType, BarShape, CategoryType, ChartAttributeBits, ChartAxisDimension, ChartBorderDashType, ChartMarkLineLabelPosition, ChartSemanticAxis, ChartSourceDataTypeEnum, ChartTrendlineType, ChartTypeBits, ChartWaterfallPointRole, DataOrientation, InvalidValueType, IRuntimeAxisPosition, IRuntimeAxisPriority, LabelAlignEnum, LabelContentType, LegendPositionEnum, LinePointShape, ParetoSeriesIndex, ParetoSeriesPart, PieLabelPosition, RadarShape, RelationChartLayoutEnum, SelectModeEnum, SeriesLabelPosition, StackType, TextAlign, TextVerticalAlign, TitlePositionEnum, WaterfallSeriesTypeEnum, WaterfallStackTypeEnum, WordCloudShapeEnum, } from './enum';
|
|
6
6
|
export { buildChartData, RelationColumnIndex } from './models/chart-data-operators/build-chart-data';
|
|
7
7
|
export { CartesianPointRoleIndex, CartesianPointValueIndex } from './models/chart-data-operators/cartesian-point-data';
|
|
8
8
|
export { defaultChartContextOperators, findCategoryIndexes, findCategoryOperator, findHeaderOperator, findSeriesOperator, generateChartModelContextByOperators, pieSeriesFilterOperator, } from './models/chart-data-operators/operators';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IChartElementBounds, IChartElementHit } from '../../types';
|
|
2
|
+
import type { ECharts } from '../../utils/echarts';
|
|
2
3
|
import type { ChartElementEditBorderType, IChartElementEditOverlayPalette } from './types';
|
|
3
4
|
export declare class ChartElementEditOverlay {
|
|
4
5
|
private readonly _getInstance;
|
|
@@ -11,7 +12,7 @@ export declare class ChartElementEditOverlay {
|
|
|
11
12
|
private _hoverBorderHitKey;
|
|
12
13
|
private _fixedBorder;
|
|
13
14
|
private _fixedBorderBounds;
|
|
14
|
-
constructor(_getInstance: () =>
|
|
15
|
+
constructor(_getInstance: () => ECharts | null, _getContainer?: () => HTMLElement | null | undefined, _paletteOverride?: Partial<IChartElementEditOverlayPalette> | undefined);
|
|
15
16
|
ensure(): any;
|
|
16
17
|
remove(): void;
|
|
17
18
|
clearAll(): void;
|