ex2.vue
2.02 KB
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
<template>
<div>
<div class="echart" id="mychart2" :style="myChartStyle"></div>
</div>
</template>
<script>
import * as echarts from "echarts";
export default {
data() {
return {
myChartStyle: { float: "left", width: "100%", height: "300px" }, //图表样式
};
},
mounted() {
// this.initEcharts();
},
methods: {
initEcharts(x, y) {
// 基本柱状图
const option = {
title: {
text: "最近30天进件量分析",
subtext: "",
left: "center",
},
color: ["#409EFF"],
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
y2: 150,
},
xAxis: [
{
type: "category",
data: x,
axisTick: {
alignWithLabel: true,
},
// axisLabel: {
// interval:0,
// rotate:-30
// },
},
],
yAxis: [
{
type: "value",
},
],
series: [
{
name: "当日进件量",
type: "line",
smooth: true,
stack: "Total",
barWidth: "100%",
data: y,
areaStyle: {
// color: "#ff0",
// opacity: 0.5,
},
emphasis: {
focus: "series",
},
label: {
show: true,
position: "top",
textStyle: {
color: "#333",
fontSize: 12,
},
},
},
],
};
const myChart = echarts.init(document.getElementById("mychart2"));
myChart.setOption(option);
//随着屏幕大小调节图表
window.addEventListener("resize", () => {
myChart.resize();
});
},
},
};
</script>