如何从左对齐条形图列
上图是我使用HighCharts创建的条形图;请让我知道如何从左侧对齐单个数据条形图并减小列宽。
下面是我创建条形图的代码
var chart = Highcharts.chart('chart', {
chart : {
plotBackgroundColor : null,
plotBorderWidth : null,
plotShadow : false
},
plotOptions : {
series : {
dataLabels : {
enabled : true,
formatter : function () {
return this.point.t;
}
}
}
},
title : {
text : 'Overdue Projects'
},
xAxis : {
categories : ["Please Select to View data"]
},
yAxis : {
title : {
text : 'Hours'
}
},
series : [{
"type" : "column",
"name" : "Estimated Hours",
"data" : [2]
}, {
"type" : "column",
"name" : "Consumed Hours",
"data" : [3]
}
]
});
您可以使用
pointPlacement
和pointPadding
。
现场工作演示:http://jsfiddle.net/kkulig/xyh73s11/
接口参考:
- http://api.highcharts.com/highcharts/plotOptions.column.pointPadding
- http://api.highcharts.com/highcharts/plotOptions.column.pointPlacement