*Uncaught ReferenceError: data is not definedAvaliacao:193 drawStuff*

 google.load('visualization', '1.1', { 'packages': ['corechart'] });
        google.setOnLoadCallback(drawStuff);
        $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {});
        function drawStuff() {      .....

Em segunda-feira, 9 de março de 2015 16:19:45 UTC-3, Sergey escreveu:
>
> I'm not sure what you were trying to do here, so I don't have any 
> suggestions for what to do instead, but this is the line where the error is:
> *            $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {};*
>
> On Mon, Mar 9, 2015 at 3:08 PM Wilson Rogério Braun <brau...@gmail.com 
> <javascript:>> wrote:
>
>> * Uncaught SyntaxError: Unexpected token ;*
>>
>>
>> *<script type="text/javascript">        google.load('visualization', 
>> '1.1', { 'packages': ['corechart'] });        
>> google.setOnLoadCallback(drawStuff);              function drawStuff() {    
>>         $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {};*
>> *                                                      var tdata = new 
>> google.visualization.DataTable();                    
>> tdata.addColumn('date', 'data_semanal');                    
>> tdata.addColumn('number', 'peso_kg');                    
>> //tdata.addColumn({ type: 'string', role: 'annotation' });*
>> *                    //console.log(data);*
>> *                         for (var i = 0; i < data.length; i++) {        
>>                 if (data[i].data_semanal != null)                          
>>   tdata.addRow([data[i].data_semanal, data[i].peso_kg]);*
>> *                    });                       // Redefine as dates      
>>               var view = new google.visualization.DataView(data);          
>>           view.setColumns([{                        type: 'date',          
>>               calc: function(dt, row) {                            var 
>> stringDateValue = dt.getValue(row, 0);                            var 
>> number = parseInt(/Date\((\d+)\)/.exec(stringDateValue)[1]);                
>>             return new Date(number);                        }              
>>       }, 1])                            var options = {                    
>>             //title: "EVOLUÇÃO DE PESO EM KG POR DATA",*
>> *                                vAxis: { title: "PESO", minValue: 1 },  
>>                               hAxis: { title: "DATA", textStyle: { 
>> fontSize: 10 } },*
>> *                                legend: { position: "none" },            
>>                     async: true //aumenta a velocidade de renderização*
>> *                            };                            var chart = 
>> new 
>> google.visualization.LineChart(document.getElementById('EvolucaoPeso'));*
>> *                            chart.draw(view, options);                  
>>       };         </script>*
>>
>>
>> Em sexta-feira, 6 de março de 2015 11:09:40 UTC-3, Wilson Rogério Braun 
>> escreveu:
>>
>>> *Alguém tem alguma sugestão?*
>>>
>>> *Controler:*
>>>     public ActionResult Peso()
>>>         {
>>>             var dia = db.spPesoEvolucao().ToList();
>>>             var a = dia.Select(x => new { x.data_semanal, x.peso_kg });
>>>             return Json(a, JsonRequestBehavior.AllowGet);
>>>         }
>>>
>>> *View:*
>>>
>>> <script type="text/javascript" 
>>> src="https://www.google.com/jsapi";></script><script type="text/javascript" 
>>> src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
>>>
>>>     <!-- Script-->
>>>     <script type="text/javascript">
>>>         google.load('visualization', '1', { 'packages': ['corechart'] });
>>>         google.setOnLoadCallback(drawChart);
>>>         function drawChart() {
>>>             $.get('/Programa/Peso', {},
>>>                 function (data) {
>>>                     var tdata = new google.visualization.DataTable();
>>>                     tdata.addColumn('date', 'data_semanal');
>>>                     tdata.addColumn('number', 'peso_kg');
>>>                     //tdata.addColumn({ type: 'string', role: 'annotation' 
>>> });
>>>                     console.log(data);
>>>                     for (var i = 0; i < data.length; i++) {
>>>                         if (data[i].data_semanal != null)
>>>                             tdata.addRow([data[i].data_semanal, 
>>> data[i].peso_kg]);
>>>                     }
>>>                     var options = {                       
>>>                         vAxis: { title: "PESO", minValue: 1 },
>>>                         hAxis: { title: "DATA", textStyle: { fontSize: 10
>>>
>>> ...
>>
>>  -- 
>> 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 
>> <javascript:>.
>> To post to this group, send email to google-visua...@googlegroups.com 
>> <javascript:>.
>> Visit this group at 
>> http://groups.google.com/group/google-visualization-api.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to