繁体   English   中英

如何使用 echarts 库在每个条的左侧设置 x 轴刻度?

[英]How to set x-axis ticks at the left of each bar with echarts library?

我想在栏的左侧而不是在中心显示每个 x 轴刻度,但我不确定哪个设置可以帮助我解决这个问题,我尝试将boundaryGap设置为 false,但没有运气。 请注意 x 轴类型是time 在此处输入图像描述

http://jsfiddle.net/ztcyhwr9/

let xAxis = historyTheft.map(item => moment(item[0]).format('HH:mm'));
let series = historyTheft.map(item => item[1]);

....
option = {
   color: ["#009C95","#21ba45"],
   title : {
       text: 'Fuel History',
       textStyle: {
           fontFamily: 'lato'
       }
   },
   tooltip : {
       trigger: 'axis'
   },
   xAxis: {
       type: 'category',
       data: xAxis
   },
   yAxis : {
       type: 'value'
   },
   series : [
       {
           name:'Fuel Theft',
           type:'bar',
           itemStyle: {normal: {areaStyle: {type: 'default'}}},
           data: series
       }
   ]
}

我希望,它会对你有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM