In the Data tab of the report editor, create a new script data source. Then write your script inside the updateData() function and assign the resulting dataset to a key, ie
data['MyBarChartData'] = system.dataset.toDataSet(myHeader,myData)
You can then assign the MyBarChartData key, or whatever you want to name it, to the bar chart component.
