@univerjs-pro/engine-chart 0.25.1 → 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/enum.d.ts +3 -0
- package/lib/types/index.d.ts +23 -20
- package/lib/types/{model → models}/chart-data-operators/operators.d.ts +6 -10
- package/lib/types/{model → models}/chart-model.d.ts +152 -115
- package/lib/types/models/chart-runtime-axes.d.ts +38 -0
- package/lib/types/models/chart-runtime-style.d.ts +12 -0
- package/lib/types/{model → models}/constants/default-chart-style.d.ts +4 -2
- package/lib/types/{model → models}/echart-render-model.d.ts +6 -1
- package/lib/types/models/mode-converter/converters/word-cloud-converter.d.ts +2 -0
- package/lib/types/{model → models}/mode-converter/mode-converter.d.ts +2 -2
- package/lib/types/models/mode-converter/render-spec-operators/implicit-category-axis.operator.d.ts +2 -0
- package/lib/types/{model → models}/mode-converter/render-spec-operators/index.d.ts +2 -0
- package/lib/types/models/mode-converter/render-spec-operators/legend-size.d.ts +2 -0
- package/lib/types/models/mode-converter/render-spec-operators/rtl-render-spec.operator.d.ts +2 -0
- package/lib/types/models/mode-converter/render-spec-operators/tool-tip-operator.d.ts +37 -0
- package/lib/types/models/mode-converter/render-spec-operators/tool-tip-renderer.d.ts +15 -0
- package/lib/types/{model → models}/word-cloud-musk-image.service.d.ts +1 -1
- package/lib/types/source/option-data-value.d.ts +3 -0
- package/lib/types/source/source-util.d.ts +2 -2
- package/lib/types/source/static-chart-source.d.ts +1 -0
- package/lib/types/types.d.ts +21 -8
- package/lib/types/util.d.ts +2 -1
- package/lib/types/utils/echarts.d.ts +3 -2
- package/lib/types/word-cloud-resource/word-cloud-shape-resource.d.ts +5 -0
- package/lib/types/wordcloud-chart/adapters/echarts/chart-view.d.ts +7 -0
- package/lib/types/wordcloud-chart/adapters/echarts/echarts-options.d.ts +24 -0
- package/lib/types/wordcloud-chart/adapters/echarts/install.d.ts +4 -0
- package/lib/types/wordcloud-chart/adapters/echarts/layout-register.d.ts +5 -0
- package/lib/types/wordcloud-chart/adapters/echarts/layout.d.ts +82 -0
- package/lib/types/wordcloud-chart/adapters/echarts/render-config.d.ts +57 -0
- package/lib/types/wordcloud-chart/adapters/echarts/series-model.d.ts +7 -0
- package/lib/types/wordcloud-chart/adapters/echarts/text-measurer.d.ts +12 -0
- package/lib/types/wordcloud-chart/adapters/echarts/words.d.ts +47 -0
- package/lib/types/wordcloud-chart/canvas.d.ts +8 -0
- package/lib/types/wordcloud-chart/core/collision/bitset-board.d.ts +45 -0
- package/lib/types/wordcloud-chart/core/collision/box-shape-engine.d.ts +31 -0
- package/lib/types/wordcloud-chart/core/collision/engine.d.ts +67 -0
- package/lib/types/wordcloud-chart/core/collision/failure-cache.d.ts +6 -0
- package/lib/types/wordcloud-chart/core/collision/footprint.d.ts +13 -0
- package/lib/types/wordcloud-chart/core/collision/glyph-shape-engine.d.ts +49 -0
- package/lib/types/wordcloud-chart/core/collision/grid.d.ts +10 -0
- package/lib/types/wordcloud-chart/core/collision/types.d.ts +1 -0
- package/lib/types/wordcloud-chart/core/layout/candidates.d.ts +15 -0
- package/lib/types/wordcloud-chart/core/layout/font-scale.d.ts +66 -0
- package/lib/types/wordcloud-chart/core/layout/layout-config.d.ts +3 -0
- package/lib/types/wordcloud-chart/core/layout/layout.d.ts +4 -0
- package/lib/types/wordcloud-chart/core/layout/phases.d.ts +12 -0
- package/lib/types/wordcloud-chart/core/layout/place-word.d.ts +12 -0
- package/lib/types/wordcloud-chart/core/layout/placement-stats.d.ts +7 -0
- package/lib/types/wordcloud-chart/core/layout/placement-types.d.ts +28 -0
- package/lib/types/wordcloud-chart/core/layout/placement-word-manager.d.ts +23 -0
- package/lib/types/wordcloud-chart/core/layout/rotation.d.ts +10 -0
- package/lib/types/wordcloud-chart/core/layout/runtime-mask.d.ts +6 -0
- package/lib/types/wordcloud-chart/core/layout/search-plan.d.ts +51 -0
- package/lib/types/wordcloud-chart/core/layout/types.d.ts +1 -0
- package/lib/types/wordcloud-chart/core/layout/word-prepare.d.ts +3 -0
- package/lib/types/wordcloud-chart/core/layout/word-shrink.d.ts +39 -0
- package/lib/types/wordcloud-chart/core/random/seed.d.ts +3 -0
- package/lib/types/wordcloud-chart/core/shape/built-in-shapes.d.ts +14 -0
- package/lib/types/wordcloud-chart/core/shape/shape-mask.d.ts +12 -0
- package/lib/types/wordcloud-chart/core/shape/shape-profile.d.ts +20 -0
- package/lib/types/wordcloud-chart/core/shape/sprite-shape.d.ts +19 -0
- package/lib/types/wordcloud-chart/core/shape/types.d.ts +1 -0
- package/lib/types/wordcloud-chart/core/text/formatter.d.ts +2 -0
- package/lib/types/wordcloud-chart/core/text/measure.d.ts +8 -0
- package/lib/types/wordcloud-chart/core/text/normalize.d.ts +2 -0
- package/lib/types/wordcloud-chart/core/text/sprite.d.ts +17 -0
- package/lib/types/wordcloud-chart/core/text/types.d.ts +1 -0
- package/lib/types/wordcloud-chart/core/types/layout.d.ts +81 -0
- package/lib/types/wordcloud-chart/core/types/option.d.ts +1 -0
- package/lib/types/wordcloud-chart/core/types/shape.d.ts +1 -0
- package/lib/types/wordcloud-chart/core/types/word.d.ts +1 -0
- package/lib/types/wordcloud-chart/defaults.d.ts +70 -0
- package/lib/types/wordcloud-chart/echarts.d.ts +2 -0
- package/lib/types/wordcloud-chart/index.d.ts +11 -0
- package/lib/types/wordcloud-chart/types.d.ts +339 -0
- package/lib/types/wordcloud-chart/word-cloud-render-config.d.ts +30 -0
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
- package/lib/types/model/mode-converter/converters/word-cloud-converter.d.ts +0 -76
- package/lib/types/model/mode-converter/render-spec-operators/tool-tip-operator.d.ts +0 -3
- /package/lib/types/{model → models}/chart-data-operators/build-chart-data.d.ts +0 -0
- /package/lib/types/{model → models}/chart-data-operators/index.d.ts +0 -0
- /package/lib/types/{model → models}/chart-locale-texts.d.ts +0 -0
- /package/lib/types/{model → models}/chart-theme.service.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/default.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/index.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/theme-util.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/types.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer-gradient1.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer-gradient2.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer-gradient3.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer-gradient4.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer-gradient5.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer-gradient6.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer1.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer2.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer3.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer4.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer5.d.ts +0 -0
- /package/lib/types/{model → models}/constants/build-in-theme/univer6.d.ts +0 -0
- /package/lib/types/{model → models}/constants/default.d.ts +0 -0
- /package/lib/types/{model → models}/data-context-transformers/bar-data-context-transformer.d.ts +0 -0
- /package/lib/types/{model → models}/data-context-transformers/box-plot-data-context-transformer.d.ts +0 -0
- /package/lib/types/{model → models}/data-context-transformers/line-like-context-transformer.d.ts +0 -0
- /package/lib/types/{model → models}/data-context-transformers/pareto-data-context-transformer.d.ts +0 -0
- /package/lib/types/{model → models}/data-context-transformers/percent-data-context-transformer.d.ts +0 -0
- /package/lib/types/{model → models}/data-context-transformers/pie-data-context-transformer.d.ts +0 -0
- /package/lib/types/{model → models}/data-context-transformers/word-cloud-data-context-transform.d.ts +0 -0
- /package/lib/types/{model → models}/echart-to-chart-model-init.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/boxplot-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/bubble-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/combination-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/constants.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/funnel-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/heatmap-chart-convert.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/pareto-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/pie-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/radar-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/relation-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/sankey-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/scatter-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/tools.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/converters/waterfall-chart-converter.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/axis-title.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/bubble-style.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/chart-axes.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/chart-box-style.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/empty-style-operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/font-size.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/grid-operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/heatmap-chart-operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/hover-mark-style.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/invalid-value-style.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/legend-style.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/line-like-style.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/operator-types.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/pie-style.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/radar-style.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/relation-chart-operator/relation-chart-operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/relation-chart-operator/relation-force-directed-layout.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/sankey-chart-operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/scatter-style.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/series-style-operator/pareto-series-style.handler.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/series-style-operator/series-chart-style.handler.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/series-style-operator/series-data-label.handler.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/series-style-operator/series-style-operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/series-style-operator/waterfall-series-style-operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/stack.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/theme.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/title-style.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/tools.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/trend-line/trend-line.operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/trend-line/trendline-util.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/visual-map-operator.d.ts +0 -0
- /package/lib/types/{model → models}/mode-converter/render-spec-operators/watermark.operator.d.ts +0 -0
- /package/lib/types/{model → models}/spec-converter/spec-converter.d.ts +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ChartStyle, IChartContext, IRuntimeAxis } from '../types';
|
|
2
|
+
import { ChartTypeBits } from '../enum';
|
|
3
|
+
export interface IGetChartRuntimeAxesParams {
|
|
4
|
+
chartType: ChartTypeBits;
|
|
5
|
+
context?: Pick<IChartContext, 'categoryIndex' | 'seriesIndexes'>;
|
|
6
|
+
style?: ChartStyle;
|
|
7
|
+
direction?: ChartStyle['direction'];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Builds the transient axis model consumed by chart converters.
|
|
11
|
+
*
|
|
12
|
+
* Persisted `ChartStyle` axis options are semantic buckets, while converters and
|
|
13
|
+
* style operators consume axes by physical `position`, value `type`, and runtime
|
|
14
|
+
* `priority`. This function centralizes the mapping from chart type, data
|
|
15
|
+
* context, per-series secondary-axis switches, and document direction. The
|
|
16
|
+
* returned priorities are runtime-only roles and should not be treated as the
|
|
17
|
+
* persisted `yAxis` / `rightYAxis` bucket names.
|
|
18
|
+
*
|
|
19
|
+
* Cases handled here:
|
|
20
|
+
* - Heatmap always returns two text axes because both dimensions come from
|
|
21
|
+
* `heatmapData`; the vertical axis is left in LTR and right in RTL, while the
|
|
22
|
+
* bottom axis remains text.
|
|
23
|
+
* - Horizontal bar charts use a vertical primary category axis, left in LTR and
|
|
24
|
+
* right in RTL, plus a numeric bottom axis. If the normal source context has
|
|
25
|
+
* no category, the category axis is still kept so ECharts can use implicit
|
|
26
|
+
* row-index categories and every cartesian series has both axes.
|
|
27
|
+
* - Scatter and bubble charts use a numeric bottom axis instead of a category
|
|
28
|
+
* bottom axis. Their vertical value axis still follows the normal RTL and
|
|
29
|
+
* secondary-axis visibility rules.
|
|
30
|
+
* - Other vertical category/value charts use a bottom text axis when a category
|
|
31
|
+
* exists. Their left/right value axes are derived from
|
|
32
|
+
* `allSeriesStyle.rightYAxis` and `seriesStyleMap[*].rightYAxis`; RTL merges
|
|
33
|
+
* `RTLChartStyle` first so the default value axis is physical right unless a
|
|
34
|
+
* user override brings the left axis back.
|
|
35
|
+
* - Pareto keeps its Excel-like sorted layout. RTL does not apply default axis
|
|
36
|
+
* mirroring, and the right value axis is always available.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getChartRuntimeAxes(params: IGetChartRuntimeAxesParams): IRuntimeAxis[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChartStyle } from '../types';
|
|
2
|
+
import { ChartTypeBits } from '../enum';
|
|
3
|
+
/**
|
|
4
|
+
* Converts persisted semantic chart style buckets into transient render buckets.
|
|
5
|
+
*
|
|
6
|
+
* Persisted `style.yAxis` is the primary vertical axis configuration, and
|
|
7
|
+
* `style.rightYAxis` is the secondary vertical axis configuration. RTL can draw
|
|
8
|
+
* the primary vertical axis on the physical right, but that must not change the
|
|
9
|
+
* saved field names. This resolver swaps y-axis option/title buckets only in
|
|
10
|
+
* the runtime render style consumed by physical-position operators.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveChartRuntimeStyle(style: ChartStyle, chartType?: ChartTypeBits): ChartStyle;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ChartStyle } from '../../types';
|
|
2
|
+
import { AreaLineStyle, AxisAlignEnum, ChartBorderDashType, ChartTypeBits, InvalidValueType, LabelContentType, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, SelectModeEnum, SeriesLabelPosition, TextAlign, TitlePositionEnum, WaterfallStackTypeEnum, WordCloudShapeEnum } from '../../enum';
|
|
2
3
|
export declare const themeColors: string[];
|
|
4
|
+
export declare const RTLChartStyle: ChartStyle;
|
|
3
5
|
export declare const defaultChartConfig: {
|
|
4
6
|
allSeriesId: string;
|
|
5
7
|
invalidValueType: InvalidValueType;
|
|
@@ -68,7 +70,7 @@ export declare const defaultChartConfig: {
|
|
|
68
70
|
areaOpacity: number;
|
|
69
71
|
};
|
|
70
72
|
wordCloud: {
|
|
71
|
-
|
|
73
|
+
shape: WordCloudShapeEnum;
|
|
72
74
|
repeat: boolean;
|
|
73
75
|
};
|
|
74
76
|
waterfall: {
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { ChartStyle, EChartInstance, EChartSpec, IChartConfig, IChartHostRect, IChartInstance, IChartRenderModel, IChartRenderModelStylizeInit } from '../types';
|
|
2
|
+
import type { IWordCloudRenderConfig } from '../wordcloud-chart/word-cloud-render-config';
|
|
2
3
|
import { Disposable } from '@univerjs/core';
|
|
4
|
+
export interface IEChartRenderModelOptions {
|
|
5
|
+
wordCloudRenderConfig?: IWordCloudRenderConfig;
|
|
6
|
+
}
|
|
3
7
|
export declare class EChartRenderModel extends Disposable implements IChartRenderModel {
|
|
4
8
|
private _specConverters;
|
|
5
9
|
private _specOperators;
|
|
6
10
|
private _addWatermark;
|
|
7
|
-
|
|
11
|
+
private readonly _wordCloudRenderConfig?;
|
|
12
|
+
constructor(_addWatermark: boolean, options?: IEChartRenderModelOptions);
|
|
8
13
|
updateWatermark(addWatermark: boolean): void;
|
|
9
14
|
private _addSpecConverters;
|
|
10
15
|
private _addSpecOperators;
|
|
@@ -53,7 +53,7 @@ export interface IChartModelInitParams {
|
|
|
53
53
|
isRowDirection?: boolean;
|
|
54
54
|
localeTexts?: IChartLocaleTexts;
|
|
55
55
|
}
|
|
56
|
-
export declare function generateChartModelContext(chartModel: ChartModel, dataSource: StaticChartSource): IChartContext
|
|
56
|
+
export declare function generateChartModelContext(chartModel: ChartModel, dataSource: StaticChartSource): IChartContext;
|
|
57
57
|
/**
|
|
58
58
|
* Convert the initial data to a chart model.
|
|
59
59
|
* @param initJson The initial data of the chart model.
|
|
@@ -66,7 +66,7 @@ export declare function generateChartModelContext(chartModel: ChartModel, dataSo
|
|
|
66
66
|
* const inject = sheet.getInject(); *
|
|
67
67
|
* const data = {
|
|
68
68
|
* dimensions: ['a', 'b', 'c'],
|
|
69
|
-
* source: [['test', 1, 3], ['test1', 2, 2], ['tes2', 3, 1], ['test3', 4, 4]
|
|
69
|
+
* source: [['test', 1, 3], ['test1', 2, 2], ['tes2', 3, 1], ['test3', 4, 4]]
|
|
70
70
|
* } *
|
|
71
71
|
* const initData = {
|
|
72
72
|
* chartType: 4,
|
|
@@ -3,10 +3,12 @@ export { chartAxesOperator } from './chart-axes.operator';
|
|
|
3
3
|
export { chartBoxStyleOperator } from './chart-box-style.operator';
|
|
4
4
|
export { fontSizeOperator } from './font-size.operator';
|
|
5
5
|
export { hoverMarkStyleOperator } from './hover-mark-style.operator';
|
|
6
|
+
export { implicitCategoryAxisOperator } from './implicit-category-axis.operator';
|
|
6
7
|
export { invalidValueStyleOperator } from './invalid-value-style.operator';
|
|
7
8
|
export { legendStyleOperator } from './legend-style.operator';
|
|
8
9
|
export { lineLikeStyleOperator } from './line-like-style.operator';
|
|
9
10
|
export { pieStyleOperator } from './pie-style.operator';
|
|
11
|
+
export { rtlRenderSpecOperator } from './rtl-render-spec.operator';
|
|
10
12
|
export { seriesStyleOperator } from './series-style-operator/series-style-operator';
|
|
11
13
|
export { stackOperator } from './stack.operator';
|
|
12
14
|
export { chartThemeOperator } from './theme.operator';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ChartDirection, ChartStyle, EChartRenderSpecOperator, EChartSpec, IChartConfig } from '../../../types';
|
|
2
|
+
import { InvalidValueType } from '../../../enum';
|
|
3
|
+
interface ITooltipFormatterDataContext {
|
|
4
|
+
category: IChartConfig['category'];
|
|
5
|
+
xAxisFormat: ChartStyle['xAxis'] extends infer T ? T extends {
|
|
6
|
+
format?: infer F;
|
|
7
|
+
} ? F : undefined : undefined;
|
|
8
|
+
invalidValueType: InvalidValueType;
|
|
9
|
+
blankText: string;
|
|
10
|
+
minText: string;
|
|
11
|
+
q1Text: string;
|
|
12
|
+
medianText: string;
|
|
13
|
+
q3Text: string;
|
|
14
|
+
maxText: string;
|
|
15
|
+
wordText: string;
|
|
16
|
+
frequencyText: string;
|
|
17
|
+
isDateAxis: boolean | undefined;
|
|
18
|
+
allSeriesStyle: ChartStyle['allSeriesStyle'];
|
|
19
|
+
seriesStyleMap: ChartStyle['seriesStyleMap'];
|
|
20
|
+
runtimeThemeColors: string[];
|
|
21
|
+
relationNodeMap: Map<string, string>;
|
|
22
|
+
negativeMap: Map<string, boolean>;
|
|
23
|
+
getRenderColor: (color: string) => string;
|
|
24
|
+
}
|
|
25
|
+
interface ITooltipFormatters {
|
|
26
|
+
axis: (params: any) => string;
|
|
27
|
+
item: (params: any) => string;
|
|
28
|
+
radar: (params: any) => string;
|
|
29
|
+
wordCloud: (params: any) => string;
|
|
30
|
+
}
|
|
31
|
+
export declare function excelDateToUnixMilliseconds(excelDate: number, useDefault1900DateSystem?: boolean): number;
|
|
32
|
+
export declare function createTooltipFormatterDataContext(spec: EChartSpec, style: ChartStyle, config: IChartConfig): ITooltipFormatterDataContext;
|
|
33
|
+
export declare function createLTRTooltipFormatters(context: ITooltipFormatterDataContext, config: IChartConfig): ITooltipFormatters;
|
|
34
|
+
export declare function createRTLTooltipFormatters(context: ITooltipFormatterDataContext, config: IChartConfig): ITooltipFormatters;
|
|
35
|
+
export declare function createTooltipFormatters(context: ITooltipFormatterDataContext, config: IChartConfig, direction: ChartDirection): ITooltipFormatters;
|
|
36
|
+
export declare const toolTipStyleOperator: EChartRenderSpecOperator;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChartDirection } from '../../../types';
|
|
2
|
+
export declare const tooltipBaseCss = "max-width: 280px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;";
|
|
3
|
+
export declare const rtlTooltipCss = "direction:rtl;text-align:right;";
|
|
4
|
+
export declare function getTooltipExtraCss(backgroundColor: string, direction: ChartDirection): string;
|
|
5
|
+
export declare function getLTRTooltipMarker(color: string): string;
|
|
6
|
+
export declare function getRTLTooltipMarker(color: string): string;
|
|
7
|
+
export declare function normalizeRTLTooltipMarker(marker: string | undefined): string;
|
|
8
|
+
export declare function wrapTooltipAutoDirection(content: string): string;
|
|
9
|
+
export declare function wrapTooltipLTRDirection(content: string): string;
|
|
10
|
+
export declare function renderRTLTooltipRow(content: string): string;
|
|
11
|
+
export declare function renderRTLTooltipBlock(rows: string[]): string;
|
|
12
|
+
export declare function renderRTLTitleRow(content: string): string;
|
|
13
|
+
export declare function renderRTLMarkerTextRow(text: string, marker?: string): string;
|
|
14
|
+
export declare function renderRTLValueLabelRow(label: string, value: unknown, marker?: string, boldValue?: boolean): string;
|
|
15
|
+
export declare function renderRTLEdgeRow(sourceName: string, targetName: string, value: unknown, marker?: string): string;
|
|
@@ -5,7 +5,7 @@ export declare class WordCloudMuskImageService extends Disposable {
|
|
|
5
5
|
constructor();
|
|
6
6
|
loadMuskImage(name: string, url: string): void;
|
|
7
7
|
loadMuskImages(): void;
|
|
8
|
-
getWordCloudImageMask(
|
|
8
|
+
getWordCloudImageMask(imageName: string): HTMLImageElement | undefined;
|
|
9
9
|
getWordCloudImageMaskMap(): Map<string, HTMLImageElement>;
|
|
10
10
|
dispose(): void;
|
|
11
11
|
}
|
|
@@ -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, isRowDirection: boolean, sourceType
|
|
4
|
-
categoryData: OptionDataValue
|
|
3
|
+
export declare function getCategoryData(source: OptionDataValue[][], categoryIndex: number, isRowDirection: boolean, sourceType?: ChartSourceDataTypeEnum[][]): {
|
|
4
|
+
categoryData: Array<OptionDataValue | undefined>;
|
|
5
5
|
isAllDateTime: boolean;
|
|
6
6
|
};
|
|
@@ -6,6 +6,7 @@ export declare class StaticChartSource extends ChartDataSource {
|
|
|
6
6
|
private _columnDirectionDataSetCache;
|
|
7
7
|
constructor();
|
|
8
8
|
initData(data: IUniverDataSet, isRowDirection?: boolean): void;
|
|
9
|
+
setData(data: IUniverDataSet): void;
|
|
9
10
|
updateIsRowDirection(flag: boolean): void;
|
|
10
11
|
refresh(): void;
|
|
11
12
|
convertDataSet(): IUniverDataSet;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type {
|
|
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 {
|
|
5
|
-
import type {
|
|
4
|
+
import type { IChartLocaleTexts } from './models/chart-locale-texts';
|
|
5
|
+
import type { IEchartTheme } from './models/constants/build-in-theme';
|
|
6
6
|
import type { BarSeriesOption } from './utils/echarts';
|
|
7
|
+
import type { IWordCloudRenderConfig } from './wordcloud-chart/word-cloud-render-config';
|
|
7
8
|
export type DeepPartial<T> = T extends Record<string, any> ? T extends any[] ? T : {
|
|
8
9
|
[key in keyof T]+?: DeepPartial<T[key]>;
|
|
9
10
|
} : T;
|
|
11
|
+
export type ChartDirection = 'ltr' | 'rtl';
|
|
10
12
|
export interface IChartDataSource {
|
|
11
13
|
data$: Observable<IUniverDataSet>;
|
|
12
14
|
canSwitchOrient$: Observable<boolean>;
|
|
@@ -17,8 +19,6 @@ export interface IChartDataSource {
|
|
|
17
19
|
getDimensionCount(): number;
|
|
18
20
|
refresh(): void;
|
|
19
21
|
}
|
|
20
|
-
export type ChartDataSourceValue = Nullable<CellValue>;
|
|
21
|
-
export type ChartDataSourceValues = Array<Array<ChartDataSourceValue>>;
|
|
22
22
|
export interface IDimensionDefinition {
|
|
23
23
|
type?: 'number' | 'ordinal' | 'time' | 'float' | 'int';
|
|
24
24
|
name?: string;
|
|
@@ -26,10 +26,13 @@ export interface IDimensionDefinition {
|
|
|
26
26
|
}
|
|
27
27
|
export type DimensionDefinitionLoose = IDimensionDefinition['name'] | IDimensionDefinition;
|
|
28
28
|
export type OptionDataValue = string | number | Date | null | undefined;
|
|
29
|
+
export type ChartDataSourceValue = OptionDataValue;
|
|
30
|
+
export type ChartDataSourceValues = ChartDataSourceValue[][];
|
|
29
31
|
export interface IUniverDataSet {
|
|
30
32
|
source: OptionDataValue[][];
|
|
31
33
|
dimensions: Array<DimensionDefinitionLoose>;
|
|
32
34
|
sourceType?: ChartSourceDataTypeEnum[][];
|
|
35
|
+
sourceLabels?: string[][];
|
|
33
36
|
}
|
|
34
37
|
export interface IChartContext {
|
|
35
38
|
headers?: string[];
|
|
@@ -163,6 +166,7 @@ export interface IChartRuntimeContext {
|
|
|
163
166
|
themeColors?: string[];
|
|
164
167
|
axes: IRuntimeAxis[];
|
|
165
168
|
themeInfo: IEchartTheme;
|
|
169
|
+
wordCloudRenderConfig?: IWordCloudRenderConfig;
|
|
166
170
|
/**
|
|
167
171
|
* The function to transform the color to the render color with considering the system theme is dark mode or not.
|
|
168
172
|
* @param {string} color - The color to be rendered.
|
|
@@ -175,7 +179,6 @@ export interface IChartRuntimeContext {
|
|
|
175
179
|
isDarkMode: boolean;
|
|
176
180
|
hasSecondaryAxis: boolean;
|
|
177
181
|
localeTexts: IChartLocaleTexts;
|
|
178
|
-
wordCloudImageMaskMap: Map<string, HTMLImageElement>;
|
|
179
182
|
}
|
|
180
183
|
export interface ILabelStyle {
|
|
181
184
|
visible: boolean;
|
|
@@ -235,11 +238,15 @@ export interface IPointStyle {
|
|
|
235
238
|
color: Nullable<string>;
|
|
236
239
|
}
|
|
237
240
|
export interface IDataPointStyle extends IPointStyle {
|
|
241
|
+
/** Fill opacity for this data point, from 0 (transparent) to 1 (opaque). */
|
|
242
|
+
fillOpacity?: number;
|
|
238
243
|
}
|
|
239
244
|
export interface ISeriesStyle {
|
|
240
245
|
chartType?: ChartTypeBits.Line | ChartTypeBits.Column | ChartTypeBits.Area;
|
|
246
|
+
/** Compatibility switch for placing this series on the secondary vertical axis. It does not change the yAxis/rightYAxis option bucket semantics. */
|
|
241
247
|
rightYAxis?: boolean;
|
|
242
248
|
color: Nullable<string>;
|
|
249
|
+
/** Fill opacity for this series, from 0 (transparent) to 1 (opaque). */
|
|
243
250
|
fillOpacity: number;
|
|
244
251
|
border: {
|
|
245
252
|
opacity: number;
|
|
@@ -284,6 +291,8 @@ export interface ITrendLine {
|
|
|
284
291
|
}
|
|
285
292
|
export interface IChartStyle {
|
|
286
293
|
runtime: IChartRuntimeContext;
|
|
294
|
+
/** Runtime-only locale direction. It must not be persisted in chart snapshots. */
|
|
295
|
+
direction: ChartDirection;
|
|
287
296
|
width: number;
|
|
288
297
|
height: number;
|
|
289
298
|
theme: string;
|
|
@@ -298,13 +307,17 @@ export interface IChartStyle {
|
|
|
298
307
|
title: Omit<ILabelStyle, 'visible'>;
|
|
299
308
|
subtitle: Omit<ILabelStyle, 'visible'>;
|
|
300
309
|
xAxisTitle: Omit<ILabelStyle, 'visible'>;
|
|
310
|
+
/** Primary vertical axis title. RTL may render it on the physical right, but it is still persisted here. */
|
|
301
311
|
yAxisTitle: Omit<ILabelStyle, 'visible'>;
|
|
312
|
+
/** Secondary vertical axis title. */
|
|
302
313
|
rightYAxisTitle: Omit<ILabelStyle, 'visible'>;
|
|
303
314
|
titlePosition: TitlePositionEnum;
|
|
304
315
|
};
|
|
305
316
|
legend: ILegendStyle;
|
|
306
317
|
xAxis: IAxisOptions;
|
|
318
|
+
/** Primary vertical axis options. This is a semantic bucket, not the physical left-axis bucket. */
|
|
307
319
|
yAxis: IAxisOptions;
|
|
320
|
+
/** Secondary vertical axis options. Do not store RTL primary vertical axis edits here. */
|
|
308
321
|
rightYAxis: RightYAxisOptions;
|
|
309
322
|
allSeriesStyle: IAllSeriesStyle;
|
|
310
323
|
seriesStyleMap: {
|
|
@@ -335,8 +348,8 @@ export interface IChartStyle {
|
|
|
335
348
|
useAbsValue: boolean;
|
|
336
349
|
};
|
|
337
350
|
wordCloud: {
|
|
338
|
-
|
|
339
|
-
|
|
351
|
+
maskImage?: string;
|
|
352
|
+
shape?: WordCloudShapeEnum;
|
|
340
353
|
repeat: boolean;
|
|
341
354
|
};
|
|
342
355
|
relation: {
|
package/lib/types/util.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ 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" | "bar" | "scatter" | "pie" | "radar" | "graph" | "funnel" | "sankey" | "boxplot" | "heatmap" | "combination"
|
|
6
|
+
chartBitToString(bit: ChartTypeBits): "" | "line" | "wordCloud" | "bar" | "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
|
+
export declare const getProperty: <T = any>(data: Record<string, any> | undefined, propertyPath: string) => T | undefined;
|
|
9
10
|
/**
|
|
10
11
|
* Set graphic element to data.
|
|
11
12
|
* because we use graphic element to draw watermark title, so we need to set it to data.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extendChartView, extendSeriesModel, format, getInstanceByDom, graphic, helper, init, List, number, registerLayout, registerPreprocessor, util } from 'echarts';
|
|
1
|
+
import { extendChartView, extendSeriesModel, format, getInstanceByDom, graphic, helper, init, List, number, registerAction, registerLayout, registerPreprocessor, util } from 'echarts';
|
|
2
2
|
export declare const echarts: {
|
|
3
3
|
extendChartView: typeof extendChartView;
|
|
4
4
|
extendSeriesModel: typeof extendSeriesModel;
|
|
@@ -9,8 +9,9 @@ export declare const echarts: {
|
|
|
9
9
|
init: typeof init;
|
|
10
10
|
List: typeof List;
|
|
11
11
|
number: typeof number;
|
|
12
|
+
registerAction: typeof registerAction;
|
|
12
13
|
registerLayout: typeof registerLayout;
|
|
13
14
|
registerPreprocessor: typeof registerPreprocessor;
|
|
14
15
|
util: typeof util;
|
|
15
16
|
};
|
|
16
|
-
export type { BarSeriesOption, DatasetComponentOption, ECharts, EChartsInitOpts, EChartsOption, FunnelSeriesOption, LegendComponentOption, LineSeriesOption, XAXisComponentOption, } from 'echarts';
|
|
17
|
+
export type { BarSeriesOption, DatasetComponentOption, ECharts, EChartsInitOpts, EChartsOption, FunnelSeriesOption, LegendComponentOption, LineSeriesOption, PieSeriesOption, XAXisComponentOption, } from 'echarts';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IWordCloudEChartsMaskSource, WordCloudShape } from '../wordcloud-chart/types';
|
|
2
|
+
export declare const WORD_CLOUD_SHAPE_RESOURCE_KEYS: Partial<Record<WordCloudShape, string>>;
|
|
3
|
+
export declare function getWordCloudShapeImageSources(): string[];
|
|
4
|
+
export declare function resolveWordCloudShapeImageSource(shape: unknown): string | undefined;
|
|
5
|
+
export declare function resolveWordCloudShapeMaskSource(shape: unknown): IWordCloudEChartsMaskSource;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { echarts as EchartsType } from '../../../utils/echarts';
|
|
2
|
+
import { WORD_CLOUD_SERIES_TYPE } from './echarts-options';
|
|
3
|
+
export interface IRegisterWordCloudChartViewContext {
|
|
4
|
+
createTextElement(layout: any, data: any, dataIndex: number, seriesModel: any): unknown;
|
|
5
|
+
}
|
|
6
|
+
export declare function registerWordCloudChartView(echarts: typeof EchartsType, context: IRegisterWordCloudChartViewContext): void;
|
|
7
|
+
export { WORD_CLOUD_SERIES_TYPE };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const WORD_CLOUD_SERIES_TYPE = "wordCloud";
|
|
2
|
+
export declare const WORD_CLOUD_DEFAULT_OPTION: {
|
|
3
|
+
readonly z: 2;
|
|
4
|
+
readonly maskSource: import("../..").IWordCloudEChartsMaskSource;
|
|
5
|
+
readonly colorBy: "data";
|
|
6
|
+
readonly keepAspect: false;
|
|
7
|
+
readonly left: "center";
|
|
8
|
+
readonly top: "center";
|
|
9
|
+
readonly width: "96%";
|
|
10
|
+
readonly height: "96%";
|
|
11
|
+
readonly right: null;
|
|
12
|
+
readonly bottom: null;
|
|
13
|
+
readonly fontSizeRange: readonly [16, 56];
|
|
14
|
+
readonly rotations: readonly [0, -45, 45, 90, -90];
|
|
15
|
+
readonly randomSeed: 1;
|
|
16
|
+
readonly gridSize: 4;
|
|
17
|
+
readonly padding: 1;
|
|
18
|
+
readonly zoomToFit: {
|
|
19
|
+
readonly shrink: true;
|
|
20
|
+
readonly enlarge: false;
|
|
21
|
+
readonly fontSizeLimitMin: 16;
|
|
22
|
+
readonly minShrinkRatio: 0.8;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { echarts as EchartsType } from '../../../utils/echarts';
|
|
2
|
+
import type { IWordCloudEChartsSeriesOption } from '../../types';
|
|
3
|
+
export declare function registerWordCloudChart(echarts: typeof EchartsType): typeof EchartsType;
|
|
4
|
+
export type { IWordCloudEChartsSeriesOption };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { echarts as EchartsType } from '../../../utils/echarts';
|
|
2
|
+
import { WORD_CLOUD_SERIES_TYPE } from './echarts-options';
|
|
3
|
+
export type PerformWordCloudSeriesLayout = (seriesModel: unknown, ecModel: unknown, api: unknown) => void;
|
|
4
|
+
export declare function registerWordCloudLayout(echarts: typeof EchartsType, performSeriesLayout: PerformWordCloudSeriesLayout): void;
|
|
5
|
+
export { WORD_CLOUD_SERIES_TYPE };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { WordCloudCollisionShape } from '../../core/collision/engine';
|
|
2
|
+
import type { IWordCloudBounds, IWordCloudClipMask, IWordCloudEncodedWord, IWordCloudLayoutResult, IWordCloudLayoutStats, IWordCloudMaskGrid, IWordCloudTextMeasurer, WordCloudShape } from '../../types';
|
|
3
|
+
export interface IEChartsWordCloudLayoutConfig {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
cellSize: number;
|
|
7
|
+
padding: number;
|
|
8
|
+
shape: WordCloudShape | string | undefined;
|
|
9
|
+
rotations: number[];
|
|
10
|
+
randomSeed: number;
|
|
11
|
+
collisionShape: WordCloudCollisionShape;
|
|
12
|
+
maskImage?: HTMLImageElement | HTMLCanvasElement | null;
|
|
13
|
+
drawOutOfBound: boolean;
|
|
14
|
+
shapeSampleSize?: number | null;
|
|
15
|
+
shapeInsideRatio?: number | null;
|
|
16
|
+
shapePaddingRatio?: number | null;
|
|
17
|
+
shapeFit?: 'contain' | 'cover' | 'stretch' | 'fill';
|
|
18
|
+
shapeMaskMode?: 'auto' | 'alpha' | 'luminance';
|
|
19
|
+
shapeAlphaThreshold?: number | null;
|
|
20
|
+
shapeLuminanceThreshold?: number | null;
|
|
21
|
+
shapeInvert?: boolean;
|
|
22
|
+
zoomToFitShrink: boolean;
|
|
23
|
+
zoomToFitEnlarge: boolean;
|
|
24
|
+
zoomToFitFontSizeLimitMin: number;
|
|
25
|
+
zoomToFitFontSizeLimitMax?: number;
|
|
26
|
+
zoomToFitMinShrinkRatio?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface IEChartsWordCloudRenderLayout {
|
|
29
|
+
dataIndex: number;
|
|
30
|
+
text: string;
|
|
31
|
+
name: string;
|
|
32
|
+
value: number;
|
|
33
|
+
cx: number;
|
|
34
|
+
cy: number;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
rawWidth: number;
|
|
38
|
+
rawHeight: number;
|
|
39
|
+
fontSize: number;
|
|
40
|
+
fontFamily: string;
|
|
41
|
+
fontWeight: string | number;
|
|
42
|
+
rotate: number;
|
|
43
|
+
corners: Array<{
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
}>;
|
|
47
|
+
clipBounds?: IWordCloudBounds;
|
|
48
|
+
clipMask?: IWordCloudClipMask;
|
|
49
|
+
phase: 1 | 2;
|
|
50
|
+
}
|
|
51
|
+
export interface IEChartsWordCloudLayoutResult {
|
|
52
|
+
placed: IEChartsWordCloudRenderLayout[];
|
|
53
|
+
skipped: IWordCloudEncodedWord[];
|
|
54
|
+
phase2PlacedCount: number;
|
|
55
|
+
gridCells: number;
|
|
56
|
+
usedCells: number;
|
|
57
|
+
footprintCacheSize: number;
|
|
58
|
+
failureCacheStats: {
|
|
59
|
+
size: number;
|
|
60
|
+
hit: number;
|
|
61
|
+
miss: number;
|
|
62
|
+
};
|
|
63
|
+
zoomRatio: number;
|
|
64
|
+
enlargeRatio: number;
|
|
65
|
+
bounds?: IEChartsWordCloudLayoutBounds | null;
|
|
66
|
+
stats?: IWordCloudLayoutStats;
|
|
67
|
+
}
|
|
68
|
+
export interface IEChartsWordCloudLayoutBounds {
|
|
69
|
+
x1: number;
|
|
70
|
+
y1: number;
|
|
71
|
+
x2: number;
|
|
72
|
+
y2: number;
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
cx: number;
|
|
76
|
+
cy: number;
|
|
77
|
+
}
|
|
78
|
+
export declare function layoutEChartsWordsWithZoomToFit(words: readonly IWordCloudEncodedWord[], config: IEChartsWordCloudLayoutConfig, measurer: IWordCloudTextMeasurer): IEChartsWordCloudLayoutResult;
|
|
79
|
+
export declare function convertCoreLayoutToEChartsLayout(result: IWordCloudLayoutResult): IEChartsWordCloudLayoutResult;
|
|
80
|
+
export declare function buildWordCloudLayoutStats(layout: IEChartsWordCloudLayoutResult): IEChartsWordCloudLayoutResult;
|
|
81
|
+
export declare function createEChartsMaskGrid(maskImage: HTMLImageElement | HTMLCanvasElement | null | undefined, width: number, height: number, options: Pick<IEChartsWordCloudLayoutConfig, 'shapeFit' | 'shapeMaskMode' | 'shapeAlphaThreshold' | 'shapeLuminanceThreshold' | 'shapeInvert'>): IWordCloudMaskGrid | undefined;
|
|
82
|
+
export declare function estimateGlobalZoomRatio(words: readonly IWordCloudEncodedWord[], config: IEChartsWordCloudLayoutConfig, maskGrid?: IWordCloudMaskGrid): number;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const WORD_CLOUD_ECHARTS_RENDER_CONFIG: {
|
|
2
|
+
readonly fontSizeRange: readonly [16, 56];
|
|
3
|
+
readonly seriesStyle: {
|
|
4
|
+
readonly rotations: readonly [0, -45, 45, 90, -90];
|
|
5
|
+
readonly randomSeed: 1;
|
|
6
|
+
readonly gridSize: 4;
|
|
7
|
+
readonly padding: 1;
|
|
8
|
+
readonly width: "96%";
|
|
9
|
+
readonly height: "96%";
|
|
10
|
+
};
|
|
11
|
+
readonly search: {
|
|
12
|
+
readonly ringCount: 7;
|
|
13
|
+
readonly defaultBudget: 4500;
|
|
14
|
+
};
|
|
15
|
+
readonly placement: {
|
|
16
|
+
readonly renderRotationSign: -1;
|
|
17
|
+
readonly failureCacheLimit: 180;
|
|
18
|
+
};
|
|
19
|
+
readonly shapeMask: {
|
|
20
|
+
readonly sampleSize: null;
|
|
21
|
+
readonly insideRatio: null;
|
|
22
|
+
readonly paddingRatio: 0.02;
|
|
23
|
+
readonly fit: "contain";
|
|
24
|
+
readonly mode: "auto";
|
|
25
|
+
readonly alphaThreshold: 8;
|
|
26
|
+
readonly luminanceThreshold: 245;
|
|
27
|
+
readonly invert: false;
|
|
28
|
+
};
|
|
29
|
+
readonly globalFontScale: {
|
|
30
|
+
readonly minimumEffectiveScale: 1.03;
|
|
31
|
+
readonly binarySearchIterations: 12;
|
|
32
|
+
};
|
|
33
|
+
readonly fastAreaDensity: {
|
|
34
|
+
readonly areaRatio: 1;
|
|
35
|
+
readonly targetOccupancy: 0.62;
|
|
36
|
+
readonly safety: 1.03;
|
|
37
|
+
readonly cjkCharWidth: 1;
|
|
38
|
+
readonly whitespaceCharWidth: 0.28;
|
|
39
|
+
readonly narrowCharWidth: 0.32;
|
|
40
|
+
readonly wideCharWidth: 0.82;
|
|
41
|
+
readonly uppercaseCharWidth: 0.66;
|
|
42
|
+
readonly defaultCharWidth: 0.56;
|
|
43
|
+
readonly boldFactor: 1.06;
|
|
44
|
+
readonly fontHeightRatio: 1.16;
|
|
45
|
+
readonly rotationDiagonalInflate: 0.12;
|
|
46
|
+
readonly gridPerimeterOverhead: 0.9;
|
|
47
|
+
readonly gridAreaOverheadCells: 4;
|
|
48
|
+
readonly minimumSafety: 0.5;
|
|
49
|
+
readonly maximumSafety: 2;
|
|
50
|
+
};
|
|
51
|
+
readonly zoomToFit: {
|
|
52
|
+
readonly shrink: true;
|
|
53
|
+
readonly enlarge: false;
|
|
54
|
+
readonly fontSizeLimitMin: 16;
|
|
55
|
+
readonly minShrinkRatio: 0.8;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { echarts as EchartsType } from '../../../utils/echarts';
|
|
2
|
+
import { WORD_CLOUD_DEFAULT_OPTION, WORD_CLOUD_SERIES_TYPE } from './echarts-options';
|
|
3
|
+
export interface IWordCloudEChartsHelper {
|
|
4
|
+
createDimensions(data: any[], options: Record<string, unknown>): any;
|
|
5
|
+
}
|
|
6
|
+
export declare function registerWordCloudSeriesModel(echarts: typeof EchartsType, helper: IWordCloudEChartsHelper): void;
|
|
7
|
+
export { WORD_CLOUD_DEFAULT_OPTION, WORD_CLOUD_SERIES_TYPE };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function createMeasureContext(): CanvasRenderingContext2D;
|
|
2
|
+
export declare function createCanvasTextMeasurer(context: CanvasRenderingContext2D): {
|
|
3
|
+
measureText(word: any): {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
actualBoundingBoxAscent: number;
|
|
7
|
+
actualBoundingBoxDescent: number;
|
|
8
|
+
actualBoundingBoxLeft: number;
|
|
9
|
+
actualBoundingBoxRight: number;
|
|
10
|
+
};
|
|
11
|
+
rasterizeText(word: any): import("../..").IWordCloudTextSprite;
|
|
12
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IWordCloudEncodedWord, WordCloudFontSizeRange } from '../../types';
|
|
2
|
+
import { createWordCloudFontSizeAccessor } from '../../core/layout/font-scale';
|
|
3
|
+
export interface IEChartsWordCloudSourceRecord {
|
|
4
|
+
dataIndex: number;
|
|
5
|
+
key: string;
|
|
6
|
+
name: string;
|
|
7
|
+
text: string;
|
|
8
|
+
value: number;
|
|
9
|
+
raw: Record<string, unknown>;
|
|
10
|
+
explicitFontSize?: unknown;
|
|
11
|
+
fontFamily: string;
|
|
12
|
+
fontWeight: string | number;
|
|
13
|
+
padding: number;
|
|
14
|
+
}
|
|
15
|
+
export interface IEChartsWordCloudWordsBuildOptions {
|
|
16
|
+
fontSizeRange: WordCloudFontSizeRange;
|
|
17
|
+
rotations: number[];
|
|
18
|
+
randomSeed?: number | string;
|
|
19
|
+
}
|
|
20
|
+
export interface IEChartsWordCloudDesignWordsBuildOptions {
|
|
21
|
+
fontSizeRange: WordCloudFontSizeRange;
|
|
22
|
+
}
|
|
23
|
+
export interface IEChartsWordCloudLayoutWordsBuildOptions {
|
|
24
|
+
rotations: number[];
|
|
25
|
+
randomSeed?: number | string;
|
|
26
|
+
}
|
|
27
|
+
export interface IEChartsWordCloudDesignWord {
|
|
28
|
+
key: string;
|
|
29
|
+
recordIndex: number;
|
|
30
|
+
datumIndex: number;
|
|
31
|
+
name: string;
|
|
32
|
+
text: string;
|
|
33
|
+
value: number;
|
|
34
|
+
raw: Record<string, unknown>;
|
|
35
|
+
designFontSize: number;
|
|
36
|
+
}
|
|
37
|
+
export interface IEChartsWordCloudDesignWordsBuildResult {
|
|
38
|
+
words: IEChartsWordCloudDesignWord[];
|
|
39
|
+
fontSizeInfo: ReturnType<typeof createWordCloudFontSizeAccessor>['meta'];
|
|
40
|
+
}
|
|
41
|
+
export declare function buildEChartsWordCloudWords(records: readonly IEChartsWordCloudSourceRecord[], options: IEChartsWordCloudWordsBuildOptions): {
|
|
42
|
+
words: IWordCloudEncodedWord[];
|
|
43
|
+
fontSizeInfo: ReturnType<typeof createWordCloudFontSizeAccessor>['meta'];
|
|
44
|
+
};
|
|
45
|
+
export declare function buildEChartsWordCloudDesignWords(records: readonly IEChartsWordCloudSourceRecord[], options: IEChartsWordCloudDesignWordsBuildOptions): IEChartsWordCloudDesignWordsBuildResult;
|
|
46
|
+
export declare function deriveEChartsWordCloudLayoutWords(designWords: readonly IEChartsWordCloudDesignWord[], records: readonly IEChartsWordCloudSourceRecord[], options: IEChartsWordCloudLayoutWordsBuildOptions): IWordCloudEncodedWord[];
|
|
47
|
+
export declare function createEChartsWordCloudDesignWordsCacheKey(records: readonly IEChartsWordCloudSourceRecord[], fontSizeRange: WordCloudFontSizeRange): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IWordCloudLayoutMask, IWordCloudLayoutOptions, IWordCloudLayoutResult, IWordCloudMaskGrid, IWordCloudSpecBase, IWordCloudTextMeasurer } from './types';
|
|
2
|
+
export interface IWordCloudLayoutRuntime {
|
|
3
|
+
measurer: IWordCloudTextMeasurer;
|
|
4
|
+
mask?: IWordCloudLayoutMask;
|
|
5
|
+
maskGrid?: IWordCloudMaskGrid;
|
|
6
|
+
}
|
|
7
|
+
export declare function layoutWordCloudChart(spec: IWordCloudSpecBase, runtime: IWordCloudLayoutRuntime): IWordCloudLayoutResult;
|
|
8
|
+
export declare function resolveLayoutOptions(spec: IWordCloudSpecBase): IWordCloudLayoutOptions;
|