3 个回答

使用双坐标轴

xAxis: [{
    type: 'category',
    data: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],
    show: false
}, {
    type: 'category',
    data: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],
    boundaryGap: false,
    axisTick: { alignWithLabel: true },
    position: 'bottom'
}],
yAxis: {
    type: 'value'
},
series: [{
    data: [120, 200, 150, 80, 70, 110, 130,120,210,110,210],
    type: 'bar',
    barCategoryGap:'20%',
    itemStyle: {
    },        
    xAxisIndex: 0,
    backgroundStyle: {
        color: 'rgba(220, 220, 220, 0.8)'
    }
}]

不知道你想要的是不是这种效果,https://echarts.apache.org/zh...

xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    boundaryGap: true,  // <-----------------
},
新手上路,请多包涵

你可以改变x轴文字的偏移量
xAxis:[

{
    axisLabel: {
        padding:[2,2,2,60] //x轴文字偏移
    },
}

]

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题