我想在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);
}
答案 0 :(得分:2)
SerialChart中的属性,例如AxisForeground,PlotAreaBackground,GridStroke,它们的类型是 Brush 。所以你可以设置它:
AxisForeground = new SolidColorBrush(Colors.White);
PlotAreaBackground = new SolidColorBrush(Colors.Black);
GridStroke = new SolidColorBrush(Colors.DarkGray);