2014-05-11 112 views
-2

我想在Windows Phone應用程序中使用amchart創建圖表。這是我的代碼,當我運行我有這個消息「不能隱式轉換類型'字符串'System.Windows.Media.Brush 「我怎樣才能解決這個製圖在Windows手機應用程序

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); 




     } 

回答

2

在SerialChart的性質,如AxisForeground,PlotAreaBackground,GridStroke,其類型爲。所以你可以設置它:

AxisForeground = new SolidColorBrush(Colors.White); 
PlotAreaBackground = new SolidColorBrush(Colors.Black); 
GridStroke = new SolidColorBrush(Colors.DarkGray); 
相關問題