Hello!
Development in the sample(MVVM) obtained on RadControlsSilverlightCourseware.
But the series were not color what might be happening?
thanks
Development in the sample(MVVM) obtained on RadControlsSilverlightCourseware.
But the series were not color what might be happening?
thanks
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
chart.Loaded += new RoutedEventHandler(chart_Loaded);
}
void chart_Loaded(object sender, RoutedEventArgs e)
{
List<
Pepper
> peppers = new List<
Pepper
>()
{
new Pepper() { Name = "Pimento", ScovilleRating = 250 },
new Pepper() { Name = "Poblano Pepper", ScovilleRating = 500 },
new Pepper() { Name = "Jalapeno Pepper", ScovilleRating = 2500 },
new Pepper() { Name = "Cayenne Pepper", ScovilleRating = 10000 }
};
List<
PepperViewModel
> viewModel = new List<
PepperViewModel
>();
foreach (Pepper pepper in peppers)
{
viewModel.Add(new PepperViewModel(pepper));
}
// setup the grid to display name and rating
chart.DefaultSeriesDefinition = new BarSeriesDefinition() { ItemStyle = this.ScovilleStyle };
SeriesMapping mapping = new SeriesMapping();
mapping.ItemMappings.Add(new ItemMapping("Pepper.ScovilleRating", DataPointMember.YValue));
mapping.ItemMappings.Add(new ItemMapping("Pepper.Name", DataPointMember.XCategory));
chart.SeriesMappings.Add(mapping);
// bind view model to chart
chart.ItemsSource = viewModel;
chart.DefaultView.ChartLegend.Visibility = Visibility.Collapsed;
chart.DefaultView.ChartTitle.Content = "Scoville Scale";
chart.DefaultView.ChartTitle.Foreground = new SolidColorBrush(Colors.Red);
chart.DefaultView.ChartArea.AxisX.LabelRotationAngle = 45;
chart.DefaultView.ChartArea.AxisY.AxisStyles.AxisLineStyle = this.Resources["CustomAxisStyle"] as Style;
chart.DefaultView.ChartArea.AxisY.AxisStyles.ItemLabelStyle = this.Resources["CustomItemLabelStyle"] as Style;
chart.DefaultView.ChartArea.AxisX.AxisStyles.AxisLineStyle = this.Resources["CustomAxisStyle"] as Style;
chart.DefaultView.ChartArea.AxisX.AxisStyles.ItemLabelStyle = this.Resources["CustomItemLabelStyle"] as Style;
}
}