Welcome Guest Search | Active Topics |

Passing Dates from servlet using AJAX
d20gdx
#1 Posted : Wednesday, August 10, 2016 6:03:00 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/4/2016(UTC)
Posts: 2

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Apologies if this has been asked before:

I need to create my chart data in a servlet and then pass using AJAX. This is all working fine but I can't understand how to pass a datetime without having to reprocess it in JavaScript.

I have tried passing millseconds and also strings of the format: 2016-08-08T02:17:14.315Z but these dont appear to be seen as dates

my code is below: any help would be appreciated please

Code:

$('#jqChart').jqChart({
               title : 'Web Service 1',
               tooltips : {
                  type : 'shared'
               },
               legend : {
                  visible : false
               },
               axes : [ {
                  type : 'dateTime',
                  location : 'bottom',
                  zoomEnabled : true
               }, {
                  type : 'linear',
                  location : 'left'
               } ],
               series : [

               {
                  type : 'column',
                  title : '##',
                  data : concurrent_transactions_data.chartdata
               }

               ]
            });


and ideally I would like my JSON to be using millisecos like this:

Code:

[["1470567194319",259],["1470580154318",243],["1470593114317",252],["1470606074316",263],["1470619034315",265],["1470631994314",272],["1470644954313",249],["1470657914312",263],["1470670874311",259],["1470683834310",269],["1470696794309",256],["1470709754308",265],["1470722714307",267],["1470735674306",273],["1470748634305",243],["1470761594304",270],["1470774554303",255],["1470787514302",259],["1470800474301",254],["1470813434300",253]]
Dragan
#2 Posted : Thursday, August 11, 2016 3:45:05 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Hi,

in your case your data can be in the following format:
Code:
[[new Date(1470567194319), 259], [new Date(1470580154318), 243], [new Date(1470593114317), 252], ...]


You can also check this example:
http://www.jqchart.com/jquery/chart/ChartData/DataFromAjaxCall
Best Regards,
Dragan Matek
jqChart Inc.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

FlatEarth Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.118 seconds.