首页 > 解决方案 > echarts - 如何绘制两个不同日期的时间序列

问题描述

使用 echarts 时:有没有办法绘制两个不同日期的时间序列?

此处解释了一个示例:https ://peltiertech.com/plot-two-time-series-with-different-dates/

标签: time-seriesecharts

解决方案


看看堆积折线图

option = {
    title: {
        text: 'Stacked line'
    },
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data:['first','second']
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    toolbox: {
        feature: {
            saveAsImage: {}
        }
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['12/1/2018','12/2/2018','12/3/2018','12/4/2018','12/5/2018','12/6/2018','12/7/2018']
    },
    yAxis: {
        type: 'value'
    },
    series: [
        {
            name:'first',
            type:'line',
            data:[120, 132, 121, 134, , 200, 210]
        },
        {
            name:'second',
            type:'line',
            data:[220, 182, , 234, 290, 100, 310]
        }
    ]
};

堆积折线图


推荐阅读