Repository navigation
Expand file tree
/
Copy pathvis.ts
More file actions
175 lines (172 loc) · 5.99 KB
/
Copy pathvis.ts
File metadata and controls
175 lines (172 loc) · 5.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/**
* Chart definitions metadata
*/
import type { ChartTypeDefinition } from '../types';
const chartDefinitions: ChartTypeDefinition[] = [
{
type: 'line',
name: '折线图',
features: ['比较', '趋势分析'],
useCases: ['展示数值随时间或有序类别的变化', '分析事物随时间变化的趋势'],
dataRequirements: ['需要一个时间字段或分类字段', '至少一个数值字段'],
limitations: ['变量数值大多情况下为 0 时不适用'],
},
{
type: 'column',
name: '柱形图',
features: ['比较', '分布', '排名'],
useCases: ['对分类数据进行数值比较', '尤其是当数值比较接近时'],
dataRequirements: ['需要一个分类变量和一个数值变量'],
limitations: ['不能是连续型变量'],
},
{
type: 'bar',
name: '条形图',
features: ['比较', '分布', '排名'],
useCases: ['分类数据比较', '特别适合分类名称较长或分类数量较多的情况'],
dataRequirements: ['需要一个分类变量和一个数值变量'],
limitations: ['不适合显示连续型变量关系', '不适合强调趋势'],
},
{
type: 'pie',
name: '饼图',
features: ['占比', '成分分析'],
useCases: ['显示组成部分占整体的比例', '强调某部分在整体中的占比'],
dataRequirements: ['需要一个分类字段和一个数值字段', '分类应构成一个整体'],
limitations: [
'变量相互独立不构成整体时不适用',
'不能表现趋势',
'数值接近时难以分辨',
'类别过多时(建议不超过 5 个)不适用',
],
},
{
type: 'area',
name: '面积图',
features: ['比较', '趋势分析'],
useCases: ['体现连续自变量下数据趋势变化', '同时观察数据总量变化'],
dataRequirements: ['需要时间序列或有序数据'],
limitations: ['自变量不是顺序性变量时不适用'],
},
{
type: 'scatter',
name: '散点图',
features: ['相关性分析', '分布'],
useCases: ['发现两个变量之间的关系或趋势', '显示数据分布', '检测异常值'],
dataRequirements: ['需要两个数值变量'],
limitations: ['只有一个变量,或分类数据时不适用'],
},
{
type: 'dual-axes',
name: '双轴图',
features: ['多维对比', '趋势分析'],
useCases: ['同时展示两个不同量级的数据'],
dataRequirements: ['需要多个数值序列'],
limitations: ['两个序列量级相近或含义无关时不适用,应使用 line 或 column'],
},
{
type: 'histogram',
name: '直方图',
features: ['分布分析'],
useCases: ['显示数据分布'],
dataRequirements: ['连续数值数据'],
limitations: ['需要原始观测值,不适用于已聚合的计数或分类数据'],
},
{
type: 'boxplot',
name: '箱线图',
features: ['分布分析', '异常检测'],
useCases: ['显示数据分布和异常值'],
dataRequirements: ['连续数值数据', '可按分类分组'],
limitations: ['每个分类需要多条观测值,每类只有一个值时不适用'],
},
{
type: 'radar',
name: '雷达图',
features: ['多维对比'],
useCases: ['多维度数据对比'],
dataRequirements: ['多个维度的数值数据'],
limitations: ['维度过多(建议 3-8 个)或系列过多时不适用'],
},
{
type: 'funnel',
name: '漏斗图',
features: ['流程分析', '转化分析'],
useCases: ['展示流程转化率'],
dataRequirements: ['有序的分类数据和对应数值'],
limitations: ['阶段必须有序且数值递减,无序分类不适用'],
},
{
type: 'waterfall',
name: '瀑布图',
features: ['增减变化分析'],
useCases: ['显示累计效应'],
dataRequirements: ['分类数据和增减数值'],
limitations: ['需要分类的增减值,无累计关系时不适用'],
},
{
type: 'liquid',
name: '水波图',
features: ['进度展示', '占比'],
useCases: ['显示百分比或进度'],
dataRequirements: ['单个百分比数值'],
limitations: ['只能展示单个 0-1 的百分比,多个数值不适用'],
},
{
type: 'word-cloud',
name: '词云图',
features: ['词频分析', '热点展示'],
useCases: ['展示文本词频'],
dataRequirements: ['文本和对应频次'],
limitations: ['需要文本及词频,不适合精确比较数值'],
},
{
type: 'violin',
name: '小提琴图',
features: ['分布分析'],
useCases: ['显示数据分布密度'],
dataRequirements: ['连续数值数据'],
limitations: ['每个分类需要多条观测值,每类只有一个值时不适用'],
},
{
type: 'venn',
name: '韦恩图',
features: ['集合交并关系'],
useCases: ['显示集合关系'],
dataRequirements: ['集合及其交集数据'],
limitations: ['集合数量较多(建议不超过 4 个)时不适用'],
},
{
type: 'treemap',
name: '矩阵树图',
features: ['层级占比', '结构分析'],
useCases: ['显示层级数据占比'],
dataRequirements: ['层级结构数据'],
limitations: ['不适合负值,也不适合没有层级或占比意义的数据'],
},
{
type: 'sankey',
name: '桑基图',
features: ['流向分析'],
useCases: ['展示流量流向'],
dataRequirements: ['源、目标、流量数值'],
limitations: ['需要源、目标节点对,存在环路时不适用'],
},
{
type: 'table',
name: '表格',
features: ['数据展示', '查找'],
useCases: ['展示详细数据明细'],
dataRequirements: ['任意结构化数据'],
limitations: [],
},
{
type: 'summary',
name: '文本摘要',
features: ['概括数据结论和关键指标'],
useCases: ['明确请求可视化摘要或数据简报'],
dataRequirements: ['有可概括的数据或指标'],
limitations: ['普通问答或已明确指定其他图表的场景'],
},
];
export { chartDefinitions };