@univerjs-pro/sheets-chart-ui 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -7
- package/lib/cjs/facade.js +1 -0
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +1 -0
- package/lib/es/index.js +1 -1
- package/lib/es/locale/en-US.js +1 -1
- package/lib/es/locale/fa-IR.js +1 -1
- package/lib/es/locale/fr-FR.js +1 -1
- package/lib/es/locale/ru-RU.js +1 -1
- package/lib/es/locale/vi-VN.js +1 -1
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-TW.js +1 -1
- package/lib/index.css +1 -1
- package/lib/types/commands/commands/sheets-chart.command.d.ts +11 -1
- package/lib/types/const.d.ts +1 -0
- package/lib/types/facade/chart-builder/builder-util.d.ts +4 -0
- package/lib/types/facade/chart-builder/chart-builder-base.d.ts +568 -0
- package/lib/types/facade/chart-builder/line-chart-builder.d.ts +55 -0
- package/lib/types/facade/chart-builder/pie-chart-builder.d.ts +70 -0
- package/lib/types/facade/chart-builder/radar-chart-builder.d.ts +42 -0
- package/lib/types/facade/chart-builder/types.d.ts +22 -0
- package/lib/types/facade/f-chart.d.ts +86 -0
- package/lib/types/facade/f-worksheet.d.ts +120 -0
- package/lib/types/facade/index.d.ts +16 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/locale/zh-CN.d.ts +19 -0
- package/lib/types/models/echart-render-engine.d.ts +2 -0
- package/lib/types/models/echart-render-model.d.ts +1 -1
- package/lib/types/models/render-spec-operators/axis-title.operator.d.ts +2 -0
- package/lib/types/models/render-spec-operators/index.d.ts +2 -1
- package/lib/types/models/render-spec-operators/title-style.operator.d.ts +1 -1
- package/lib/types/models/render-spec-operators/tools.d.ts +4 -2
- package/lib/types/services/sheets-chart-ui.service.d.ts +2 -1
- package/lib/types/views/chart-edit-panel/options.d.ts +5 -5
- package/lib/types/views/chart-edit-panel/style-tab-panel/DataLabelOptions.d.ts +1 -1
- package/lib/types/views/chart-edit-panel/style-tab-panel/IndicatorLine.d.ts +19 -0
- package/lib/types/views/chart-edit-panel/style-tab-panel/series-style-edit/RadarPoints.d.ts +2 -2
- package/lib/types/views/chart-edit-panel/style-tab-panel/series-style-edit/const.d.ts +2 -0
- package/lib/types/views/chart-edit-panel/style-tab-panel/series-style-edit/widgets.d.ts +3 -6
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +29 -17
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Injector, Workbook } from '@univerjs/core';
|
|
2
|
+
import { IChartBuilderInfo, FChartBuilderBase } from './chart-builder-base';
|
|
3
|
+
export declare class PieChartBuilder extends FChartBuilderBase {
|
|
4
|
+
doughnutHole: number;
|
|
5
|
+
borderColor: string;
|
|
6
|
+
hasPaddingAngle: boolean;
|
|
7
|
+
isHalfPie: boolean;
|
|
8
|
+
rosePie: boolean;
|
|
9
|
+
showLabelLine: boolean;
|
|
10
|
+
constructor(unitId: string, subUnitId: string, workbook: Workbook, injector: Injector, chartId?: string);
|
|
11
|
+
/**
|
|
12
|
+
* Sets the size of the hole in the center of the pie chart as a percentage of the chart size.The value should be in the range 0-1.
|
|
13
|
+
* @param {number} doughnutHole The size of the hole in the center of the pie chart as a percentage of the chart size.
|
|
14
|
+
* @returns this builder, for chaining.
|
|
15
|
+
*/
|
|
16
|
+
setDoughnutHole(doughnutHole: number): PieChartBuilder;
|
|
17
|
+
/**
|
|
18
|
+
* Sets the color of the border around the pie chart.
|
|
19
|
+
* @param {string} borderColor The color of the border around the pie chart.
|
|
20
|
+
* @returns this builder, for chaining.
|
|
21
|
+
*/
|
|
22
|
+
setBorderColor(borderColor: string): PieChartBuilder;
|
|
23
|
+
/**
|
|
24
|
+
* Sets whether the pie chart has a padding angle.
|
|
25
|
+
* @param {boolean} hasPaddingAngle True if the pie chart has a padding angle; false otherwise.
|
|
26
|
+
* @returns this builder, for chaining.
|
|
27
|
+
*/
|
|
28
|
+
setHasPaddingAngle(hasPaddingAngle: boolean): PieChartBuilder;
|
|
29
|
+
/**
|
|
30
|
+
* Sets whether the pie chart is a half pie chart.
|
|
31
|
+
* @param {boolean} isHalfPie True if the pie chart is a half pie chart; false otherwise.
|
|
32
|
+
* @returns this builder, for chaining.
|
|
33
|
+
*/
|
|
34
|
+
setIsHalfPie(isHalfPie: boolean): PieChartBuilder;
|
|
35
|
+
/**
|
|
36
|
+
* Sets whether the pie chart is a rose pie chart.
|
|
37
|
+
* @param {boolean} rosePie True if the pie chart is a rose pie chart; false otherwise.
|
|
38
|
+
* @returns this builder, for chaining.
|
|
39
|
+
*/
|
|
40
|
+
setRosePie(rosePie: boolean): PieChartBuilder;
|
|
41
|
+
/**
|
|
42
|
+
* Sets whether the pie chart shows label lines.
|
|
43
|
+
* @param {boolean} showLabelLine True if the pie chart shows label lines; false otherwise.
|
|
44
|
+
* @returns this builder, for chaining.
|
|
45
|
+
*/
|
|
46
|
+
setShowLabelLine(showLabelLine: boolean): PieChartBuilder;
|
|
47
|
+
/**
|
|
48
|
+
* Builds the chart to reflect all changes made to it.
|
|
49
|
+
* @description This method does not automatically draw the chart on top of the spreadsheet. A new chart must be inserted via sheet.insertChart(chart), and an existing chart should be updated via sheet.updateChart(chart).
|
|
50
|
+
* @returns {IChartBuilderInfo} The chart builder info.
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
54
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
55
|
+
* const chartBuilder = fSheet.newChart().asPieChart();
|
|
56
|
+
* const chartInfo = chartBuilder.addRange('A1:B8')
|
|
57
|
+
* .setChartType(ChartTypeBits.Pie)
|
|
58
|
+
* .setDoughnutHole(0.5)
|
|
59
|
+
* .setBorderColor('#ff0000')
|
|
60
|
+
* .setHasPaddingAngle(true)
|
|
61
|
+
* .setIsHalfPie(true)
|
|
62
|
+
* .build();
|
|
63
|
+
* fSheet.insertChart(chartInfo);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
build(): IChartBuilderInfo;
|
|
67
|
+
}
|
|
68
|
+
export declare class PieChartBuilderMixin extends FChartBuilderBase {
|
|
69
|
+
asPieChart(): PieChartBuilder;
|
|
70
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RadarShape } from '@univerjs-pro/sheets-chart';
|
|
2
|
+
import { Injector, Workbook } from '@univerjs/core';
|
|
3
|
+
import { IChartBuilderInfo, FChartBuilderBase } from './chart-builder-base';
|
|
4
|
+
export declare class RadarChartBuilder extends FChartBuilderBase {
|
|
5
|
+
shape: RadarShape;
|
|
6
|
+
fill: boolean;
|
|
7
|
+
constructor(unitId: string, subUnitId: string, workbook: Workbook, injector: Injector, chartId?: string);
|
|
8
|
+
/**
|
|
9
|
+
* Sets the shape of the radar chart.
|
|
10
|
+
* @param {RadarShape} shape The shape of the radar chart.
|
|
11
|
+
* @returns this builder, for chaining.
|
|
12
|
+
*/
|
|
13
|
+
setShape(shape: RadarShape): RadarChartBuilder;
|
|
14
|
+
/**
|
|
15
|
+
* Sets whether the radar chart is filled.
|
|
16
|
+
* @param {boolean} fill True if the radar chart is filled; false otherwise.
|
|
17
|
+
* @returns this builder, for chaining.
|
|
18
|
+
*/
|
|
19
|
+
setFill(fill: boolean): RadarChartBuilder;
|
|
20
|
+
/**
|
|
21
|
+
* Builds the chart to reflect all changes made to it.
|
|
22
|
+
* @description This method does not automatically draw the chart on top of the spreadsheet. A new chart must be inserted via sheet.insertChart(chart), and an existing chart should be updated via sheet.updateChart(chart).
|
|
23
|
+
* @returns {IChartBuilderInfo} The chart builder info.
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // import { ChartTypeBits } from '@univerjs-pro/sheets-chart';
|
|
27
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
28
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
29
|
+
* const chartBuilder = fSheet.newChart().asRadarChart();
|
|
30
|
+
* const chartInfo = chartBuilder.addRange('A1:B8')
|
|
31
|
+
* .setChartType(ChartTypeBits.Radar)
|
|
32
|
+
* .setShape(RadarShape.Polygon)
|
|
33
|
+
* .setFill(true)
|
|
34
|
+
* .build();
|
|
35
|
+
* fSheet.insertChart(chartInfo);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
build(): IChartBuilderInfo;
|
|
39
|
+
}
|
|
40
|
+
export declare class RadarChartBuilderMixin extends FChartBuilderBase {
|
|
41
|
+
asRadarChart(): RadarChartBuilder;
|
|
42
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LineChartBuilder } from './line-chart-builder';
|
|
2
|
+
import { PieChartBuilder } from './pie-chart-builder';
|
|
3
|
+
import { RadarChartBuilder } from './radar-chart-builder';
|
|
4
|
+
export interface IPieChartBuilderMixin {
|
|
5
|
+
asPieChart(): PieChartBuilder;
|
|
6
|
+
}
|
|
7
|
+
export interface IRadarChartBuilderMixin {
|
|
8
|
+
asRadarChart(): RadarChartBuilder;
|
|
9
|
+
}
|
|
10
|
+
export interface ILineChartBuilderMixin {
|
|
11
|
+
asLineChart(): LineChartBuilder;
|
|
12
|
+
}
|
|
13
|
+
export interface IPieChartBuilderInfo {
|
|
14
|
+
pie?: {
|
|
15
|
+
doughnutHole: number;
|
|
16
|
+
borderColor: string;
|
|
17
|
+
hasPaddingAngle: boolean;
|
|
18
|
+
isHalfPie: boolean;
|
|
19
|
+
rosePie: boolean;
|
|
20
|
+
showLabelLine: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { IChartDataCategory, IChartDataSeries, ISheetChartSourceSingleRange } from '@univerjs-pro/sheets-chart';
|
|
2
|
+
import { Injector } from '@univerjs/core';
|
|
3
|
+
import { FChartBuilderBase } from './chart-builder/chart-builder-base';
|
|
4
|
+
export declare class FChart {
|
|
5
|
+
unitId: string;
|
|
6
|
+
subUnitId: string;
|
|
7
|
+
chartId: string;
|
|
8
|
+
private _injector;
|
|
9
|
+
constructor(unitId: string, subUnitId: string, chartId: string, injector: Injector);
|
|
10
|
+
getChartId(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Get the range of the chart.
|
|
13
|
+
*/
|
|
14
|
+
getRange(): ISheetChartSourceSingleRange | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Update the range info of the chart. The range info includes the range of the chart and the direction in source.
|
|
17
|
+
* @param rangeInfo The new range of the chart.
|
|
18
|
+
* @param rangeInfo.range.range The new range of the chart.
|
|
19
|
+
* @param rangeInfo.range.subUnitId The new sheet id of the chart.
|
|
20
|
+
* @param rangeInfo.range.unitId The new workbook id of the chart.
|
|
21
|
+
* @param {boolean} [rangeInfo.isRowDirection] Is treat row as category.
|
|
22
|
+
* @returns {Promise<boolean>} Whether the update is successful.
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
26
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
27
|
+
* const charts = fSheet.getCharts();
|
|
28
|
+
* // switch chart row direction
|
|
29
|
+
* if (charts.length > 0){
|
|
30
|
+
* const rangeInfo = {...charts[0].getRange()}
|
|
31
|
+
* rangeInfo.isRowDirection = !rangeInfo.isRowDirection;
|
|
32
|
+
* charts[0].updateRange(rangeInfo);
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
updateRange(rangeInfo: ISheetChartSourceSingleRange): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Get the series data list of the chart.
|
|
39
|
+
* @type ChartSeriesData
|
|
40
|
+
* @property {string} name The name of the series.
|
|
41
|
+
* @property {number} index The index of the series.
|
|
42
|
+
* @property {ChartSeriesItem[]} items The data of the series.
|
|
43
|
+
* @property {number} items.value The value of the series.
|
|
44
|
+
* @property {string} items.label The label of the series.
|
|
45
|
+
* @returns The series data list of the chart.
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
49
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
50
|
+
* const charts = fSheet.getCharts();
|
|
51
|
+
* if (charts.length > 0){
|
|
52
|
+
* const seriesData = charts[0].getSeriesData();
|
|
53
|
+
* console.log(seriesData);
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
getSeriesData(): IChartDataSeries[] | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Get the category data of the chart.
|
|
60
|
+
* @type ChartCategoryData
|
|
61
|
+
* @property {string} name The name of the category.
|
|
62
|
+
* @property {number} index The index of the category.
|
|
63
|
+
* @property {CategoryType} type The type of the category.
|
|
64
|
+
* @property {string[]} keys The keys of the category.
|
|
65
|
+
* @property {IChartDataItem[]} items The data of the category.
|
|
66
|
+
* @property {number} items.value The value of the category.
|
|
67
|
+
* @property {string} items.label The label of the category.
|
|
68
|
+
* @returns The category data of the chart.
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
72
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
73
|
+
* const charts = fSheet.getCharts();
|
|
74
|
+
* if (charts.length > 0){
|
|
75
|
+
* const categoryData = charts[0].getCategoryData();
|
|
76
|
+
* console.log(categoryData);
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
getCategoryData(): IChartDataCategory | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Returns a new FChartBuilderBase instance that modifies this chart.
|
|
83
|
+
* @returns {FChartBuilderBase} The new FChartBuilderBase instance.
|
|
84
|
+
*/
|
|
85
|
+
modify(): FChartBuilderBase;
|
|
86
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { IEchartTheme } from '@univerjs-pro/sheets-chart';
|
|
2
|
+
import { IChartBuilderInfo, FChartBuilderBase } from './chart-builder/chart-builder-base';
|
|
3
|
+
import { FWorksheet } from '@univerjs/sheets/facade';
|
|
4
|
+
import { FChart } from './f-chart';
|
|
5
|
+
export interface IFWorksheetChartMixin {
|
|
6
|
+
/**
|
|
7
|
+
* Adds a new chart to this sheet.
|
|
8
|
+
* @param {IChartBuilderInfo} chartBuildInfo - The chart builder info.
|
|
9
|
+
* @returns {Promise<FChart>} - The new chart.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
13
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
14
|
+
* const chartInfo = fSheet.newChart()
|
|
15
|
+
* .addRange('A1:B8')
|
|
16
|
+
* .setChartType(ChartTypeBits.Column)
|
|
17
|
+
* .setPosition(1, 1, 0, 0)
|
|
18
|
+
* .build();
|
|
19
|
+
* const fChart = await fSheet.insertChart(chartInfo);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
insertChart(chartBuildInfo: IChartBuilderInfo): Promise<FChart>;
|
|
23
|
+
/**
|
|
24
|
+
* Updates the chart on this sheet. This api can not update source range, please use FChart.updateRange.
|
|
25
|
+
* @param {IChartBuilderInfo} chartBuildInfo - The chart builder info.
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
29
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
30
|
+
* const chartInfo = fSheet.getCharts()[0];
|
|
31
|
+
* if(chartInfo){
|
|
32
|
+
* const chartBuilder = fSheet.newChart(chartInfo);
|
|
33
|
+
* const buildInfo =chartBuilder
|
|
34
|
+
* .setChartType(ChartTypeBits.Column)
|
|
35
|
+
* .setOptions('legend.position', 'right')
|
|
36
|
+
* .build();
|
|
37
|
+
* fSheet.updateChart(buildInfo);
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
updateChart(chartBuildInfo: IChartBuilderInfo): void;
|
|
42
|
+
/**
|
|
43
|
+
* Returns a builder to create a new chart for this sheet.The builder will not automatically create the chart. You must call build() on the returned builder to create the chart by calling insertChart(chartBuilder).
|
|
44
|
+
* @description If the fChart is provided, the builder will be initialized with the existing chart's data.
|
|
45
|
+
* @param {FChart} [fChart] - The chart to update.
|
|
46
|
+
* @return {FChartBuilderBase} - a new chart builder
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
50
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
51
|
+
* const chartBuilder = fSheet.newChart();
|
|
52
|
+
* const chartInfo = chartBuilder.addRange('A1:B8')
|
|
53
|
+
* .setChartType(ChartTypeBits.Column)
|
|
54
|
+
* .setPosition(1, 1, 0, 0)
|
|
55
|
+
* .setWidth(600)
|
|
56
|
+
* .setHeight(400)
|
|
57
|
+
* .build();
|
|
58
|
+
* fSheet.insertChart(chartInfo);
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
newChart(fChart?: FChart): FChartBuilderBase;
|
|
62
|
+
/**
|
|
63
|
+
* Returns an array of charts on this sheet.
|
|
64
|
+
* @returns {FChart[]} - An array of charts on this sheet.
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
68
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
69
|
+
* const charts = fSheet.getCharts();
|
|
70
|
+
* console.log(charts.length); //chart count
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
getCharts(): FChart[];
|
|
74
|
+
/**
|
|
75
|
+
* Removes a chart from the parent sheet.
|
|
76
|
+
* @param {FChart} chart - The chart to remove.
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
80
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
81
|
+
* const charts = fSheet.getCharts();
|
|
82
|
+
* if (charts.length > 0){
|
|
83
|
+
* fSheet.removeChart(charts[0]);
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
removeChart(chart: FChart): Promise<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* Univer chart is base on echarts, you can register your own theme by echart theme builder.
|
|
90
|
+
* @description The theme object should be a valid echarts theme object.The online builder is available at https://echarts.apache.org/zh/theme-builder.html
|
|
91
|
+
* @param {string} themeName - The name of the theme.
|
|
92
|
+
* @param {IEchartTheme} theme - The theme object.
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
96
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
97
|
+
* // register your theme
|
|
98
|
+
* const theme = {}; // your theme object
|
|
99
|
+
* fSheet.registerChartTheme('myTheme', theme);
|
|
100
|
+
* // use your theme for chart
|
|
101
|
+
* const chartBuilder = fSheet.newChart().asLineChart();
|
|
102
|
+
* chartBuilder.setTheme('myTheme');
|
|
103
|
+
* const chartInfo = chartBuilder.addRange('A1:B8').build();
|
|
104
|
+
* fSheet.insertChart(chartInfo);
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
registerChartTheme(themeName: string, theme: IEchartTheme): void;
|
|
108
|
+
}
|
|
109
|
+
export declare class FWorksheetChartMixin extends FWorksheet implements IFWorksheetChartMixin {
|
|
110
|
+
insertChart(chartBuildInfo: IChartBuilderInfo): Promise<FChart>;
|
|
111
|
+
updateChart(chartBuilder: IChartBuilderInfo): void;
|
|
112
|
+
newChart(fChart?: FChart): FChartBuilderBase;
|
|
113
|
+
getCharts(): FChart[];
|
|
114
|
+
removeChart(chart: FChart): Promise<boolean>;
|
|
115
|
+
registerChartTheme(themeName: string, theme: IEchartTheme): void;
|
|
116
|
+
}
|
|
117
|
+
declare module '@univerjs/sheets/facade' {
|
|
118
|
+
interface FWorksheet extends IFWorksheetChartMixin {
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ILineChartBuilderMixin, IPieChartBuilderInfo, IPieChartBuilderMixin, IRadarChartBuilderMixin } from './chart-builder/types';
|
|
2
|
+
import './f-worksheet';
|
|
3
|
+
export { FChartBuilderBase } from './chart-builder/chart-builder-base';
|
|
4
|
+
export type * from './chart-builder/chart-builder-base';
|
|
5
|
+
export { LineChartBuilder } from './chart-builder/line-chart-builder';
|
|
6
|
+
export { PieChartBuilder } from './chart-builder/pie-chart-builder';
|
|
7
|
+
export { RadarChartBuilder } from './chart-builder/radar-chart-builder';
|
|
8
|
+
export { FChart } from './f-chart';
|
|
9
|
+
export type * from './f-chart';
|
|
10
|
+
export type * from './f-worksheet';
|
|
11
|
+
declare module '@univerjs-pro/sheets-chart-ui/facade' {
|
|
12
|
+
interface FChartBuilderBase extends IPieChartBuilderMixin, IRadarChartBuilderMixin, ILineChartBuilderMixin {
|
|
13
|
+
}
|
|
14
|
+
interface IChartBuildOptions extends IPieChartBuilderInfo {
|
|
15
|
+
}
|
|
16
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { SheetsChartUIService } from './services/sheets-chart-ui.service';
|
|
|
3
3
|
export { SheetsChartUIController } from './controllers/sheets-chart-ui.controller';
|
|
4
4
|
export { UniverSheetsChartUIPlugin } from './plugins/univer-sheets-chart-ui-plugin';
|
|
5
5
|
export { defaultChartHeight, defaultChartWidth } from './const';
|
|
6
|
+
export { type IInsertChartCommandParams, InsertChartCommand } from './commands/commands/sheets-chart.command';
|
|
@@ -79,6 +79,12 @@ declare const locale: {
|
|
|
79
79
|
chartStyle: string;
|
|
80
80
|
chartAndAxisTitles: string;
|
|
81
81
|
legend: string;
|
|
82
|
+
legendSelectMode: string;
|
|
83
|
+
legendSelectModeType: {
|
|
84
|
+
single: string;
|
|
85
|
+
multiple: string;
|
|
86
|
+
close: string;
|
|
87
|
+
};
|
|
82
88
|
axes: {
|
|
83
89
|
axis: string;
|
|
84
90
|
axisOptions: string;
|
|
@@ -92,6 +98,11 @@ declare const locale: {
|
|
|
92
98
|
position: string;
|
|
93
99
|
dataLabels: string;
|
|
94
100
|
gridlinesAndTicks: string;
|
|
101
|
+
indicatorLine: string;
|
|
102
|
+
indicatorLineType: string;
|
|
103
|
+
indicatorLineColor: string;
|
|
104
|
+
indicatorLabel: string;
|
|
105
|
+
indicatorValue: string;
|
|
95
106
|
shape: {
|
|
96
107
|
polygon: string;
|
|
97
108
|
circle: string;
|
|
@@ -103,6 +114,14 @@ declare const locale: {
|
|
|
103
114
|
pin: string;
|
|
104
115
|
arrow: string;
|
|
105
116
|
none: string;
|
|
117
|
+
emptyCircle: string;
|
|
118
|
+
emptySquare: string;
|
|
119
|
+
emptyTriangle: string;
|
|
120
|
+
emptyDiamond: string;
|
|
121
|
+
emptyRect: string;
|
|
122
|
+
emptyRoundRect: string;
|
|
123
|
+
emptyPin: string;
|
|
124
|
+
emptyArrow: string;
|
|
106
125
|
};
|
|
107
126
|
border: string;
|
|
108
127
|
value: string;
|
|
@@ -14,7 +14,9 @@ export declare class EChartRenderEngine extends Disposable implements EChartInst
|
|
|
14
14
|
static name: string;
|
|
15
15
|
private _instance;
|
|
16
16
|
container: HTMLElement | string;
|
|
17
|
+
private _devicePixelRatio;
|
|
17
18
|
constructor();
|
|
19
|
+
getDevicePixelRatio(): 1 | 2 | undefined;
|
|
18
20
|
mount(id: string | HTMLElement): void;
|
|
19
21
|
resize(): void;
|
|
20
22
|
private _ensureChartInstance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Rect } from '@univerjs/engine-render';
|
|
2
1
|
import { ChartStyle, IChartConfig } from '@univerjs-pro/sheets-chart';
|
|
2
|
+
import { Rect } from '@univerjs/engine-render';
|
|
3
3
|
import { EChartSpec } from './echart-render-engine';
|
|
4
4
|
import { IChartInstance, IChartRenderModel, IChartRenderModelStylizeInit } from './interface';
|
|
5
5
|
import { Disposable } from '@univerjs/core';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { axisTitleStyleOperator } from './axis-title.operator';
|
|
1
2
|
export { chartAxesOperator } from './chart-axes.operator';
|
|
2
3
|
export { chartBoxStyleOperator } from './chart-box-style.operator';
|
|
3
4
|
export { fontSizeOperator } from './font-size.operator';
|
|
@@ -9,4 +10,4 @@ export { pieStyleOperator } from './pie-style.operator';
|
|
|
9
10
|
export { seriesStyleOperator } from './series-style-operator/series-style-operator';
|
|
10
11
|
export { stackOperator } from './stack.operator';
|
|
11
12
|
export { chartThemeOperator } from './theme.operator';
|
|
12
|
-
export {
|
|
13
|
+
export { chartTitleStyleOperator } from './title-style.operator';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { EChartRenderSpecOperator } from '../echart-render-engine';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const chartTitleStyleOperator: EChartRenderSpecOperator;
|
|
@@ -3,10 +3,12 @@ import { EChartSeriesItem, EChartSpec } from '../echart-render-engine';
|
|
|
3
3
|
import { ISpecGrid } from './operator-types';
|
|
4
4
|
type PartialLabelStyle = Partial<Pick<ILabelStyle, 'visible' | 'color' | 'fontSize' | 'italic' | 'bold' | 'underline' | 'strikethrough' | 'showMaxLabel' | 'showMinLabel'>>;
|
|
5
5
|
export declare function applyLabelStyle(spec: Record<string, any>, path: string, labelStyle: PartialLabelStyle): void;
|
|
6
|
+
export declare function applyLineStyle(spec: Record<string, any>, path: string, labelStyle: PartialLabelStyle): void;
|
|
6
7
|
export declare function toArray<T = unknown>(value: T | T[]): T[];
|
|
7
8
|
export declare function seriesForEach(series: EChartSpec['series'], func: (item: EChartSeriesItem, index: number) => void): void;
|
|
8
9
|
export declare function toPercentage(value: number, fixed?: number): string;
|
|
9
10
|
export declare const getLegendOrSeriesMaxWidth: (gridInfo: ISpecGrid, config: IChartConfig, style: ChartStyle) => number;
|
|
10
|
-
export declare const getCategoryLabelVertical: (gridInfo: ISpecGrid, style: ChartStyle
|
|
11
|
-
export declare const getCategoryLabelHorizontal: (gridInfo: ISpecGrid, style: ChartStyle, seriesCount: number) => number;
|
|
11
|
+
export declare const getCategoryLabelVertical: (gridInfo: ISpecGrid, style: ChartStyle) => number;
|
|
12
|
+
export declare const getCategoryLabelHorizontal: (gridInfo: ISpecGrid, style: ChartStyle, seriesCount: number, axisLabelMaxWidth?: number) => number;
|
|
13
|
+
export declare const getIntegerValue: (value: number, digit?: number) => number;
|
|
12
14
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Nullable, Disposable, ICommandService, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
2
1
|
import { AreaLineStyle, ChartModel, ChartStyle, DeepPartial, IAllSeriesStyle, IAxisOptions, IChartContext, IChartSourceMultiRangeItem, IChartStyle, IChartUpdateConfigCommandParams, IChartUpdateSourceCommandParams, ILegendStyle, InvalidValueType, IPieLabelStyle, IRuntimeAxis, ISheetChartSourceSingleRange, RadarShape, RightYAxisOptions, TitlePositionEnum, CategoryType, ChartModelService, ChartTypeBits, DataOrientation, SheetsChartService } from '@univerjs-pro/sheets-chart';
|
|
2
|
+
import { Nullable, Disposable, ICommandService, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { IChartHostProviderService } from './sheets-chart-host-provider.service';
|
|
5
5
|
export declare function registryChartConfigState(service: SheetsChartUIService): void;
|
|
@@ -12,6 +12,7 @@ export interface IChartConfigStateMap {
|
|
|
12
12
|
orient: IChartConfigState<Nullable<DataOrientation>>;
|
|
13
13
|
aggregate: IChartConfigState<boolean>;
|
|
14
14
|
gradientFill: IChartConfigState<Nullable<boolean>>;
|
|
15
|
+
indicator: IChartConfigState<Nullable<ChartStyle['tooltip']>>;
|
|
15
16
|
chartType: IChartConfigState<ChartTypeBits>;
|
|
16
17
|
dataRange: IChartConfigState<Nullable<ISheetChartSourceSingleRange | IChartSourceMultiRangeItem[]>>;
|
|
17
18
|
/** Series & Category */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IChartOptionType } from '../../services/sheets-chart-ui.service';
|
|
2
|
-
import { AreaLineStyle, AxisAlignEnum, ChartBorderDashType, InvalidValueType, LabelContentType, LegendPositionEnum, LinePointShape, PieLabelPosition,
|
|
2
|
+
import { AreaLineStyle, AxisAlignEnum, ChartBorderDashType, InvalidValueType, LabelContentType, LegendPositionEnum, LinePointShape, PieLabelPosition, RadarShape, SelectModeEnum, SeriesLabelPosition, TextAlign, TextVerticalAlign, TitlePositionEnum } from '@univerjs-pro/sheets-chart';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
4
|
export type OptionType = IChartOptionType;
|
|
5
5
|
export declare const defaultOption: {
|
|
@@ -88,10 +88,6 @@ export declare const linePointShapeOptions: {
|
|
|
88
88
|
label: string;
|
|
89
89
|
value: LinePointShape;
|
|
90
90
|
}[];
|
|
91
|
-
export declare const radarPointShapeOptions: {
|
|
92
|
-
label: string;
|
|
93
|
-
value: RadarPointShape;
|
|
94
|
-
}[];
|
|
95
91
|
export declare const linePointSizeOptions: {
|
|
96
92
|
label: string;
|
|
97
93
|
value: string;
|
|
@@ -112,6 +108,10 @@ export declare const legendLabelPositionOptions: {
|
|
|
112
108
|
label: string;
|
|
113
109
|
value: LegendPositionEnum;
|
|
114
110
|
}[];
|
|
111
|
+
export declare const legendSelectModeOptions: {
|
|
112
|
+
label: string;
|
|
113
|
+
value: SelectModeEnum;
|
|
114
|
+
}[];
|
|
115
115
|
export declare const titlePositionOptions: {
|
|
116
116
|
label: string;
|
|
117
117
|
value: TitlePositionEnum;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChartTypeBits, IPieLabelStyle, ISeriesLabelStyle } from '@univerjs-pro/sheets-chart';
|
|
1
2
|
import { LocaleService, Nullable } from '@univerjs/core';
|
|
2
|
-
import { IPieLabelStyle, ISeriesLabelStyle, ChartTypeBits } from '@univerjs-pro/sheets-chart';
|
|
3
3
|
import { PropertyChangeFunction } from '../font-format-bar';
|
|
4
4
|
import { OptionType } from '../options';
|
|
5
5
|
import { default as React } from 'react';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChartBorderDashType } from '@univerjs-pro/sheets-chart';
|
|
2
|
+
import { LocaleService } from '@univerjs/core';
|
|
3
|
+
import { default as React } from 'react';
|
|
4
|
+
interface IIndicatorChangeInfo {
|
|
5
|
+
indicatorLabelColor?: string;
|
|
6
|
+
indicatorLineType?: ChartBorderDashType;
|
|
7
|
+
indicatorLineColor?: string;
|
|
8
|
+
indicatorLabelTextColor?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IIndicatorLineProps {
|
|
11
|
+
localeService: LocaleService;
|
|
12
|
+
indicatorLabelColor: string;
|
|
13
|
+
indicatorLineType: ChartBorderDashType;
|
|
14
|
+
indicatorLineColor: string;
|
|
15
|
+
indicatorLabelTextColor: string;
|
|
16
|
+
onChange?: (v: IIndicatorChangeInfo) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const IndicatorLine: (props: IIndicatorLineProps) => React.JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { DeepPartial, IPointStyle, ISeriesStyle } from '@univerjs-pro/sheets-chart';
|
|
1
2
|
import { LocaleService } from '@univerjs/core';
|
|
2
|
-
import { DeepPartial, IRadarPointStyle, ISeriesStyle } from '@univerjs-pro/sheets-chart';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
4
|
interface IRadarSeriesPointProps {
|
|
5
5
|
localeService: LocaleService;
|
|
6
6
|
setSeriesStyle: (style: DeepPartial<ISeriesStyle>) => void;
|
|
7
|
-
pointStyle?:
|
|
7
|
+
pointStyle?: IPointStyle;
|
|
8
8
|
}
|
|
9
9
|
export declare const RadarSeriesPoint: (props: IRadarSeriesPointProps) => React.JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { DeepPartial, IPointStyle, ISeriesStyle, ChartTypeBits } from '@univerjs-pro/sheets-chart';
|
|
1
2
|
import { LocaleService, Nullable } from '@univerjs/core';
|
|
2
|
-
import { DeepPartial, IPointStyle, IRadarPointStyle, ISeriesStyle } from '@univerjs-pro/sheets-chart';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
4
|
export interface IWidgetProps {
|
|
5
5
|
localeService: LocaleService;
|
|
@@ -9,6 +9,7 @@ export interface IFillOptions extends IWidgetProps {
|
|
|
9
9
|
seriesStyle: Nullable<DeepPartial<ISeriesStyle>>;
|
|
10
10
|
allSeriesStyle: Nullable<DeepPartial<ISeriesStyle>>;
|
|
11
11
|
controlName: string;
|
|
12
|
+
chartType: Nullable<ChartTypeBits>;
|
|
12
13
|
}
|
|
13
14
|
export declare const FillOptions: (props: IFillOptions) => React.JSX.Element;
|
|
14
15
|
export interface IBorderOptionsProps extends IWidgetProps {
|
|
@@ -21,12 +22,8 @@ export interface IBorderOptionsProps extends IWidgetProps {
|
|
|
21
22
|
export declare const BorderOptions: (props: IBorderOptionsProps) => React.JSX.Element;
|
|
22
23
|
type PointStyleKeys = keyof IPointStyle;
|
|
23
24
|
export interface ILinePointOptionsProps extends Omit<IWidgetProps, 'onSeriesStyleChange'> {
|
|
24
|
-
pointStyle: ISeriesStyle['point'] |
|
|
25
|
+
pointStyle: ISeriesStyle['point'] | IPointStyle;
|
|
25
26
|
controls: Array<PointStyleKeys>;
|
|
26
|
-
pointShapeOptions?: {
|
|
27
|
-
label: string;
|
|
28
|
-
value: string;
|
|
29
|
-
}[];
|
|
30
27
|
onChange?: <K extends PointStyleKeys = PointStyleKeys>(key: K, value: IPointStyle[K]) => void;
|
|
31
28
|
}
|
|
32
29
|
export declare const LinePointOptions: (props: ILinePointOptionsProps) => React.JSX.Element;
|