-
-
Notifications
You must be signed in to change notification settings - Fork 843
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
Feature: [Linkgraph] Show a tooltip with statistics when hovering a link #9760
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things I'm worried about (having not tested the code):
Is the LinkGraphOverlay::ShowTooltip sufficiently fast on big networks?
Does this even work when the tooltip delay is zero so you need to hold RMB to show them?
6312710
to
64f7d5c
Compare
Thanks for the feedback! On the performance of |
Might we get a |
64f7d5c
to
0ec4f8a
Compare
I just pushed a new version that displays statistics for the most saturated one when a link has several cargo types. This is already how the color to use for a link is determined, so the two will always match. |
0ec4f8a
to
84f9410
Compare
In my opinion, this and #9866 close #9167 and #9168. One point of minor confusion for me regarding links which are over capacity — e.g. To me, this reads like 219 passengers is 547% of capacity. Obviously it's not, but perhaps there's a better way to word this. What about |
219 passengers/month is 547% of capacity. Even without this PR, all dark red links in the overlay correspond to links with a 200%+ usage/capacity ratio. The "capacity" of a link is only a rough estimate, based on the capacity of the vehicles that took the link in the past few months. By construction, the estimated usage of a link never exceeds 100% of its capacity, but the demand can, thus the occasional >100% usage ratios. This is suboptimal, but reworking the formulae to be more accurate is definitely out of scope for this PR. I may give it a try at some point in the future though :) In any case, I realize the tooltip text is a bit confusing as is. |
it looks like there are two different stats trying to be condensed into a single line here. that stops it from sounding like more than 100% capacity is being transported, and also helps prevent capacity and time from being confused. |
84f9410
to
17be4c2
Compare
Thanks for the suggestions. I slightly reworded the tooltip:
The travel time is now on a separate line, and is an average for the two directions of travel. |
The |
Motivation / Problem
Cargodist considers many parameters to determine how cargo should be routed.
These parameters are not all exposed to the player:
the linkgraph overlay shows the saturation of links, but there is nothing
for the capacities, or for the travel times.
Description
This PR shows a tooltip when a link of the overlay is hovered.
The tooltip contains the source and destination stations, the link capacity, its usage and its average travel time.
For bidirectional links, data are shown for both directions of travel.
I believe this could be useful for various reasons:
Limitations
Corner cases
Limitations
I had to declare a C-like string as static because TooltipsWindow segfaults if its given string has a temporary RAW_STRING argument that does not outlive the TooltipsWindow.
A possible alternative would be to add a GetString call in the constructor of TooltipsWindow and store the resulting string once and for all in a buffer. This is how JGR's patch pack solves the same problem.
Alternatives
A window would be more flexible than a tooltip, but it would raise many questions about its layout, etc.
I preferred to keep this PR relatively simple.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.