echarts双y轴

 
 
var colors = ['#5793f3', '#d14a61', '#675bba'];
searchAndIndexChart=echarts.init(document.getElementById("search-index-chart"));
searchAndIndexChart.setOption({
    color: colors,
    tooltip : {
        trigger: 'axis',
        axisPointer: {
            animation: false
        },
        formatter: function (params) {
            var res = params[0].name;
            for (var i = 0, l = params.length; i < l; i++) {
                res += '<br/>' + params[i].seriesName + ' : ' + params[i].value;
            }
            return res;
        }
    },
    legend: {
        data:['搜索流量', '索引数据']
    },
    grid: {
        top: 70,
        bottom: 50
    },
    xAxis: {
            type: 'category',
            axisTick: {
                alignWithLabel: true
            },
            boundaryGap: false,
            axisLine: {
                onZero: true,
            },
            data: result.date
        },
    yAxis: [
        {
            type: 'value',
            axisLine: {
                onZero: false,
                lineStyle: {
                    color: colors[0]
                }
            }
        },
        {
            type: 'value',
            axisLine: {
                onZero: false,
                lineStyle: {
                    color: colors[1]
                }
            }
        }
    ],
    series: [
        {
            name:'搜索流量',
            type:'line',
            yAxisIndex:'0',
            smooth: true,
            axisLine : {onZero: true},
            tooltip:{
                trigger:'axis'
            },
            data: result.search
        },
        {
            name:'索引数据',
            type:'line',
            smooth: true,
            yAxisIndex:'1',
            tooltip:{
                trigger:'axis'
            },
            data: result.index
        }
    ]
});
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值