前端vue中利用echarts实现折线图前半段数据实线后半段数据虚线

主要改两个点

一、

formatter: function(arg) {

            // 自定义提示

            if(arg[0].data[0]!=null){

              return (

              arg[0].name +

              "<br>" +

              '<span style="margin:0 5px 2px 0;display:inline-block;width:6px;height:6px;border-radius:5px;background-color:' +

              arg[0].color +

              ';"></span>' +

              arg[0].seriesName +

              '<span style="margin-left:10px;">' +

              arg[0].data +

              "</span>" +

              "<br>" +

              '<span style="margin:0 5px 2px 0;display:inline-block;width:6px;height:6px;border-radius:5px;background-color:' +

             

            }else{

              return (

              arg[1].name +

              "<br>" +

              '<span style="margin:0 5px 2px 0;display:inline-block;width:6px;height:6px;border-radius:5px;background-color:' +

              arg[1].color +

              ';"></span>' +

              arg[1].seriesName +

              '<span style="margin-left:10px;">' +

              arg[1].data +

              "</span>" +

              "<br>" +

              '<span style="margin:0 5px 2px 0;display:inline-block;width:6px;height:6px;border-radius:5px;background-color:' +

             

            );

            }     

        },

二、

 series: [

          {

            name: "库水位/m",

            type: "line", //bar:柱状 line:折线图

            data: [this.a[0],this.a[1],this.a[2],this.a[3],this.a[4],this.a[5],this.a[6],this.a[7],this.a[8],this.a[9],this.a[10],this.a[11],'','','','','','','','','','','',''],

            color: "#00C5AB",

            // symbol: "circle", //折线点设置为实心点

            symbolSize: 8, //折线点的大小

              smooth:false,   //关键点,为true是不支持虚线的,实线就用true

              

            itemStyle:{

                normal:{

                    lineStyle:{

                        width:2,

                        type:'solid'  //'dotted'虚线 'solid'实线

                    }

                }}

          },

                {

            name:  "库水位/m",

            type: "line", //bar:柱状 line:折线图

            data: ['','','','','','','','','','','',this.a[11],this.a[12],this.a[13],this.a[14],this.a[15],this.a[16],this.a[17],this.a[18],this.a[19],this.a[20],this.a[21],this.a[22],this.a[23]],

            color: "#00C5AB",

            // symbol: "circle", //折线点设置为实心点

            symbolSize: 8, //折线点的大小

              smooth:false,   //关键点,为true是不支持虚线的,实线就用true

              

            itemStyle:{

                normal:{

                    lineStyle:{

                        width:2,

                        type:'dotted'  //'dotted'虚线 'solid'实线

                    }

                }}

          },

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值