Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-11 Thread 'Sergey Grabkovsky' via Google Visualization API
You're welcome. I'm glad you got it working.
On Wed, Mar 11, 2015 at 5:09 PM Wilson Rogério Braun braun0...@gmail.com
wrote:

 Many Thanks.

 Em quarta-feira, 11 de março de 2015 18:08:12 UTC-3, Wilson Rogério Braun
 escreveu:

 Wonder! Congratulations.
 https://lh3.googleusercontent.com/-rl3ZSGoiBho/VQCubyGr0dI/AX8/pPwRiH_0P50/s1600/console.png


 Em quarta-feira, 11 de março de 2015 18:03:28 UTC-3, Sergey escreveu:

 So you need to change it to:
  tdata.addRow([ToJavaScriptDate(data[i].data_semanal),
 parseFloat(data[i].peso_kg)]);

 On Wed, Mar 11, 2015 at 4:58 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 *He returned to the console with the message:*
 Uncaught Error: If argument is given to addRow, it must be an array, or
 null

 Em quarta-feira, 11 de março de 2015 17:50:45 UTC-3, Sergey escreveu:

 I missed this earlier, but you have a syntax error in your code. You're
 not calling your ToJavaScriptDate function. The code you have is 
 ToJavaScriptDate[data[i].data_semanal], which is property access, not
 function call. You need to change it to be ToJavaScriptDate(data[i].data
 _semanal).

 It also looks like you're returning strings for your numbers as well, so
 you'll need to parse those too. To do that, modify this line:
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
 to:
   
 tdata.addRow(ToJavaScriptDate(data[i].data_semanal),
 parseFloat(data[i].peso_kg));

 On Wed, Mar 11, 2015 at 4:45 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 Okay, but the chart is not out yet. The return format below:

 Tue Sep 02 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.340 

 Sat Sep 06 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.450 

 Mon Sep 08 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.540 

 Em quarta-feira, 11 de março de 2015 17:27:57 UTC-3, Sergey escreveu:

 The entire point of parsing the date was to turn it into a JavaScript
 Date. You are returning a string. You need to change your toJavaScriptDate
 function to be:
   function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 return new Date(parseFloat(results[1]));
 }

 On Wed, Mar 11, 2015 at 3:43 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 Almost there, but miss rendereizar the chart. Below image attached with
 island and return code. Any suggestions?


 script type=text/javascript src=https://www.google.com/jsapi
 /script
 script type=text/javascript src=//ajax.googleapis.com/aja
 x/libs/jquery/1.10.2/jquery.min.js/script
 script
 function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 var dt = new Date(parseFloat(results[1]));
 return (dt.getMonth() + 1) + / + dt.getDate() + / +
 dt.getFullYear();
 }
 /script
 !-- Script--

 script type=text/javascript
 google.load('visualization', '1.1', { 'packages': ['corechart'] });
 google.setOnLoadCallback(drawChart);
 function drawChart() {
 $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {},
   function (data) {
   var tdata = new google.visualization.DataTable();

   tdata.addColumn('date', 'data_semanal');
   tdata.addColumn('number', 'peso_kg');
   for (var i = 0; i  data.length; i++) {

   if (data[i].data_semanal != null)
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
   console.log(ToJavaScriptDate(d
 ata[i].data_semanal),data[i].peso_kg);
   }
   var options = {
   vAxis: { title: PESO, minValue: 1, maxValue: 6 },
   hAxis: { title: DATA, textStyle: { fontSize: 10
 }},
   legend: { position: none }
   };
   var chart = new google.visualization.LineChart
 (document.getElementById('EvolucaoPeso'));
   chart.draw(tdata, options);
   });
   }
 /script


 Em segunda-feira, 9 de março de 2015 16:40:54 UTC-3, Wilson Rogério Braun
 escreveu:

 THANK YOU.

 Em segunda-feira, 9 de março de 2015 16:38:14 UTC-3, Sergey escreveu:

 It sounds like a lot of the questions you have are unrelated to Google
 Charts, and have more to do with basic JavaScript programming. You should
 consult a JavaScript book or tutorial, or ask this question on a beginner
 forum, like StackOverflow.

 Hope this helps,
 - Sergey

 On Mon, Mar 9, 2015 at 3:24 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 *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 

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-11 Thread 'Sergey Grabkovsky' via Google Visualization API
The entire point of parsing the date was to turn it into a JavaScript Date.
You are returning a string. You need to change your toJavaScriptDate
function to be:
  function ToJavaScriptDate(value)
   {
var pattern = /Date\(([^)]+)\)/;
var results = pattern.exec(value);
return new Date(parseFloat(results[1]));
}

