ScottPlot/ScottPlot

Problem updating heatmaps when buffer changes

joacorapela opened this issue · 3 comments

Question: (Ask your question here)
I need a heatmap displaying the content of a 2D buffer, which updates when the buffer is modified. I cannot make the heatmap update without clicking on the heatmap in order to force the update. Is it possible to get heatmap updates without clicking on it? If so, how?

ScottPlot Version: (What NuGet package are you using?)

I am using ScottPlot.Avalonia in a C# standalone application.
PackageReference Include="ScottPlot.Avalonia" Version="4.1.64"

Code Sample: See http://scottplot.net/faq/repro/ for tips about creating reproducible code samples

Unfortunately the code below does not update the heatmap when _buffer is modified by computeMultivariateGaussianPDForGrid. I need to click on the Heatmap to see the updates.

        _plt = new ScottPlot.Plot(400, 400);                                                                                                                                                                                                           
        _hm = _plt.AddHeatmap(_buffer, lockScales: false);
        // computeMultivariateGaussianPDForGrid updates _buffer
        computeMultivariateGaussianPDForGrid(_buffer, m0, S0);
        _hm.Update(_buffer);

Please refer to the constructor MainWindow() and to method OnNext() on this source code for more details.

Thanks, Joaquin

The above problem holds when running in Linux and Windows with Avalonia. However, the problem disappears (i.e., heatmaps update automatically not needing mouse clicks) when running on Windows with WinForms.
https://github.com/joacorapela/bayesianLinearRegressionCSharp/tree/master/code/scripts/OnlineBayesianLinearRegressionRxxWinForms

I haven't been able to take a closer look yet, but information here may help!

https://scottplot.net/faq/async/