There are a few things you'll need to know to make this work:

1) The object {v: value, f: 'formatted value'} represents a single cell in 
the table, where the 'v' property is the value of the cell and the 'f' 
property is the string-formatted value of the cell (like {v: 5, f: '5 
apples'}).  Most of the time, you don't need to use this syntax; using just 
the value works fine.

2) The line:

[varjs,  v:varjs,      400], 

will throw an error, because the syntax "v:varjs" only has meaning in an 
object, not an array.  You would need this instead:

[varjs, {v:varjs}, 400],
 
3) If you want more than one row of data, there are much easier ways to 
write this code that will save you a lot of time and effort


On Thursday, May 24, 2012 2:22:31 PM UTC-4, Ro wrote:
>
> hi this is ma code and it does not work
> please help
>
> <?php
> $variable_php=1;
>
> echo '<html>
>   <head>
>   
>     <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
>     <script type="text/javascript">
>  var varjs="'.$variable_php.'";
>       google.load("visualization", "1", {packages:["corechart"]});
>       google.setOnLoadCallback(drawChart);
>       function drawChart() {
>         var data = google.visualization.arrayToDataTable([
>           [\'Year\', \'Sales\', \'Expenses\'],
>           [varjs,  v:varjs,      400],
>           [\'2005\',  1170,      460],
>           [\'2006\',  660,       1120],
>           [\'2007\',  1030,      540]
>         ]);
>
>         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>
>   </head>
>   <body>
>     <div id="chart_div" style="width: 900px; height: 500px;"></div>
>   </body>
> </html>'
> ?>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/YTL0meFxfEYJ.
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.

Reply via email to