On Wed, Mar 11, 2015 at 3:43 PM Wilson Rogério Braun braun0...@gmail.com
wrote:

 Almost there, but miss rendereizar the chart. Below image attached with
 island and return code. Any suggestions?


 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
 function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 var dt = new Date(parseFloat(results[1]));
 return (dt.getMonth() + 1) + / + dt.getDate() + / +
 dt.getFullYear();
 }
 /script
 !-- Script--

 script type=text/javascript
 google.load('visualization', '1.1', { 'packages': ['corechart'] });
 google.setOnLoadCallback(drawChart);
 function drawChart() {
 $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {},
   function (data) {
   var tdata = new google.visualization.DataTable();

   tdata.addColumn('date', 'data_semanal');
   tdata.addColumn('number', 'peso_kg');
   for (var i = 0; i  data.length; i++) {

   if (data[i].data_semanal != null)

 tdata.addRow(ToJavaScriptDate[data[i].data_semanal],data[i].peso_kg);

 console.log(ToJavaScriptDate(data[i].data_semanal),data[i].peso_kg);
   }
   var options = {
   vAxis: { title: PESO, minValue: 1, maxValue: 6 },
   hAxis: { title: DATA, textStyle: { fontSize: 10 }},
   legend: { position: none }
   };
   var chart = new
 google.visualization.LineChart(document.getElementById('EvolucaoPeso'));
   chart.draw(tdata, options);
   });
   }
 /script


 Em segunda-feira, 9 de março de 2015 16:40:54 UTC-3, Wilson Rogério Braun
 escreveu:

 THANK YOU.

 Em segunda-feira, 9 de março de 2015 16:38:14 UTC-3, Sergey escreveu:

 It sounds like a lot of the questions you have are unrelated to Google
 Charts, and have more to do with basic JavaScript programming. You should
 consult a JavaScript book or tutorial, or ask this question on a beginner
 forum, like StackOverflow.

 Hope this helps,
 - Sergey

 On Mon, Mar 9, 2015 at 3:24 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 *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
 wrote:

 * Uncaught SyntaxError: Unexpected token ;*


 *script type=text/javascriptgoogle.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 

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-11 Thread 'Sergey Grabkovsky' via Google Visualization API
I missed this earlier, but you have a syntax error in your code. You're not
calling your ToJavaScriptDate function. The code you have is 
ToJavaScriptDate[data[i].data_semanal], which is property access, not
function call. You need to change it to be ToJavaScriptDate(
data[i].data_semanal).

It also looks like you're returning strings for your numbers as well, so
you'll need to parse those too. To do that, modify this line:
  tdata.addRow(ToJavaScriptDate[
data[i].data_semanal],data[i].peso_kg);
to:
  tdata.addRow(ToJavaScriptDate(data[i].data_semanal),
parseFloat(data[i].peso_kg));

