output:

( ! ) Notice: Undefined variable: value_y6 in C:\wamp\www\PHP6\output.php 
on line *228*


source:

<script type='text/javascript'>        google.load('visualization', '1', 
{'packages':['annotatedtimeline']});      google.setOnLoadCallback(drawChart);  
    function drawChart() {        var data = new 
google.visualization.DataTable();        data.addColumn('date', 'Date');        
data.addColumn('number', 'Value');           data.addRows([                     
      <?phpfor (6=1; 6<=90; 6++){echo: "[new Date(".1976."1, 1), ".."],";}?>    
      ]);        var chart = new 
google.visualization.AnnotatedTimeLine(document.getElementById('chart_div1'));  
      chart.draw(data, {displayAnnotations: true});      }    </script>  



On Wednesday, 22 May 2013 12:09:32 UTC-4, asgallant wrote:
>
> The syntax looks a little odd to me, what does that output?  Open the page 
> in a browser, view the source, and paste the javascript here.
>
> On Wednesday, May 22, 2013 11:43:39 AM UTC-4, matt wrote:
>>
>> asgallant,
>>
>> Thanks. I did the following 
>>
>> <script type='text/javascript'>
>>  
>> google.load('visualization', '1', {'packages':[' annotatedtimeline']});
>>   google.setOnLoadCallback(drawC hart);
>>   function drawChart() {
>>     var data = new google.visualization.DataTable ();
>>     data.addColumn('date', 'Date');
>>     data.addColumn('number', 'Data');   
>>     data.addRows([
>>
>> <?php>
>>
>> for ($i=1; $i<=120; $i++){
>>
>> echo: "[new Date(".${'y'.$i}."1, 1), ".${'value_y'.$i}."],";
>> /*
>> to output 
>>
>> [new Date($y1, 1, 1), $value_y1],[new Date($y2, 1, 1), $value_y2],
>>
>> etc
>> */
>> }
>> </>
>>      
>>     ]);
>>
>>     var chart = new google.visualization.Annotated 
>> TimeLine(document.getElementBy Id('chart_div1'));
>>     chart.draw(data, {displayAnnotations: true});
>>   }
>> </script>  
>>
>> This did not work. I got undefined variable error. Suggestion?
>>
>> Thanks,
>> Matt
>>
>>
>>
>> On Monday, 20 May 2013 09:46:40 UTC-4, asgallant wrote:
>>>
>>> The code you posted is looking for javascript variables like $y1 and 
>>> isn't finding them.  If you want to use your PHP variables, you have to 
>>> echo them into the javascript:
>>>
>>> [new Date(<php echo $y1; ?>, 1, 1), <php echo $value_y1_1; ?>],
>>>
>>>
>>>
>>> On Monday, May 20, 2013 12:43:59 AM UTC-4, matt wrote:
>>>>
>>>> I want to use Google Annotated Time Line to generate a graph using 
>>>> values generated from a PHP script, so far I have:
>>>>
>>>>  <script type='text/javascript'>
>>>>   
>>>>
>>>> google.load('visualization', '1', {'packages':['annotatedtimeline']});
>>>>   google.setOnLoadCallback(drawChart);
>>>>   function drawChart() {
>>>>     var data = new google.visualization.DataTable();
>>>>     data.addColumn('date', 'Date');
>>>>     data.addColumn('number', 'Data');   
>>>>     data.addRows([
>>>>
>>>>       [new Date($y1, 1, 1), $value_y1_1],
>>>>       [new Date($y1, 2, 1), $value_y1_2],
>>>>       [new Date($y1, 3, 1), $value_y1_3],
>>>>
>>>>     ]);
>>>>
>>>>     var chart = new 
>>>> google.visualization.AnnotatedTimeLine(document.getElementById('chart_div1'));
>>>>     chart.draw(data, {displayAnnotations: true});
>>>>   }</script>  
>>>>
>>>> I want to add more monthly data points, from $y1 to $y80, with the 
>>>> corresponding $value. I used a for loop but got "undefined variable" 
>>>> error. 
>>>> Suggestions?
>>>>
>>>> Thanks!
>>>>
>>>>
>>>>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to