乐趣区

echarts-缩放功能


option[8] = {

        // Make gradient line here
        visualMap: [{
            show: false,
            type: 'continuous',
            seriesIndex: 0,
            dimension: 0,
            min: 0,
            max: xData.length - 1
        }],
        title: [{
            top: '',
            left: 'center',
            text: param.title
        }],
        dataZoom: [     // 主要是这一部分,他是折线图的缩放功能的开启  
            {startValue:startValue,    // 起始位置},
            {type: 'inside',}
        ],
        tooltip: {
            trigger: 'axis',
            formatter: function(params){    
                var text_Unit ='';     
                for(var i = 0;i < params.length;i++){text_Unit += params[i].value + param.Unit + "</br>"
                }    
                    return params[0].name + "</br>" + text_Unit;                      
            }
        },
        xAxis: [{
            data: xData,
            gridIndex: 1,
        }],
        yAxis: [{
            name: param.yName,
            splitLine: {show: false},
            gridIndex: 1,
        }],
        grid: [{bottom: '',}, {top: '20%',}],
        series: [{
            type: 'line',
            showSymbol: false,
            data: data
        }]
退出移动版