RFR: 6682: Flamegraph gets cutoff when resized horizontally to increase the width

Miroslav Wengner mwengner at openjdk.java.net
Fri Jan 31 17:28:37 UTC 2020

On Fri, 31 Jan 2020 16:32:40 GMT, Alex Macdonald <aptmac at openjdk.org> wrote:

> Hi!
> This PR addresses JMC-6682 [[0]](https://bugs.openjdk.java.net/browse/JMC-6682), in which the flamegraph can be cutoff when resizing to increase the width.
> The issue is that the `d3-flame-graph` `width()` function updates the labels, but not the overall `svg` width. As a result, increasing the width of the container will cause the graph dimensions to increase, but the `svg width` stays the same as its initialized value, so clipping can occur. I've raised this as an issue in the upstream repo [[1]](https://github.com/spiermar/d3-flame-graph/issues/146), but altering the width can be done via `css`. If the `svg width` is set to `100%`, then it will fill the `chart` div, and the flamegraph will be displayed in its entirety. This width change also removes excess whitespace that results from resizing the chart smaller, and centers the chart in the view. I included a `css` file for the width value, because placing it in the template html was causing Eclipse to error when reading the html. Does the css file require a license header? I can add one if so.
> There are also two other changes here, but I can remove this if desired. The first being that Eclipse kept throwing NPEs when trying to open `flameviewColoring.js`, because it couldn't find the file unless the path wasn't specified to be `src/main/js/[..]`. The second is that the chart container was a SWT `SashForm`, but this could have been a `Composite` because we aren't doing anything with the sash (unless that was a future usage type of thing).
> [0] https://bugs.openjdk.java.net/browse/JMC-6682
> [1] https://github.com/spiermar/d3-flame-graph/issues/146
> Before:
> ![before-gif](https://user-images.githubusercontent.com/10425301/73555530-ce0d3800-441b-11ea-8e17-7ba33a95a133.gif)
> After:
> ![fixed-gif](https://user-images.githubusercontent.com/10425301/73555525-cbaade00-441b-11ea-84e3-3085690e1c0f.gif)

I've it fixed in my PR 6677, what do we do ?


PR: https://git.openjdk.java.net/jmc/pull/44

More information about the jmc-dev mailing list