vue3中echarts雷达图代码
时间: 2023-11-20 11:08:29 浏览: 24
echart_EChart代码_vue雷达图_源码
以下是Vue3中Echarts雷达图的示例代码:
template:
```
<template>
<div id="radar-chart" style="width: 600px;height:400px;"></div>
</template>
```
script:
```
<script>
import * as echarts from 'echarts';
export default {
mounted() {
const chartDom = document.getElementById('radar-chart');
const myChart = echarts.init(chartDom);
const option = {
tooltip: {},
radar: {
indicator: [
{ name: '销售', max: 6500},
{ name: '管理', max: 16000},
{ name: '信息技术', max: 30000},
{ name: '客服', max: 38000},
{ name: '研发', max: 52000},
{ name: '市场', max: 25000}
]
},
series: [{
name: '预算 vs 开销(Budget vs spending)',
type: 'radar',
data : [
{
value : [4300, 10000, 28000, 35000, 50000, 19000],
name : '预算分配(Allocated Budget)'
},
{
value : [5000, 14000, 28000, 31000, 42000, 21000],
name : '实际开销(Actual Spending)'
}
]
}]
};
option && myChart.setOption(option);
}
};
</script>
```
注意:需要先安装echarts库。
阅读全文