123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <template>
- <div class="container">
- <div id="EBottom2" style="height:100%;"></div>
- </div>
- </template>
- <script>
- export default {
- name: "EBottom2",
- data() {
- return {
- data: [40, 38.5, 48.2, 43.6, 42.8, 55.6, 44.6],
- };
- },
- mounted() {
- this.drawChart();
- },
- methods: {
- drawChart() {
- // 基于准备好的dom,初始化echarts实例
- let myChart = this.$echarts.init(
- document.getElementById("EBottom2")
- );
- // 指定图表的配置项和数据
- let option = {
- // backgroundColor: "#0D1943",
- title: {
- left: "4%",
- top: "4%",
- text: "屠宰率",
- textStyle: {
- color: "#fff",
- fontSize: 30,
- },
- },
- tooltip: {
- trigger: "axis",
- textStyle: {
- fontSize: 25,
- color: "#fff"
- }
- },
- grid: {
- x: "5%",
- y: "18%",
- x2: "8%",
- y2: "5%",
- containLabel: true,
- },
- toolbox: {
- feature: {
- saveAsImage: {},
- },
- },
- xAxis: {
- type: "category",
- boundaryGap: false,
- name: "(时间)",
- nameTextStyle: {
- fontSize: 20,
- },
- axisLine: {
- show: true,
- lineStyle: {
- type: "solid",
- color: "#fff", //左边线的颜色
- width: "2", //坐标线的宽度
- },
- },
- axisLabel: {
- textStyle: {
- color: "#fff",
- fontSize: 20,
- },
- },
- data: [
- "08-01",
- "08-02",
- "08-03",
- "08-04",
- "08-05",
- "08-06",
- "08-07",
- ],
- },
- yAxis: [
- {
- type: "value",
- nameTextStyle: {
- fontSize: 20,
- },
- axisLine: {
- show: true,
- lineStyle: {
- type: "solid",
- color: "#fff", //左边线的颜色
- width: "2", //坐标线的宽度
- },
- },
- axisLabel: {
- formatter: "{value} %",
- textStyle: {
- color: "#fff",
- fontSize: 20,
- },
- },
- },
- ],
- series: [
- {
- name: "屠宰率",
- type: "line",
- lineStyle: {
- color: "#01d7ef",
- width: 2,
- },
- areaStyle: {
- //区域填充样式
- normal: {
- //线性渐变
- color: new this.$echarts.graphic.LinearGradient(
- 0,
- 0,
- 0,
- 1,
- [
- {
- offset: 0,
- color: "#01d7ef", // 0% 处的颜色
- },
- {
- offset: 1,
- color: "#0d1943", // 100% 处的颜色
- },
- ],
- false
- ),
- },
- },
- itemStyle: {
- //borderWidth: 3,
- //borderColor: 'yellow',
- color: "#01d7ef",
- },
- symbol: "circle",
- symbolSize: 15, //折线点的大小
- data: [33, 43.4, 46, 41, 42, 38, 46],
- },
- ],
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- </style>
|