echarts多条折线图动态分层

54次阅读

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

var xData = param.xData;

    var data = param.yData
    let option = [];
    let num =param.num ? param.num : 0;
    let max = num ? num *100 : 100;    // 处理精度丢失问题  但不是最佳方案 

option = {

        title: {
            left: 'center',
            text: param.title
        },
        tooltip: {trigger: 'axis',},
        legend: {
            right:0,
            data:param.tName,
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            boundaryGap: false,
            data:param.xData
        },
        yAxis: {
            name: param.yName,
            splitLine: {show: false},
            
        },
        series: []}
    option[6].series.push(
        {
            name: '平行于 y 轴的趋势线',
            type: 'line',
            //data:[0],
            markLine: {
                silent: true,
                data: [{yAxis: num}]
            }
        }
    )
    if(param.option_type == 6){for( var item in param.yData){
            var obj ={name: param.yData[item].name,
                type: 'line',
                color:param.yData[item].color,
                data: param.yData[item].data
            }
            option[6].series.push(obj)
        }
    }
    

正文完
 0