【发布时间】:2014-08-02 16:10:37
【问题描述】:
这是我的 c# 代码,其中InBoundtable 是一个数据表
DateTime epoch = new DateTime(1970, 1, 1);
var result = (from row in InBoundtable.AsEnumerable()
group row by row.Field <string> ("Date") into grp
select new {
AbandonCalls = grp.Sum((r) => Double.Parse(r["AvgAbandonedCalls"].ToString())),
Date = ((DateTime.Parse(grp.Key)) - epoch).TotalMilliseconds
}).ToList();
double[][] finalArray = new double[result.Count][];
for (int i = 0; i < result.Count; i++) {
double[] tempArrayDoubel = new double[2];
tempArrayDoubel[0] = result[i].Date;
tempArrayDoubel[1] = result[i].AbandonCalls;
finalArray[i] = tempArrayDoubel;
}
我使用此代码返回final array:
string jsonformatstring = JsonConvert.SerializeObject(finalArray, Formatting.Indented);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "application/json; charset=utf-8";
HttpContext.Current.Response.Write(jsonformatstring);
HttpContext.Current.Response.End();
我这样称呼那个网络服务:
$.getJSON(webServiceUrl,
{ fromDate: valFrom, toDate: valTo, sliceNumber:sliceNumber })
.done(function (result) {
console.log(result);
控制台上的结果是这样的:
我的问题
: 图像中的格式是否与此格式相同:d3 = [
[1325376000000, 650], [1328054400000, 450], [1330560000000, 150], [1333238400000, 200],
[1335830400000, 150]
];
?
更新 1
这是jquery中扩展数组的结果
【问题讨论】:
-
呃,也许给我们看一下结果变量的内容而不仅仅是一张图片?在结果上使用 JSON.stringify 并将其作为文本提供给我们。如果我必须通过这张图片来判断它们可能是相同的格式..
-
@ViktorBahtev 我更新了问题
-
格式一样。
标签: c# javascript jquery arrays