On Wed, Mar 11, 2015 at 4:45 PM Wilson Rogério Braun braun0...@gmail.com
wrote:

 Okay, but the chart is not out yet. The return format below:

 Tue Sep 02 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.340 

 Sat Sep 06 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.450 

 Mon Sep 08 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.540 

 Em quarta-feira, 11 de março de 2015 17:27:57 UTC-3, Sergey escreveu:

 The entire point of parsing the date was to turn it into a JavaScript
 Date. You are returning a string. You need to change your toJavaScriptDate
 function to be:
   function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 return new Date(parseFloat(results[1]));
 }

 On Wed, Mar 11, 2015 at 3:43 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 Almost there, but miss rendereizar the chart. Below image attached with
 island and return code. Any suggestions?


 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
 function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 var dt = new Date(parseFloat(results[1]));
 return (dt.getMonth() + 1) + / + dt.getDate() + / +
 dt.getFullYear();
 }
 /script
 !-- Script--

 script type=text/javascript
 google.load('visualization', '1.1', { 'packages': ['corechart'] });
 google.setOnLoadCallback(drawChart);
 function drawChart() {
 $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {},
   function (data) {
   var tdata = new google.visualization.DataTable();

   tdata.addColumn('date', 'data_semanal');
   tdata.addColumn('number', 'peso_kg');
   for (var i = 0; i  data.length; i++) {

   if (data[i].data_semanal != null)
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
   console.log(ToJavaScriptDate(
 data[i].data_semanal),data[i].peso_kg);
   }
   var options = {
   vAxis: { title: PESO, minValue: 1, maxValue: 6 },
   hAxis: { title: DATA, textStyle: { fontSize: 10
 }},
   legend: { position: none }
   };
   var chart = new google.visualization.
 LineChart(document.getElementById('EvolucaoPeso'));
   chart.draw(tdata, options);
   });
   }
 /script


 Em segunda-feira, 9 de março de 2015 16:40:54 UTC-3, Wilson Rogério Braun
 escreveu:

 THANK YOU.

 Em segunda-feira, 9 de março de 2015 16:38:14 UTC-3, Sergey escreveu:

 It sounds like a lot of the questions you have are unrelated to Google
 Charts, and have more to do with basic JavaScript programming. You should
 consult a JavaScript book or tutorial, or ask this question on a beginner
 forum, like StackOverflow.

 Hope this helps,
 - Sergey

 On Mon, Mar 9, 2015 at 3:24 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 *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
 wrote:

 * Uncaught SyntaxError: Unexpected token ;*


 *script type=text/javascriptgoogle.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');
 

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-11 Thread 'Sergey Grabkovsky' via Google Visualization API
So you need to change it to:
 tdata.addRow([ToJavaScriptDate(data[i].data_semanal),
parseFloat(data[i].peso_kg)]);

On Wed, Mar 11, 2015 at 4:58 PM Wilson Rogério Braun braun0...@gmail.com
wrote:

 *He returned to the console with the message:*
 Uncaught Error: If argument is given to addRow, it must be an array, or
 null

 Em quarta-feira, 11 de março de 2015 17:50:45 UTC-3, Sergey escreveu:

 I missed this earlier, but you have a syntax error in your code. You're
 not calling your ToJavaScriptDate function. The code you have is 
 ToJavaScriptDate[data[i].data_semanal], which is property access, not
 function call. You need to change it to be ToJavaScriptDate(data[i].
 data_semanal).

 It also looks like you're returning strings for your numbers as well, so
 you'll need to parse those too. To do that, modify this line:
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
 to:
   
 tdata.addRow(ToJavaScriptDate(data[i].data_semanal),
 parseFloat(data[i].peso_kg));

 On Wed, Mar 11, 2015 at 4:45 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 Okay, but the chart is not out yet. The return format below:

 Tue Sep 02 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.340 

 Sat Sep 06 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.450 

 Mon Sep 08 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.540 

 Em quarta-feira, 11 de março de 2015 17:27:57 UTC-3, Sergey escreveu:

 The entire point of parsing the date was to turn it into a JavaScript
 Date. You are returning a string. You need to change your toJavaScriptDate
 function to be:
   function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 return new Date(parseFloat(results[1]));
 }

 On Wed, Mar 11, 2015 at 3:43 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 Almost there, but miss rendereizar the chart. Below image attached with
 island and return code. Any suggestions?


 script type=text/javascript src=https://www.google.com/jsapi
 /script
 script type=text/javascript src=//ajax.googleapis.com/aja
 x/libs/jquery/1.10.2/jquery.min.js/script
 script
 function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 var dt = new Date(parseFloat(results[1]));
 return (dt.getMonth() + 1) + / + dt.getDate() + / +
 dt.getFullYear();
 }
 /script
 !-- Script--

 script type=text/javascript
 google.load('visualization', '1.1', { 'packages': ['corechart'] });
 google.setOnLoadCallback(drawChart);
 function drawChart() {
 $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {},
   function (data) {
   var tdata = new google.visualization.DataTable();

   tdata.addColumn('date', 'data_semanal');
   tdata.addColumn('number', 'peso_kg');
   for (var i = 0; i  data.length; i++) {

   if (data[i].data_semanal != null)
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
   console.log(ToJavaScriptDate(d
 ata[i].data_semanal),data[i].peso_kg);
   }
   var options = {
   vAxis: { title: PESO, minValue: 1, maxValue: 6 },
   hAxis: { title: DATA, textStyle: { fontSize: 10
 }},
   legend: { position: none }
   };
   var chart = new google.visualization.LineChart
 (document.getElementById('EvolucaoPeso'));
   chart.draw(tdata, options);
   });
   }
 /script


 Em segunda-feira, 9 de março de 2015 16:40:54 UTC-3, Wilson Rogério Braun
 escreveu:

 THANK YOU.

 Em segunda-feira, 9 de março de 2015 16:38:14 UTC-3, Sergey escreveu:

 It sounds like a lot of the questions you have are unrelated to Google
 Charts, and have more to do with basic JavaScript programming. You should
 consult a JavaScript book or tutorial, or ask this question on a beginner
 forum, like StackOverflow.

 Hope this helps,
 - Sergey

 On Mon, Mar 9, 2015 at 3:24 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 *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
 wrote:

 * Uncaught SyntaxError: Unexpected token ;*


 *script type=text/javascript

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-11 Thread Wilson Rogério Braun


Okay, but the chart is not out yet. The return format below:

Tue Sep 02 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.340 

Sat Sep 06 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.450 

Mon Sep 08 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.540 

Em quarta-feira, 11 de março de 2015 17:27:57 UTC-3, Sergey escreveu:

 The entire point of parsing the date was to turn it into a JavaScript 
 Date. You are returning a string. You need to change your toJavaScriptDate 
 function to be:
   function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 return new Date(parseFloat(results[1]));
 }

 On Wed, Mar 11, 2015 at 3:43 PM Wilson Rogério Braun brau...@gmail.com 
 javascript: wrote:

 Almost there, but miss rendereizar the chart. Below image attached with 
 island and return code. Any suggestions?


 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
 function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 var dt = new Date(parseFloat(results[1]));
 return (dt.getMonth() + 1) + / + dt.getDate() + / + 
 dt.getFullYear();
 }  
 /script
 !-- Script--

 script type=text/javascript
 google.load('visualization', '1.1', { 'packages': ['corechart'] });
 google.setOnLoadCallback(drawChart);   
 function drawChart() {
 $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {},
   function (data) { 
   var tdata = new google.visualization.DataTable();   
   
   tdata.addColumn('date', 'data_semanal');
   tdata.addColumn('number', 'peso_kg'); 
   for (var i = 0; i  data.length; i++) { 
  
   if (data[i].data_semanal != null)
   
 tdata.addRow(ToJavaScriptDate[data[i].data_semanal],data[i].peso_kg);
   
 console.log(ToJavaScriptDate(data[i].data_semanal),data[i].peso_kg);
   }   
   var options = {   
   vAxis: { title: PESO, minValue: 1, maxValue: 6 },
   hAxis: { title: DATA, textStyle: { fontSize: 10 }},
   legend: { position: none } 
   };  
   var chart = new 
 google.visualization.LineChart(document.getElementById('EvolucaoPeso'));
   chart.draw(tdata, options);
   });
   }
 /script


 Em segunda-feira, 9 de março de 2015 16:40:54 UTC-3, Wilson Rogério Braun 
 escreveu:

 THANK YOU.

 Em segunda-feira, 9 de março de 2015 16:38:14 UTC-3, Sergey escreveu:

 It sounds like a lot of the questions you have are unrelated to Google 
 Charts, and have more to do with basic JavaScript programming. You should 
 consult a JavaScript book or tutorial, or ask this question on a beginner 
 forum, like StackOverflow.

 Hope this helps,
 - Sergey

 On Mon, Mar 9, 2015 at 3:24 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 *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 
 wrote:

 * Uncaught SyntaxError: Unexpected token ;*


 *script type=text/javascriptgoogle.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([{

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-11 Thread Wilson Rogério Braun
*He returned to the console with the message:*
Uncaught Error: If argument is given to addRow, it must be an array, or null

Em quarta-feira, 11 de março de 2015 17:50:45 UTC-3, Sergey escreveu:

 I missed this earlier, but you have a syntax error in your code. You're 
 not calling your ToJavaScriptDate function. The code you have is 
 ToJavaScriptDate[data[i].data_semanal], which is property access, not 
 function call. You need to change it to be ToJavaScriptDate(
 data[i].data_semanal).

 It also looks like you're returning strings for your numbers as well, so 
 you'll need to parse those too. To do that, modify this line:
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
 to:
   
 tdata.addRow(ToJavaScriptDate(data[i].data_semanal), 
 parseFloat(data[i].peso_kg));

 On Wed, Mar 11, 2015 at 4:45 PM Wilson Rogério Braun brau...@gmail.com 
 javascript: wrote:

 Okay, but the chart is not out yet. The return format below:

 Tue Sep 02 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.340 

 Sat Sep 06 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.450 

 Mon Sep 08 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.540 

 Em quarta-feira, 11 de março de 2015 17:27:57 UTC-3, Sergey escreveu:

 The entire point of parsing the date was to turn it into a JavaScript 
 Date. You are returning a string. You need to change your toJavaScriptDate 
 function to be:
   function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 return new Date(parseFloat(results[1]));
 }

 On Wed, Mar 11, 2015 at 3:43 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 Almost there, but miss rendereizar the chart. Below image attached with 
 island and return code. Any suggestions?


 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
 function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 var dt = new Date(parseFloat(results[1]));
 return (dt.getMonth() + 1) + / + dt.getDate() + / + 
 dt.getFullYear();
 }  
 /script
 !-- Script--

 script type=text/javascript
 google.load('visualization', '1.1', { 'packages': ['corechart'] });
 google.setOnLoadCallback(drawChart);   
 function drawChart() {
 $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {},
   function (data) { 
   var tdata = new google.visualization.DataTable();   
   
   tdata.addColumn('date', 'data_semanal');
   tdata.addColumn('number', 'peso_kg'); 
   for (var i = 0; i  data.length; i++) { 
  
   if (data[i].data_semanal != null)
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
   console.log(ToJavaScriptDate(
 data[i].data_semanal),data[i].peso_kg);
   }   
   var options = {   
   vAxis: { title: PESO, minValue: 1, maxValue: 6 },
   hAxis: { title: DATA, textStyle: { fontSize: 10 }},
   legend: { position: none } 
   };  
   var chart = new google.visualization.LineChart(document.
 getElementById('EvolucaoPeso'));
   chart.draw(tdata, options);
   });
   }
 /script


 Em segunda-feira, 9 de março de 2015 16:40:54 UTC-3, Wilson Rogério Braun 
 escreveu:

 THANK YOU.

 Em segunda-feira, 9 de março de 2015 16:38:14 UTC-3, Sergey escreveu:

 It sounds like a lot of the questions you have are unrelated to Google 
 Charts, and have more to do with basic JavaScript programming. You should 
 consult a JavaScript book or tutorial, or ask this question on a beginner 
 forum, like StackOverflow.

 Hope this helps,
 - Sergey

 On Mon, Mar 9, 2015 at 3:24 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 *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 
 wrote:

 * Uncaught SyntaxError: Unexpected token ;*


 *script type=text/javascriptgoogle.load('visualization', 
 '1.1', { 

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-11 Thread Wilson Rogério Braun


Wonder! Congratulations. 
https://lh3.googleusercontent.com/-rl3ZSGoiBho/VQCubyGr0dI/AX8/pPwRiH_0P50/s1600/console.png


Em quarta-feira, 11 de março de 2015 18:03:28 UTC-3, Sergey escreveu:

 So you need to change it to:
  tdata.addRow([ToJavaScriptDate(data[i].data_semanal), 
 parseFloat(data[i].peso_kg)]);

 On Wed, Mar 11, 2015 at 4:58 PM Wilson Rogério Braun brau...@gmail.com 
 javascript: wrote:

 *He returned to the console with the message:*
 Uncaught Error: If argument is given to addRow, it must be an array, or 
 null

 Em quarta-feira, 11 de março de 2015 17:50:45 UTC-3, Sergey escreveu:

 I missed this earlier, but you have a syntax error in your code. You're 
 not calling your ToJavaScriptDate function. The code you have is 
 ToJavaScriptDate[data[i].data_semanal], which is property access, not 
 function call. You need to change it to be ToJavaScriptDate(data[i].
 data_semanal).

 It also looks like you're returning strings for your numbers as well, so 
 you'll need to parse those too. To do that, modify this line:
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
 to:
   
 tdata.addRow(ToJavaScriptDate(data[i].data_semanal), 
 parseFloat(data[i].peso_kg));

 On Wed, Mar 11, 2015 at 4:45 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 Okay, but the chart is not out yet. The return format below:

 Tue Sep 02 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.340 

 Sat Sep 06 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.450 

 Mon Sep 08 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.540 

 Em quarta-feira, 11 de março de 2015 17:27:57 UTC-3, Sergey escreveu:

 The entire point of parsing the date was to turn it into a JavaScript 
 Date. You are returning a string. You need to change your toJavaScriptDate 
 function to be:
   function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 return new Date(parseFloat(results[1]));
 }

 On Wed, Mar 11, 2015 at 3:43 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 Almost there, but miss rendereizar the chart. Below image attached with 
 island and return code. Any suggestions?


 script type=text/javascript src=https://www.google.com/jsapi
 /script
 script type=text/javascript src=//ajax.googleapis.com/aja
 x/libs/jquery/1.10.2/jquery.min.js/script
 script
 function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 var dt = new Date(parseFloat(results[1]));
 return (dt.getMonth() + 1) + / + dt.getDate() + / + 
 dt.getFullYear();
 }  
 /script
 !-- Script--

 script type=text/javascript
 google.load('visualization', '1.1', { 'packages': ['corechart'] });
 google.setOnLoadCallback(drawChart);   
 function drawChart() {
 $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {},
   function (data) { 
   var tdata = new google.visualization.DataTable();   
   
   tdata.addColumn('date', 'data_semanal');
   tdata.addColumn('number', 'peso_kg'); 
   for (var i = 0; i  data.length; i++) { 
  
   if (data[i].data_semanal != null)
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
   console.log(ToJavaScriptDate(d
 ata[i].data_semanal),data[i].peso_kg);
   }   
   var options = {   
   vAxis: { title: PESO, minValue: 1, maxValue: 6 },
   hAxis: { title: DATA, textStyle: { fontSize: 10 }},
   legend: { position: none } 
   };  
   var chart = new google.visualization.LineChart(document.
 getElementById('EvolucaoPeso'));
   chart.draw(tdata, options);
   });
   }
 /script


 Em segunda-feira, 9 de março de 2015 16:40:54 UTC-3, Wilson Rogério Braun 
 escreveu:

 THANK YOU.

 Em segunda-feira, 9 de março de 2015 16:38:14 UTC-3, Sergey escreveu:

 It sounds like a lot of the questions you have are unrelated to Google 
 Charts, and have more to do with basic JavaScript programming. You should 
 consult a JavaScript book or tutorial, or ask this question on a beginner 
 forum, like StackOverflow.

 Hope this helps,
 - Sergey

 On Mon, Mar 9, 2015 at 3:24 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 *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 

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-11 Thread Wilson Rogério Braun
Many Thanks.

