forked from e-mgam-e/Lab1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainViewModel.cs
More file actions
39 lines (33 loc) · 1.06 KB
/
MainViewModel.cs
File metadata and controls
39 lines (33 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OxyPlot;
using OxyPlot.Series;
namespace Lab1 // замени на своё namespace, если у тебя другое
{
public class MainViewModel
{
public PlotModel CurrentPlot { get; }
public MainViewModel()
{
// Создаём модель графика
var plotModel = new PlotModel { Title = "Пример графика" };
// Добавляем линию
var lineSeries = new LineSeries
{
Title = "Sine wave",
MarkerType = MarkerType.Circle
};
// Заполняем точками
for (double x = 0; x <= 10; x += 0.5)
{
lineSeries.Points.Add(new DataPoint(x, Math.Sin(x)));
}
plotModel.Series.Add(lineSeries);
// Присваиваем модель свойству
CurrentPlot = plotModel;
}
}
}