Xaml code reception:
The background to the original code:
//chart data set
Public class CustomerVm
{
Public string Title {get; The set; }
Public double Value {get; The set; }
Public string ValueStr {get; The set; }
}
List
DayInfo=SharesDataInfoList_YK;//SharesDataInfoList_YK for the query to article 15 of the data, follow-up with this assignment
List
String [] XLabels=new string [dayInfo. Count];
for (int i=0; I & lt; DayInfo. Count; I++)
{
XLabels [I]=dayInfo [I]. Name of securities;
DayList. Add (new CustomerVm () {Title=dayInfo [I] the name of the securities, Value=https://bbs.csdn.net/topics/double.Parse (dayInfo [I]. The amount of profit and loss. The ToString ()});
}
//new diagram code
SeriesCollection SeriesCollection=new SeriesCollection ();
Labels=new ObservableCollection
SeriesCollection SeriesCollection=new SeriesCollection ();
ColumnSeries dayColunmSeries=new ColumnSeries
{
Title="profit and loss",
Values=new ChartValues
};
SeriesCollection. Add (dayColunmSeries);
YK_Series. Series=seriesCollection;
LBB. Labels=Labels;//Labels code omitted, extraction of 15 note no problem
MillionFormatter=value=https://bbs.csdn.net/topics/> value/(10000). The ToString (" #. 00 ") + "RMB ten thousand";
DataContext=this;
The above code display is normal, as static note 15 bar chart, including the mouse show note
According to the numerical change color after adjusting code Series change parts:
for (int i=0; I & lt; SharesDataInfoList_YK. Count; I++)
{
ColumnSeries dayColunmSeries=new ColumnSeries ();
DayColunmSeries. Title="profit and loss:";
DayColunmSeries. Values=new ChartValues
DayColunmSeries. The Fill=SharesDataInfoList_YK [I]. Profit and loss amount & gt; 0? New SolidColorBrush (Color FromRgb (255, 0, 0)) : new SolidColorBrush (Color. FromRgb (0, 255, 0));
SeriesCollection. Add (dayColunmSeries);
}
YK_Series. Series=seriesCollection;
LBB. Labels=Labels;//Labels code omitted, extraction of 15 note no problem
MillionFormatter=value=https://bbs.csdn.net/topics/> value/(10000). The ToString (" #. 00 ") + "RMB ten thousand";
DataContext=this;
Other part did not change, modified bar chart color although logical change, but the bottom, according to the article 15 label turned out to be only 1 select graph and the mouse out instructions into reality all 15 descr,
The graphical control is not very familiar with to ask what the problem with the code?