-
Notifications
You must be signed in to change notification settings - Fork 782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem updating heatmaps when buffer changes #3802
Comments
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. |
I haven't been able to take a closer look yet, but information here may help! |
Hi @joacorapela, I created the following live heatmap app that seems to work on Avalonia on my system (Windows). Does this code also work for you on Linux? If so, maybe you can compare what you do differently and arrive at a solution. If it doesn't work on Linux, let me know and we can open this issue back up and take a look, but I don't do much Linux desktop development so it will be pretty difficult for me to work on this, and I'll have to lean on others in the open source community to offer advice. using Avalonia.Controls;
using ScottPlot.Avalonia;
using Avalonia.Threading;
namespace Sandbox.Avalonia;
public partial class MainView : UserControl
{
readonly ScottPlot.Plottables.Heatmap HMap;
readonly DispatcherTimer Timer = new();
readonly double[,] HeatmapData;
public MainView()
{
InitializeComponent();
HeatmapData = ScottPlot.Generate.Sin2D(23, 13, multiple: 3);
HMap = new ScottPlot.Plottables.Heatmap(HeatmapData);
AvaPlot.Plot.PlottableList.Add(HMap);
Timer.Interval = System.TimeSpan.FromMilliseconds(100);
Timer.Tick += (s, e) => ChangeData();
Timer.Start();
AvaPlot.Refresh();
}
private void ChangeData()
{
System.Random rand = new();
for (int y = 0; y < HeatmapData.GetLength(0); y++)
{
for (int x = 0; x < HeatmapData.GetLength(1); x++)
{
HeatmapData[y, x] += rand.NextDouble() - .5;
}
}
HMap.Update();
AvaPlot.Refresh();
}
} |
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 bycomputeMultivariateGaussianPDForGrid
. I need to click on the Heatmap to see the updates.Please refer to the constructor
MainWindow()
and to methodOnNext()
on this source code for more details.Thanks, Joaquin
The text was updated successfully, but these errors were encountered: