public static LineSeries CreateLineSeries(DataSeriesViewModel dataSeries, Color color, bool dashed, bool firstSeries) { LineSeries lineSeries = new LineSeries(); lineSeries.LegendSettings = new SeriesLegendSettings() { Title = dataSeries.Name }; lineSeries.Stroke = new SolidColorBrush(color); lineSeries.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "XValue" }; lineSeries.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "YValue" }; lineSeries.ItemsSource = dataSeries.DataPoints; lineSeries.TrackBallInfoTemplate = CreateTooltipDataTemplate(dataSeries.Name, firstSeries); if (dashed) { List <double> dashArray = new List <double>() { 1, 1 }; lineSeries.DashArray = new DoubleCollection(dashArray); lineSeries.StrokeThickness = 5; } return(lineSeries); }
public static AreaSeries CreateAreaSeries(DataSeriesViewModel dataSeries, Color color, bool firstSeries) { AreaSeries areaSeries = new AreaSeries(); SeriesLegendSettings legendSettings = new SeriesLegendSettings() { Title = dataSeries.Name }; areaSeries.LegendSettings = legendSettings; areaSeries.Fill = new SolidColorBrush(color); areaSeries.CombineMode = ChartSeriesCombineMode.Stack; areaSeries.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "XValue" }; areaSeries.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "YValue" }; areaSeries.ItemsSource = dataSeries.DataPoints; areaSeries.TrackBallInfoTemplate = CreateTooltipDataTemplate(dataSeries.Name, firstSeries); return(areaSeries); }
public static BarSeries CreateBarSeries(DataSeriesViewModel dataSeries, bool firstSeries) { BarSeries barSeries = new BarSeries(); SeriesLegendSettings legendSettings = new SeriesLegendSettings() { Title = dataSeries.Name }; barSeries.LegendSettings = legendSettings; barSeries.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "XValue" }; barSeries.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "YValue" }; barSeries.ItemsSource = dataSeries.DataPoints; barSeries.TrackBallInfoTemplate = CreateTooltipDataTemplate(dataSeries.Name, firstSeries); barSeries.CombineMode = ChartSeriesCombineMode.Cluster; barSeries.PaletteMode = SeriesPaletteMode.Series; return(barSeries); }