1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
| <template>
| <div :style="{ height: height, width: width }" id="mainThree">
| <div></div>
| </div>
| </template>
|
| <script>
| import * as echarts from "echarts/core";
| import {
| TitleComponent,
| TooltipComponent,
| LegendComponent,
| } from "echarts/components";
| import { PieChart } from "echarts/charts";
| import { LabelLayout } from "echarts/features";
| import { CanvasRenderer } from "echarts/renderers";
| echarts.use([
| TitleComponent,
| TooltipComponent,
| LegendComponent,
| PieChart,
| CanvasRenderer,
| LabelLayout,
| ]);
| // Vue.prototype.$echarts = echarts;
| export default {
| props: {
| height: {
| type: String,
| default: "100%",
| },
| width: {
| type: String,
| default: "100%",
| },
| },
| name: "sevSystem",
| data() {
| return {
| // charts: "",
| // opinion: ["未交易用户", "交易一次用户", "留存客户", "回流客户"],
| // opinionData: [
| // { value: 335, name: "未交易用户" },
| // { value: 310, name: "交易一次用户" },
| // { value: 234, name: "留存客户" },
| // { value: 135, name: "回流客户" },
| // ],
| };
| },
| components: {},
| created(){
| Vue.prototype.$echarts = echarts;
| },
| mounted() {
| this.$nextTick(function () {
| this.drawPie("mainThree");
| });
| },
| methods: {
| drawPie(id) {
| var chartDom = document.getElementById(id);
| var myChart = echarts.init(chartDom);
| var option;
| option = {
| title: {
| text: "",
| subtext: "",
| left: "center",
| },
| tooltip: {
| trigger: "item",
| formatter: "{a}<br/>{b}:{c} ({d}%)",
| },
| legend: {
| orient: "vertical",
| left: "left",
| },
| series: [
| {
| name: "数据统计",
| type: "pie",
| radius: "50%",
| data: [
| { value: 1048, name: "未交易用户" },
| { value: 735, name: "交易一次用户" },
| { value: 580, name: "留存客户" },
| { value: 300, name: "回流客户" },
| ],
| emphasis: {
| itemStyle: {
| shadowBlur: 10,
| shadowOffsetX: 0,
| shadowColor: "rgba(0, 0, 0, 0.5)",
| },
| },
| },
| ],
| };
| option && myChart.setOption(option);
| },
| },
| };
| </script>
| <style lang="scss" scoped></style>
|
|