Does 'numberFormat' work for you http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html#Data_Format
<http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html#Data_Format> ChartMan On Sat, Aug 14, 2010 at 10:21 PM, Raju <[email protected]> wrote: > Hi I am trying to display % value on Y-Axis in annotatedtimeline > chart but it is not suffixing '%' in Y-Axis.. > > Here is my code.. Can any one help me??? > > ---------------------- > <html> > <head> > > > <style> > .sfe-search > { > text-align: left; > white-space: nowrap; > height: 45px; > font-size: 0.9em; > padding-top: 6px; > } > .sfe-search #searchbox > { > height: 17px; > } > .sfe-search INPUT > { > vertical-align: middle; > } > .searchExample > { > color: #6f6f6f; > font-size: 0.97em; > } > > > > </style> > > > <script type='text/javascript' src='http://www.google.com/jsapi'></ > script> > <script type='text/javascript'> > google.load('visualization', '1', { 'packages': > ['annotatedtimeline'] }); > function drawChart() { > var data = new google.visualization.DataTable(); > data.addColumn('date', 'Date'); > data.addColumn('number', 'Sold Pencils'); > data.addColumn('string', 'title1'); > data.addColumn('string', 'text1'); > data.addColumn('number', 'Sold Pens'); > data.addColumn('string', 'title2'); > data.addColumn('string', 'text2'); > data.addRows([ > [new Date(2008, 1, 1), { v: 10, f: '10.0%' }, undefined, > undefined, { v: -12, f: '-12.0%' }, undefined, undefined], > [new Date(2008, 1, 2), { v: -5, f: '-5%' }, undefined, > undefined, { v: 20, f: '20%' }, undefined, undefined], > [new Date(2008, 1, 3), { v: 8, f: '8%' }, undefined, > undefined, { v: -8, f: '-8%' }, undefined, undefined], > [new Date(2008, 1, 4), { v: -20, f: '-20%' }, undefined, > undefined, { v: -2, f: '-2%' }, 'Out of Stock', 'Ran out of stock on > pens at 4pm'], > [new Date(2008, 1, 5), { v: 5, f: '5%' }, 'Bought Pens', > 'Bought 200k pens', { v: 14, f: '14%' }, undefined, undefined], > [new Date(2008, 1, 6), { v: 22, f: '22%' }, undefined, > undefined, { v: -8, f: '-8%' }, undefined, undefined] > ]); > > var chart = new > > google.visualization.AnnotatedTimeLine(document.getElementById('chart_div')); > > > var formatter = new google.visualization.NumberFormat( > { suffix: '%%', negativeColor: 'red', negativeParens: true }); > formatter.format(data, 1); // Apply formatter to second > column > formatter.format(data, 4); > > > chart.draw(data, { displayAnnotations: true }); > } > </script> > </head> > > <body> > <DIV class="sfe-search"> > > <INPUT id="searchbox" title="Quote search input" maxLength="2048" > size="40" name="q" autocomplete="off" value="" /> <INPUT type="submit" > value="Get quotes" onclick="javascript:drawChart()" /> <BR /><SPAN > class="searchExample">Example: "CSCO" or "Google"</SPAN> > > </DIV> > > <div id='chart_div' style='width: 700px; height: 240px;'></div> > </body> > </html> > --------------------- > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-visualization-api%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. 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.
