sponsored links

echarts 制作折线统计图

app.title = '多 X 轴示例';

var colors = ['#5793f3', '#d14a61', '#675bba'];

option = {
    color: colors,
    tooltip: {
        trigger: 'none',
        axisPointer: {
            type: 'cross'
        }
    },
    legend: {
        data:['人数', '消费金额']
    },
    grid: {
        top: 70,
        bottom: 50
    },
    xAxis: [
        {
            type: 'category',
            data: ["25岁以下", "25-35岁", "35-45岁", "45-55岁", "55岁以上"]
        }
    ],
    yAxis: [
        {
            type: 'value',
            name:'金额'
        },
        {
            type: 'value',
            name:'人数'
        }
    ],
    series: [
        {
            name:'消费金额',
            type:'line',
            smooth:true,
            data:['4400','5500','3540','4111'],
            emphasis:{
                label:{
                    show:true,
                }
            }

        },{
            name:'人数',
            type:'line',
            smooth:true,
            data:['400','500','340','411'],
            yAxisIndex: 1  //关联第二根Y轴
        }
    ]
};

echarts 制作折线统计图

Tags: