javascript - Highchart value series mapping -
I try to customize the example from a problem with inserting data in highchart but displaying any information in my chart No, I example looked at the data, and it is in the nature of my data: here is my code in C #: To make it highchart my JS code: And here is passed to check your data I: "1421751600000,4.9928500000000007,1421755200000,13.314966666666665,1421758800000,8.316766666666668,1421845200000,14.738,1421848800000,7.9762000000000013 " or if I have not erased the brackets: " [[1421751600000,4.9928500000000007], [1421755200000, 13.314 9 66666666665], [1421758800000,8.316766666666668], [1421845200000,14.738 ], [1421848800000 7.9762000000000013]] " If someone can help me, I would be very grateful!
[HttpPost] public JsonResult GetData () {... var view = new JavaScriptSerializer () Serialize (dictionary.dicValues.Select (x = & gt; new object [] {x.Key, x.Value})); See = Reggae Change (see, @ "\" "\\ / date \ ((? -? \ D +) \) \\ / \" "", "$ 1"); View = View Change (@ "[", ""). Change (@ "]", ""); Return New JsonResult {Data = New {view}, ContentType = Null, ContentEncoding = Null, JsonRequestBehavior = JsonRequestBehavior.AllowGet}; }
$ (ELEM) .highcharts ( 'StockChart', {rangeSelector: {selected: 1}, Title: {text: "title"}, XAxis: {type: 'Date',}, YAxis: {type: 'double',}, range: [{name: "AAPL" data: data.view , Tooltip: {ValueDecimals: 2}}]});
You just need to be able to:
public JsonResult GetData () {new JsonResult {} {data = dictionary.dicValues.select (x = & gt; new object [] {x.Key, x.Value}}};} < The default for code> JsonResult
should give you the correct settings for ContentType and it should automatically use the default serializer to serial your object (unless in the right JSON string You need some custom serialization Ykta not).
Comments
Post a Comment