Saturday, 24 August 2013

jqplot date format not working

jqplot date format not working

I'm newbie at jqplot plug also in javascript. I fetched data properly from
xml doc. (I have to use XML) And I added my jqplot data array. But I fetch
from xml whenever time, I returns 01/01/1970 at chart. Also I use line
chart.
Here's my codes
$(document).ready(function () {
getData();
});
window.querylist.push("V81_Avg"); //This two line is related my xml
//document. This selects my data from their xml nodes.
window.querylist.push("V81_Min");
function getData()
{
var cntr0=0;
while(cntr0<(window.querylist.length))
{
eval('window.'+window.querylist[cntr0]+'= [[]]'); // For
//intializing like V81_Avg V81_Min variable from xml
cntr0++;
}
$.get(window.server,{},function(xml) {
var index2=0;
$('row',xml).each(function(i) {
while(index2<60)
{
if((window.querylist[index2]!= null))
{
var content= $(this).find(window.querylist[index2]).text();
// This Above Part [Star] converts to dd/mmm/yy to mm/dd/yy
content=content.replace(",",".");
var datetime= $(this).find('TimeStamp').text();
var date_buff = new Array();
date_buff=datetime.split(" ");
var date_buff_buff= new Array();
date_buff_buff=date_buff[0].split(".");
var new_date =
date_buff_buff[1]+"/"+date_buff_buff[0]+"/"+date_buff_buff[2]+"
"+date_buff[1];
// This part ends.
var buff= new_date+" "+content;
eval('window.'+window.querylist[index2]+'.push(buff)');
// For adding xlm variable releated arrays
}
index2++;
}
var brk=0;
console.log(window.V81_Avg[0]);
//V81_Avg is my xml value for example its value 5, I must
//show on chart line a single V81_Avg.
$.jqplot('test_chart',[window.V81_Avg],{
title:"Test Data Graph V.001",
legend: {
show:true,
location:'se',
placement:"outsideGrid"
},
axesDefaults: {
tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
},
axes:{
xaxis: {
renderer: $.jqplot.DateAxisRenderer,
rendererOptions:{
tickRenderer:$.jqplot.CanvasAxisTickRenderer
},
// min:'August 1, 2007 16:00:00',
tickInterval: '1 months',
label: 'Tarih',
showLabel: true,
tickOptions:{angle:-70,
formatString:'%d/%#m/%Y %#H:%#M:%#S',
fontSize:'10pt',
fontFamily:'Tahoma'
},
autoscale: true
},
yaxis: {
tickOptions:{formatString:''}
}
},
series: [ { label:'burak',
neighborThreshold: -1 ,
lineWidth:2, markerOptions:{ style:'circle'}
}
]
,
cursor: {
style: 'crosshair',
show: true,
zoom:true,
looseZoom:true
}
});
});
});
}
So, I'm very very stack. Almost I tried 4hours to solve my problem. But I
cant solve.
For Any Helps, Advice I'm really appreciated. Thanks a lot.

No comments:

Post a Comment