Em quarta-feira, 11 de março de 2015 18:08:12 UTC-3, Wilson Rogério Braun 
escreveu:

 Wonder! Congratulations. 
 https://lh3.googleusercontent.com/-rl3ZSGoiBho/VQCubyGr0dI/AX8/pPwRiH_0P50/s1600/console.png


 Em quarta-feira, 11 de março de 2015 18:03:28 UTC-3, Sergey escreveu:

 So you need to change it to:
  tdata.addRow([ToJavaScriptDate(data[i].data_semanal), 
 parseFloat(data[i].peso_kg)]);

 On Wed, Mar 11, 2015 at 4:58 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 *He returned to the console with the message:*
 Uncaught Error: If argument is given to addRow, it must be an array, or 
 null

 Em quarta-feira, 11 de março de 2015 17:50:45 UTC-3, Sergey escreveu:

 I missed this earlier, but you have a syntax error in your code. You're 
 not calling your ToJavaScriptDate function. The code you have is 
 ToJavaScriptDate[data[i].data_semanal], which is property access, not 
 function call. You need to change it to be ToJavaScriptDate(data[i].
 data_semanal).

 It also looks like you're returning strings for your numbers as well, so 
 you'll need to parse those too. To do that, modify this line:
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
 to:
   
 tdata.addRow(ToJavaScriptDate(data[i].data_semanal), 
 parseFloat(data[i].peso_kg));

 On Wed, Mar 11, 2015 at 4:45 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 Okay, but the chart is not out yet. The return format below:

 Tue Sep 02 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.340 

 Sat Sep 06 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.450 

 Mon Sep 08 2014 00:00:00 GMT-0300 (Hora oficial do Brasil) 1.540 

 Em quarta-feira, 11 de março de 2015 17:27:57 UTC-3, Sergey escreveu:

 The entire point of parsing the date was to turn it into a JavaScript 
 Date. You are returning a string. You need to change your toJavaScriptDate 
 function to be:
   function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 return new Date(parseFloat(results[1]));
 }

 On Wed, Mar 11, 2015 at 3:43 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 Almost there, but miss rendereizar the chart. Below image attached with 
 island and return code. Any suggestions?


 script type=text/javascript src=https://www.google.com/jsapi
 /script
 script type=text/javascript src=//ajax.googleapis.com/aja
 x/libs/jquery/1.10.2/jquery.min.js/script
 script
 function ToJavaScriptDate(value)
{
 var pattern = /Date\(([^)]+)\)/;
 var results = pattern.exec(value);
 var dt = new Date(parseFloat(results[1]));
 return (dt.getMonth() + 1) + / + dt.getDate() + / + 
 dt.getFullYear();
 }  
 /script
 !-- Script--

 script type=text/javascript
 google.load('visualization', '1.1', { 'packages': ['corechart'] });
 google.setOnLoadCallback(drawChart);   
 function drawChart() {
 $.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {},
   function (data) { 
   var tdata = new google.visualization.DataTable();   
   
   tdata.addColumn('date', 'data_semanal');
   tdata.addColumn('number', 'peso_kg'); 
   for (var i = 0; i  data.length; i++) { 
  
   if (data[i].data_semanal != null)
   tdata.addRow(ToJavaScriptDate[
 data[i].data_semanal],data[i].peso_kg);
   console.log(ToJavaScriptDate(d
 ata[i].data_semanal),data[i].peso_kg);
   }   
   var options = {   
   vAxis: { title: PESO, minValue: 1, maxValue: 6 },
   hAxis: { title: DATA, textStyle: { fontSize: 10 }},
   legend: { position: none } 
   };  
   var chart = new google.visualization.LineChart(document.
 getElementById('EvolucaoPeso'));
   chart.draw(tdata, options);
   });
   }
 /script


 Em segunda-feira, 9 de março de 2015 16:40:54 UTC-3, Wilson Rogério Braun 
 escreveu:

 THANK YOU.

 Em segunda-feira, 9 de março de 2015 16:38:14 UTC-3, Sergey escreveu:

 It sounds like a lot of the questions you have are unrelated to Google 
 Charts, and have more to do with basic JavaScript programming. You should 
 consult a JavaScript book or tutorial, or ask this question on a beginner 
 forum, like StackOverflow.

 Hope this helps,
 - Sergey

 On Mon, Mar 9, 2015 at 3:24 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 *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() {  

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-11 Thread Wilson Rogério Braun
Almost there, but miss rendereizar the chart. Below image attached with 
island and return code. Any suggestions?


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
function ToJavaScriptDate(value)
   {
var pattern = /Date\(([^)]+)\)/;
var results = pattern.exec(value);
var dt = new Date(parseFloat(results[1]));
return (dt.getMonth() + 1) + / + dt.getDate() + / + 
dt.getFullYear();
}  
/script
!-- Script--

