1
私は、Ajax xmlでデータを取得してjqplotグラフをレンダリングしようとしています。JQPlot Ajaxグラフのレンダリングの問題
$.ajax({
type: "POST",
url: "/ajaxXML.jsp",
data: ({cmd: "report"}),
dataType: "xml",
success: function(xml) {
var data= new Array();
$(xml).find('graph').each(function(){
var points = new Array()
var x = $(this).attr('x');
var y = $(this).attr('y');
points.push(x);
points.push(y);
data.push(points);
});
plotGraph(data);
}
});
function plotGraph(data){
var line1=[['11-01-11',2052], ['11-02-11',2205], ['11-03-11',1910], ['11-04-11',2085], ['11-05-11',2261], ['11-06-11',1714], ['11-07-11',3123], ['11-08-11',3369], ['11-09-11',3515], ['11-10-11',3380], ['11-11-11',3476], ['11-12-11',3954], ['11-13-11',2799], ['11-14-11',3166], ['11-15-11',2932] ,['11-16-11',3289]];
alert(data);
alert(line1);
$.jqplot('chart1', [data], {
title:'Margin vs Date',
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer
},
yaxis:{autoscale:true}
},
series:[{lineWidth:4}]
});
}
XMLは
<graphs>
<graph x="11-28-2011" y="48973"></graph>
<graph x="11-29-2011" y="41981"></graph>
<graph x="11-30-2011" y="45562"></graph>
<graph x="12-01-2011" y="82437"></graph>
<graph x="12-02-2011" y="83979"></graph>
<graph x="12-03-2011" y="64444"></graph>
</graphs>
ように見えるが、この戦略は、X軸のみを動作していない方法をいくつかは、グラフ上にデータ点又はy軸が移入されています。
は、しかし、私はそれはあなたがあなたのyの値が文字列でない整数として配列にプッシュされるXMLを解析するとAJAX呼び出しによってfetchcedデータは
ありがとうございますMark u made my day :) – dpsdce