我想使用AmChart创建一个图表并从Xml文件中解析数据。我删除了这段代码,但没有图表,我不知道我的错误在哪里
This is my xml file
<Results>
<Chart>
<ChartName>Ahmed</ChartName>
<Category>25</Category>
</Chart>
<Chart>
<ChartName>Test</ChartName>
<Category>25</Category>
</Chart>
<Chart>
<ChartName>PFE</ChartName>
<Category>50</Category>
</Chart>
</Results>
和XAML代码
<amq:PieChart x:Name="Pie" Height="500" Width="400" TitleMemberPath="{Binding ChartName}" ValueMemberPath="{Binding Category}">
</amq:PieChart>
我的代码背后 public partial class Page1:PhoneApplicationPage {
public Page1()
{
InitializeComponent();
XDocument data = XDocument.Load("Results.xml");
var results = from query in data.Descendants("Chart")
select new ResultModel((string)query.Element("ChartName"),
(int)query.Element("Category"));
}
}
public class Test {
public string ChartName { get; set; }
public int Category { get; set; }
public Test(string label, int category)
{ ChartName = label; Category = category; }
}
}