Echarts 和 Ajax

1、json

public JsonResult Return_Title(string RelGuid)
{
    Base_Model base_Model = new Base_Model();

    if (string.Format("{0}", RelGuid) != "")
    {
        base_Model = new Base_Dal().GetDetailByCE("EchartsBase_003", "RelGuid", RelGuid);
    }

    JsonResult jr_TextStyle = Return_TextStyle(base_Model.CE13);

    JsonResult json = new JsonResult();
    json.Data = new
    {
        show = base_Model.CE01,
        text = base_Model.CE02,
        left = base_Model.CE03,
        top = base_Model.CE04,
        right = base_Model.CE05,
        bottom = base_Model.CE06,
        x = base_Model.CE07,
        y = base_Model.CE08,
        backgroundColor = base_Model.CE09,
        borderColor = base_Model.CE10,
        borderWidth = base_Model.CE11,
        borderRadius = base_Model.CE12,
        textStyle = jr_TextStyle,
    };
    return json;
    //JavaScriptSerializer js = new JavaScriptSerializer();
    //string treeStr = js.Serialize(json.Data);
    //return Content(treeStr);

}






2、String

 public ActionResult Return_Title(string RelGuid)
{
    Base_Model base_Model = new Base_Model();

    if (string.Format("{0}", RelGuid) != "")
    {
        base_Model = new Base_Dal().GetDetailByCE("EchartsBase_003", "RelGuid", RelGuid);
    }

    JsonResult jr_TextStyle = Return_TextStyle(base_Model.CE13);

    JsonResult json = new JsonResult();
    json.Data = new
    {
        show = base_Model.CE01,
        text = base_Model.CE02,
        left = base_Model.CE03,
        top = base_Model.CE04,
        right = base_Model.CE05,
        bottom = base_Model.CE06,
        x = base_Model.CE07,
        y = base_Model.CE08,
        backgroundColor = base_Model.CE09,
        borderColor = base_Model.CE10,
        borderWidth = base_Model.CE11,
        borderRadius = base_Model.CE12,
        textStyle = jr_TextStyle,
    };
    //return json;
    JavaScriptSerializer js = new JavaScriptSerializer();
    string treeStr = js.Serialize(json.Data);
    return Content(treeStr);

}

你可能感兴趣的:(Echarts 和 Ajax)