Bonjour,
J'essaye d'initialiser les premières valeurs de mon chart , l'ajout de nouveaux points ne pose pas de problème .
Voici mon Action JsonResult
Voici mon appel pour peuplé la série
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 public JsonResult GetHistory() { List<ServiceReferenceCurrency.CurrencyPrice> ListPrice = new List<ServiceReferenceCurrency.CurrencyPrice>(); TradeSimulator.ServiceReferenceCurrency.CurrencyPrice price = new TradeSimulator.ServiceReferenceCurrency.CurrencyPrice(); price.CurrencyName = "BTC-LTC"; ListPrice = repo.GetThisPriceList(price); List<FormatJsonForCHarts> FormatPriceList = new List<FormatJsonForCHarts>(); foreach (var item in ListPrice) { FormatJsonForCHarts FormatPrice = new FormatJsonForCHarts(); FormatPrice.x = item.CurrencyLast; FormatPrice.y = item.CurrencyTime; FormatPriceList.Add(FormatPrice); } return Json(FormatPriceList.ToArray(),JsonRequestBehavior.AllowGet) }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 series: [{ name: 'Random data', data: (function () { var data = []; $.ajax({ url: "/Home/GetHistory", type: "POST", typefile: "json", async: false }).done(function (done) { price = done; }); $.each(price, function ( index, item) { data.push([ item.y, item.x ]); }); return data; }) }]
et voici mon json , j'ai activer global : useUTC pour highcharts
Voila j'ai essayé plusieurs formatage de la date mais aucun résultat impossible d inititaliser les premières valeurs du charts avant de mettre a jour de nouveau points .
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 [{"y":0.01264734,"x":"\/Date(1444401994243)\/"},{"y":0.01264734,"x":"\/Date(1444401994243)\/"}]
voila le fiddle du charts en question http://jsfiddle.net/gh/get/jquery/1....ynamic-update/
Si vous avez une idées merci d avance
Partager