echarts多条折线图动态分层

0

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)
        }
    }
    

clipboard.png

你可能感兴趣的

载入中...