script type=text/javascript
google.load('visualization', '1.1', { 'packages': ['corechart'] });
google.setOnLoadCallback(drawChart);   
function drawChart() {
$.get('/Programa_Nutricao/Avaliacao/EvolucaoPeso', {},
  function (data) { 
  var tdata = new google.visualization.DataTable(); 
  tdata.addColumn('date', 'data_semanal');
  tdata.addColumn('number', 'peso_kg'); 
  for (var i = 0; i  data.length; i++) {   
   
  if (data[i].data_semanal != null)
  
tdata.addRow(ToJavaScriptDate[data[i].data_semanal],data[i].peso_kg);
  
console.log(ToJavaScriptDate(data[i].data_semanal),data[i].peso_kg);
  }   
  var options = {   
  vAxis: { title: PESO, minValue: 1, maxValue: 6 },
  hAxis: { title: DATA, textStyle: { fontSize: 10 }},
  legend: { position: none } 
  };  
  var chart = new 
google.visualization.LineChart(document.getElementById('EvolucaoPeso'));
  chart.draw(tdata, options);
  });
  }
/script


Em segunda-feira, 9 de março de 2015 16:40:54 UTC-3, Wilson Rogério Braun 
escreveu:

 THANK YOU.

 Em segunda-feira, 9 de março de 2015 16:38:14 UTC-3, Sergey escreveu:

 It sounds like a lot of the questions you have are unrelated to Google 
 Charts, and have more to do with basic JavaScript programming. You should 
 consult a JavaScript book or tutorial, or ask this question on a beginner 
 forum, like StackOverflow.

 Hope this helps,
 - Sergey

 On Mon, Mar 9, 2015 at 3:24 PM Wilson Rogério Braun brau...@gmail.com 
 wrote:

 *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 
 wrote:

 * Uncaught SyntaxError: Unexpected token ;*


 *script type=text/javascriptgoogle.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*
 *};   

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-09 Thread 'Sergey Grabkovsky' via Google Visualization API
I would recommend that you change the database itself either to store real
dates or numbers. If this is not possible, you could use a regular
expression to get the number out. In your case, that regexp would look
something like /Date\((\d+)\)/. Here's an example of using that:
http://jsfiddle.net/vc36osx3/2/

