Timeline chart - Error - Invalid data at row - though Start Time < End Time

244 views
Skip to first unread message

priyanka shinde

unread,
Nov 3, 2017, 5:06:25 AM11/3/17
to Google Visualization API
While plotting the Timeline chart I am facing the following error:

Invalid data at row #1: start(1511518003028) > end(1511518003025).

After searching over the web found that this occurs in case the start time is greater than the end time, but this is not in my case.

Attaching the error and the code which is causing the issue, along with one working example and the other which is having the said error.

******************************************************************************************************************************************************************************************
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>


<script type="text/javascript">
google.charts.load("current", {packages:["timeline"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
    var container = document.getElementById('example3.1');
    var chart = new google.visualization.Timeline(container);
    var dataTable = new google.visualization.DataTable();
    dataTable.addColumn({ type: 'string', id: 'Fruit' });
    dataTable.addColumn({ type: 'string', id: 'Color' });
dataTable.addColumn({ type: 'number', id: 'EatStart' });
    dataTable.addColumn({ type: 'number', id: 'EatEnd' });
/* Not-Working -> Error in 2nd Data (Apple,Yellow) */ 
    dataTable.addRows([
 
  [ 'Apple','Green', new Date(2017,10,24,15,36,43,028).getTime(), new Date(2017,10,24,15,36,43,028).getTime()],
  [ 'Apple','Yellow', new Date(2017,10,24,15,36,43,028).getTime(), new Date(2017,10,24,15,36,43,031).getTime()],  // Error
  [ 'Apple','Red', new Date(2017,10,24,15,36,43,031).getTime(), new Date(2017,10,24,15,36,43,301).getTime()],
  [ 'Apple','LightGreen', new Date(2017,10,24,15,36,43,301).getTime(), new Date(2017,10,24,15,36,43,317).getTime()],
  [ 'Apple','LightYellow', new Date(2017,10,24,15,36,43,317).getTime(), new Date(2017,10,24,15,36,43,389).getTime()],
  [ 'Apple','LightRed',new Date(2017,10,24,15,36,43,389).getTime(), new Date(2017,10,24,15,36,43,425).getTime()],
    ]);
/* Working */
    dataTable.addRows([
 
  [ 'Mango','Green', new Date(2017,10,24,15,36,51,673).getTime(), new Date(2017,10,24,15,36,51,673).getTime()],
  [ 'Mango','Yellow', new Date(2017,10,24,15,36,51,673).getTime(), new Date(2017,10,24,15,36,51,686).getTime()],
  [ 'Mango','Red', new Date(2017,10,24,15,36,51,686).getTime(), new Date(2017,10,24,15,36,51,975).getTime()],
  [ 'Mango','LightGreen', new Date(2017,10,24,15,36,51,975).getTime(), new Date(2017,10,24,15,36,52,082).getTime()],
  [ 'Mango','LightYellow', new Date(2017,10,24,15,36,52,082).getTime(), new Date(2017,10,24,15,36,52,176).getTime()],
  [ 'Mango','LightRed',new Date(2017,10,24,15,36,52,176).getTime(), new Date(2017,10,24,15,36,52,377).getTime()],
    ]);
chart.draw(dataTable);

  }
</script>

<h1>SnacksTime</h1>
<div id="example3.1" style="height: 600px;"></div>  
 




Any help would be appreciated. Thanks.
test.php
Reply all
Reply to author
Forward
0 new messages