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
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/nt9HDvIJOaMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to