123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <template>
- <div>
- <div ref="echarts6" class="echarts6" style="height: 200px; width: 100%"></div>
- </div>
- </template>
- <style scoped></style>
- <script setup>
- import * as echarts from 'echarts'
- const echarts6 = ref()
- onMounted(() => {
- drawEcharts6()
- })
- function drawEcharts6() {
- var myChart6 = echarts.init(echarts6.value)
- var b = 298
- var c = 523
- var d = b + c
- var option6 = {
- series: [
- {
- type: 'pie',
- radius: ['60%', '70%'],
- color: '#cdba00',
- label: {
- normal: {
- position: 'center'
- }
- },
- data: [
- {
- value: b,
- name: '男消费',
- label: {
- normal: {
- formatter: b + '',
- textStyle: {
- fontSize: 20,
- color: '#fff'
- }
- }
- }
- },
- {
- value: c,
- name: '女消费',
- label: {
- normal: {
- formatter: function () {
- return '占比' + Math.round((b / d) * 100) + '%'
- },
- textStyle: {
- color: '#aaa',
- fontSize: 12
- }
- }
- },
- itemStyle: {
- normal: {
- color: 'rgba(255,255,255,.2)'
- },
- emphasis: {
- color: '#fff'
- }
- }
- }
- ]
- }
- ]
- }
- myChart6.setOption(option6)
- }
- </script>
|