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

150 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page