I am trying to learn how to use Flot , and I think your example is very good, simple and clear code, so I tried to implement it, but here is my code in index.aspx:
$(function () { $.getJSON("../../Home/JsonValues", function (data) { alert('json: ' + data + ' ...'); var plotarea = $("#plot_area"); $.plot(plotarea, data);
And here is the code in HomeController:
public ActionResult JsonValues() { //string s = "[ [[0, 0], [1, 1]] ]"; //return Json(s, JsonRequestBehavior.AllowGet); StringBuilder sb = new StringBuilder(); sb.Append("[[0, 0], [1, 1]]"); return Json("[" + sb.ToString() + "]", JsonRequestBehavior.AllowGet); }
All I get is an empty graph, although when notified in the index. I get perfect JSON formatted data.
What am I doing wrong?
Lina
source share