@visactor/vseed 0.0.1 → 0.0.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/dist/builder/builder/build.d.ts +3 -0
- package/dist/builder/builder/buildAdvanced.d.ts +3 -0
- package/dist/builder/builder/buildSpec.d.ts +4 -0
- package/dist/builder/builder/builder.d.ts +18 -0
- package/dist/builder/builder/index.d.ts +1 -0
- package/dist/builder/index.d.ts +2 -0
- package/dist/builder/register/index.d.ts +1 -0
- package/dist/builder/register/register.d.ts +10 -0
- package/dist/dataReshape/constant.d.ts +5 -0
- package/dist/dataReshape/dataReshapeFor1D1M.d.ts +13 -0
- package/dist/dataReshape/dataReshapeFor2D1M.d.ts +13 -0
- package/dist/dataReshape/foldMeasures.d.ts +31 -0
- package/dist/dataReshape/index.d.ts +4 -0
- package/dist/dataReshape/unfoldDimensions.d.ts +19 -0
- package/dist/index.cjs +893 -4
- package/dist/index.d.ts +5 -1
- package/dist/index.js +768 -2
- package/dist/pipeline/advanced/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipeline/area.d.ts +2 -0
- package/dist/pipeline/advanced/pipeline/areaPercent.d.ts +2 -0
- package/dist/pipeline/advanced/pipeline/bar.d.ts +2 -0
- package/dist/pipeline/advanced/pipeline/barParallel.d.ts +2 -0
- package/dist/pipeline/advanced/pipeline/barPercent.d.ts +2 -0
- package/dist/pipeline/advanced/pipeline/column.d.ts +2 -0
- package/dist/pipeline/advanced/pipeline/columnParallel.d.ts +2 -0
- package/dist/pipeline/advanced/pipeline/columnPercent.d.ts +2 -0
- package/dist/pipeline/advanced/pipeline/index.d.ts +9 -0
- package/dist/pipeline/advanced/pipeline/line.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/encoding/encodingCartesian.d.ts +3 -0
- package/dist/pipeline/advanced/pipes/encoding/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipes/index.d.ts +3 -0
- package/dist/pipeline/advanced/pipes/init/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipes/init/initAdvancedVSeed.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/reshape/index.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/reshape/reshapeTo1D1M.d.ts +8 -0
- package/dist/pipeline/advanced/pipes/reshape/reshapeTo2D1M.d.ts +8 -0
- package/dist/pipeline/index.d.ts +3 -0
- package/dist/pipeline/spec/index.d.ts +1 -0
- package/dist/pipeline/spec/pipeline/area.d.ts +2 -0
- package/dist/pipeline/spec/pipeline/areaPercent.d.ts +2 -0
- package/dist/pipeline/spec/pipeline/bar.d.ts +2 -0
- package/dist/pipeline/spec/pipeline/barParallel.d.ts +2 -0
- package/dist/pipeline/spec/pipeline/barPercent.d.ts +2 -0
- package/dist/pipeline/spec/pipeline/column.d.ts +2 -0
- package/dist/pipeline/spec/pipeline/columnParallel.d.ts +2 -0
- package/dist/pipeline/spec/pipeline/columnPercent.d.ts +2 -0
- package/dist/pipeline/spec/pipeline/index.d.ts +9 -0
- package/dist/pipeline/spec/pipeline/line.d.ts +2 -0
- package/dist/pipeline/spec/pipes/axes/index.d.ts +4 -0
- package/dist/pipeline/spec/pipes/axes/xBand.d.ts +2 -0
- package/dist/pipeline/spec/pipes/axes/xLinear.d.ts +2 -0
- package/dist/pipeline/spec/pipes/axes/yBand.d.ts +2 -0
- package/dist/pipeline/spec/pipes/axes/yLinear.d.ts +2 -0
- package/dist/pipeline/spec/pipes/dataset/dataset.d.ts +2 -0
- package/dist/pipeline/spec/pipes/dataset/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/index.d.ts +5 -0
- package/dist/pipeline/spec/pipes/init/area.d.ts +2 -0
- package/dist/pipeline/spec/pipes/init/bar.d.ts +2 -0
- package/dist/pipeline/spec/pipes/init/barParallel.d.ts +2 -0
- package/dist/pipeline/spec/pipes/init/column.d.ts +2 -0
- package/dist/pipeline/spec/pipes/init/columnParallel.d.ts +2 -0
- package/dist/pipeline/spec/pipes/init/index.d.ts +6 -0
- package/dist/pipeline/spec/pipes/init/line.d.ts +2 -0
- package/dist/pipeline/spec/pipes/percent/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/percent/percent.d.ts +2 -0
- package/dist/pipeline/spec/pipes/stack/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/stack/stack.d.ts +2 -0
- package/dist/pipeline/utils/index.d.ts +1 -0
- package/dist/pipeline/utils/pipeline.d.ts +9 -0
- package/dist/types/builder/builder.d.ts +10 -0
- package/dist/types/builder/index.d.ts +1 -0
- package/dist/types/chartType/area/area.d.ts +46 -0
- package/dist/types/chartType/area/index.d.ts +1 -0
- package/dist/types/chartType/areaPercent/areaPercent.d.ts +45 -0
- package/dist/types/chartType/areaPercent/index.d.ts +1 -0
- package/dist/types/chartType/bar/bar.d.ts +45 -0
- package/dist/types/chartType/bar/index.d.ts +1 -0
- package/dist/types/chartType/barParallel/barParallel.d.ts +45 -0
- package/dist/types/chartType/barParallel/index.d.ts +1 -0
- package/dist/types/chartType/barPercent/barPercent.d.ts +45 -0
- package/dist/types/chartType/barPercent/index.d.ts +1 -0
- package/dist/types/chartType/column/column.d.ts +45 -0
- package/dist/types/chartType/column/index.d.ts +1 -0
- package/dist/types/chartType/columnParallel/columnParallel.d.ts +45 -0
- package/dist/types/chartType/columnParallel/index.d.ts +1 -0
- package/dist/types/chartType/columnPercent/columnPercent.d.ts +45 -0
- package/dist/types/chartType/columnPercent/index.d.ts +1 -0
- package/dist/types/chartType/donut/donut.d.ts +45 -0
- package/dist/types/chartType/donut/index.d.ts +1 -0
- package/dist/types/chartType/dualAxis/dualAxis.d.ts +47 -0
- package/dist/types/chartType/dualAxis/index.d.ts +1 -0
- package/dist/types/chartType/index.d.ts +16 -0
- package/dist/types/chartType/line/index.d.ts +1 -0
- package/dist/types/chartType/line/line.d.ts +45 -0
- package/dist/types/chartType/pie/index.d.ts +1 -0
- package/dist/types/chartType/pie/pie.d.ts +45 -0
- package/dist/types/chartType/pivotTable/index.d.ts +1 -0
- package/dist/types/chartType/pivotTable/pivotTable.d.ts +45 -0
- package/dist/types/chartType/rose/index.d.ts +1 -0
- package/dist/types/chartType/rose/rose.d.ts +45 -0
- package/dist/types/chartType/table/index.d.ts +1 -0
- package/dist/types/chartType/table/table.d.ts +45 -0
- package/dist/types/chartType/vseedDSL.d.ts +16 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/pipeline/advancedVSeed/advancedVSeed.d.ts +7 -0
- package/dist/types/pipeline/advancedVSeed/index.d.ts +1 -0
- package/dist/types/pipeline/index.d.ts +3 -0
- package/dist/types/pipeline/pipeline.d.ts +2 -0
- package/dist/types/pipeline/spec/index.d.ts +1 -0
- package/dist/types/pipeline/spec/spec.d.ts +9 -0
- package/dist/types/properties/advancedVSeed.d.ts +105 -0
- package/dist/types/properties/chartType/index.d.ts +2 -0
- package/dist/types/properties/chartType/zChartType.d.ts +36 -0
- package/dist/types/properties/dataset/dataset.d.ts +15 -0
- package/dist/types/properties/dataset/index.d.ts +2 -0
- package/dist/types/properties/datasetReshapeInfo/datasetReshapeInfo.d.ts +34 -0
- package/dist/types/properties/datasetReshapeInfo/index.d.ts +2 -0
- package/dist/types/properties/dimensions/dimensions.d.ts +23 -0
- package/dist/types/properties/dimensions/index.d.ts +2 -0
- package/dist/types/properties/encoding/encoding.d.ts +19 -0
- package/dist/types/properties/encoding/index.d.ts +2 -0
- package/dist/types/properties/index.d.ts +8 -0
- package/dist/types/properties/measures/index.d.ts +2 -0
- package/dist/types/properties/measures/measures.d.ts +109 -0
- package/dist/types/properties/vseed.d.ts +94 -0
- package/package.json +13 -2
@@ -0,0 +1,45 @@
|
|
1
|
+
import type { Dataset, Dimensions, Measures } from 'src/types';
|
2
|
+
/**
|
3
|
+
* 百分比柱状图类型定义
|
4
|
+
* @description 百分比柱状图,适用于展示各类别占比关系的场景,Y轴以百分比形式展示数据占比
|
5
|
+
* 适用场景:
|
6
|
+
* - 不同类别数据的占比对比
|
7
|
+
* - 多维度数据的构成分析
|
8
|
+
* - 时间序列的占比变化趋势
|
9
|
+
* 数据要求:
|
10
|
+
* - 至少1个指标字段(度量)
|
11
|
+
* - 第一个维度会放至X轴, 其余维度会与指标名称(存在多个指标时)合并, 作为图例项展示.
|
12
|
+
* - 所有指标会自动合并为一个指标
|
13
|
+
* 默认开启的功能:
|
14
|
+
* - 默认开启图例、坐标轴、百分比标签、提示信息、占比计算
|
15
|
+
*/
|
16
|
+
export interface ColumnPercent {
|
17
|
+
/**
|
18
|
+
* 百分比柱状图
|
19
|
+
* @description 百分比柱状图,以百分比形式展示各类别数据占比关系
|
20
|
+
* @type {'columnPercent'}
|
21
|
+
* @example 'columnPercent'
|
22
|
+
*/
|
23
|
+
chartType: 'columnPercent';
|
24
|
+
/**
|
25
|
+
* 数据集
|
26
|
+
* @description 符合TidyData规范的且已经聚合的数据集,用于定义图表的数据来源和结构, 用户输入的数据集并不需要进行任何处理, VSeed带有强大的数据重塑功能, 会自行进行数据重塑, 百分比柱状图的数据最终会被转换为2个维度, 1个指标.
|
27
|
+
* @type {Array<Record<string|number, any>>}
|
28
|
+
* @example [{category:'A', value:30}, {category:'B', value:70}]
|
29
|
+
*/
|
30
|
+
dataset: Dataset;
|
31
|
+
/**
|
32
|
+
* 维度
|
33
|
+
* @description 第一个维度被映射到X轴, 其余维度会与指标名称(存在多个指标时)合并, 作为图例项展示.
|
34
|
+
* @type {Dimensions}
|
35
|
+
* @example [{id: 'category', alias: '类别'}]
|
36
|
+
*/
|
37
|
+
dimensions: Dimensions;
|
38
|
+
/**
|
39
|
+
* 指标
|
40
|
+
* @description 百分比柱状图指标会自动合并为一个指标, 映射到Y轴, 存在多个指标时, 指标名称会与其余维度合并, 作为图例项展示.
|
41
|
+
* @type {Measures}
|
42
|
+
* @example [{id: 'value', alias: '数值占比', format: 'percent'}]
|
43
|
+
*/
|
44
|
+
measures: Measures;
|
45
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type { ColumnPercent } from './columnPercent';
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import type { Dataset, Dimensions, Measures } from 'src/types';
|
2
|
+
/**
|
3
|
+
* 环形图类型定义
|
4
|
+
* @description 环形图,适用于展示单一维度数据的占比关系,中心留有空白区域可展示汇总信息
|
5
|
+
* 适用场景:
|
6
|
+
* - 需要同时展示整体数据和各部分占比
|
7
|
+
* - 强调数据的整体与部分关系
|
8
|
+
* - 中心区域需要展示关键指标或标题
|
9
|
+
* 数据要求:
|
10
|
+
* - 至少1个指标字段(度量)
|
11
|
+
* - 所有维度会与指标名称(存在多个指标时)合并, 作为图例项展示.
|
12
|
+
* - 所有指标会自动合并为一个指标
|
13
|
+
* 默认开启的功能:
|
14
|
+
* - 默认开启图例、数据标签、提示信息、占比计算、中心文本
|
15
|
+
*/
|
16
|
+
export interface Donut {
|
17
|
+
/**
|
18
|
+
* 环形图
|
19
|
+
* @description 环形图,中心留有空白区域的饼图变体
|
20
|
+
* @type {'donut'}
|
21
|
+
* @example 'donut'
|
22
|
+
*/
|
23
|
+
chartType: 'donut';
|
24
|
+
/**
|
25
|
+
* 数据集
|
26
|
+
* @description 符合TidyData规范的且已经聚合的数据集,用于定义图表的数据来源和结构, 用户输入的数据集并不需要进行任何处理, VSeed带有强大的数据重塑功能, 会自行进行数据重塑, 环形图的数据最终会被转换为1个维度, 1个指标.
|
27
|
+
* @type {Array<Record<string|number, any>>}
|
28
|
+
* @example [{category:'A', value:30}, {category:'B', value:70}]
|
29
|
+
*/
|
30
|
+
dataset: Dataset;
|
31
|
+
/**
|
32
|
+
* 维度
|
33
|
+
* @description 环形图的所有维度会与指标名称(存在多个指标时)合并成1个维度, 映射到饼图的角度, 并作为图例项展示.
|
34
|
+
* @type {Dimensions}
|
35
|
+
* @example [{id: 'category', alias: '类别'}]
|
36
|
+
*/
|
37
|
+
dimensions: Dimensions;
|
38
|
+
/**
|
39
|
+
* 指标
|
40
|
+
* @description 环形图的所有指标会自动合并为一个指标, 映射到饼图的半径, 存在多个指标时, 指标名称会与其余维度合并, 并作为图例项展示.
|
41
|
+
* @type {Measures}
|
42
|
+
* @example [{id: 'value', alias: '数值占比', format: 'percent'}]
|
43
|
+
*/
|
44
|
+
measures: Measures;
|
45
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type { Donut } from './donut';
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import type { Dataset, Dimensions, Measures } from 'src/types';
|
2
|
+
/**
|
3
|
+
* 双轴图类型定义
|
4
|
+
* @description 双轴图,适用于展示两个不同量级或不同单位指标的对比关系,包含主坐标轴和次坐标轴
|
5
|
+
* 适用场景:
|
6
|
+
* - 不同量级指标的对比分析
|
7
|
+
* - 相关性指标的趋势比较
|
8
|
+
* - 需要同时展示数值和增长率等复合指标
|
9
|
+
* - 支持不同类型图表组合(如折线图+柱状图/ 折线图+面积图/ 面积图+柱状图)
|
10
|
+
* 数据要求:
|
11
|
+
* - 至少1个指标字段(度量)
|
12
|
+
* - 支持指标组, 第一组指标会放置(主轴)左轴, 第二组指标会放置(次轴)右轴
|
13
|
+
* - 第一个维度会放至X轴, 其余维度会与指标名称(存在多个指标时)合并, 作为图例项展示.
|
14
|
+
* - 两组指标字段可分别映射到左右两个Y轴, 一个指标组内的所有会自动合并为一个指标
|
15
|
+
* 默认开启的功能:
|
16
|
+
* - 默认开启坐标轴、图例、数据标签、提示信息
|
17
|
+
*/
|
18
|
+
export interface DualAxis {
|
19
|
+
/**
|
20
|
+
* 双轴图
|
21
|
+
* @description 双轴图,展示两个不同量级指标对比关系的复合图表
|
22
|
+
* @type {'dualAxis'}
|
23
|
+
* @example 'dualAxis'
|
24
|
+
*/
|
25
|
+
chartType: 'dualAxis';
|
26
|
+
/**
|
27
|
+
* 数据集
|
28
|
+
* @description 符合TidyData规范的且已经聚合的数据集,用于定义图表的数据来源和结构, 用户输入的数据集并不需要进行任何处理, VSeed带有强大的数据重塑功能, 会自行进行数据重塑, 双轴图的数据最终会被转换为2个维度, 1或2个指标(取决于用户是否配置了指标组).
|
29
|
+
* @type {Array<Record<string|number, any>>}
|
30
|
+
* @example [{month:'1月', value:100, growth:0.2}, {month:'2月', value:150, growth:0.5}]
|
31
|
+
*/
|
32
|
+
dataset: Dataset;
|
33
|
+
/**
|
34
|
+
* 维度
|
35
|
+
* @description 第一个维度会放至X轴, 其余维度会与指标名称(存在多个指标时)合并, 作为图例项展示.
|
36
|
+
* @type {Dimensions}
|
37
|
+
* @example [{id: 'month', alias: '月份'}]
|
38
|
+
*/
|
39
|
+
dimensions: Dimensions;
|
40
|
+
/**
|
41
|
+
* 指标
|
42
|
+
* @description 双轴图如果有2组指标组, 则每个组内的所有指标分别自动合并为一个指标, 分别映射到双轴图的左右轴, 如果指标不成组, 则会当作一组指标处理.
|
43
|
+
* @type {Measures}
|
44
|
+
* @example [{id: 'value', alias: '数值', axis: 'left'}, {id: 'growth', alias: '增长率', axis: 'right', format: 'percent'}]
|
45
|
+
*/
|
46
|
+
measures: Measures;
|
47
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type { DualAxis } from './dualAxis';
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export type * from './table';
|
2
|
+
export type * from './pivotTable';
|
3
|
+
export type * from './line';
|
4
|
+
export type * from './column';
|
5
|
+
export type * from './columnParallel';
|
6
|
+
export type * from './columnPercent';
|
7
|
+
export type * from './bar';
|
8
|
+
export type * from './barParallel';
|
9
|
+
export type * from './barPercent';
|
10
|
+
export type * from './area';
|
11
|
+
export type * from './areaPercent';
|
12
|
+
export type * from './dualAxis';
|
13
|
+
export type * from './rose';
|
14
|
+
export type * from './pie';
|
15
|
+
export type * from './donut';
|
16
|
+
export type * from './vseedDSL';
|
@@ -0,0 +1 @@
|
|
1
|
+
export type { Line } from './line';
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import type { Dataset, Dimensions, Measures } from 'src/types';
|
2
|
+
/**
|
3
|
+
* 折线图类型定义
|
4
|
+
* @description 折线图,适用于展示数据随时间或有序类别变化的趋势,通过线段连接数据点形成趋势线
|
5
|
+
* 适用场景:
|
6
|
+
* - 展示时间序列数据的变化趋势
|
7
|
+
* - 比较多个数据系列的趋势对比
|
8
|
+
* - 分析数据的增长或下降规律
|
9
|
+
* 数据要求:
|
10
|
+
* - 至少1个数值字段(度量)
|
11
|
+
* - 第一个维度会放至X轴, 其余维度会与指标名称(存在多个指标时)合并, 作为图例项展示
|
12
|
+
* - 所有指标会自动合并为一个指标
|
13
|
+
* 默认开启的功能:
|
14
|
+
* - 默认开启图例、坐标轴、数据点标记、提示信息、趋势线
|
15
|
+
*/
|
16
|
+
export interface Line {
|
17
|
+
/**
|
18
|
+
* 折线图
|
19
|
+
* @description 折线图,适用于展示数据随时间或有序类别变化的趋势
|
20
|
+
* @type {'line'}
|
21
|
+
* @example 'line'
|
22
|
+
*/
|
23
|
+
chartType: 'line';
|
24
|
+
/**
|
25
|
+
* 数据集
|
26
|
+
* @description 符合TidyData规范的且已经聚合的数据集,用于定义图表的数据来源和结构, 用户输入的数据集并不需要进行任何处理, VSeed带有强大的数据重塑功能, 会自行进行数据重塑, 折线图的数据最终会被转换为2个维度, 1个指标.
|
27
|
+
* @type {Array<Record<string|number, any>>}
|
28
|
+
* @example [{month:'1月', value:100}, {month:'2月', value:150}, {month:'3月', value:120}]
|
29
|
+
*/
|
30
|
+
dataset: Dataset;
|
31
|
+
/**
|
32
|
+
* 维度
|
33
|
+
* @description 折线图的第一个维度被映射到X轴, 其余维度会与指标名称(存在多个指标时)合并, 作为图例项展示
|
34
|
+
* @type {Dimensions}
|
35
|
+
* @example [{id: "month", alias: "月份"}]
|
36
|
+
*/
|
37
|
+
dimensions: Dimensions;
|
38
|
+
/**
|
39
|
+
* 指标
|
40
|
+
* @description 折线图的所有指标会自动合并为一个指标, 映射到Y轴, 存在多个指标时, 指标名称会与其余维度合并, 作为图例项展示.
|
41
|
+
* @type {Measures}
|
42
|
+
* @example [{id: "value", alias: "数值"}]
|
43
|
+
*/
|
44
|
+
measures: Measures;
|
45
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type { Pie } from './pie';
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import type { Dataset, Dimensions, Measures } from 'src/types';
|
2
|
+
/**
|
3
|
+
* 饼图类型定义
|
4
|
+
* @description 饼图,适用于展示单一维度数据的占比关系,通过扇形面积大小表示各类别占比
|
5
|
+
* 适用场景:
|
6
|
+
* - 展示分类数据的占比分布
|
7
|
+
* - 强调数据的整体与部分关系
|
8
|
+
* - 类别数量较少(建议不超过6个)的占比分析
|
9
|
+
* 数据要求:
|
10
|
+
* - 至少1个数值字段(度量)
|
11
|
+
* - 所有维度会与指标名称(存在多个指标时)合并成一个维度, 作为图例项展示
|
12
|
+
* - 所有指标会自动合并为一个指标
|
13
|
+
* 默认开启的功能:
|
14
|
+
* - 默认开启图例、数据标签、提示信息、占比计算
|
15
|
+
*/
|
16
|
+
export interface Pie {
|
17
|
+
/**
|
18
|
+
* 饼图
|
19
|
+
* @description 饼图,展示单一维度数据的占比关系
|
20
|
+
* @type {'pie'}
|
21
|
+
* @example 'pie'
|
22
|
+
*/
|
23
|
+
chartType: 'pie';
|
24
|
+
/**
|
25
|
+
* 数据集
|
26
|
+
* @description 符合TidyData规范的且已经聚合的数据集,用于定义图表的数据来源和结构, 用户输入的数据集并不需要进行任何处理, VSeed带有强大的数据重塑功能, 会自行进行数据重塑, 饼图的数据最终会被转换为1个维度, 1个指标.
|
27
|
+
* @type {Array<Record<string|number, any>>}
|
28
|
+
* @example [{category:'A', value:30}, {category:'B', value:70}]
|
29
|
+
*/
|
30
|
+
dataset: Dataset;
|
31
|
+
/**
|
32
|
+
* 维度
|
33
|
+
* @description 饼图的所有维度会与指标名称(存在多个指标时)合并成一个维度, 映射到角度, 并作为图例项展示
|
34
|
+
* @type {Dimensions}
|
35
|
+
* @example [{id: 'category', alias: '类别'}]
|
36
|
+
*/
|
37
|
+
dimensions: Dimensions;
|
38
|
+
/**
|
39
|
+
* 指标
|
40
|
+
* @description 饼图的所有指标会自动合并为一个指标, 映射到半径轴, 存在多个指标时, 指标名称会与其余维度合并, 作为图例项展示.
|
41
|
+
* @type {Measures}
|
42
|
+
* @example [{id: 'value', alias: '数值占比', format: 'percent'}]
|
43
|
+
*/
|
44
|
+
measures: Measures;
|
45
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type { PivotTable } from './pivotTable';
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import type { Dataset, Dimensions, Measures } from 'src/types';
|
2
|
+
/**
|
3
|
+
* 透视表类型定义
|
4
|
+
* @description 透视表,适用于多维度数据交叉分析场景,可灵活配置行、列维度和指标计算方式
|
5
|
+
* 适用场景:
|
6
|
+
* - 复杂多维数据统计分析
|
7
|
+
* - 数据钻取与聚合展示
|
8
|
+
* - 业务报表生成与数据探索
|
9
|
+
* 数据要求:
|
10
|
+
* - 至少1个行维度 或 1个列维度 或 1个指标
|
11
|
+
* - 数据必须已聚合
|
12
|
+
* - 数据可被分组
|
13
|
+
* 默认开启的功能:
|
14
|
+
* - 默认开启行列排序、数据筛选、聚合计算、小计/总计
|
15
|
+
*/
|
16
|
+
export interface PivotTable {
|
17
|
+
/**
|
18
|
+
* 透视表
|
19
|
+
* @description 透视表,适用于多维度数据交叉分析场景
|
20
|
+
* @type {'pivotTable'}
|
21
|
+
* @example 'pivotTable'
|
22
|
+
*/
|
23
|
+
chartType: 'pivotTable';
|
24
|
+
/**
|
25
|
+
* 数据集
|
26
|
+
* @description 符合TidyData规范的且已经聚合的数据集,用于定义图表的数据来源和结构, 用户输入的数据集并不需要进行任何处理, VSeed带有强大的数据重塑功能, 会自行进行数据重塑, 透视表的数据最终会被转换对应的树形结构, 用户无需手动进行数据处理.
|
27
|
+
* @type {Array<Record<string|number, any>>}
|
28
|
+
* @example [{region:'华东', product:'A', sales:1000}, {region:'华东', product:'B', sales:1500}]
|
29
|
+
*/
|
30
|
+
dataset: Dataset;
|
31
|
+
/**
|
32
|
+
* 维度
|
33
|
+
* @description 透视表的行维度和列维度,会自动对数据进行处理为树形结构, 并映射到行和列轴, 可以通过 location : "rowDimension" | "columnDimension" 来控制一维度的映射位置
|
34
|
+
* @type {Dimensions}
|
35
|
+
* @example [{id: 'region', alias: '地区', isRow: true}, {id: 'product', alias: '产品', isColumn: true}]
|
36
|
+
*/
|
37
|
+
dimensions: Dimensions;
|
38
|
+
/**
|
39
|
+
* 指标
|
40
|
+
* @description 透视表支持多个维度指标
|
41
|
+
* @type {Measures}
|
42
|
+
* @example [{id: 'sales', alias: '销售额', aggregation: 'sum'}]
|
43
|
+
*/
|
44
|
+
measures: Measures;
|
45
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type { Rose } from './rose';
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import type { Dataset, Dimensions, Measures } from 'src/types';
|
2
|
+
/**
|
3
|
+
* 玫瑰图类型定义
|
4
|
+
* @description 玫瑰图,适用于多维度数据对比场景,通过极坐标系下的扇形弧度和半径展示数据大小
|
5
|
+
* 适用场景:
|
6
|
+
* - 多维度数据的分布对比
|
7
|
+
* - 周期性数据的强弱比较
|
8
|
+
* - 分类数据的数值与占比同时展示
|
9
|
+
* 数据要求:
|
10
|
+
* - 至少1个数值字段(度量)
|
11
|
+
* - 第一个维度会放至角度轴, 其余维度会与指标名称(存在多个指标时)合并, 作为图例项展示
|
12
|
+
* - 所有指标会自动合并为一个指标
|
13
|
+
* 默认开启的功能:
|
14
|
+
* - 默认开启图例、极坐标系、数据标签、提示信息、数值缩放
|
15
|
+
*/
|
16
|
+
export interface Rose {
|
17
|
+
/**
|
18
|
+
* 玫瑰图
|
19
|
+
* @description 玫瑰图,通过极坐标系展示多维度数据对比关系
|
20
|
+
* @type {'rose'}
|
21
|
+
* @example 'rose'
|
22
|
+
*/
|
23
|
+
chartType: 'rose';
|
24
|
+
/**
|
25
|
+
* 数据集
|
26
|
+
* @description 符合TidyData规范的且已经聚合的数据集,用于定义图表的数据来源和结构, 用户输入的数据集并不需要进行任何处理, VSeed带有强大的数据重塑功能, 会自行进行数据重塑, 玫瑰图的数据最终会被转换为2个维度, 1个指标.
|
27
|
+
* @type {Array<Record<string|number, any>>}
|
28
|
+
* @example [{month:'1月', value:100}, {month:'2月', value:150}, {month:'3月', value:120}]
|
29
|
+
*/
|
30
|
+
dataset: Dataset;
|
31
|
+
/**
|
32
|
+
* 维度
|
33
|
+
* @description 玫瑰图的第一个维度被映射到角度轴, 其余维度会与指标名称(存在多个指标时)合并, 作为图例项展示.
|
34
|
+
* @type {Dimensions}
|
35
|
+
* @example [{id: 'category', alias: '类别'}]
|
36
|
+
*/
|
37
|
+
dimensions: Dimensions;
|
38
|
+
/**
|
39
|
+
* 指标
|
40
|
+
* @description 玫瑰图的指标会自动合并为一个指标, 映射到半径轴, 存在多个指标时, 指标名称会与其余维度合并, 作为图例项展示.
|
41
|
+
* @type {Measures}
|
42
|
+
* @example [{id: 'value', alias: '数值'}]
|
43
|
+
*/
|
44
|
+
measures: Measures;
|
45
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type { Table } from './table';
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import type { Dataset, Dimensions, Measures } from 'src/types';
|
2
|
+
/**
|
3
|
+
* 表格类型定义
|
4
|
+
* @description 表格,适用于详细数据展示场景,行列分明,便于查看具体数值
|
5
|
+
* 适用场景:
|
6
|
+
* - 需要展示详细数据明细
|
7
|
+
* - 数据项需要精确比对
|
8
|
+
* - 展示多维度数据属性
|
9
|
+
* 数据要求:
|
10
|
+
* - 至少1个维度字段
|
11
|
+
* - 至少1个度量字段
|
12
|
+
* - 维度字段会作为表格的列标题
|
13
|
+
* 默认开启的功能:
|
14
|
+
* - 默认开启排序、筛选、分页功能
|
15
|
+
*/
|
16
|
+
export interface Table {
|
17
|
+
/**
|
18
|
+
* 表格
|
19
|
+
* @description 标准表格组件,用于展示详细数据
|
20
|
+
* @type {'table'}
|
21
|
+
* @example 'table'
|
22
|
+
*/
|
23
|
+
chartType: 'table';
|
24
|
+
/**
|
25
|
+
* 数据集
|
26
|
+
* @description 符合TidyData规范的且已经聚合的数据集,用于定义图表的数据来源和结构, 用户输入的数据集并不需要进行任何处理, 一个字段对应一列, 一个记录对应一行
|
27
|
+
* @type {Array<Record<string|number, any>>}
|
28
|
+
* @example [{id: 1, name: "A", value: 100}, {id: 2, name: "B", value: 200}]
|
29
|
+
*/
|
30
|
+
dataset: Dataset;
|
31
|
+
/**
|
32
|
+
* 维度
|
33
|
+
* @description 表格的每个维度会对应一列
|
34
|
+
* @type {Dimensions}
|
35
|
+
* @example [{id: "name", alias: "名称"}]
|
36
|
+
*/
|
37
|
+
dimensions: Dimensions;
|
38
|
+
/**
|
39
|
+
* 指标
|
40
|
+
* @description 表格的每个指标会对应一行, 并且天生支持指标组合.
|
41
|
+
* @type {Measures}
|
42
|
+
* @example [{id: "value", alias: "数值"}]
|
43
|
+
*/
|
44
|
+
measures: Measures;
|
45
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { Bar } from './bar';
|
2
|
+
import type { BarParallel } from './barParallel';
|
3
|
+
import type { Column } from './column';
|
4
|
+
import type { ColumnParallel } from './columnParallel';
|
5
|
+
import type { ColumnPercent } from './columnPercent';
|
6
|
+
import type { Line } from './line';
|
7
|
+
import type { Table } from './table';
|
8
|
+
import type { Rose } from './rose';
|
9
|
+
import type { BarPercent } from './barPercent';
|
10
|
+
import type { PivotTable } from './pivotTable';
|
11
|
+
import type { Pie } from './pie';
|
12
|
+
import type { Donut } from './donut';
|
13
|
+
import type { DualAxis } from './dualAxis';
|
14
|
+
import type { Area } from './area';
|
15
|
+
import type { AreaPercent } from './areaPercent';
|
16
|
+
export type VSeedDSL = Table | PivotTable | Line | Column | ColumnParallel | ColumnPercent | Bar | BarParallel | BarPercent | Area | AreaPercent | DualAxis | Rose | Pie | Donut;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { AdvancedVSeed, VSeed } from '../../properties';
|
2
|
+
import type { Pipe } from '../pipeline';
|
3
|
+
export type AdvancedPipelineContext = {
|
4
|
+
vseed: VSeed;
|
5
|
+
};
|
6
|
+
export type AdvancedPipe = Pipe<AdvancedVSeed, AdvancedPipelineContext>;
|
7
|
+
export type AdvancedPipeline = Pipe<AdvancedVSeed, AdvancedPipelineContext>[];
|
@@ -0,0 +1 @@
|
|
1
|
+
export type * from './advancedVSeed';
|
@@ -0,0 +1 @@
|
|
1
|
+
export type * from './spec';
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { ISpec } from '@visactor/vchart';
|
2
|
+
import type { AdvancedVSeed, VSeed } from '../../properties';
|
3
|
+
import type { Pipe } from '../pipeline';
|
4
|
+
export type SpecPipelineContext = {
|
5
|
+
vseed: VSeed;
|
6
|
+
advancedVSeed: AdvancedVSeed;
|
7
|
+
};
|
8
|
+
export type SpecPipe = Pipe<ISpec, SpecPipelineContext>;
|
9
|
+
export type SpecPipeline = SpecPipe[];
|
@@ -0,0 +1,105 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
export declare const zAdvancedVSeed: z.ZodObject<{
|
3
|
+
chartType: z.ZodEnum<{
|
4
|
+
area: "area";
|
5
|
+
line: "line";
|
6
|
+
bar: "bar";
|
7
|
+
pie: "pie";
|
8
|
+
rose: "rose";
|
9
|
+
column: "column";
|
10
|
+
areaPercent: "areaPercent";
|
11
|
+
barPercent: "barPercent";
|
12
|
+
columnPercent: "columnPercent";
|
13
|
+
columnParallel: "columnParallel";
|
14
|
+
barParallel: "barParallel";
|
15
|
+
table: "table";
|
16
|
+
pivotTable: "pivotTable";
|
17
|
+
donut: "donut";
|
18
|
+
dualAxis: "dualAxis";
|
19
|
+
}>;
|
20
|
+
dataset: z.ZodArray<z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>>;
|
21
|
+
datasetReshapeInfo: z.ZodObject<{
|
22
|
+
foldInfo: z.ZodObject<{
|
23
|
+
foldMap: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodUndefined]>>;
|
24
|
+
measureId: z.ZodString;
|
25
|
+
measureName: z.ZodString;
|
26
|
+
measureValue: z.ZodString;
|
27
|
+
}, z.core.$strip>;
|
28
|
+
unfoldInfo: z.ZodObject<{
|
29
|
+
colorItems: z.ZodArray<z.ZodString>;
|
30
|
+
groupName: z.ZodString;
|
31
|
+
}, z.core.$strip>;
|
32
|
+
}, z.core.$strip>;
|
33
|
+
dimensions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
34
|
+
id: z.ZodString;
|
35
|
+
alias: z.ZodOptional<z.ZodString>;
|
36
|
+
visible: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
37
|
+
location: z.ZodEnum<{
|
38
|
+
dimension: "dimension";
|
39
|
+
rowDimension: "rowDimension";
|
40
|
+
columnDimension: "columnDimension";
|
41
|
+
}>;
|
42
|
+
}, z.core.$strip>>>;
|
43
|
+
measures: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
44
|
+
id: z.ZodString;
|
45
|
+
alias: z.ZodOptional<z.ZodString>;
|
46
|
+
visible: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
47
|
+
children: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject</*elided*/ any, z.core.$strip>, z.ZodObject<{
|
48
|
+
id: z.ZodString;
|
49
|
+
alias: z.ZodOptional<z.ZodString>;
|
50
|
+
visible: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
51
|
+
autoFormat: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
52
|
+
format: z.ZodOptional<z.ZodObject<{
|
53
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
54
|
+
number: "number";
|
55
|
+
percent: "percent";
|
56
|
+
permille: "permille";
|
57
|
+
}>>>;
|
58
|
+
ratio: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
59
|
+
symbol: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
60
|
+
thousandSeparator: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
61
|
+
decimalPlaces: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
62
|
+
round: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
63
|
+
round: "round";
|
64
|
+
floor: "floor";
|
65
|
+
ceil: "ceil";
|
66
|
+
}>>>;
|
67
|
+
prefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
68
|
+
suffix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
69
|
+
}, z.core.$strip>>;
|
70
|
+
}, z.core.$strip>]>>>;
|
71
|
+
}, z.core.$strip>, z.ZodObject<{
|
72
|
+
id: z.ZodString;
|
73
|
+
alias: z.ZodOptional<z.ZodString>;
|
74
|
+
visible: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
75
|
+
autoFormat: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
76
|
+
format: z.ZodOptional<z.ZodObject<{
|
77
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
78
|
+
number: "number";
|
79
|
+
percent: "percent";
|
80
|
+
permille: "permille";
|
81
|
+
}>>>;
|
82
|
+
ratio: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
83
|
+
symbol: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
84
|
+
thousandSeparator: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
85
|
+
decimalPlaces: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
86
|
+
round: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
87
|
+
round: "round";
|
88
|
+
floor: "floor";
|
89
|
+
ceil: "ceil";
|
90
|
+
}>>>;
|
91
|
+
prefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
92
|
+
suffix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
93
|
+
}, z.core.$strip>>;
|
94
|
+
}, z.core.$strip>]>>>;
|
95
|
+
encoding: z.ZodArray<z.ZodObject<{
|
96
|
+
x: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
97
|
+
y: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
98
|
+
color: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
99
|
+
group: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
100
|
+
angle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
101
|
+
radius: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
102
|
+
tooltip: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
103
|
+
}, z.core.$strip>>;
|
104
|
+
}, z.core.$strip>;
|
105
|
+
export type AdvancedVSeed = z.infer<typeof zAdvancedVSeed>;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
export type ChartType = 'table' | 'pivotTable' | 'line' | 'column' | 'columnPercent' | 'columnParallel' | 'bar' | 'barPercent' | 'barParallel' | 'area' | 'areaPercent' | 'rose' | 'pie' | 'donut' | 'dualAxis';
|
3
|
+
export declare enum ChartTypeEnum {
|
4
|
+
Table = "table",
|
5
|
+
PivotTable = "pivotTable",
|
6
|
+
Line = "line",
|
7
|
+
Column = "column",
|
8
|
+
ColumnPercent = "columnPercent",
|
9
|
+
ColumnParallel = "columnParallel",
|
10
|
+
Bar = "bar",
|
11
|
+
BarPercent = "barPercent",
|
12
|
+
BarParallel = "barParallel",
|
13
|
+
Area = "area",
|
14
|
+
AreaPercent = "areaPercent",
|
15
|
+
Rose = "rose",
|
16
|
+
Pie = "pie",
|
17
|
+
Donut = "donut",
|
18
|
+
DualAxis = "dualAxis"
|
19
|
+
}
|
20
|
+
export declare const zChartType: z.ZodEnum<{
|
21
|
+
area: "area";
|
22
|
+
line: "line";
|
23
|
+
bar: "bar";
|
24
|
+
pie: "pie";
|
25
|
+
rose: "rose";
|
26
|
+
column: "column";
|
27
|
+
areaPercent: "areaPercent";
|
28
|
+
barPercent: "barPercent";
|
29
|
+
columnPercent: "columnPercent";
|
30
|
+
columnParallel: "columnParallel";
|
31
|
+
barParallel: "barParallel";
|
32
|
+
table: "table";
|
33
|
+
pivotTable: "pivotTable";
|
34
|
+
donut: "donut";
|
35
|
+
dualAxis: "dualAxis";
|
36
|
+
}>;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
/**
|
3
|
+
* example dataset link:
|
4
|
+
* [
|
5
|
+
* { date: '2019', 20001:'type', profit:10, sales: null, },
|
6
|
+
* { date: '2020', 20001:'type', profit:30, sales: -1.1, },
|
7
|
+
* { date: '2021', 20001:'type', profit:30, sales: 1, },
|
8
|
+
* { date: '2023', 20001:'type', profit:40, sales: undefined, },
|
9
|
+
* { date: '2022', 20001:'type', profit:50, sales: 100, },
|
10
|
+
* ]
|
11
|
+
*/
|
12
|
+
export declare const zDatum: z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>;
|
13
|
+
export declare const zDataset: z.ZodArray<z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>>;
|
14
|
+
export type Datum = z.infer<typeof zDatum>;
|
15
|
+
export type Dataset = z.infer<typeof zDataset>;
|