Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found out the problem. I commented out the previous code and inserted new ones to make the differences apparent.</p> <pre><code>&lt;script type="text/javascript"&gt; var options = { series: { pie: {show: true} } }; $(document).ready(function () { $.ajax({ type: "POST", url: "server_processing.aspx/GetPieData", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { //var jsObj = []; //jsObj.push($.parseJSON(msg.d)); var data = ($.parseJSON(msg.d); $.plot($("#piechart"), data, options); } }); }); &lt;/script&gt; //server_processing.aspx.cs [WebMethod] public static string GetPieData() { List&lt;PieData&gt; pieData = new List&lt;PieData&gt;(); pieData.Add(new PieData { label = "A", data = 40 }); pieData.Add(new PieData { label = "B", data = 40 }); pieData.Add(new PieData { label = "C", data = 20 }); JavaScriptSerializer js = new JavaScriptSerializer(); string returnArray = js.Serialize(pieData); return returnArray; //var serializer = new JsonSerializer(); //var stringWriter = new StringWriter(); //var writer = new JsonTextWriter(stringWriter); //writer.QuoteName = false; //serializer.Serialize(writer, pieData); //writer.Close(); //var json = stringWriter.ToString(); //return json; } </code></pre> <p>Since, I was pushing parsed data into already initialized array. It seemed that the data was being pushed on the first index which is not acceptable format for Flot pie and thus, the exception and no Pie chart on screen. Please feel free to correct my explanation. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload