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

5,163次阅读
没有评论

共计 2087 个字符,预计需要花费 6 分钟才能阅读完成。

主要改两个点

一、

formatter: function(arg) {

            // 自定义提示

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

              return (

              arg[0].name +

              “
” +

              ‘

              arg[0].color +

              ‘;”>

‘ +

              arg[0].seriesName +

              ‘‘ +

              arg[0].data +

              “” +

              “
” +

              ‘

             

            }else{

              return (

              arg[1].name +

              “
” +

              ‘

              arg[1].color +

              ‘;”>

‘ +

              arg[1].seriesName +

              ‘‘ +

              arg[1].data +

              “

” +

              “
” +

              ‘

             

            );

            }     

        },

二、

 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’ 实线

                    }

                }}

          },

原文地址: 前端 vue 中利用 echarts 实现折线图前半段数据实线后半段数据虚线

    正文完
     0
    Yojack
    版权声明:本篇文章由 Yojack 于2024-10-07发表,共计2087字。
    转载说明:
    1 本网站名称:优杰开发笔记
    2 本站永久网址:https://yojack.cn
    3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长进行删除处理。
    4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
    5 本站所有内容均可转载及分享, 但请注明出处
    6 我们始终尊重原创作者的版权,所有文章在发布时,均尽可能注明出处与作者。
    7 站长邮箱:laylwenl@gmail.com
    评论(没有评论)