-
Notifications
You must be signed in to change notification settings - Fork 954
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
Absolute limits and MinimumRange not always honored #1812
Comments
Thanks for reporting this. Your suggested solution sounds reasonable to me. Feel free to open a PR making the change if you have time, otherwise I'll sort one out at some point. (may be worth checking the absolutes aren't NaN; not sure if that's supported) We should consider some tests for this, since it's not something that will occur regularly if there are data on the plot. |
Thanks for the reply. I have cloned the repository and will add a few tests as well. It might take me a few days though. What would in your opinion be the best range for the axis after |
@mghieI think in this unusual scenario - where there is no data-range and the absolute min/max is non-NaN and finite - then I think assuming absolute range is probably the most sensible thing to do, but I should probably mess around with a few options myself and get back to you. |
To me it's not at all unusual, but of course it depends on your use case. I use it for visualization of the last 5 minutes of measured values in testing equipment. The time axis is therefore constrained to My preference would be to have the full absolute range visible in this case. |
@mghie for your use case, you should probably be setting the Your original suggestion certainly improves matters, and would be a welcome change. It's still possible for the series to be 'upside down' in edge cases. That's a more general concern, and isn't necessarily in the scope of a PR to address this. The reality is that when the axis has nothing to go on, it's never going to give everyone what they expect. |
If I understand correctly this should also close #21 |
Steps to reproduce
Create an empty model with a range-constrained axis but no data, like so:
I used the WindowsFormsDemo but many of the examples should be usable as well.
Platform: OxyPlot.WinForms on Windows 10 64 bit
.NET version: 4.8
Expected behaviour
I would expect the axis to honour the absolute limits and the minimum range, so any of these visible ranges would be fine:
[-200.0, -100.0]
[-200.0, -190.0]
[-155.0, -145.0]
[-110.0, -100.0]
Actual behaviour
Instead I get the range
[-100.0, -99.0]
which violates both theAbsoluteMaximum
and theMinimumRange
properties:Cause and proposed fix
The problem is the following code in
Axis.cs
:which uses values outside the allowed range. A possible fix would be to change this to:
and
respectively. With these changes I get the initial display range
[-110.0, -100.0]
which is valid.The text was updated successfully, but these errors were encountered: