0

日付と値をグラフ化しようとしましたが、これが私のコードです:

function getDaily(vsatid){
$.ajax({
     type: "POST",
     url: "daily_graph.php",
     data: "id=" + vsatid,
     success: function(obj1){
     options.series[0].data = obj1.date;
     options.series[1].data = obj1.ebno;
     }
var chart = new Highcharts.Chart(options);  
});}

xをdatetimeとして、yを値として取得できるように、シリーズをプッシュする方法を教えてください。以下は、json_encode を使用して mysql データベースから json に解析された私のデータです。

[{"date":"1363700566","ebno":8.04},{"date":"1363701638","ebno":8.02},{"date":"1363705226","ebno":7.93},{ "日付":"1363709087","ebno":7.65},{"日付":"1363712661","ebno":7.69},{"日付":"1363716221","ebno":7.44},{"日付":"1363719708","ebno":7.19},{"日付":"1363723254","ebno":6.97},{"日付":"1363726853","ebno":6.99},{"日付": "1363730481","ebno":7.04},{"日付":"1363734045","ebno":6.92},{"日付":"1363737697","ebno":7.07},{"日付":"1363741201 ","ebno":7.27},{"日付":"1363744878","ebno":7.35},{"日付":"1363748625","ebno":7.48},{"日付":"1363752211","ebno":0},{"日付":"1363755741" ,"ebno":7.69},{"日付":"1363759347","ebno":7.76},{"日付":"1363762894","ebno":7.83},{"日付":"1363766640"," ebno":7.82},{"date":"1363770121","ebno":7.82},{"date":"1363773789","ebno":7.69},{"date":"1363777209","ebno" :6.78},{"日付":"1363780874","ebno":8.15}]"1363755741","ebno":7.69},{"日付":"1363759347","ebno":7.76},{"日付":"1363762894","ebno":7.83},{"日付":"1363766640 ","ebno":7.82},{"日付":"1363770121","ebno":7.82},{"日付":"1363773789","ebno":7.69},{"日付":"1363777209", "ebno":6.78},{"日付":"1363780874","ebno":8.15}]"1363755741","ebno":7.69},{"日付":"1363759347","ebno":7.76},{"日付":"1363762894","ebno":7.83},{"日付":"1363766640 ","ebno":7.82},{"日付":"1363770121","ebno":7.82},{"日付":"1363773789","ebno":7.69},{"日付":"1363777209", "ebno":6.78},{"日付":"1363780874","ebno":8.15}]{"date":"1363777209","ebno":6.78},{"date":"1363780874","ebno":8.15}]{"date":"1363777209","ebno":6.78},{"date":"1363780874","ebno":8.15}]

すべての回答をいただければ幸いです。

4

3 に答える 3

0

日付はタイムスタンプである必要があるため、parseFloat() 関数を使用して文字列を数値に変換し、1000 を掛けて適切な JavaScript タイムスタンプ形式を実現する必要があります。

于 2013-03-20T14:52:22.423 に答える
0
try
chart.series[0].addPoint(obj1.date);
chart.series[1].addpoint(obj1.ebno)


//     options.series[0].data = obj1.date;
//     options.series[1].data = obj1.ebno;

by using two series u will get 2 diff x values for two diff series
if u want to get x,y val for same series 

parse the obj1 to json . or 
add

               type:"GET",
                   url: "delete",
            //       dataType:"json",
                       data:chart.series[0].data,

try
 $.each(obj1,function(index,object){
 chart.series[0].addPoint(object);
 });                
  // will iterate all the objects and add it to series

where obj1 should contain
[{"x":"1363700566","y":8.04}
于 2013-03-21T12:17:05.927 に答える