Skip to content
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

DataLogger has a strange behaviour when visualizing data #3794

Closed
cataclism opened this issue May 7, 2024 · 2 comments
Closed

DataLogger has a strange behaviour when visualizing data #3794

cataclism opened this issue May 7, 2024 · 2 comments

Comments

@cataclism
Copy link

cataclism commented May 7, 2024

Question:

I'm using a DataLogger to log real time data thatt I obtain from a Server. ( I've started looking at the example provided in the demos)

I have two actions to perform on it, start that as the name suggests start the log and stop.
When i click stop the data acquisition stops and i'd like to be able to perform actions on the plot, such as ZoomIn and ZoomOut and move left and right.

I've called my variable Logger = formsPlot1.Plot.Add.DataLogger(); (So that you can know what I am referring to)

The problem is that when I per form the ZoomIn as long as the Logger remains within the plottable areea there are no problems, but as soon as it goes beyond it, the data gets automatically fully showed, "bouncing back" (see video)

Please nothe that the button I am clicking performs a formsPlot1.Plot.Axes.Zoom(1.2, 1); formsPlot1.Refresh();

PXL_20240507_083050811.mp4

For what is concerning the code i an using ViewSlide() for visualization and then when I stop the data collection i pass to ViewFull(), otherwise when I try to do just an easy autoscaleX orY the plot becomes blank.

Last note to successfully be able to visualize data I had to set formsPlot1.Plot.MoveToFront(Logger);

If I do not do it I obtain:

image

Moreover I've found some issues with formsPlot1.Refresh(); that does refresh the plot as it should, leading to situations as the pic above

ScottPlot Version: 5.0.34
.Net Framework 4.6.2
C# version

@cataclism cataclism changed the title Logger has a strange behaviour when visualizing data DataLogger has a strange behaviour when visualizing data May 7, 2024
@cataclism
Copy link
Author

Follow up:

I've managed to obtain a workaround to better visualize the data, which is that to insert all the data in a SignalXY, and toggle the visibility of the logger off. It works but i need to perform a formsPlot1.Plot.Clear().

When then I restart the data acquisition nothing shows up, even after Logger.IsVisible = true,SignalXY.IsVisible = false and formsPlot1.Plot.MoveToFront(Logger);

There is something that breaks when clearing out everything to show again the real time data.

It's absolutely possiblew that I'm missing something and/or doing something wrong

@swharden
Copy link
Member

Hi @cataclism, thanks for sharing this! I feel bad for closing this issue, but I can't reproduce the effect you show in your video (the datalogger example in the demo app works well for me), and you don't share the code of your app so I can't offer many suggestions.

I think the problem is this:

formsPlot1.Plot.Axes.Zoom(1.2, 1);

Removing that line may solve your problem.

If you're using a data logger, you should either let it manage the axis limits, or you should manually manage the limits. I think what is happening is that you're both trying to manage the limits and you are "fighting" each other. If you wish to use custom scaling, you should disable automatic axis management:

Logger.ManageAxisLimits = false;

When i click stop the data acquisition stops and i'd like to be able to perform actions on the plot, such as ZoomIn and ZoomOut and move left and right.

Consider using commands like this to toggle user interactions so the user's mouse never "fights" with the data logger's automatic axis management

formsPlot1.Interaction.Disable();
formsPlot1.Interaction.Enable();

Hope it helps!
Scott

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants