在Windows手机应用程序中绘制图表

时间:2014-05-11 13:19:47

标签: windows-phone-8

我想在windows phone应用程序中使用amchart创建一个图表。这是我的代码,当我运行时我有这个消息“不能隐式转换类型'字符串'到'System.Windows.Media.Brush”我怎么解决此

InitializeComponent();

            XDocument data = XDocument.Load("Data.xml");
            var results = from query in data.Descendants("year")
                          select new ResultModel((string)query.Element("month"),
                           (int)query.Element("actual"));
            var chart = new SerialChart
            {
                CategoryValueMemberPath = "month",
                AxisForeground="White",
                 PlotAreaBackground="Black",
                  GridStroke="DarkGray"
            };
            chart.SetBinding(SerialChart.DataSourceProperty, new Binding("results"));

            var lineGraph = new LineGraph
            {
                Title = "Sales",
                ValueMemberPath = "actual",

            };

            chart.Graphs.Add(lineGraph);
            sta.Children.Add(chart);




        }

1 个答案:

答案 0 :(得分:2)

SerialChart中的属性,例如AxisForeground,PlotAreaBackground,GridStroke,它们的类型是 Brush 。所以你可以设置它:

AxisForeground = new SolidColorBrush(Colors.White);
PlotAreaBackground = new SolidColorBrush(Colors.Black);
GridStroke = new SolidColorBrush(Colors.DarkGray);