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

Limit the thickness of spans in the minimap #372

Merged
merged 1 commit into from
Apr 24, 2019

Conversation

rubenvp8510
Copy link
Collaborator

Which problem is this PR solving?

Short description of the changes

  • This imposes a limit of the thickness of spans in the minimap. (not more than the span in the main view)

@rubenvp8510 rubenvp8510 force-pushed the Issue-370 branch 2 times, most recently from db03666 to ff10ce8 Compare April 17, 2019 22:17
@codecov
Copy link

codecov bot commented Apr 17, 2019

Codecov Report

Merging #372 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #372      +/-   ##
==========================================
+ Coverage   88.17%   88.17%   +<.01%     
==========================================
  Files         157      157              
  Lines        3493     3494       +1     
  Branches      798      798              
==========================================
+ Hits         3080     3081       +1     
  Misses        376      376              
  Partials       37       37
Impacted Files Coverage Δ
...e/TracePageHeader/SpanGraph/render-into-canvas.tsx 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f40765...184626b. Read the comment docs.

Copy link
Member

@yurishkuro yurishkuro 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 the PR!

@@ -36,7 +37,9 @@ export default function renderIntoCanvas(
canvas.width = cWidth;
// eslint-disable-next-line no-param-reassign
canvas.height = cHeight;
const itemHeight = Math.max(MIN_ITEM_HEIGHT, cHeight / items.length);
const computedItemHeight = Math.max(MIN_ITEM_HEIGHT, cHeight / items.length);
const itemHeight = computedItemHeight > MAX_ITEM_HEIGHT ? MAX_ITEM_HEIGHT : computedItemHeight;
Copy link
Member

Choose a reason for hiding this comment

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

Why mix ?: and max?

w = Math.min(MAX, Math.max(MIN, expr))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just wanted to be more explicit, but I think using math.min and math.max is more elegant. I'll change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

Another alternative implementation could be to limit the height of the minimap canvas to min(currentHeight, spans*spanHeight). Then the existing span height logic would remain the same. But I don't know how the minimap would look aesthetically.

Could you add a screenshot of how it now looks with a small trace (a couple of spans)?

const width = valueWidth / totalValueWidth * getCanvasWidth();
const x = valueOffset / totalValueWidth * getCanvasWidth();
const y = height * i;
const y = cHeight / items.length * i;
Copy link
Member

Choose a reason for hiding this comment

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

Can we have the same min/max logic in the test? It's easier to read.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually the test has the min/max logic,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll attach screenshots with small trace. But I think if we limit the height of the minimap for this case we will end with a really small minimap (not too much aesthetic IMHO) but I'll attach both screenshots.

Copy link
Member

@tiffon tiffon Apr 22, 2019

Choose a reason for hiding this comment

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

Thanks!

@rubenvp8510
Copy link
Collaborator Author

I attached 3 possible implementations here.

  1. This PR , limit the thickness of the span bar

Screenshot from 2019-04-23 10-23-19

  1. Limit the canvas for render (but not the minimap height)

Screenshot from 2019-04-23 11-01-46

  1. Also limit the heigh of the minimap according to the number of spans.

Screenshot from 2019-04-23 11-05-07

@yurishkuro
Copy link
Member

the last two screenshots look wrong - if we reduce the height of the minimap, we should still calculate it as MIN(max_allowed_height, default_span_height * span_count), where default_span_height is the same as in the main timeline view.

@rubenvp8510
Copy link
Collaborator Author

Ha! I did the calculations using MIN(max_allowed_height, default_span_height * span_count) but I used the MIN_ITEM_HEIGHT as a default_span_height, that explains why it looks bad.

If I understand correctly default_span_height should be the height of the span in the main timeline. Ok I'll update it.

@rubenvp8510
Copy link
Collaborator Author

Screenshot from 2019-04-23 13-01-20
@yurishkuro is this way correct?

Thanks for review!

@yurishkuro
Copy link
Member

that's what I was suggesting, but now that I see it, it doesn't look particularly great (probably because there's no whitespace between spans).

@tiffon what are your creative suggestions?

@tiffon
Copy link
Member

tiffon commented Apr 24, 2019

1 looks the great, IMO. Is that the one currently set to be merged?

@rubenvp8510
Copy link
Collaborator Author

Yes, option 1 is implemented in this PR.

@tiffon tiffon merged commit fe6c244 into jaegertracing:master Apr 24, 2019
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 5, 2021
Limit the thickness of spans in the minimap
Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
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.

Limit the thickness of spans in the minimap
3 participants