In HighChart I needs to plot a series of data against x and y axis. HighChart expects the data to be in json format. ie, [ [ x, y],[x, y]……[x, y] ]. Where x and y are time ( 1392345000 – Unix epoch format ) and value ( 49.322 ). So I am making an ajax call to get the data and on success I render the json returned data in highchart. In most of the time ie, if the count of data( [x,y] ) is below 87500 rows than Json returns the data from controller to view. But when the data exceeds 87500 the ajax error is called with 404, not found error. Is there any size restriction for json returned data.
Section-1 – Controller Class
public JsonResult GetPlotData(Dictionary<string, List<ChartData>> dataPlot)
{
// dataPlot = D00213 - [[13245678000,49.9],[13245345000,43.9]...[n,n]]
// if dataPlot.Count < 87500 here throwing error and in ajax error 404 Not found
return Json(dataPlot, JsonRequestBehavior.AllowGet);
}
Section-2 – Ajax
$.ajax(
{
url: '../Report/GetPlotData',
data: { "fromDate": fromDate, "toDate":toDate, "item": items[i].id },
type: "POST",
dataType: "json",
cache: false,
success: function(chartData) {
alert(‘success’
},
error: function(xhr, ajaxOptions, thrownError)
{
debugger;
ShowDialogError(xhr, 'Site Status Report');
}
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…