-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Added Zoom inside SVG #35
Conversation
zoom / unzoom seems to work fine on Firefox too. However I noticed that if you click on an empty box, because it is too narrow, then the zoomed view is empty too. Could this limitation be fixed ? It would be very useful to drill down complex flame graphs. I uploaded an example of a such flame graph here. You can easily reproduce the issue by clicking on one of the left boxes. |
Thanks for testing cykl. Do you mean the zoomed boxes doesn't have the text inside ? I'll try to implemented that. I found it also limitating :( |
I just read flamegraph.pl source code. Basically the clipping is done in the Perl script and not in the browser. The only way to achieve what we want is to always put the full string in the text element and find a way to let the browser do the clipping. Unfortunately, it seems that most browsers do not support the CSS3/SVG2 |
Sorry, I'm late |
Yup JavaScript does the job. I quickly wrote a proof of concept The initial clipping should still be done by flamegraph.pl. Otherwise it would break png creation ( |
Ok, I added some fixes and parts of your diff without touching a lot to the standard structure. It's still working correctly with convert. Can you test it with firefox ? |
Tested with Chromium 38 and Firefox 24.1.1 on Windows, also working. |
I can see three issues:
|
Thanks for pointing them :)
|
Maybe because of the rouding or float calculation, I wasn't able to fix properly the "+3" pixels. So I aligned the "x" with the parent rect. Maybe there is too many index relations between the DOM Nodes (2 is rect, 4 is text, etc...). Maybe replacing these numbers with a function may be cleaner, but it'll also add complexity. |
@cykl can you provide me a heavy stack (like the one used to generate flamegraph35.svg) ? I'd like to test what a search function for a tagname will imply as performance hit, versus direct index. |
This is awesome Saruspete, thanks! Something minor to do later: when zoomed, I'd still like to see the lower ancestry frames. |
@Saruspete If you want a beta tester or sharing ideas, feel free to contact me via email to stop polluting brendan's inbox :) The stack straces I use in my unit tests for hprof2flamegraph are quite heavy, you can use them:
|
This extends svg script to zoom/unzoom.
This was only tested under chromium, but should not break from standard svg.
You may consider moving the "Reset Zoom" button to a more "clean" position.