d3-flame-graph icon indicating copy to clipboard operation
d3-flame-graph copied to clipboard

export svg

Open spiermar opened this issue 8 years ago • 2 comments

spiermar avatar Oct 17 '15 23:10 spiermar

Hi, Was there any idea about how to implement this feature? It would be a great thing to have.

The SVG tag created by this library seems to have the all data. What is missing is the callback methods that would handle "clicking" on frame adding the "interactive" feature to it. Something like the SVG from original flame-graph library have https://github.com/brendangregg/FlameGraph/blob/master/demos/cpu-mixedmode-flamegraph-java.svg?short_path=704339e

If there was an Idea for this feature, maybe I would be able to contribute :)

kristoffSC avatar Apr 04 '23 13:04 kristoffSC

@kristoffSC this is a feature I discussed with @brendangregg a while ago. The way I'm thinking about this now is that this should not be a feature of the d3 plugin, but the application using it, mostly because some features are highly customizable can change significantly from application to application. Also, a few notes on using SVG as an output format:

  1. Right now the plugin is generating an SVG, but that might not be the case in the future. HTML canvas was an option for example.
  2. The SVG, with all embedded JavaScript to add the "interactive" features is a bit awful and limited in functionality.
  3. It would also require a fairly large rewrite of the interactive functions just for that.

In the internal version of https://github.com/Netflix/flamescope, FlameCommander, we implemented a feature to download a self contained HTML file with the flame graph and all features. I could probably create an example based on that.

Also, @andreasgerstmayr implemented a flame graph HTML output for perf.

spiermar avatar Apr 04 '23 16:04 spiermar