My workaround for this, was adding event on 'ready' after draw a chart like:
google.visualization.events.addListener(chart, 'ready', function() {
and replace values with formated one (it's not so clean code but i hope
it's gonna help someone)
Event
google.visualization.events.addListener(chart, 'ready',
function(e) {
$('.chart').find('svg g text').each(function(){
var value = $(this).html();
value = value.replace('%', '').replace(',', '.');
value = Number(value).formatNumber(2, ',', ' ');
$(this).html(value+'%');
});
});
Formater function
Number.prototype.formatNumber = function(c, d, t) {
var n = this,
c = isNaN(c = Math.abs(c)) ? 2 : c,
d = d == undefined ? "." : d,
t = t == undefined ? "," : t,
s = n < 0 ? "-" : "",
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") +
i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n -
i).toFixed(c).slice(2) : "");
};
W dniu czwartek, 13 grudnia 2012 20:35:02 UTC+1 użytkownik asgallant
napisał:
>
> You can format the data displayed in the tooltips to 2 decimal places, but
> not the slice labels. To format the tooltips, use a NumberFormatter
> <https://developers.google.com/chart/interactive/docs/reference#numberformatter>
> on
> the data column in the DataTable.
>
> On Thursday, December 13, 2012 1:41:12 PM UTC-5, Kwasi wrote:
>>
>> Is it possible to format the percentage in the pie chart to 2 decimal
>> places instead of one?
>>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/93de0ff9-e606-44d6-a8f7-afc198d21a9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.