On Sat, Mar 7, 2015 at 8:11 AM Wilson Rogério Braun braun0...@gmail.com
wrote:

 Como retornar a data_semanal?

 De:
 Date(140962680)

 Para:
  data.addRows([
 [140962680, 3],
 [141962680, 1],
 [142962680, 1],
 [143962680, 1],
 [144962680, 2]
 ]);


 Em sábado, 7 de março de 2015 07:46:46 UTC-3, Wilson Rogério Braun
 escreveu:

 Algum local ou exemplo para esta consulta?

 Em sexta-feira, 6 de março de 2015 16:10:20 UTC-3, Wilson Rogério Braun
 escreveu:

 Até ai acho que estou entendendo, obrigado, mas como retornar do banco
 desta forma?

 Em sexta-feira, 6 de março de 2015 15:29:01 UTC-3, Sergey escreveu:

 Here is a basic example: http://jsfiddle.net/vc36osx3/

 On Fri, Mar 6, 2015 at 1:12 PM Wilson Rogério Braun brau...@gmail.com
 wrote:

 Teria algum exemplo para aplicar a sugestão?


 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;/scriptscript 
 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.
 To post to this group, send email to google-visua...@googlegroups.com.
 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.


-- 
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.


Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-09 Thread 'Sergey Grabkovsky' via Google Visualization API
It sounds like a lot of the questions you have are unrelated to Google
Charts, and have more to do with basic JavaScript programming. You should
consult a JavaScript book or tutorial, or ask this question on a beginner
forum, like StackOverflow.

