@univerjs-pro/engine-chart 1.0.0-alpha.2 → 1.0.0-alpha.3
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/README.md +9 -3
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/chart-model-api/chart-model-api.d.ts +2 -0
- package/lib/types/chart-model-api/chart-type-manifest.d.ts +128 -0
- package/lib/types/chart-model-api/chart-type-registry.d.ts +56 -0
- package/lib/types/chart-model-api/chart-type.d.ts +7 -0
- package/lib/types/chart-model-api/constants.d.ts +99 -0
- package/lib/types/chart-model-api/describe.d.ts +3 -0
- package/lib/types/chart-model-api/index.d.ts +8 -0
- package/lib/types/chart-model-api/patch-builder.d.ts +9 -0
- package/lib/types/chart-model-api/series-selector.d.ts +3 -0
- package/lib/types/chart-model-api/types.d.ts +452 -0
- package/lib/types/chart-model-api/utils.d.ts +10 -0
- package/lib/types/chart-model-api/validate.d.ts +5 -0
- package/lib/types/enum.d.ts +8 -0
- package/lib/types/f-base-chart.d.ts +25 -0
- package/lib/types/index.d.ts +118 -15
- package/lib/types/models/chart-data-operators/build-chart-data.d.ts +6 -1
- package/lib/types/models/chart-data-operators/cartesian-point-data.d.ts +43 -0
- package/lib/types/models/chart-data-operators/operators.d.ts +6 -6
- package/lib/types/models/chart-element-axis-id.d.ts +9 -0
- package/lib/types/models/chart-element-edit-overlay/chart-element-edit-overlay.d.ts +38 -0
- package/lib/types/models/chart-element-edit-overlay/index.d.ts +4 -0
- package/lib/types/models/chart-element-edit-overlay/palette.d.ts +2 -0
- package/lib/types/models/chart-element-edit-overlay/resolve-chart-element-hit-layout.d.ts +16 -0
- package/lib/types/models/chart-element-edit-overlay/types.d.ts +20 -0
- package/lib/types/models/chart-host-style.d.ts +35 -0
- package/lib/types/models/chart-model.d.ts +40 -31
- package/lib/types/models/chart-render-input-resolver.d.ts +13 -0
- package/lib/types/models/chart-render-model-manager.service.d.ts +26 -0
- package/lib/types/models/constants/build-in-theme/index.d.ts +12 -12
- package/lib/types/models/constants/build-in-theme/univer-gradient1.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer-gradient2.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer-gradient3.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer-gradient4.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer-gradient5.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer-gradient6.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer1.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer2.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer3.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer4.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer5.d.ts +1 -1
- package/lib/types/models/constants/build-in-theme/univer6.d.ts +1 -1
- package/lib/types/models/constants/default.d.ts +3 -1
- package/lib/types/models/echart-render-model.d.ts +37 -2
- package/lib/types/models/image-chart-host.d.ts +2 -1
- package/lib/types/models/mode-converter/mode-converter.d.ts +0 -2
- package/lib/types/models/mode-converter/render-spec-operators/legend-size.d.ts +2 -1
- package/lib/types/models/series-style/series-style-resolver.d.ts +9 -0
- package/lib/types/source/source-util.d.ts +1 -1
- package/lib/types/source/static-chart-source.d.ts +11 -3
- package/lib/types/types.d.ts +101 -37
- package/lib/types/util.d.ts +1 -1
- package/lib/types/wordcloud-chart/adapters/echarts/chart-view.d.ts +2 -2
- package/lib/types/wordcloud-chart/adapters/echarts/install.d.ts +2 -2
- package/lib/types/wordcloud-chart/adapters/echarts/layout-register.d.ts +2 -2
- package/lib/types/wordcloud-chart/adapters/echarts/series-model.d.ts +2 -2
- package/lib/types/wordcloud-chart/core/collision/box-shape-engine.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/collision/engine.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/collision/footprint.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/collision/glyph-shape-engine.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/collision/grid.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/layout/candidates.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/layout/layout-config.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/layout/layout.d.ts +1 -2
- package/lib/types/wordcloud-chart/core/layout/phases.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/layout/place-word.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/layout/placement-stats.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/layout/placement-types.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/layout/placement-word-manager.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/layout/runtime-mask.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/layout/word-prepare.d.ts +1 -1
- package/lib/types/wordcloud-chart/core/shape/shape-mask.d.ts +1 -1
- package/lib/types/wordcloud-chart/index.d.ts +3 -2
- package/lib/types/wordcloud-chart/types.d.ts +2 -0
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
- package/lib/types/wordcloud-chart/core/collision/types.d.ts +0 -1
- package/lib/types/wordcloud-chart/core/layout/types.d.ts +0 -1
- package/lib/types/wordcloud-chart/core/shape/types.d.ts +0 -1
- package/lib/types/wordcloud-chart/core/text/types.d.ts +0 -1
- package/lib/types/wordcloud-chart/core/types/option.d.ts +0 -1
- package/lib/types/wordcloud-chart/core/types/shape.d.ts +0 -1
- package/lib/types/wordcloud-chart/core/types/word.d.ts +0 -1
- package/lib/types/wordcloud-chart/echarts.d.ts +0 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IDisposable, Injector } from '@univerjs/core';
|
|
2
|
+
import type { ChartHostRenderMode, IChartInstance, IChartRenderInstance, IChartRenderInstanceCreateContext, IChartRenderModel, IChartRenderModelImageExportInput, IChartRenderModelImageExportOptions, IChartRenderModelImageExportResult } from '../types';
|
|
3
|
+
import { Disposable } from '@univerjs/core';
|
|
4
|
+
export interface IChartRenderModelManagerService extends IDisposable {
|
|
5
|
+
registerRenderModel(name: string, renderModel: IChartRenderModel): void;
|
|
6
|
+
setRenderModel(name: string): void;
|
|
7
|
+
getRenderModel(name?: string): IChartRenderModel | undefined;
|
|
8
|
+
getCurrentRenderModel(): IChartRenderModel;
|
|
9
|
+
createChartInstance(): IChartInstance;
|
|
10
|
+
createChartInstance(mode: ChartHostRenderMode, context?: IChartRenderInstanceCreateContext): IChartRenderInstance;
|
|
11
|
+
exportImage(input: IChartRenderModelImageExportInput, options?: IChartRenderModelImageExportOptions): Promise<IChartRenderModelImageExportResult>;
|
|
12
|
+
}
|
|
13
|
+
export declare const IChartRenderModelManagerService: import("@wendellhu/redi").IdentifierDecorator<IChartRenderModelManagerService>;
|
|
14
|
+
export declare class ChartRenderModelManagerService extends Disposable implements IChartRenderModelManagerService {
|
|
15
|
+
private readonly _renderModelMap;
|
|
16
|
+
private _currentRenderModel;
|
|
17
|
+
registerRenderModel(name: string, renderModel: IChartRenderModel): void;
|
|
18
|
+
setRenderModel(name: string): void;
|
|
19
|
+
getRenderModel(name?: string): IChartRenderModel | undefined;
|
|
20
|
+
getCurrentRenderModel(): IChartRenderModel;
|
|
21
|
+
createChartInstance(): IChartInstance;
|
|
22
|
+
createChartInstance(mode: ChartHostRenderMode, context?: IChartRenderInstanceCreateContext): IChartRenderInstance;
|
|
23
|
+
exportImage(input: IChartRenderModelImageExportInput, options?: IChartRenderModelImageExportOptions): Promise<IChartRenderModelImageExportResult>;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare function registerChartRenderModelManagerService(injector: Injector, defaultRenderModel?: IChartRenderModel): IChartRenderModelManagerService;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { themeDefault } from './default';
|
|
2
2
|
export { getThemeAxesByType, getThemeProps } from './theme-util';
|
|
3
3
|
export type { IEchartTheme } from './types';
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
4
|
+
export { UniverTheme1 } from './univer1';
|
|
5
|
+
export { UniverTheme2 } from './univer2';
|
|
6
|
+
export { UniverTheme3 } from './univer3';
|
|
7
|
+
export { UniverTheme4 } from './univer4';
|
|
8
|
+
export { UniverTheme5 } from './univer5';
|
|
9
|
+
export { UniverTheme6 } from './univer6';
|
|
10
|
+
export { UniverThemeGradient1 } from './univer-gradient1';
|
|
11
|
+
export { UniverThemeGradient2 } from './univer-gradient2';
|
|
12
|
+
export { UniverThemeGradient3 } from './univer-gradient3';
|
|
13
|
+
export { UniverThemeGradient4 } from './univer-gradient4';
|
|
14
|
+
export { UniverThemeGradient5 } from './univer-gradient5';
|
|
15
|
+
export { UniverThemeGradient6 } from './univer-gradient6';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverThemeGradient1: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverThemeGradient2: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverThemeGradient3: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverThemeGradient4: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverThemeGradient5: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverThemeGradient6: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverTheme1: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverTheme2: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverTheme3: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverTheme4: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverTheme5: IEchartTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IEchartTheme } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UniverTheme6: IEchartTheme;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type { ChartStyle } from '../../types';
|
|
1
2
|
export declare const EChartRenderEngineName = "EChartRenderEngine";
|
|
2
3
|
export declare const defaultChartWidth = 468;
|
|
3
4
|
export declare const defaultChartHeight = 369;
|
|
4
5
|
export declare const LegendPadding = 15;
|
|
5
6
|
export declare const TitleOrLegendPadding = 12;
|
|
6
7
|
export declare const TitleDefaultStartPosition = 8;
|
|
7
|
-
export declare const
|
|
8
|
+
export declare const DEFAULT_CHART_LAYOUT_PADDING = 14;
|
|
9
|
+
export declare function getChartLayoutPadding(style?: ChartStyle): number;
|
|
8
10
|
export declare const TitleLineHeightBase = 1.2;
|
|
9
11
|
export declare const AxisLabelMaxPercent = 0.15;
|
|
10
12
|
export declare const defaultBubbleSize = 0.12;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChartElementEventHandler, ChartElementEventType, ChartImageSource, ChartStyle, EChartInstance, EChartSpec, IChartConfig, IChartHostRect, IChartInstance, IChartRenderAsImageOptions, IChartRenderInstance, IChartRenderInstanceCreateContext, IChartRenderModel, IChartRenderModelImageExportInput, IChartRenderModelImageExportOptions, IChartRenderModelImageExportResult, IChartRenderModelStylizeInit, IChartRenderRuntimeOptions } from '../types';
|
|
2
2
|
import type { IWordCloudRenderConfig } from '../wordcloud-chart/word-cloud-render-config';
|
|
3
3
|
import { Disposable } from '@univerjs/core';
|
|
4
|
+
import { ChartHostRenderMode } from '../types';
|
|
4
5
|
export interface IEChartRenderModelOptions {
|
|
5
6
|
wordCloudRenderConfig?: IWordCloudRenderConfig;
|
|
6
7
|
}
|
|
@@ -22,20 +23,54 @@ export declare class EChartRenderModel extends Disposable implements IChartRende
|
|
|
22
23
|
stylizeSpec(spec: EChartSpec, stylizeInit: IChartRenderModelStylizeInit<EChartSpec>, rect: IChartHostRect): import("echarts").EChartsOption | {
|
|
23
24
|
backgroundColor: string;
|
|
24
25
|
};
|
|
26
|
+
exportImage(input: IChartRenderModelImageExportInput, options?: IChartRenderModelImageExportOptions): Promise<IChartRenderModelImageExportResult>;
|
|
25
27
|
}
|
|
26
28
|
export declare class EChartRenderEngine extends Disposable implements EChartInstance {
|
|
27
29
|
static engineName: string;
|
|
28
30
|
private _instance;
|
|
29
31
|
container: HTMLElement | string;
|
|
30
32
|
private _devicePixelRatio;
|
|
33
|
+
private _lastSpec;
|
|
34
|
+
private readonly _eventHandlers;
|
|
35
|
+
private readonly _nativeEventHandlers;
|
|
36
|
+
private readonly _nativeZrBlankEventHandlers;
|
|
37
|
+
private readonly _elementEditModeHandlers;
|
|
38
|
+
private _elementEditModeZrMouseMoveHandler;
|
|
39
|
+
private _elementEditModeZrClickHandler;
|
|
40
|
+
private _elementEditModeEnabled;
|
|
41
|
+
private _editOverlay;
|
|
42
|
+
private readonly _emittedElementEventKeys;
|
|
43
|
+
private _emittedElementEventKeysClearQueued;
|
|
31
44
|
constructor();
|
|
32
45
|
getDevicePixelRatio(): 1 | 2 | undefined;
|
|
33
46
|
mount(id: string | HTMLElement): void;
|
|
34
|
-
resize(
|
|
47
|
+
resize(echartsProviderOrOptions?: any | IChartRenderRuntimeOptions): void;
|
|
35
48
|
private _ensureChartInstance;
|
|
36
49
|
get containerElement(): HTMLElement | null;
|
|
37
50
|
render(spec: EChartSpec, echartsProviderOrOptions?: any | IChartRenderRuntimeOptions): void;
|
|
38
51
|
renderAsImage(spec: EChartSpec, options: IChartRenderAsImageOptions): Promise<ChartImageSource>;
|
|
52
|
+
on(type: ChartElementEventType, handler: ChartElementEventHandler): {
|
|
53
|
+
dispose: () => void;
|
|
54
|
+
};
|
|
55
|
+
setElementEditMode(enabled: boolean): void;
|
|
56
|
+
private _bindAllNativeEvents;
|
|
57
|
+
private _bindNativeEvent;
|
|
58
|
+
private _unbindNativeEvent;
|
|
59
|
+
private _bindNativeZrBlankEvent;
|
|
60
|
+
private _unbindNativeZrBlankEvent;
|
|
61
|
+
private _bindElementEditModeEvents;
|
|
62
|
+
private _unbindElementEditModeEvents;
|
|
63
|
+
private _emitChartElementEvent;
|
|
64
|
+
private _shouldSkipDuplicateElementEvent;
|
|
65
|
+
private _handleElementEditHover;
|
|
66
|
+
private _handleElementEditZrHover;
|
|
67
|
+
private _handleElementEditClick;
|
|
68
|
+
private _handleElementEditZrClick;
|
|
69
|
+
private _hideTooltip;
|
|
70
|
+
private _ensureEditOverlay;
|
|
71
|
+
private _removeEditOverlay;
|
|
72
|
+
private _clearHoverBorder;
|
|
73
|
+
private _clearFixedBorder;
|
|
39
74
|
exportImg(echartsProvider?: any): Promise<string>;
|
|
40
75
|
dispose(): void;
|
|
41
76
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ChartImageSource, IChartHostLease, IChartHostRect, IChartHostStyle, IImageChartHost } from '../types';
|
|
2
2
|
import { Disposable } from '@univerjs/core';
|
|
3
|
+
import { ChartHostRenderMode } from '../types';
|
|
3
4
|
export declare function chartImageSourceToDataUrl(image: ChartImageSource): string;
|
|
4
5
|
export declare abstract class ImageChartHost extends Disposable implements IImageChartHost {
|
|
5
6
|
readonly chartId: string;
|
|
6
|
-
readonly mode
|
|
7
|
+
readonly mode = ChartHostRenderMode.Image;
|
|
7
8
|
private readonly _offscreenChartHost;
|
|
8
9
|
constructor(chartId: string);
|
|
9
10
|
abstract getRect(): IChartHostRect | null;
|
|
@@ -2,7 +2,6 @@ import type { Injector } from '@univerjs/core';
|
|
|
2
2
|
import type { ChartTypeBits } from '../../enum';
|
|
3
3
|
import type { ChartStyle, IChartContext, IChartHostRect, IUniverDataSet } from '../../types';
|
|
4
4
|
import type { IChartLocaleTexts } from '../chart-locale-texts';
|
|
5
|
-
import { StaticChartSource } from '../../source/static-chart-source';
|
|
6
5
|
import { ChartModel } from '../chart-model';
|
|
7
6
|
/**
|
|
8
7
|
* The parameters for initializing a chart model.
|
|
@@ -53,7 +52,6 @@ export interface IChartModelInitParams {
|
|
|
53
52
|
isRowDirection?: boolean;
|
|
54
53
|
localeTexts?: IChartLocaleTexts;
|
|
55
54
|
}
|
|
56
|
-
export declare function generateChartModelContext(chartModel: ChartModel, dataSource: StaticChartSource): IChartContext;
|
|
57
55
|
/**
|
|
58
56
|
* Convert the initial data to a chart model.
|
|
59
57
|
* @param initJson The initial data of the chart model.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type SeriesStyleKeyInput = string | number | null | undefined;
|
|
2
|
+
export interface ISeriesStyleSource {
|
|
3
|
+
seriesId?: SeriesStyleKeyInput;
|
|
4
|
+
seriesIndex?: SeriesStyleKeyInput;
|
|
5
|
+
baseSeriesIndex?: SeriesStyleKeyInput;
|
|
6
|
+
}
|
|
7
|
+
export declare function getSeriesStyleKey(source: ISeriesStyleSource): string | undefined;
|
|
8
|
+
export declare function resolveSeriesStyle<T extends object>(seriesStyleMap: Partial<Record<string, T | undefined>> | undefined, source: ISeriesStyleSource, fallbackSources?: readonly ISeriesStyleSource[]): T | undefined;
|
|
9
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OptionDataValue } from '../types';
|
|
2
2
|
import { ChartSourceDataTypeEnum } from '../enum';
|
|
3
|
-
export declare function getCategoryData(source: OptionDataValue[][], categoryIndex: number,
|
|
3
|
+
export declare function getCategoryData(source: OptionDataValue[][], categoryIndex: number, sourceType?: ChartSourceDataTypeEnum[][]): {
|
|
4
4
|
categoryData: Array<OptionDataValue | undefined>;
|
|
5
5
|
isAllDateTime: boolean;
|
|
6
6
|
};
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import type { IUniverDataSet } from '../types';
|
|
2
2
|
import { BehaviorSubject } from 'rxjs';
|
|
3
3
|
import { ChartDataSource } from './chart-source';
|
|
4
|
+
/**
|
|
5
|
+
* Legacy static init data uses `dimensions` as the table header row and
|
|
6
|
+
* `source` as row-major table cells. StaticChartSource adapts that input to the
|
|
7
|
+
* canonical vector-based IUniverDataSet returned by convertDataSet().
|
|
8
|
+
*/
|
|
9
|
+
type ILegacyTableDataSet = IUniverDataSet;
|
|
4
10
|
export declare class StaticChartSource extends ChartDataSource {
|
|
5
11
|
_canSwitchOrient$: BehaviorSubject<boolean>;
|
|
6
|
-
private
|
|
12
|
+
private _rawDataSet;
|
|
13
|
+
private _convertedDataSetCache;
|
|
7
14
|
constructor();
|
|
8
|
-
initData(data:
|
|
9
|
-
setData(data:
|
|
15
|
+
initData(data: ILegacyTableDataSet, isRowDirection?: boolean): void;
|
|
16
|
+
setData(data: ILegacyTableDataSet): void;
|
|
10
17
|
updateIsRowDirection(flag: boolean): void;
|
|
11
18
|
refresh(): void;
|
|
12
19
|
convertDataSet(): IUniverDataSet;
|
|
13
20
|
dispose(): void;
|
|
14
21
|
}
|
|
22
|
+
export {};
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IDisposable, Nullable } from '@univerjs/core';
|
|
2
2
|
import type { Observable } from 'rxjs';
|
|
3
3
|
import type { AreaLineStyle, AxisAlignEnum, AxisValueType, CategoryType, ChartBorderDashType, ChartSourceDataTypeEnum, ChartTrendlineType, ChartTypeBits, DataOrientation, InvalidValueType, IRuntimeAxisPosition, IRuntimeAxisPriority, LabelAlignEnum, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, RelationChartLayoutEnum, SelectModeEnum, SeriesLabelPosition, TitlePositionEnum, WaterfallSeriesTypeEnum, WaterfallStackTypeEnum, WordCloudShapeEnum } from './enum';
|
|
4
|
+
import type { ICartesianPointData } from './models/chart-data-operators/cartesian-point-data';
|
|
4
5
|
import type { IChartLocaleTexts } from './models/chart-locale-texts';
|
|
5
6
|
import type { IEchartTheme } from './models/constants/build-in-theme';
|
|
6
7
|
import type { BarSeriesOption } from './utils/echarts';
|
|
@@ -28,6 +29,17 @@ export type DimensionDefinitionLoose = IDimensionDefinition['name'] | IDimension
|
|
|
28
29
|
export type OptionDataValue = string | number | Date | null | undefined;
|
|
29
30
|
export type ChartDataSourceValue = OptionDataValue;
|
|
30
31
|
export type ChartDataSourceValues = ChartDataSourceValue[][];
|
|
32
|
+
/**
|
|
33
|
+
* Canonical chart dataset used by chart context operators and chart-data builders.
|
|
34
|
+
*
|
|
35
|
+
* Adapters must normalize their raw input before exposing this shape:
|
|
36
|
+
* - `dimensions[index]` is the optional header label for `source[index]`.
|
|
37
|
+
* - `source[index]` is one logical data vector, already oriented by the adapter.
|
|
38
|
+
* - `sourceType` and `sourceLabels`, when present, have the same vector shape as `source`.
|
|
39
|
+
*
|
|
40
|
+
* Category detection reads from `source` vectors only. `dimensions` must not be
|
|
41
|
+
* used as a fallback category vector.
|
|
42
|
+
*/
|
|
31
43
|
export interface IUniverDataSet {
|
|
32
44
|
source: OptionDataValue[][];
|
|
33
45
|
dimensions: Array<DimensionDefinitionLoose>;
|
|
@@ -49,15 +61,15 @@ export interface IChartContext {
|
|
|
49
61
|
categoryIndex?: number;
|
|
50
62
|
seriesIndexes?: number[];
|
|
51
63
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
scatterXIndex?: number;
|
|
65
|
+
scatterYIndex?: number;
|
|
66
|
+
scatterLabelIndex?: number;
|
|
67
|
+
bubbleSizeIndex?: number;
|
|
68
|
+
bubbleSeriesIndex?: number;
|
|
57
69
|
}
|
|
58
70
|
export interface IRelationNodes {
|
|
59
71
|
id: string;
|
|
60
|
-
category
|
|
72
|
+
category?: string;
|
|
61
73
|
name: string;
|
|
62
74
|
value: number;
|
|
63
75
|
symbolSize?: number;
|
|
@@ -80,34 +92,7 @@ export interface IChartData {
|
|
|
80
92
|
* the dataset of the chart, it should match echart dataset option
|
|
81
93
|
*/
|
|
82
94
|
dataset?: IUniverDataSet;
|
|
83
|
-
|
|
84
|
-
bubbleSizeData?: {
|
|
85
|
-
id: string;
|
|
86
|
-
name: string;
|
|
87
|
-
items: IChartDataItem[];
|
|
88
|
-
};
|
|
89
|
-
bubbleXData?: {
|
|
90
|
-
id: string;
|
|
91
|
-
name: string;
|
|
92
|
-
items: IChartDataItem[];
|
|
93
|
-
};
|
|
94
|
-
bubbleYData?: {
|
|
95
|
-
id: string;
|
|
96
|
-
name: string;
|
|
97
|
-
items: IChartDataItem[];
|
|
98
|
-
};
|
|
99
|
-
bubbleLabelData?: {
|
|
100
|
-
id: string;
|
|
101
|
-
name: string;
|
|
102
|
-
items: IChartDataItem[];
|
|
103
|
-
};
|
|
104
|
-
bubbleSeriesData?: {
|
|
105
|
-
id: string;
|
|
106
|
-
name: string;
|
|
107
|
-
items: IChartDataItem[];
|
|
108
|
-
};
|
|
109
|
-
isValidateBubbleSource?: boolean;
|
|
110
|
-
};
|
|
95
|
+
cartesianPoint?: ICartesianPointData;
|
|
111
96
|
heatmapData?: {
|
|
112
97
|
xData: string[];
|
|
113
98
|
yData: string[];
|
|
@@ -167,6 +152,8 @@ export interface IChartRuntimeContext {
|
|
|
167
152
|
axes: IRuntimeAxis[];
|
|
168
153
|
themeInfo: IEchartTheme;
|
|
169
154
|
wordCloudRenderConfig?: IWordCloudRenderConfig;
|
|
155
|
+
/** Runtime-only extra inset reserved by host adapters around chart content. */
|
|
156
|
+
layoutInset?: number;
|
|
170
157
|
/**
|
|
171
158
|
* The function to transform the color to the render color with considering the system theme is dark mode or not.
|
|
172
159
|
* @param {string} color - The color to be rendered.
|
|
@@ -326,6 +313,8 @@ export interface IChartStyle {
|
|
|
326
313
|
trendlines: ITrendLine[];
|
|
327
314
|
pie: {
|
|
328
315
|
doughnutHole: Nullable<number>;
|
|
316
|
+
/** Slice offset as a ratio of the pie radius. */
|
|
317
|
+
explosion?: number;
|
|
329
318
|
labelStyle: IPieLabelStyle;
|
|
330
319
|
borderColor: string;
|
|
331
320
|
hasPaddingAngle: boolean;
|
|
@@ -375,6 +364,7 @@ export interface IChartStyle {
|
|
|
375
364
|
pareto: {
|
|
376
365
|
lineStyle: ISeriesStyle;
|
|
377
366
|
barStyle: ISeriesStyle;
|
|
367
|
+
includeZeroValues?: boolean;
|
|
378
368
|
};
|
|
379
369
|
heatmap: {
|
|
380
370
|
visualMapType: 'continuous' | 'piecewise';
|
|
@@ -413,10 +403,19 @@ export interface IChartRenderSpecConverter<ChartRenderSpec = Record<string, any>
|
|
|
413
403
|
}
|
|
414
404
|
export type ChartConfigInterceptor = (config: IChartConfig) => IChartConfig;
|
|
415
405
|
export type RenderSpecOperator<ChartRenderSpec> = (spec: ChartRenderSpec, style: ChartStyle, config: IChartConfig, instance: IChartInstance) => void;
|
|
416
|
-
export
|
|
406
|
+
export declare enum ChartHostRenderMode {
|
|
407
|
+
Image = "image",
|
|
408
|
+
Dom = "dom"
|
|
409
|
+
}
|
|
410
|
+
export interface IChartHostBorderStyle {
|
|
411
|
+
color?: string;
|
|
412
|
+
width?: number;
|
|
413
|
+
}
|
|
417
414
|
export interface IChartHostStyle {
|
|
418
415
|
stroke?: string;
|
|
419
416
|
fill?: string;
|
|
417
|
+
border?: IChartHostBorderStyle;
|
|
418
|
+
radius?: number;
|
|
420
419
|
[key: string]: any;
|
|
421
420
|
}
|
|
422
421
|
export interface IChartHostLease extends IDisposable {
|
|
@@ -429,7 +428,7 @@ export interface IChartHost extends IDisposable {
|
|
|
429
428
|
setStyle(style: IChartHostStyle): void;
|
|
430
429
|
}
|
|
431
430
|
export interface IImageChartHost extends IChartHost {
|
|
432
|
-
readonly mode:
|
|
431
|
+
readonly mode: ChartHostRenderMode.Image;
|
|
433
432
|
nextVersion(): number;
|
|
434
433
|
commitSnapshot(image: ChartImageSource, version: number): boolean;
|
|
435
434
|
requestPaint(): void;
|
|
@@ -437,7 +436,7 @@ export interface IImageChartHost extends IChartHost {
|
|
|
437
436
|
acquireOffscreenHost(rect: IChartHostRect): IChartHostLease;
|
|
438
437
|
}
|
|
439
438
|
export interface IDomChartHost extends IChartHost {
|
|
440
|
-
readonly mode:
|
|
439
|
+
readonly mode: ChartHostRenderMode.Dom;
|
|
441
440
|
ensureMount(): Promise<HTMLElement | null>;
|
|
442
441
|
checkMounted(): boolean;
|
|
443
442
|
syncLayout(): void;
|
|
@@ -449,11 +448,28 @@ export interface IChartRenderInput {
|
|
|
449
448
|
config: IChartConfig;
|
|
450
449
|
style: ChartStyle;
|
|
451
450
|
}
|
|
451
|
+
export interface IChartRenderModelImageExportInput extends IChartRenderInput {
|
|
452
|
+
width: number;
|
|
453
|
+
height: number;
|
|
454
|
+
}
|
|
455
|
+
export interface IChartRenderModelImageExportOptions {
|
|
456
|
+
pixelRatio?: number;
|
|
457
|
+
backgroundColor?: string | null;
|
|
458
|
+
}
|
|
459
|
+
export interface IChartRenderModelImageExportResult {
|
|
460
|
+
dataUrl: string;
|
|
461
|
+
width: number;
|
|
462
|
+
height: number;
|
|
463
|
+
pixelRatio: number;
|
|
464
|
+
}
|
|
452
465
|
export interface IChartRenderInstance extends IDisposable {
|
|
453
466
|
readonly mode: ChartHostRenderMode;
|
|
454
467
|
bind(host: IChartHost): void;
|
|
455
468
|
render(input: IChartRenderInput): Promise<void>;
|
|
469
|
+
exportImg(): Promise<string | undefined>;
|
|
456
470
|
resize(): void;
|
|
471
|
+
on(type: ChartElementEventType, handler: ChartElementEventHandler): IDisposable;
|
|
472
|
+
setElementEditMode(enabled: boolean): void;
|
|
457
473
|
}
|
|
458
474
|
export interface IChartRenderInstanceStyleInput<Spec = Record<string, any>> extends IChartRenderInput {
|
|
459
475
|
mode: ChartHostRenderMode;
|
|
@@ -478,6 +494,7 @@ export interface IChartRenderModelStylizeInit<Spec> {
|
|
|
478
494
|
export interface IChartRenderModel<Spec extends Record<string, any> = Record<string, any>> extends IDisposable {
|
|
479
495
|
toSpec(chartConfig: IChartConfig, style: ChartStyle): Spec;
|
|
480
496
|
stylizeSpec(spec: Spec, stylizeInit: IChartRenderModelStylizeInit<Spec>, rect: IChartHostRect): Spec;
|
|
497
|
+
exportImage(input: IChartRenderModelImageExportInput, options?: IChartRenderModelImageExportOptions): Promise<IChartRenderModelImageExportResult>;
|
|
481
498
|
updateWatermark(addWatermark: boolean): void;
|
|
482
499
|
createChartInstance(): IChartInstance<Spec>;
|
|
483
500
|
createChartInstance(mode: ChartHostRenderMode, context?: IChartRenderInstanceCreateContext<Spec>): IChartRenderInstance;
|
|
@@ -515,13 +532,60 @@ export interface IChartRenderAsImageOptions {
|
|
|
515
532
|
export interface IChartRenderRuntimeOptions {
|
|
516
533
|
echartsProvider?: any;
|
|
517
534
|
chartId?: string;
|
|
535
|
+
width?: number;
|
|
536
|
+
height?: number;
|
|
537
|
+
}
|
|
538
|
+
export type ChartElementKind = 'blank' | 'chartArea' | 'title' | 'subtitle' | 'xAxisTitle' | 'yAxisTitle' | 'rightYAxisTitle' | 'xAxisLabel' | 'yAxisLabel' | 'rightYAxisLabel' | 'xAxisLine' | 'yAxisLine' | 'rightYAxisLine' | 'gridLine' | 'tick' | 'legend' | 'legendItem' | 'mark' | 'series' | 'dataPoint' | 'dataLabel';
|
|
539
|
+
export interface IChartElementBounds {
|
|
540
|
+
left: number;
|
|
541
|
+
top: number;
|
|
542
|
+
right: number;
|
|
543
|
+
bottom: number;
|
|
544
|
+
}
|
|
545
|
+
export interface IChartElementOverlay {
|
|
546
|
+
type: 'rect' | 'circle' | 'polyline' | 'polygon' | 'sector';
|
|
547
|
+
bounds: IChartElementBounds;
|
|
548
|
+
shape?: Record<string, any>;
|
|
549
|
+
padding?: number;
|
|
550
|
+
items?: IChartElementOverlay[];
|
|
551
|
+
}
|
|
552
|
+
export interface IChartElementHit {
|
|
553
|
+
kind: ChartElementKind;
|
|
554
|
+
bounds?: IChartElementBounds;
|
|
555
|
+
overlay?: IChartElementOverlay;
|
|
556
|
+
axisId?: 'xAxis' | 'yAxis' | 'rightYAxis';
|
|
557
|
+
axisIndex?: number;
|
|
558
|
+
axisPosition?: 'top' | 'right' | 'bottom' | 'left';
|
|
559
|
+
legendIndex?: number;
|
|
560
|
+
legendName?: string;
|
|
561
|
+
seriesIndex?: number;
|
|
562
|
+
seriesId?: string;
|
|
563
|
+
seriesName?: string;
|
|
564
|
+
dataIndex?: number;
|
|
565
|
+
baseSeriesIndex?: string;
|
|
566
|
+
waterfallSeriesType?: WaterfallSeriesTypeEnum;
|
|
567
|
+
}
|
|
568
|
+
export type ChartElementEventType = 'click' | 'dblclick' | 'pointerdown' | 'pointerup' | 'pointermove' | 'pointerenter' | 'pointerleave';
|
|
569
|
+
export interface IChartElementEvent {
|
|
570
|
+
type: ChartElementEventType;
|
|
571
|
+
hit: IChartElementHit;
|
|
572
|
+
localPoint: {
|
|
573
|
+
x: number;
|
|
574
|
+
y: number;
|
|
575
|
+
};
|
|
576
|
+
button?: number;
|
|
577
|
+
nativeEvent?: Event;
|
|
578
|
+
preventDefault?(): void;
|
|
518
579
|
}
|
|
580
|
+
export type ChartElementEventHandler = (event: IChartElementEvent) => void;
|
|
519
581
|
export interface IChartInstance<Spec = Record<string, any>> extends IDisposable {
|
|
520
582
|
container: HTMLElement | string;
|
|
521
583
|
mount(id: string | HTMLElement): void;
|
|
522
584
|
render(spec: Spec, echartsProvider?: any): void;
|
|
523
585
|
render(spec: Spec, options?: IChartRenderRuntimeOptions): void;
|
|
524
586
|
renderAsImage(spec: Spec, options: IChartRenderAsImageOptions): Promise<ChartImageSource>;
|
|
587
|
+
on(type: ChartElementEventType, handler: ChartElementEventHandler): IDisposable;
|
|
588
|
+
setElementEditMode(enabled: boolean): void;
|
|
525
589
|
exportImg(): Promise<string>;
|
|
526
590
|
resize(): void;
|
|
527
591
|
}
|
package/lib/types/util.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const chartBitsUtils: {
|
|
|
3
3
|
has(bit: number, attribute: number): boolean;
|
|
4
4
|
baseOn(bit: number, base: number): boolean;
|
|
5
5
|
remove(bit: number, attribute: number): number;
|
|
6
|
-
chartBitToString(bit: ChartTypeBits): "" | "line" | "
|
|
6
|
+
chartBitToString(bit: ChartTypeBits): "" | "line" | "bar" | "wordCloud" | "scatter" | "pie" | "radar" | "graph" | "funnel" | "sankey" | "boxplot" | "heatmap" | "combination";
|
|
7
7
|
};
|
|
8
8
|
export declare const setProperty: (data: Record<string, any>, propertyPath: string, value: any) => void;
|
|
9
9
|
export declare const getProperty: <T = any>(data: Record<string, any> | undefined, propertyPath: string) => T | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { echarts
|
|
1
|
+
import type { echarts } from '../../../utils/echarts';
|
|
2
2
|
import { WORD_CLOUD_SERIES_TYPE } from './echarts-options';
|
|
3
3
|
export interface IRegisterWordCloudChartViewContext {
|
|
4
4
|
createTextElement(layout: any, data: any, dataIndex: number, seriesModel: any): unknown;
|
|
5
5
|
}
|
|
6
|
-
export declare function registerWordCloudChartView(
|
|
6
|
+
export declare function registerWordCloudChartView(echartsInstance: typeof echarts, context: IRegisterWordCloudChartViewContext): void;
|
|
7
7
|
export { WORD_CLOUD_SERIES_TYPE };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { echarts
|
|
1
|
+
import type { echarts } from '../../../utils/echarts';
|
|
2
2
|
import type { IWordCloudEChartsSeriesOption } from '../../types';
|
|
3
|
-
export declare function registerWordCloudChart(
|
|
3
|
+
export declare function registerWordCloudChart(echartsInstance: typeof echarts): typeof echarts;
|
|
4
4
|
export declare function waitForWordCloudImageResourcesReady(spec: unknown, timeout?: number): Promise<void>;
|
|
5
5
|
export type { IWordCloudEChartsSeriesOption };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { echarts
|
|
1
|
+
import type { echarts } from '../../../utils/echarts';
|
|
2
2
|
import { WORD_CLOUD_SERIES_TYPE } from './echarts-options';
|
|
3
3
|
export type PerformWordCloudSeriesLayout = (seriesModel: unknown, ecModel: unknown, api: unknown) => void;
|
|
4
|
-
export declare function registerWordCloudLayout(
|
|
4
|
+
export declare function registerWordCloudLayout(echartsInstance: typeof echarts, performSeriesLayout: PerformWordCloudSeriesLayout): void;
|
|
5
5
|
export { WORD_CLOUD_SERIES_TYPE };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { echarts
|
|
1
|
+
import type { echarts } from '../../../utils/echarts';
|
|
2
2
|
import { WORD_CLOUD_DEFAULT_OPTION, WORD_CLOUD_SERIES_TYPE } from './echarts-options';
|
|
3
3
|
export interface IWordCloudEChartsHelper {
|
|
4
4
|
createDimensions(data: any[], options: Record<string, unknown>): any;
|
|
5
5
|
}
|
|
6
|
-
export declare function registerWordCloudSeriesModel(
|
|
6
|
+
export declare function registerWordCloudSeriesModel(echartsInstance: typeof echarts, helper: IWordCloudEChartsHelper): void;
|
|
7
7
|
export { WORD_CLOUD_DEFAULT_OPTION, WORD_CLOUD_SERIES_TYPE };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IWordCloudEncodedWord } from '../../types';
|
|
2
|
-
import type { IBoxFootprint, IWordCloudLayoutGrid } from '../layout
|
|
2
|
+
import type { IBoxFootprint, IWordCloudLayoutGrid } from '../types/layout';
|
|
3
3
|
import type { ICollisionCandidate, ICollisionEngine, ICollisionEngineStats, ICollisionTextStyle } from './engine';
|
|
4
4
|
export declare class BoxShapeEngine implements ICollisionEngine<IBoxFootprint> {
|
|
5
5
|
private readonly _grid;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IWordCloudBounds, IWordCloudClipMask, IWordCloudEncodedWord, IWordCloudTextMeasurer, IWordCloudTextSprite } from '../../types';
|
|
2
|
-
import type { IWordCloudLayoutGrid } from '../layout
|
|
2
|
+
import type { IWordCloudLayoutGrid } from '../types/layout';
|
|
3
3
|
export type WordCloudCollisionShape = 'box' | 'glyph';
|
|
4
4
|
export type WordCloudRejectReason = 'collision' | 'shape';
|
|
5
5
|
export interface ICollisionEngineStats {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IWordCloudBounds, IWordCloudMeasureResult } from '../../types';
|
|
2
|
-
import type { IBoxFootprint, IWordCloudLayoutGrid } from '
|
|
2
|
+
import type { IBoxFootprint, IWordCloudLayoutGrid } from '../types/layout';
|
|
3
3
|
export interface IBoxTightTextBox {
|
|
4
4
|
readonly width: number;
|
|
5
5
|
readonly height: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IWordCloudBounds, IWordCloudClipMask, IWordCloudEncodedWord, IWordCloudTextMeasurer } from '../../types';
|
|
2
|
-
import type { IWordCloudLayoutGrid } from '../layout
|
|
2
|
+
import type { IWordCloudLayoutGrid } from '../types/layout';
|
|
3
3
|
import type { IPixelBitsetSprite } from './bitset-board';
|
|
4
4
|
import type { ICollisionCandidate, ICollisionEngine, ICollisionFootprint, ICollisionTextStyle } from './engine';
|
|
5
5
|
interface IPixelSpan {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IBoxFootprint, IWordCloudLayoutGrid } from '
|
|
1
|
+
import type { IBoxFootprint, IWordCloudLayoutGrid } from '../types/layout';
|
|
2
2
|
export declare function createWordCloudGrid(width: number, height: number, cellSize: number): IWordCloudLayoutGrid;
|
|
3
3
|
export declare function getCellCenter(grid: IWordCloudLayoutGrid, index: number): {
|
|
4
4
|
row: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ICollisionCandidate } from '../collision/engine';
|
|
2
2
|
import type { IWordCloudShapeProfile } from '../shape/shape-profile';
|
|
3
|
+
import type { IPreparedWordCloudWord, IWordCloudLayoutConfig, IWordCloudLayoutGrid, IWordCloudLayoutRuntime } from '../types/layout';
|
|
3
4
|
import type { IWordCloudPlacementContext } from './placement-types';
|
|
4
|
-
import type { IPreparedWordCloudWord, IWordCloudLayoutConfig, IWordCloudLayoutGrid, IWordCloudLayoutRuntime } from './types';
|
|
5
5
|
export interface IEnumerateCandidatePointsOptions {
|
|
6
6
|
readonly grid: IWordCloudLayoutGrid;
|
|
7
7
|
readonly shapeGrid: Uint8Array;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { IWordCloudLayoutOptions } from '../../types';
|
|
2
|
-
import type { IWordCloudLayoutConfig } from '
|
|
2
|
+
import type { IWordCloudLayoutConfig } from '../types/layout';
|
|
3
3
|
export declare function resolveWordCloudLayoutConfig(options: IWordCloudLayoutOptions): IWordCloudLayoutConfig;
|