roseParallel

分组玫瑰图

分组玫瑰图
1{
2  "chartType": "roseParallel",
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}

组合分组玫瑰图

1export const CombinationRoseParallelChart = memo(() => {
2  const vseed: VSeed = {
3    chartType: 'roseParallel',
4    dataset: [
5      { date: '2019', profit: 10, sales: 20, rateOfReturn: 0.1 },
6      { date: '2020', profit: 20, sales: 40, rateOfReturn: 0.2 },
7      { date: '2021', profit: 30, sales: 60, rateOfReturn: 0.3 },
8      { date: '2022', profit: 40, sales: 80, rateOfReturn: 0.4 },
9      { date: '2023', profit: 50, sales: 100, rateOfReturn: 0.5 },
10    ],
11    dimensions: [
12      {
13        id: 'date',
14        alias: '日期',
15      },
16    ],
17    measures: [
18      {
19        id: 'sales',
20        alias: '销售额',
21        parentId: 'salesAndProfit',
22        location: 'measure',
23      },
24      {
25        id: 'profit',
26        alias: '利润',
27        parentId: 'salesAndProfit',
28        location: 'measure',
29      },
30      {
31        id: 'rateOfReturn',
32        alias: '回报率',
33        parentId: 'ratio',
34        location: 'measure',
35      },
36    ],
37  }
38  return <PivotChart vseed={vseed} />
39})

透视组合分组玫瑰图

1export const PivotRoseParallelChart = memo(() => {
2  const vseed: VSeed = {
3    chartType: 'roseParallel',
4    dimensions: [
5      { id: 'category', alias: '类别' },
6      { id: 'date', alias: '日期', encoding: 'column' },
7      { id: 'region', alias: '区域', encoding: 'row' },
8    ],
9    measures: [
10      { id: 'sales', alias: '销售额', parentId: 'group-sales' },
11      { id: 'profit', alias: '利润' },
12    ],
13    dataset: [
14      { date: '2019', region: 'east', category: 'Grocery', profit: 10, sales: 100 },
15      { date: '2019', region: 'east', category: 'Beverages', profit: 30, sales: 320 },
16      { date: '2019', region: 'east', category: 'Dairy', profit: 30, sales: 300 },
17      { date: '2019', region: 'east', category: 'Household', profit: 50, sales: 240 },
18      { date: '2019', region: 'east', category: 'Personal', profit: 40, sales: 500 },
19      { date: '2019', region: 'west', category: 'Grocery', profit: 10, sales: 100 },
20      { date: '2019', region: 'west', category: 'Beverages', profit: 30, sales: 320 },
21      { date: '2019', region: 'west', category: 'Dairy', profit: 30, sales: 300 },
22      { date: '2019', region: 'west', category: 'Household', profit: 50, sales: 240 },
23      { date: '2019', region: 'west', category: 'Personal', profit: 40, sales: 500 },
24
25      { date: '2020', region: 'east', category: 'Grocery', profit: 10, sales: 100 },
26      { date: '2020', region: 'east', category: 'Beverages', profit: 30, sales: 320 },
27      { date: '2020', region: 'east', category: 'Dairy', profit: 30, sales: 300 },
28      { date: '2020', region: 'east', category: 'Household', profit: 50, sales: 240 },
29      { date: '2020', region: 'east', category: 'Personal', profit: 40, sales: 500 },
30      { date: '2020', region: 'west', category: 'Grocery', profit: 10, sales: 100 },
31      { date: '2020', region: 'west', category: 'Beverages', profit: 30, sales: 320 },
32      { date: '2020', region: 'west', category: 'Dairy', profit: 30, sales: 300 },
33      { date: '2020', region: 'west', category: 'Household', profit: 50, sales: 240 },
34      { date: '2020', region: 'west', category: 'Personal', profit: 40, sales: 500 },
35    ],
36  }
37  return <PivotChart vseed={vseed} />
38})