Hope this helps,
- Sergey

On Mon, Mar 9, 2015 at 3:24 PM Wilson Rogério Braun braun0...@gmail.com
wrote:

 *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
 wrote:

 * Uncaught SyntaxError: Unexpected token ;*


 *script type=text/javascriptgoogle.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;/scriptscript 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.

 To post to this group, send email to google-visua...@googlegroups.com.


 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 

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-09 Thread 'Sergey Grabkovsky' via Google Visualization API
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 braun0...@gmail.com
wrote:

 * Uncaught SyntaxError: Unexpected token ;*


 *script type=text/javascriptgoogle.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;/scriptscript 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.
 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.


-- 
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.


Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-09 Thread Wilson Rogério Braun
*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/javascriptgoogle.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;/scriptscript 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 

Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-06 Thread 'Sergey Grabkovsky' via Google Visualization API
Your error doesn't come from the options. You are not specifying dates
correctly. /Date(140962680)/ is not a supported way to specify dates.
If I were you, I would have your Database query return raw numbers, and use
a DataView calculated column to convert them to Date objects.

On Fri, Mar 6, 2015 at 10:49 AM Wilson Rogério Braun braun0...@gmail.com
wrote:

 *Muito bom, mas estou com dificuldades para localizar o erro, eu tentei
 incluindo o o código, mas não da de renderizar o gráfico:*
 *De: hAxis: { title: DATA, textStyle: { fontSize: 10 } }, *
 *Para:  hAxis: { title: DATA, format: 'M/d/yy', textStyle: { fontSize:
 10 } },*

 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;/scriptscript 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.
 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.


-- 
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.


Re: [visualization-api] Re: Uncaught Error: Type mismatch. Value /Date(1409626800000)/ does not match type date in column index 0

2015-03-06 Thread Wilson Rogério Braun
Até ai acho que estou entendendo, obrigado, mas como retornar do banco 
desta forma?

Em sexta-feira, 6 de março de 2015 15:29:01 UTC-3, Sergey escreveu:

 Here is a basic example: http://jsfiddle.net/vc36osx3/

 On Fri, Mar 6, 2015 at 1:12 PM Wilson Rogério Braun brau...@gmail.com 
 javascript: wrote:

 Teria algum exemplo para aplicar a sugestão?


 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;/scriptscript 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.