chart = new SfChart()
{
Margin = new Thickness(10),
Palette = ChartColorPalette.Custom
};
ChartColorModel colorModel= new ChartColorModel();
colorModel.CustomBrushes.Add(new SolidColorBrush(Colors.Red));
colorModel.CustomBrushes.Add(new SolidColorBrush(Colors.Green));
colorModel.CustomBrushes.Add(new SolidColorBrush(Colors.Blue));
colorModel.CustomBrushes.Add(new SolidColorBrush(Colors.Yellow));
colorModel.CustomBrushes.Add(new SolidColorBrush(Colors.Orange));
chart.ColorModel = colorModel;
SplineSeries series1 = new SplineSeries();
chart.Series.Add(series1);
SplineSeries series2 = new SplineSeries()
{
ItemsSource = view.Collection,
XBindingPath = "XValue",
YBindingPath = "Value2"
};
chart.Series.Add(series2);
SplineSeries series3 = new SplineSeries()
{
ItemsSource = view.Collection,
XBindingPath = "XValue",
YBindingPath = "Value3"
};
chart.Series.Add(series3);
SplineSeries series4 = new SplineSeries()
{
ItemsSource = view.Collection,
XBindingPath = "XValue",
YBindingPath = "Value4"
};
chart.Series.Add(series4);
SplineSeries series5 = new SplineSeries()
{
ItemsSource = view.Collection,
XBindingPath = "XValue",
YBindingPath = "Value5"
};
chart.Series.Add(series5);
mainGrid.Children.Add(chart);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
chart.Series[0].ItemsSource = view.Collection;
chart.Series[0].XBindingPath = "XValue";
(chart.Series[0] as SplineSeries).YBindingPath = "Value1";
} |
SplineSeries series1 = new SplineSeries();
series1.Interior = new SolidColorBrush(Colors.Red); |
SplineSeries series2 = new SplineSeries()
{
ItemsSource = view.Collection,
XBindingPath = "XValue",
YBindingPath = "Value2",
Interior=new SolidColorBrush(Colors.Black)
};
|