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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
| <!-- 学习档案 -->
| <template>
| <div class="c">
| <div class="bg">
| <div class="main">
| <TitleIndex title="学习档案" />
| <!-- 内容 -->
| <div class="flex content">
| <Echarts
| v-for="(item,index) in arr"
| :key="index"
| :id='item.echartsId'
| :echartObj="item.echartObj"
| :style="{width: '40%', height: '500px'}"
| />
| </div>
| </div>
| </div>
| </div>
| </template>
|
|
|
| <script>
| import Echarts from "../../components/Echarts/index.vue";
| export default {
| components: {
| Echarts,
| },
| data() {
| return {
| arr: [
| // 柱状图
| {
| echartsId: "myBar",
| echartObj: {
| legend: {
| bottom: "0",
| left: "center",
| },
| tooltip: {
| trigger: "axis",
| axisPointer: {
| type: "shadow",
| },
| },
| // 设置图表的大小
| grid: {
| left: "3%",
| right: "4%",
| bottom: "10%",
| containLabel: true,
| },
| xAxis: [
| {
| type: "category",
| data: ["一月", "二月", "三月", "四月", "五月", "六月"],
| axisTick: {
| alignWithLabel: true,
| },
| },
| ],
| yAxis: [
| {
| type: "value",
| },
| ],
| series: [
| {
| name: "学习时长",
| type: "bar",
| barWidth: "50%",
| data: [10, 52, 200, 334, 390, 330],
| },
| ],
| },
| },
| {
| // 传给Echarts的Id为了能够同时渲染多个,如果不传只会显示最后一个
| echartsId: "myChart",
| // echarts 展示数据
| echartObj: {
| legend: {
| left: "center",
| top: "bottom",
| },
| color: ["#fe5c30", "#fe812d", "#ffce2c", "#01c5d2", "#4f71ef"],
| series: [
| // 饼状图
| {
| type: "pie",
| radius: [0, 90],
| center: ["50%", "50%"],
| roseType: "area",
| data: [
| { value: 25, name: "JAVA" },
| { value: 15, name: "JavaScript" },
| { value: 20, name: "PHP" },
| { value: 25, name: "React" },
| { value: 15, name: "MySQL" },
| ],
| label: {
| normal: {
| formatter: ["{b|{b}}", "{d|{d}%}"].join("\n"),
| rich: {
| d: {
| // color: 'rgb(241,246,104)',
| fontSize: 15,
| fontWeight: "bold",
| lineHeight: 2,
| },
| b: {
| // color: 'rgb(98,137,169)',
| fontSize: 13,
| height: 40,
| },
| },
| },
| },
| labelLine: {
| normal: {
| lineStyle: {
| color: "#ccc",
| },
| smooth: 0,
| length: 20,
| length2: 10,
| },
| },
| },
| ],
| },
| },
| ],
| };
| },
| methods: {
| open() {
| this.dialogVisible = true;
| this.creatQrCode();
| },
| },
| };
| </script>
|
| <style scoped lang="scss">
| // 内容
| .content {
| width: 1262px;
| margin-bottom: 80px;
| background-color: #fff;
| padding: 40px 140px;
| border-radius: 10px;
| }
| .flex {
| display: flex;
| justify-content: space-between;
| }
| </style>
|
|