用echart饼状图实现男女比例
效果图如下:
实现代码如下:
<template>
<div id="main" style="width: 32.9%;height:400px;"></div>
</template>
<script>
import * as echarts from 'echarts';
export default{
data() {
return {
ageYdata: ['>50', '41-50', '31-40', '24-30', '18-23', '<18'],
sexYdata: [
{ value: 1048, name: '男' },
{ value: 735, name: '女' },
],
}
},
mounted() {
this.drawChart();
},
methods: {
drawChart() {
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var option = {
title: {