// static readonly CancellationTokenSource s_cts = new CancellationTokenSource(); public Graph() { InitializeComponent(); var mapper = Mappers.Xy <MeasureModel>() .X(model => model.ValueX) //use DateTime.Ticks as X .Y(model => model.ValueY); //use the value property as Y Charting.For <MeasureModel>(mapper); // ChartValues = new ChartValues<MeasureModel>(); ChartValues = SQLAdapter.FetchAsync().Result; LineSeries lineSeries = new LineSeries { Title = "Длина волны", Values = ChartValues, StrokeThickness = 1, Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 0, 0)), Fill = System.Windows.Media.Brushes.Transparent, LineSmoothness = 0, PointGeometrySize = 0, PointForeground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 0, 0)), Opacity = 0, OpacityMask = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 0, 0)) }; SeriesCollection = new SeriesCollection(); SeriesCollection.Add(lineSeries); MaxX = ChartValues.Select(x => x.ValueX).Max(); MinX = ChartValues.Select(x => x.ValueX).Min(); MinY = 0; DataContext = this; }