折线图标注百分比

描述:当前是关于Echarts图表中的 折线图 示例。
 
            /** 
 * 
 * 作者: GhostCat
 * 博客: https://gcat.cc
 * 描述: 双折线图
 * 
 */


let xLabel = ['102522', '225252', '3252525', '425255', '525255', '641141414','741414', '81414', '9414', '1014141', '111414', '12141414']
let goOutSchool = ['2.4','4.4','1.8','2.8','2.4','4.4','1.8','2.8','2.4','4.4','1.8','2.8']

option = {
           title: {
      text: `{a|123}`,
      textStyle: {
         rich: {
            a: {
               fontSize: 16,
               fontWeight: 600,
               color: 'white',
            },
         },
      },
      top: '8%',
      left: '30%',
   },
    backgroundColor: '#013A54',
    "tooltip": {
        "trigger": "axis",
        "axisPointer": {
            "type": "shadow"
        }
    },
   //  legend: {
   //      align: "left",
   //      right: '5%',
   //      top:'14%',
   //      type:'plain',
   //      textStyle:{
   //          color:'#3CA1EC',
   //          fontSize:16
   //      },
   //      // icon:'rect',
   //      itemGap:25,
   //      itemWidth:18,
   //      icon:'path://M0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z',

   //      data: [
   //          {
   //              name: '同比'
   //          },
   //          {
   //              name: '环比'
   //          }
   //      ]
   //  },
    grid: {
        top: '18%',
        left: '10%',
        right: '5%',
        bottom: '20%',
        // containLabel: true
    },
    xAxis: [{
        type: 'category',
        boundaryGap: false,
        axisLine: { //坐标轴轴线相关设置。数学上的x轴
            show: true,
            lineStyle: {
                color: '#233653'
            },
        },
        axisLabel: { //坐标轴刻度标签的相关设置
        "rotate": 340,
            textStyle: {
                color: 'white',
                padding: 16,
                fontSize: 14
            },
            formatter: function(data) {
                return data
            }
        },
        splitLine: {
            show: true,
            lineStyle: {
                color: '#192a44'
            },
        },
        axisTick: {
            show: false,
        },
        data: xLabel
    }],
    yAxis: [{
        name: '单位:%',
        nameTextStyle: {
            color: "#7ec7ff",
            fontSize: 16,
            padding: 10
        },
        min: 0,
        splitLine: {
            show: true,
            lineStyle: {
                color: '#192a44'
            },
        },
        axisLine: {
            show: true,
            lineStyle: {
                color: "#233653"
            }

        },
        axisLabel: {
            show: true,
            textStyle: {
                color: 'white',
                padding: 16
            },
            formatter: function(value) {
                if (value === 0) {
                    return value
                }
                return value
            }
        },
        axisTick: {
            show: false,
        },
    }],
    series: [{
        name: '收率',
        type: 'line',
        symbol: 'circle', // 默认是空心圆(中间是白色的),改成实心圆
        showAllSymbol: true,
        symbolSize: 0,
        smooth: true,
        lineStyle: {
            normal: {
                width: 5,
                color: "rgba(10,219,250,1)", // 线条颜色
            },
            borderColor: 'rgba(0,0,0,.4)',
        },
        itemStyle: {
            color: "rgba(10,219,250,1)",
            borderColor: "#646ace",
            borderWidth: 2

        },
            "label": {
                "normal": {
                    "show": true,
                    "position": "top",
                    "formatter": "{c}%"
                }
            },
        tooltip: {
            show: true
        },
        areaStyle: { //区域填充样式
            normal: {
                //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,
                        color: "rgba(10,219,250,.3)"
                    },
                    {
                        offset: 1,
                        color: "rgba(10,219,250, 0)"
                    }
                ], false),
                shadowColor: 'rgba(10,219,250, 0.5)', //阴影颜色
                shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
            }
        },
        data: goOutSchool
    }]
};