ฉันใช้ AJAX เพื่อรับข้อมูลจาก SQL Server จากนั้นฉันเตรียมอาร์เรย์ js ที่ใช้เป็นข้อมูลในแผนภูมิของฉัน โค้ด JavaScript เมื่อ AJAX สำเร็จ:
...,
success: function (data) {
            var fseries = [];
            var series = [];
            for (var arr in data) {
                for (var i in data[arr]['data'] ){
                    var d = data[arr]['data'][i];
                    //if (i < 5) alert("d.method = " + d.method);
                    var serie = {x:Date.parse(d.Value), y:d.Item, method:d.method };
                    series.push(serie);
                }
                fseries.push({name: data[arr]['name'], data: series, location: data[arr]['location']});
                series = [];
            };
            DrawChart(fseries);
         },
ตอนนี้เพื่อแสดงข้อมูลเมตาเพิ่มเติมในคำแนะนำเครื่องมือ:
...
tooltip: {
    xDateFormat: '%m/%d/%y',
    headerFormat: '<b>{series.name}</b><br>',
    pointFormat: 'Method: {point.method}<br>Date: {point.x:%m/%d/%y } <br>Reading: {point.y:,.2f}',
    shared: false,
},
ฉันใช้ DataRow เพื่อวนซ้ำชุดผลลัพธ์ของฉันจากนั้นฉันใช้คลาสเพื่อกำหนดค่าก่อนที่จะส่งกลับในรูปแบบ Json นี่คือรหัส C # ในการดำเนินการของคอนโทรลเลอร์ที่เรียกโดย Ajax
public JsonResult ChartData(string dataSource, string locationType, string[] locations, string[] methods, string fromDate, string toDate, string[] lstParams)
{
    List<Dictionary<string, object>> dataResult = new List<Dictionary<string, object>>();
    Dictionary<string, object> aSeries = new Dictionary<string, object>();
    string currParam = string.Empty;        
    lstParams = (lstParams == null) ? new string[1] : lstParams;
    foreach (DataRow dr in GetChartData(dataSource, locationType, locations, methods, fromDate, toDate, lstParams).Rows)
    {
        if (currParam != dr[1].ToString())
        {
            if (!String.IsNullOrEmpty(currParam))       //A new Standard Parameter is read and add to dataResult. Skips first record.
            {
                Dictionary<string, object> bSeries = new Dictionary<string, object>(aSeries); //Required else when clearing out aSeries, dataResult values are also cleared
                dataResult.Add(bSeries);
                aSeries.Clear();
            }
            currParam = dr[1].ToString(); 
            aSeries["name"] = cParam;
            aSeries["data"] = new List<ChartDataModel>();
            aSeries["location"] = dr[0].ToString();
        }
        ChartDataModel lst = new ChartDataModel();
        lst.Value = Convert.ToDateTime(dr[3]).ToShortDateString();
        lst.Item = Convert.ToDouble(dr[2]);
        lst.method = dr[4].ToString();
        ((List<ChartDataModel>)aSeries["data"]).Add(lst);
    }
    dataResult.Add(aSeries);
    var result = Json(dataResult.ToList(), JsonRequestBehavior.AllowGet);  //used to debug final dataResult before returning to AJAX call.
    return result;
}
ฉันตระหนักดีว่ามีวิธีการเขียนโค้ดใน C # ที่มีประสิทธิภาพและเป็นที่ยอมรับมากกว่า แต่ฉันได้รับโครงการ  
               
              
seriesออบเจ็กต์ของคุณและแสดงข้อมูลในเครื่องจัดการนี้แล้วหรือยัง