c# - how to bind date in Line series chart x axis windows phone 8.1 -
in line series chart want show date binding on x axis , on y axis index start 90 using wcf method access date
.xaml code
<charting:chart name="mychart" title="" margin="11,153,-2,39"> <charting:lineseries margin="0" independentvaluepath="item1" dependentvaluepath="item2" isselectionenabled="true" title="blood glucose" foreground="black" itemssource="{binding measurement}" /> </charting:chart>
.xaml.cs
string result = await wcfrestservicecall("get", "getbg1?email=" + emailtxtbox.text + ""); result = result.replace("{\"getbg1result\":", ""); result = result.replace("]}", "]"); list<bg> data = jsonconvert.deserializeobject<list<bg>>(result); int item1 = 0; int item2 = 1; int item3 = 2; string a1 = ""; string b2 = ""; string c3 = ""; foreach (bg b in data) { item1 = b.measurement[0]; item2 = b.measurement[1]; item3 = b.measurement[2]; a1 = b.date_[0].tostring(); b2 = b.date_[1].tostring(); c3 = b.date_[2].tostring(); } list<tuple<string, int>> mylist = new list<tuple<string, int>>() { new tuple<string, int>(a1, item1), new tuple<string, int>(b2, item2), new tuple<string, int>(c3, item3) }; (mychart.series[0] lineseries).itemssource = mylist; }
i have solved issue doing these lines of code
protected async override void onnavigatedto(navigationeventargs e) { string result = await wcfrestservicecall("get", "getbg1?email=" + emailtxtbox.text + ""); result = result.replace("{\"getbg1result\":", ""); result = result.replace("]}", "]"); list<bg> data = jsonconvert.deserializeobject<list<bg>>(result); int item1 = 0; int item2 = 1; int item3 = 2; int item4 = 0; item1 =int.parse( data[0].measurement); item2 = int.parse(data[1].measurement); item3 = int.parse(data[2].measurement); list<tuple<string, int>> mylist = new list<tuple<string, int>>() { new tuple<string, int>(data[0].date_, item1), new tuple<string, int>(data[1].date_, item2), new tuple<string, int>(data[2].date_, item3), }; (mychart.series[0] lineseries).itemssource = mylist; }
Comments
Post a Comment