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

Finite axis lines #1399

Merged
merged 8 commits into from
Oct 24, 2021
Merged

Finite axis lines #1399

merged 8 commits into from
Oct 24, 2021

Conversation

bclehmann
Copy link
Member

New Contributors:
Please review CONTRIBUTING.md

Hacktoberfest Participants:
Check-out the Hacktoberfest 2021 page

Purpose:
#1390

var x_squared = plt.AddFunction(x => x * x);

var line1 = plt.AddHorizontalLine(1);
line1.Max = 1;
line1.Color = Color.Gray;

var line2 = plt.AddVerticalLine(1);
line2.Max = 1;
line2.Color = Color.Gray;


var line3 = plt.AddHorizontalLine(4);
line3.Max = 2;
line3.Color = Color.Gray;

var line4 = plt.AddVerticalLine(2);
line4.Max = 4;
line4.Color = Color.Gray;

plt.SetAxisLimits(0, 5, 0, 5);

image

@bclehmann
Copy link
Member Author

I think this can probably be extended to AxisSpan as well.

And I think Crosshair could mimic this look, maybe an option to disable each of the "legs" individually?
image

@swharden swharden linked an issue Oct 23, 2021 that may be closed by this pull request
@swharden swharden self-requested a review October 24, 2021 14:23
Copy link
Member

@swharden swharden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this PR started @bclehmann!

What would you think if I replaced double? with double and defaulted it to NegativeInfinity, then used Math.Max() in Render() to compare it to the dims value?

My thinking is that MaximumInfinity describes the behavior a little more explicitly than null

If this sounds good to you I can make the change and merge it in before the next release today

PS: I posted this as a code line comment ~2 days ago but I think it got stuck in GitHub's API and was labeled "pending" that whole time so I deleted it and am re-posing as a general review comment

@bclehmann
Copy link
Member Author

What would you think if I replaced double? with double and defaulted it to NegativeInfinity, then used Math.Max() in Render() to compare it to the dims value?

Sure, I used null because I find ?? easier to read than a ternary, but I think Math.Max or Math.Min is just as readable, so we might as well avoid the boxing of nullables.

PS: I posted this as a code line comment ~2 days ago but I think it got stuck in GitHub's API and was labeled "pending" that whole time so I deleted it and am re-posing as a general review comment

Huh, weird, I've never gotten that before. I have seen "pending" it it's a comment as part of a review, but that goes away as soon as I complete the review (approve, suggest changes, etc)

@swharden swharden merged commit 8741918 into ScottPlot:master Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AxisLines: Add support for finite limits
2 participants