Ophir_Buchman
03-08-2022Data Integration
Column Chart - Change the Default Column Width
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 |
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 })
-Hari