Where are you getting the data from and what is its original structure?

On Saturday, June 29, 2013 6:10:41 AM UTC-4, yash shah wrote:
>
> Hello all,
>
> I am developing a site in which i am using Google column chart.?
>
> The problem is when i pass the dynamic values it is not working, I have 
> tried so many different 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.


Reply via email to