Hashtable ht = new Hashtable();
//ht.Add("name", "hello_world");
//ht.Add("type", "line");
//ht.Add("threshold", null);
ht.Add("data", ds.Tables[0]);
string strJson = Newtonsoft.Json.JsonConvert.SerializeObject(ht);
Response.Clear();
Response.ContentEncoding = Encoding.UTF8;
Response.ContentType = "application/json";
Response.Write(strJson);
Response.Flush();
Response.End();
$.post("HistoryCurce.aspx", { id: 4, spot: checkedspot }, function (data) {
// alert(series1);
$('#container').highcharts('StockChart', {
chart: {
type: 'line',
marginRight: 130,
marginBottom: 25
},
rangeSelector: {
selected: 1
}, title: {
text: 'demo'
},
xAxis: {
type: 'datetime',
// min: minDate, //0表示1月 以此类推
//max: maxDate,
//tickInterval: 30 * 24 * 3600 * 1000,//X轴点间隔
//labels: {
// align: 'left',
// formatter: function () { // return Highcharts.dateFormat('%Y%m%d', series2);
// }
//}
},
yAxis: {
type:"float"
}, series: [{
name:"测点",
data: data,
pointStart: Date.UTC(2012, 9, 10),
pointInterval: 24 * 3600 * 1000,// one day
er: {
enabled: true,
radius: 3
},
shadow: true,
tooltip: {
valueDecimals: 2
}
}]
});
}, 'json')
})
前台取到值了 但图却没有显示。。
highchart的数据格式是要啥样?
直接传json 貌似不行 数组貌似也不行
嗨发现对 对象的理解不行 老是走误区 我后台JSON直接存数组发到前台就好了。。
http://www.cnblogs.com/liuhaorain/archive/2012/01/24/2311352.html