cancel
Showing results for 
Search instead for 
Did you mean: 

Column Chart - Change the Default Column Width

Ophir_Buchman
Sisense Team Member
Sisense Team Member

When creating a column chart, you may want to control the width of the columns. To do so add the following script to your column widget:

const newWidth = 5

widget.on('domready', function(widget) {
try {
console.log('DOM Ready script starting (wid=' + widget.oid + ')');
rectangles = Array.from($('rect.highcharts-point'))
rectangles.forEach(function(element) {
element.setAttribute('width',newWidth)
});
}
catch (error) {
debugger;
console.error(error);
}
finally {
console.log('DOM Ready script complete (wid=' + widget.oid + ')');
}
});
Before After
Ophir_Buchman_0-1646734484089.png Ophir_Buchman_1-1646734496701.png
1 ACCEPTED SOLUTION

harikm007
12 - Data Integration
12 - Data Integration

An alternate script to control column width and space between bars/columns:

 

widget.on('processresult',function(se,ev){
	ev.result.plotOptions.series.pointWidth = 20 //width of bar
	ev.result.plotOptions.series.groupPadding= 0.3 //space between bars
})

 

harikm007_0-1646894429164.png

-Hari

View solution in original post

1 REPLY 1

harikm007
12 - Data Integration
12 - Data Integration

An alternate script to control column width and space between bars/columns:

 

widget.on('processresult',function(se,ev){
	ev.result.plotOptions.series.pointWidth = 20 //width of bar
	ev.result.plotOptions.series.groupPadding= 0.3 //space between bars
})

 

harikm007_0-1646894429164.png

-Hari