When we add 2 categories to a bar chart, one will display on left side and another will be on right side. We can use below script to display both categories on left side.
Step:
Create a bar with 2 categories.
Add below script to widget. Update the variable leftMargin based on length of category labels
Save the script and refresh widget
widget.on('processresult',function(se,ev){
var leftMargin = 200
ev.result.chart.marginLeft= leftMargin
ev.result.chart.marginRight= 50
ev.result.plotOptions.series.borderWidth = 1;
$.each(ev.result.xAxis.plotBands, function(index, value){
value.label.align = 'left'
value.label.x = -leftMargin + 10
})
});
Comments