Hello.

It is required to make a desktop application on WPF that does mathematical calculations, draws graphs and spits out a report according to a given pattern. There are no problems with the first and third problems.

The problem is only in drawing graphs of a function and how to push these graphs into a template (.docx, .pdf).

Are there any article libraries, built-in tools for .NET / WPF? The web was much easier. I do not know how to do it.

enter image description here

UPD: enter image description here

1 answer 1

While the answer is more suitable for comment, but there is not suitable for the volume ...

You can use OxyPlot to build a graph. An example that sketched in a couple of minutes

XAML

 <Grid> <oxy:Plot Title="Заголовок"> <oxy:Plot.Series> <oxy:LineSeries Title="" ItemsSource="{Binding TestPoints}" Color="Black" /> </oxy:Plot.Series> <oxy:Plot.Axes> <oxy:LinearAxis Title="Rx" MajorGridlineStyle="Dash" Position="Bottom" /> <oxy:LinearAxis Title="Rz" MajorGridlineStyle="Dash" Position="Left" /> </oxy:Plot.Axes> </oxy:Plot> </Grid> 

.cs

 public partial class MainWindow : Window { public static string path = "D://testData.txt"; public DataPoint[] TestPoints { get; } = DataLoader.loadData(path) .Select(x => new DataPoint(x.Rx, x.Rz)) .ToArray(); public MainWindow() { InitializeComponent(); this.DataContext = this; } } public class DataLoader { public static IEnumerable<Data> loadData(string path) { return File.ReadLines(path) .Select(x => x.Split(new[] { ';' })) .Select(x => new Data { Rx = double.Parse(x[1], CultureInfo.InvariantCulture), Rz = double.Parse(x[0], CultureInfo.InvariantCulture) }); } } public class Data { public double Rx { get; set; } public double Rz { get; set; } } 

It will all look so

http://0s.ne.on2gcy3l.nfwwo5lsfzrw63i.nblz.ru/WXAv2.jpg