donut

饼图

1{
2  "chartType": "donut",
3  "dataset": [
4    { "date": "2019", "profit": 10, "sales": 20 },
5    { "date": "2020", "profit": 30, "sales": 60 },
6    { "date": "2021", "profit": 30, "sales": 60 },
7    { "date": "2022", "profit": 50, "sales": 100 },
8    { "date": "2023", "profit": 40, "sales": 80 }
9  ]
10}

组合环形图

1{
2  "chartType": "donut",
3  "measures": [
4    {
5      "id": "sales-and-profit",
6      "alias": "销售额与利润",
7      "children": [
8        {
9          "id": "sales",
10          "alias": "sales"
11        },
12        {
13          "id": "profit",
14          "alias": "利润"
15        }
16      ]
17    },
18    {
19      "id": "ratio",
20      "alias": "比率",
21      "children": [
22        {
23          "id": "rateOfReturn",
24          "alias": "回报率"
25        }
26      ]
27    }
28  ],
29  "dataset": [
30    { "date": "2019", "profit": 10, "sales": 20, "rateOfReturn": 0.1 },
31    { "date": "2020", "profit": 20, "sales": 40, "rateOfReturn": 0.2 },
32    { "date": "2021", "profit": 30, "sales": 60, "rateOfReturn": 0.3 },
33    { "date": "2022", "profit": 40, "sales": 80, "rateOfReturn": 0.4 },
34    { "date": "2023", "profit": 50, "sales": 100, "rateOfReturn": 0.5 }
35  ],
36  "dimensions": [
37    {
38      "id": "date",
39      "alias": "日期",
40      "location": "dimension"
41    }
42  ]
43}

透视组合环形图

1{
2  "chartType": "donut",
3  "dimensions": [
4    { "id": "category", "alias": "类别", "location": "dimension" },
5    { "id": "date", "alias": "日期", "location": "columnDimension" },
6    { "id": "region", "alias": "区域", "location": "rowDimension" }
7  ],
8  "measures": [
9    {
10      "id": "group-sales",
11      "alias": "销售额分组",
12      "children": [{ "id": "sales", "alias": "销售额" }]
13    },
14    { "id": "profit", "alias": "利润" }
15  ],
16  "dataset": [
17    { "date": "2019", "region": "east", "category": "Grocery", "profit": 10, "sales": 100 },
18    { "date": "2019", "region": "east", "category": "Beverages", "profit": 30, "sales": 3200 },
19    { "date": "2019", "region": "east", "category": "Dairy", "profit": 30, "sales": 300 },
20    { "date": "2019", "region": "east", "category": "Household", "profit": 50, "sales": 2400 },
21    { "date": "2019", "region": "east", "category": "Personal", "profit": 40, "sales": 500 },
22    { "date": "2019", "region": "west", "category": "Grocery", "profit": 10, "sales": 100 },
23    { "date": "2019", "region": "west", "category": "Beverages", "profit": 30, "sales": 3200 },
24    { "date": "2019", "region": "west", "category": "Dairy", "profit": 30, "sales": 300 },
25    { "date": "2019", "region": "west", "category": "Household", "profit": 50, "sales": 2400 },
26    { "date": "2019", "region": "west", "category": "Personal", "profit": 40, "sales": 500 },
27
28    { "date": "2020", "region": "east", "category": "Grocery", "profit": 10, "sales": 100 },
29    { "date": "2020", "region": "east", "category": "Beverages", "profit": 30, "sales": 3200 },
30    { "date": "2020", "region": "east", "category": "Dairy", "profit": 30, "sales": 300 },
31    { "date": "2020", "region": "east", "category": "Household", "profit": 50, "sales": 2400 },
32    { "date": "2020", "region": "east", "category": "Personal", "profit": 40, "sales": 500 },
33    { "date": "2020", "region": "west", "category": "Grocery", "profit": 10, "sales": 100 },
34    { "date": "2020", "region": "west", "category": "Beverages", "profit": 30, "sales": 3200 },
35    { "date": "2020", "region": "west", "category": "Dairy", "profit": 30, "sales": 300 },
36    { "date": "2020", "region": "west", "category": "Household", "profit": 50, "sales": 2400 },
37    { "date": "2020", "region": "west", "category": "Personal", "profit": 40, "sales": 500 }
38  ]
39}