| | |
| | | icon: 'circle', |
| | | textStyle: { |
| | | fontSize: 18, |
| | | color: pieColors[idx % pieColors.length], |
| | | color: d.color || pieColors[idx % pieColors.length], |
| | | }, |
| | | })) |
| | | |
| | |
| | | .then((res) => { |
| | | if (res.code === 200 && Array.isArray(res.data)) { |
| | | const items = res.data |
| | | pieDatas.value = items.map((item) => ({ |
| | | name: item.name, |
| | | value: parseFloat(item.value) || 0, |
| | | rate: item.rate, |
| | | })) |
| | | pieDatas.value = items.map((item) => { |
| | | const point = { |
| | | name: item.name, |
| | | value: parseFloat(item.value) || 0, |
| | | rate: item.rate, |
| | | } |
| | | if (item.color) { |
| | | point.color = item.color |
| | | point.itemStyle = { color: item.color } |
| | | } |
| | | return point |
| | | }) |
| | | } |
| | | }) |
| | | .catch((err) => { |