private async Task RefreshPlot(Math.Expression func, double from, double to) { _ctx.Points.Clear(); await Task.Run(() => { for (var i = from; i <= to; i++) { func.addArguments(new Math.Argument($"x = {i}")); _ctx.Points.Add(new DataPoint(i, func.calculate())); func.removeAllArguments(); } }); FuncPlot.InvalidatePlot(); }