RFR: 6682: Flamegraph gets cutoff when resized horizontally to increase the width
Alex Macdonald
aptmac at openjdk.java.net
Fri Jan 31 16:44:18 UTC 2020
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:

After:

-------------
Commits:
- 87ab4c2d: replace the HTML container to be a Composite instead of a SashForm
- 7be9fb54: 6682: Flamegraph gets cutoff when resized horizontally to increase the width
Changes: https://git.openjdk.java.net/jmc/pull/44/files
Webrev: https://webrevs.openjdk.java.net/jmc/44/webrev.00
Issue: https://bugs.openjdk.java.net/browse/JMC-6682
Stats: 19 lines in 3 files changed: 8 ins; 2 del; 9 mod
Patch: https://git.openjdk.java.net/jmc/pull/44.diff
Fetch: git fetch https://git.openjdk.java.net/jmc pull/44/head:pull/44
PR: https://git.openjdk.java.net/jmc/pull/44
More information about the jmc-dev
mailing list