多 x 轴示例

多 x 轴示例_第1张图片

option = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'cross',
            crossStyle: {
                color: '#999'
            }
        }
    },
    toolbox: {
        feature: {
            dataView: {show: true, readOnly: false},
            magicType: {show: true, type: ['line', 'bar']},
            restore: {show: true},
            saveAsImage: {show: true}
        }
    },
    xAxis: [
        {
            type: 'category',
            data: ['39','40'],
            axisPointer: {
                type: 'shadow'
            },
            position:'bottom',
            offset:20,
            axisTick:{
               show:true,
               length:40,
               lineStyle:{
                   type:'dotted'
               }
            }
        },
        {
            type: 'category',
            data: ['9/25','9/26','9/27','9/28','9/29','9/30','10/1'
                  ,'10/2' ,'10/3' ,'10/4' ,'10/5' ,'10/6' ,'10/7','10/8'
            ],
            position:'bottom',
            axisPointer: {
                type: 'shadow'
            },
            axisTick:{
               show:true
            }
        },  

    ],
    yAxis: [
        {
            type: 'value',
            name: '水量',
            min: 0,
            max: 250,
            interval: 50,
            axisLabel: {
                formatter: '{value} ml'
            }
        },
        {
            type: 'value',
            name: '温度',
            min: 0,
            max: 25,
            interval: 5,
            axisLabel: {
                formatter: '{value} °C'
            }
        },
    ],
    series: [
        {
            name:'1周',
            type:'line',
            data:[211.9, 100.0]
        },
        {
            name:'主',
            type:'bar',
            data:[21.9, 2.9, 7.0, 23.2, 25.6,33.0,100.0]
        },
        {
            name:'',
            type:'bar',
            data:[2.0, 4.9, 7.0, 23.2, 25.6,33.0,100.0]
        },
        {
            name:'',
            type:'bar',
            data:[2.6, 5.9, 9.0, 26.4, 28.7,33.0,100.0]        },
              {
            name:'',
            type:'bar',
            data:[2.0, 4.9, 7.0, 23.2, 25.6,33.0,100.0]
        },
        {
            name:'',
            type:'bar',
            yAxisIndex: 1,
            data:[2.0, 2.2, 3.3, 4.5, 6.3,33.0,100.0]
        },
        {
            name:'',
            type:'bar',
            data:[2.0, 2.2, 3.3, 4.5, 6.3,33.0,100.0]
        },
        {
            name:'',
            type:'bar',
            data:[2.0, 2.2, 3.3, 4.5, 6.3,33.0,100.0]
        }
    ]
};

你可能感兴趣的:(javascript,开发语言,ecmascript,echarts)