如何在Line系列图表x轴windows phone 8.1中绑定日期

时间:2016-01-27 18:36:32

标签: c# xaml windows-phone-8.1

在线序列图中,我希望通过在x轴和y轴上绑定来显示日期,索引从90开始 我正在使用WCF方法来访问日期

.xaml代码

<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] as LineSeries).ItemsSource = myList;
       }

1 个答案:

答案 0 :(得分:1)

我通过这些代码行解决了我的问题

A=$(sed 's/[]\.|$(){}?+*^]/\\&/g' <<< "$A")