javascript - show percentages google charts on tooltip -


i want show ratio google charts, using percentages. know how change vaxis percentages:

vaxis: {format:'#%'}, 

but problem data not shown percentages on tooltips, in decimal values (0.85 instead of expected 85%)

enter image description here

my code below:

  google.load("visualization", "1", {packages:["corechart"]});         google.setonloadcallback(function() {})         function drawchart(data) {           var data = google.visualization.arraytodatatable(data);            var options = {             title: "pourcentage de production et productivité de l'entreprise",             chartarea: {top:39},             vaxis: {format:'#%'},             pointsize:2           }            var chart = new google.visualization.linechart(document.getelementbyid('chart_div'));           chart.draw(data, options);         }  drawchart([['year', '% de production', 'productivité'],[ '06/03/2013', 0.85 , 0.58 ],[ '07/03/2013', 0.85 , 0.58 ],[ '23/03/2013', 0.85 , 0.58 ],[ '25/03/2013', 1 , 1.5 ],[ '26/03/2013', 0.72 , 0.63 ],[ '04/04/2013', 1 , 1.57 ]]) 

you can use formatters.

here example (stick in code before drawing chart):

  var formatter = new google.visualization.numberformat({pattern:'#,###%'});   formatter.format(data, 1);   formatter.format(data, 2); 

the formats can use subset of icu decimalformat if want change format give above.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -