You have to apply the format yourself and return it in the calculated column, like this:
var view = new google.visualization.DataView(data);
view.setColumns([0, 1, 2, {
type: 'number',
label: 'Average',
calc: function (dt, row) {
var avg = (dt.getValue(row, 1) + dt.getValue(row, 2)) / 2;
return {v: avg, f: avg + ' ms'};
}
}]);
The returned object has two properties: "v" for the value and "f" for the formatted value.
On Sunday, July 8, 2012 12:52:59 PM UTC-4, luka wrote:
I have a DataTable displaying some numeric data, lets say there's 2 series. I want to display the average of these 2 series, so I created a DataView which calculates the average using a custom "calc" function inside "setColumns".
On my columns inside the original DataTable I have applied a DataFormatter, but this doesn't work on a DataView. So my question is how do I format this calculated data? I just want to add a simple suffix like " ms".
Regards,
Luka