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

NumericOperations: zooming too far into DateTime axes throws exception #3813

Open
kareem469 opened this issue May 8, 2024 · 9 comments
Open

Comments

@kareem469
Copy link

kareem469 commented May 8, 2024

Need to have Zoom-in & Zoom-out functionality to happen / be managed in Button click options:

ScottPlot Version: 5.0.34

By default, whatever zooming functionality is happening in mouse events, that functionality needs to happen / be managed in button click option (i.e., +, -)

I tried the following code, but it works only when buttons are used for zooming. but when zoomed with mouse events and then used the button, it not working

double val = 1.0;

private void ZoomIn_Click(object sender, EventArgs e)
{
    
    if (val <= 3.5)
    {
        formsPlot1.Plot.Axes.Zoom(val, val);
        formsPlot1.Refresh();
        val = val + 0.1;
    }
}

private void ZoomOut_Click(object sender, EventArgs e)
{
    if (val > 1.1)
    {
        val = val - 0.1;
         formsPlot1.Plot.Axes.ZoomOut(val, val);
        formsPlot1.Refresh();
       
    }

}
@swharden
Copy link
Member

swharden commented May 8, 2024

Hi @kareem469, I may not understand the issue here.

Is your question "how do I enable + and - keys to zoom in and out"?

I tried the following code, but it works only when buttons are used for zooming. but when zoomed with mouse events and then used the button, it not working

This is the part I'm uncertain about

@kareem469
Copy link
Author

kareem469 commented May 8, 2024

Hi @swharden

My query is, I want to give provision to the user to use zoomin & zoom-out buttons instead of using mouse events (right & left clicks) for zooming functionality

@KennyTK
Copy link

KennyTK commented May 8, 2024

Hi @kareem469,
formsPlot1.Plot.Axes.Zoom and formsPlot1.Plot.Axes.ZoomOut are two different functions with slightly different purposes. Could you try using only one or the other and testing?

@kareem469
Copy link
Author

Hi @KennyTK

I required both zoomin & zoom out functionality in two different buttons.

And also I want to get the current zoom factor.

@kareem469
Copy link
Author

Hi @swharden,

How to get the current zoom factor when zoomed in or out with default mouse events. So that i will use that zoom factor to zoom in or out functionality manually in buttons.

@kareem469

This comment was marked as spam.

@swharden
Copy link
Member

swharden commented May 9, 2024

Hi @kareem469, please do not abuse the notification system by posting unnecessary messages (or using @ excessively, especially tagging GitHub users who are not even owners of this project)

I really appreciate KennyTK's suggestion in #3813 (comment) ❤️ I think that understanding of how Zoom() differs from ZoomOut() may help you arrive at a solution!

I will leave this issue open until I am able to share a code demonstration for how to zoom in and out with keyboard keys. However, note that I typically respond to messages from my phone so code examples are difficult, and when I am by a computer I prioritize high priority issues from oldest to newest, so it may take some time before I'm able to address all of these questions 👍

@kareem469
Copy link
Author

While Zoomin button clicked continuously getting following exception

image

@swharden
Copy link
Member

Hi @kareem469, thanks for reporting this! I'm going to rename this issue to track fixing this datetime-related bug

@swharden swharden changed the title Zoom-in & Zoom-out functionality need to be happen / manage in Button click options NumericOperations: zooming too far into DateTime axes throws exception May 11, 2024
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

3 participants