top of page

Add both categories on the left side, if a bar chart contains two dimensions.

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:

  1. Create a bar with 2 categories.

  2. Add below script to widget. Update the variable leftMargin based on length of category labels

  3. 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
	})
	
});

108 views0 comments

Recent Posts

See All
bottom of page