vue中使用echarts柱形折现扇形混合

echarts

我们先来看一下效果图
在这里插入图片描述
如果大家不知道怎么在Vue项目中引入可以去看我的另一个博客vue项目导入echarts
如果官方文档看不懂,就可以跟我一样,比如series我不知道这个有什么用,就直接在百度上
在这里插入图片描述
大家就可以一个个的看了,不过大部分我都在代码上注释了,上代码

<div style="width: 800px;height: 650px; border: 1px solid red" ref="chart" id="main"></div>

引入echarts别忘了


<script>
import * as echarts from "echarts";

export default {
  name: "echarts",
  data(){
    return {}
  },
mounted() {
    this.init()
},methods:{
    init(){
      const MyChart = echarts.init(document.getElementById("main"));
      MyChart.setOption({
        title: {
          text: '堆叠区域图'
        },
        tooltip: {
          //坐标轴触发
          trigger: 'axis',
          axisPointer: {
            //鼠标移动到柱状图上,显示为交叉线,
            type: 'cross',
            label: {
              backgroundColor: '#6a7985'
            }
          }
        },
        //菜单的位置,默认上面orient: 'vertical',
        //left: 'center',
       // bottom:'bottom',
        legend: {
          data: ['SA服务', '等号', '机修', '钣金', '喷漆', '总检', '洗车', '滞留']
        },
        toolbox: {
          //工具类
          feature: {
           saveAsImage: {}
           // ,
            // dataZoom: { //数据缩放视图
            //   show: true
            // },
          }
        },
        //网格的配置
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        //x轴
        xAxis: [{
          type: 'category',
          boundaryGap: false,
          data: ['10.1', '10.2', '10.3', '10.4', '10.5', '10.6', '10.7']
        }],
        yAxis: [{
          type: 'value'
        }],
        //series表示这一行数据以什么现实,type:pie为扇形图,type:bar柱状图
        series: [{
          name: 'SA服务',
          type: 'line',
          stack: '总量',
          areaStyle: { normal: {} },
          data: [120, 132, 101, 134, 90, 230, 210]
        },
          {
            name: '等号',
            type: 'line',
            stack: '总量',
            areaStyle: { normal: {} },
            data: [220, 182, 191, 234, 290, 330, 310]
          },
          {
            name: '机修',
            type: 'line',
            stack: '总量',
            areaStyle: { normal: {} },
            data: [150, 232, 101, 154, 190, 330, 410]
          },
          {
            name: '钣金',
            type: 'line',
            stack: '总量',
            areaStyle: { normal: {} },
            data: [320, 332, 301, 334, 190, 330, 320]
          },
          {
            name: '喷漆',
            type: 'line',
            stack: '总量',
            areaStyle: { normal: {} },
            data: [310, 312, 301, 334, 390, 330, 320]
          },
          {
            name: '总检',
            type: 'line',
            stack: '总量',
            areaStyle: { normal: {} },
            data: [320, 332, 311, 334, 390, 330, 320]
          },
          {
            name: '洗车',
            type: 'line',
            stack: '总量',
            areaStyle: { normal: {} },
            data: [320, 332, 101, 334, 390, 310, 320]
          },
          {
            name: '滞留',
            type: 'pie',
            stack: '总量',
            center:['55%',100],
            radius: 45,
            label: {
              normal: {
                show: true,
                position: 'top'
              }
            },
            areaStyle: { normal: {} },
            data: [820, 932, 901, 934, 1290, 1330, 1300]
          }
        ]
      });


    },
  },


}
</script>

数据之类的大家可以自己改哦,大部分我都写了注释,不懂的可以留言哦!!!
还有一张图可以分享给大家,基本上就懂了
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小莉爱编程

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值