Date parsing from strings is not a good idea. Browsers may interpret a
given string differently, and users from different regions of the world may
see a difference in dates input by string, even when using the same
browser. As an example, new Date('03/04/2014') might produce March 4, 2014
to a user in the US, and April 3, 2014 to a user in the UK. The way around
this is to use one of the two unambiguous methods of entering time: either
input Unix epoch time or input year, month, day, etc as separate parameters:
new Date(year, month, day, hours, minutes, seconds, milliseconds)
where months are zero-indexed (so January is 0, not 1) and each parameter
after month is optional (defaults are 1 for day and 0 for all others).
These produce identical outputs:
new Date(1395786962000) // March 25, 2014 18:32:02
new Date(2014, 2, 25, 18, 36, 2) // March 25, 2014 18:32:02
On Tuesday, March 25, 2014 6:48:12 PM UTC-4, Will DeBerry wrote:
>
> Was finally able to over come this...figures after I post for help.
>
> Test was outputting a ton of data in the following format: [new
> Date('2014-03-25 18:35:02'), 217.3, 8.9, 0.0],
> Turns out that I needed to change it to [new Date('2014/03/25 18:36:02'),
> 221.1, 8.9, 0.0],
>
> Had to change - to / in the dates for Firefox to work.
>
> On Tuesday, March 25, 2014 6:07:50 PM UTC-4, asgallant wrote:
>>
>> What does ${TEST} output?
>>
>> On Tuesday, March 25, 2014 5:46:40 PM UTC-4, Will DeBerry wrote:
>>>
>>> Built a new chart today and had everything nice and working across
>>> chrome and firefox. Only when I switch to a continuous axis does it stop
>>> showing any data in firefox and iceweasel but still functions fine in
>>> chrome. I have provided pictures of the same code in chrome and iceweasel
>>> below:
>>>
>>>
>>> <https://lh5.googleusercontent.com/-X6fES8AHSQM/UzH3xiPNX7I/AAAAAAAAAdI/D_73vRTlfT8/s1600/chrome.png><https://lh4.googleusercontent.com/-KEsRCD7AAuY/UzH31XlNFgI/AAAAAAAAAdQ/edTY8IRcDTU/s1600/ice.png>
>>>
>>> I can take the same code and switch only enough to put it back to raw
>>> data (string vs datetime) and it will work just fine. Is there something I
>>> am missing to make datetime/continuous axis work across browsers.
>>>
>>> I can't provide the direct link to the page in question, but let me know
>>> if you need to see any of the code. The current js section looks like such:
>>>
>>> <script type="text/javascript">
>>> // Load the Visualization API and the piechart package.
>>> google.load('visualization', '1.0', {'packages':['corechart']});
>>> // Set a callback to run when the Google Visualization API is loaded.
>>> google.setOnLoadCallback(drawChart);
>>>
>>> // Callback that creates and populates a data table,
>>> // instantiates the pie chart, passes in the data and
>>> // draws it.
>>> function drawChart() {
>>>
>>> // Create the data table.
>>> var data = new google.visualization.DataTable();
>>> data.addColumn('datetime', 'Date/Time');
>>> data.addColumn('number', 'Firefox');
>>> data.addColumn('number', 'VLC');
>>> data.addColumn('number', 'Flash');
>>> data.addRows([
>>> ${TEST}
>>> ]);
>>>
>>> // Set chart options
>>> var options = {
>>> 'title':'Mem Usage over time',
>>> 'is3D':false,
>>> 'hAxis':{textStyle:{fontSize:10},title: "Date/Time",format:'MM-d-y, HH'},
>>> 'vAxis':{title: "Memory Used (MBs)"},
>>> };
>>>
>>> // Instantiate and draw our chart, passing in some options.
>>> var chart = new
>>> google.visualization.LineChart(document.getElementById('chart_div'));
>>> chart.draw(data, options);
>>> }
>>> </script>
>>>
>>
--
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.
For more options, visit https://groups.google.com/d/optout.