Hi, Thanks for your reply. I did it using wrapper class but i am facing some problems. The bar which have large value it doesn't showing label on top of bar which means scale max is 1000 but my value is 980 it is not showing the value. Please help me
On Friday, 19 April 2013 18:22:30 UTC+5:30, asgallant wrote: > > You can calculate the text value dynamically in your DataView. As an > example: > > var view = new google.visualization.DataView(data); > view.setColumns([0, 1, [2, 3, 4....], { > type: 'number', > calc: function (dt, row) { > // return the sum of all columns > var sum = 0; > var numberOfColumns = dt.getNumberOfColumns(); > for (var i = 1; i < numberOfColumns; i++) { > sum += dt.getValue(row, i); > } > return sum; > } > }, { > type: 'string', > calc: function (dt, row) { > // return the string value to use as the text > var sum = 0; > var numberOfColumns = dt.getNumberOfColumns(); > for (var i = 1; i < numberOfColumns; i++) { > sum += dt.getValue(row, i); > } > return formatCurrencyLabel(sum); > } > }]); > > On Friday, April 19, 2013 5:27:05 AM UTC-4, malla reddy wrote: >> >> But that hard coded .In my case values are dynamic. How can i add the >> values . >> >> >> On Thursday, 18 April 2013 23:11:31 UTC+5:30, asgallant wrote: >>> >>> This is not supported in the Visualization API, though there is a hack >>> which you *may* be able to apply: http://jsfiddle.net/asgallant/QjQNX/ >>> >>> On Thursday, April 18, 2013 12:19:39 PM UTC-4, malla reddy wrote: >>>> >>>> I have google visualization api Column Chart with multiple data points >>>> in each bar i want to show the total in the top of the bar.please help me. >>>> In google charts api there is option called "Chm".but how can i use >>>> this option in google visualization Api Please suggest me. >>>> >>>> >>>> <script type="text/javascript" >>>> src='https://www.google.com/jsapi?autoload={ >>>> "modules":[{"name":"visualization","version":"1"}]}'> >>>> </script> >>>> <script type="text/javascript"> >>>> formatCurrencyLabel = function ( value ) >>>> { >>>> return "$" + String(value); >>>> } >>>> >>>> google.load("visualization", "1.0", { packages: ['coreChart'] }); >>>> >>>> // google.load('visualization', '1'); >>>> >>>> google.setOnLoadCallback(drawChart); >>>> function drawChart() { >>>> >>>> var data = new google.visualization.DataTable(); >>>> data.addColumn('string', 'Months'); >>>> data.addColumn('number', 'New Business'); >>>> >>>> data.addRows([ >>>> ['3/12', >>>> {v:{!Account.Producer_New_Business_12_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_12_Months_Prior__c})}], >>>> ['4/12', >>>> {v:{!Account.Producer_New_Business_11_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_11_Months_Prior__c})}], >>>> >>>> >>>> ['5/12', >>>> {v:{!Account.Producer_New_Business_10_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_10_Months_Prior__c})}], >>>> >>>> ['6/12', >>>> {v:{!Account.Producer_New_Business_9_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_9_Months_Prior__c})}], >>>> ['7/12', >>>> {v:{!Account.Producer_New_Business_8_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_8_Months_Prior__c})}], >>>> ['8/12', >>>> {v:{!Account.Producer_New_Business_7_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_7_Months_Prior__c})}], >>>> ['9/12', >>>> {v:{!Account.Producer_New_Business_6_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_6_Months_Prior__c})}], >>>> ['10/12', >>>> {v:{!Account.Producer_New_Business_5_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_5_Months_Prior__c})}], >>>> ['11/12', >>>> {v:{!Account.Producer_New_Business_4_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_4_Months_Prior__c})}], >>>> ['12/12', >>>> {v:{!Account.Producer_New_Business_3_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_3_Months_Prior__c})}], >>>> ['1/13', >>>> {v:{!Account.Producer_New_Business_2_Months_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_2_Months_Prior__c})}], >>>> ['2/13', >>>> {v:{!Account.Producer_New_Business_1_Month_Prior__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_1_Month_Prior__c})}], >>>> ['3/13', >>>> {v:{!Account.Producer_New_Business_Month_to_Date__c}, >>>> f: >>>> formatCurrencyLabel({!Account.Producer_New_Business_Month_to_Date__c})}] >>>> ]); >>>> var view = new google.visualization.DataView(data); >>>> view.setColumns([0, 1]); >>>> var options = {'title':'New Business Rolling For 13 Months' , >>>> legend: 'left', align:'center',titleTextStyle: {color: 'Green'} , >>>> >>>> colors:['#70A1D4'],displayMarker:true,showLabels:true, >>>> curveType: 'function',seriesType: "bars", >>>> forceIFrame: >>>> true,showValueLabels:true,enableRegionInteractivity:true,markerOpacity:'0.5', >>>> >>>> hAxis: { viewWindowMode: 'explicit' }, >>>> 'width':560, >>>> 'height':228}; >>>> >>>> var chart = new >>>> google.visualization.ColumnChart(document.getElementById('chart_div')); >>>> chart.draw(view, options); >>>> google.visualization.events.addListener(chart, 'onmouseover', >>>> barMouseOver); >>>> google.visualization.events.addListener(chart, 'onmouseout', >>>> barMouseOut); >>>> } >>>> function barMouseOver(e) { >>>> chart.setSelection([e]); >>>> } >>>> >>>> function barMouseOut(e) { >>>> chart.setSelection([{'row': null, 'column': null}]); >>>> } >>>> </script> >>>> <body><div id="chart_div"></div></body> >>>> >>> -- 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 google-visualization-api+unsubscr...@googlegroups.com. To post to this group, send email to google-visualization-api@googlegroups.com. Visit this group at http://groups.google.com/group/google-visualization-api?hl=en. For more options, visit https://groups.google.com/groups/opt_out.