When using optional grouping with a bar chart, bars are rendered right next to each other. You can add some space in the beforeDrawSeries event by getting the datapointhints for a particular series and changing the x location. If we have two design series we can use the afterdatasetfilled to determine how many runtime series are generated. To get spacing only one of the series needs to be bumped. To do this just count the number of a particular series in the afterDatasetFilled method like:
function afterDataSetFilled( series, dataSet, icsc )
{
//Count the number of runtime series generated for series one
if( series.getSeriesIdentifier() == "Series one" ){
halfseries++;
}
}
Then the beforeDrawSeries will be called for every runtime series, but we only want to bump half the series so use a a script like:
halfseries=0;
currseries=0;
function beforeDrawSeries( series, isr, icsc )
{
if( isr.getSeriesRenderingHints() != null ){
var dpharray = isr.getSeriesRenderingHints().getDataPoints();
for( j=0;j<dpharray.length;j++){
var xval = dpharray[j].getLocation().getX();
if( currseries <= halfseries){
dpharray[j].getLocation().setX(xval-20);
}
}
}
currseries++;
}