您当前的位置: 首页 >  ar

漏刻有时

暂无认证

  • 2浏览

    0关注

    717博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Echarts实战案例代码(52):双轴折线图的配置

漏刻有时 发布时间:2020-11-13 09:39:44 ,浏览量:2

在这里插入图片描述

 var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    var option = {
        legend: {
            data: ['波长', '物理量']
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
            }
        },
        xAxis: {
            type: 'category',
            data: ['12:03:04', '12:03:05', '12:03:06', '12:03:07', '12:03:08', '12:03:09', '12:03:10']
        },
        yAxis: [
            {
                "type": "value",
                "name": "波长(单位,BM)",
                "axisLabel": {
                    "show": true,
                },
                axisLine: {lineStyle: {color: 'rgba(0,0,0,.4)'}},
                splitLine: {show: true, lineStyle: {color: 'rgba(0,0,0,.2)'}}
            },
            {
                "type": "value",
                "name": "物理量(单位,CM)",
                "show": true,
                "axisLabel": {
                    "show": true,
                },
                axisLine: {lineStyle: {color: 'rgba(0,0,0,.4)'}},
                splitLine: {show: false}
            },
        ],
        series: [{
            name: '波长',
            yAxisIndex: 0,
            data: [820, 932, 901, 934, 1290, 1330, 1320],
            type: 'line',
            smooth: true
        }, {
            name: '物理量',
            yAxisIndex: 1,
            data: [120, 232, 301, 434, 590, 630, 700],
            type: 'line',
            smooth: true
        }]
    };


    if (option && typeof option === "object") {
        myChart.setOption(option, true);
    }

Done!

关注
打赏
1661217259
查看更多评论
立即登录/注册

微信扫码登录

0.1087s