符合 TidyData
规范的且已聚合的数据源, 遵循变量为列、观测为行的原则
1{
2 "chartType": "columnParallel",
3 "dataset": [
4 { "date": "2019", "region": "east", "profit": 10, "sales": 20 },
5 { "date": "2020", "region": "east", "profit": 30, "sales": 60 },
6 { "date": "2021", "region": "east", "profit": 30, "sales": 60 },
7 { "date": "2022", "region": "east", "profit": 50, "sales": 100 },
8 { "date": "2023", "region": "east", "profit": 40, "sales": 80 },
9
10 { "date": "2019", "region": "north of east", "profit": 10, "sales": 20 },
11 { "date": "2020", "region": "north of east", "profit": 30, "sales": 60 },
12 { "date": "2021", "region": "north of east", "profit": 30, "sales": 60 },
13 { "date": "2022", "region": "north of east", "profit": 50, "sales": 100 },
14 { "date": "2023", "region": "north of east", "profit": 40, "sales": 80 }
15 ],
16 "measures": [
17 { "id": "profit", "alias": "利润" },
18 { "id": "sales", "alias": "销售量" }
19 ],
20 "dimensions": [
21 { "id": "date", "alias": "日期", "location": "dimension" },
22 { "id": "region", "alias": "区域", "location": "dimension" }
23 ]
24}
若未配置 dimensions
和 measures
, 会取前100条数据, 进行如下判断:
number
类型的数据, 则将其设置为指标string
类型的数据, 并且字段未被设置为指标, 则将其设置为维度1{
2 "chartType": "columnParallel",
3 "dataset": [
4 { "date": "2019", "region": "east", "profit": 10, "sales": 20 },
5 { "date": "2020", "region": "east", "profit": 30, "sales": 60 },
6 { "date": "2021", "region": "east", "profit": 30, "sales": 60 },
7 { "date": "2022", "region": "east", "profit": 50, "sales": 100 },
8 { "date": "2023", "region": "east", "profit": 40, "sales": 80 },
9
10 { "date": "2019", "region": "north of east", "profit": 10, "sales": 20 },
11 { "date": "2020", "region": "north of east", "profit": 30, "sales": 60 },
12 { "date": "2021", "region": "north of east", "profit": 30, "sales": 60 },
13 { "date": "2022", "region": "north of east", "profit": 50, "sales": 100 },
14 { "date": "2023", "region": "north of east", "profit": 40, "sales": 80 }
15 ]
16}
1{
2 "chartType": "columnParallel",
3 "dataset": [{ "profit": 10 }]
4}
1{
2 "chartType": "columnParallel",
3 "dataset": [
4 { "date": "2019", "profit": 10 },
5 { "date": "2020", "profit": 30 },
6 { "date": "2021", "profit": 30 },
7 { "date": "2022", "profit": 50 },
8 { "date": "2023", "profit": 40 }
9 ]
10}
1{
2 "chartType": "columnParallel",
3 "dataset": [
4 { "date": "2019", "region": "east", "city": "A", "profit": 10 },
5 { "date": "2019", "region": "east", "city": "B", "profit": 30 },
6 { "date": "2019", "region": "east", "city": "C", "profit": 30 },
7 { "date": "2019", "region": "east", "city": "D", "profit": 50 },
8 { "date": "2019", "region": "east", "city": "E", "profit": 40 },
9
10 { "date": "2020", "region": "north of east", "city": "A", "profit": 10 },
11 { "date": "2020", "region": "north of east", "city": "B", "profit": 30 },
12 { "date": "2020", "region": "north of east", "city": "C", "profit": 30 },
13 { "date": "2020", "region": "north of east", "city": "D", "profit": 50 },
14 { "date": "2020", "region": "north of east", "city": "E", "profit": 40 }
15 ]
16}
1{
2 "chartType": "columnParallel",
3 "dataset": [{ "profit": 1, "sales": 2, "discount": 0.1 }]
4}
1{
2 "chartType": "columnParallel",
3 "dataset": [
4 { "date": "2019", "profit": 10, "sales": 20, "discount": 0.1 },
5 { "date": "2020", "profit": 30, "sales": 60, "discount": 0.1 },
6 { "date": "2021", "profit": 30, "sales": 60, "discount": 0.1 },
7 { "date": "2022", "profit": 50, "sales": 100, "discount": 0.1 },
8 { "date": "2023", "profit": 40, "sales": 80, "discount": 0.1 }
9 ]
10}
1{
2 "chartType": "columnParallel",
3 "dataset": [
4 { "date": "2019", "region": "east", "city": "A", "profit": 10, "sales": 20, "discount": 0.1 },
5 { "date": "2019", "region": "east", "city": "B", "profit": 30, "sales": 60, "discount": 0.1 },
6 { "date": "2019", "region": "east", "city": "C", "profit": 30, "sales": 60, "discount": 0.1 },
7 { "date": "2019", "region": "east", "city": "D", "profit": 50, "sales": 100, "discount": 0.1 },
8 { "date": "2019", "region": "east", "city": "E", "profit": 40, "sales": 80, "discount": 0.1 },
9
10 { "date": "2020", "region": "north of east", "city": "A", "profit": 10, "sales": 20, "discount": 0.1 },
11 { "date": "2020", "region": "north of east", "city": "B", "profit": 30, "sales": 60, "discount": 0.1 },
12 { "date": "2020", "region": "north of east", "city": "C", "profit": 30, "sales": 60, "discount": 0.1 },
13 { "date": "2020", "region": "north of east", "city": "D", "profit": 50, "sales": 100, "discount": 0.1 },
14 { "date": "2020", "region": "north of east", "city": "E", "profit": 40, "sales": 80, "discount": 0.1 }
15 ]
16}