Hi, I'm not entirely sure what you mean by "passing dynamic values" to the chart, but it looks like you're creating a view, but then rendering data. Perhaps you meant chart.draw(view, ...)?
- Sergey On Sat, Jun 29, 2013 at 6:08 AM, yash shah <[email protected]> wrote: > Hello all, > > I am developing a site in which i am using google column chart.? > > The problem is when ipass the dynamic values it is not working, I have > tried so many differnt methods but none is working. > Please help. > > Here is the code : > > <script type="text/javascript"> > > var name1 = document.getElementById("cmnm").value; > var name = name1.split((/,/)); > > var price1 = document.getElementById("cmpr").value; > var price = price1.split(/,/); > //var data1 = "["; > //var data2 = "[['Company', 'Price'],["; > /* for (var i = 1; i < name.length; i++) > { > > if(i+1 != name.length) > { > // data1 = data1+i+","+price[i]+"], ["; > data2 = data2 + "'"+name[i]+"'" + ',' + price[i] + '], ['; > //alert(data2); > } > else > { > //data1 = data1+i+","+price[i]+"]"; > data2 = data2 + "'"+name[i]+"'" + ',' + price[i] + ']]'; > //alert(data2); > } > } > alert(data2); > */ > > > google.load("visualization", "1", {packages:["corechart"]}); > google.setOnLoadCallback(drawChart); > > function drawChart() { > var data = new google.visualization.DataTable(); > data.addColumn('string', 'Company'); > data.addColumn('number', 'Prices'); > data.addRows(1); > > //for (var i = 1; i < name.length; i++) > //{ > data.setValue(0,0,'afaaf'); > data.setValue(1,1,61); > //} > > //var data = google.visualization.arrayToDataTable([['Company', > 'Price'],['Assurity',35.57], ['Americo',39.03], ['Forethought',39.70], > ['American > //Equity',40.03], ['Mutual of Omaha',41.10], ['American > Equity',43.78], ['Columbian',43.88]]); > > var view = new google.visualization.DataView(data); > > view.setRows > ( > view.getFilteredRows([{ > column: 1, > maxValue: 5 > }]) > ); > > var options = { > title: 'Company Performance', > hAxis: {title: 'Year', titleTextStyle: {color: 'red'}} > }; > > var chart = new > google.visualization.ColumnChart(document.getElementById('chart_div')); > chart.draw(data, <options>); > } > </script> > > -- > 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 > http://groups.google.com/group/google-visualization-api. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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 http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/groups/opt_out.
