[Rev 01] RFR: 6531: Make the flame chart view render labels on windows
aptmac at openjdk.java.net
Wed Jan 22 22:22:15 UTC 2020
> This PR addresses JMC-6531 [](https://bugs.openjdk.java.net/browse/JMC-6531), in which the flame chart view displays nothing in Windows.
> tl;dr: the proposed solution uses a fork of d3-flame-graph [](https://github.com/aptmac/d3-flame-graph) which substitutes the incompatible svg element with one that works with Internet Explorer, and modifies the flameviewColoring script to work with an older ECMA version.
> Screenshot of Windows:
> For reference, here's the same view in Linux:
> When I had originally taken a look into the SWT Browser and compatibility with Windows, it looked as though we'd be able to use Edge as an embedded browser, which would be nice because it already plays nice with the d3-flame-graph library. After quite a bit of trial and error I was first able to get d3 to work (making simple line charts), and then found that d3-flame-graph version <= 2.0.2 will work. With this older version of d3-flame-graph the coloured labels will be drawn, but no text is shown - regardless of the SWT browser property being set to IE or Edge .. which makes it look like Edge can be used for visiting external webpages, but not local ones (internal browser stays IE). This is because the foreignObject element is incompatible with IE, and this has already been raised as an issue and closed as a "wontfix" by the maintainer on the upstream repo [](https://github.com/spiermar/d3-flame-graph/issues/84).
> I made a fork of the d3-flame-graph repo [](https://github.com/aptmac/d3-flame-graph), which accomplishes two things:
> - substitutes `<foreignObject>` for `<text>` [](https://github.com/aptmac/d3-flame-graph/commit/c508e2ab95de2a48f03d655d6e7f306273dcaa12#diff-e866318288d23357a14da878e2435b49L5211)
> - trims the text in the labels because the ellipsis css doesn't work [](https://github.com/aptmac/d3-flame-graph/commit/c508e2ab95de2a48f03d655d6e7f306273dcaa12#diff-e866318288d23357a14da878e2435b49R5238)
> This forked version of d3-flame-graph is downloaded by the maven-download-plugin like the other jslibs, and is used if the Environment type is `WINDOWS` as detected in `FlameGraphView.java` [](https://github.com/aptmac/jmc/commit/b64b4349057a67aeeb6b5ef560261cdb616a9d24#diff-9cb007d54dc422cf345941df647ef24cR102).
> Now that the flame chart view works at this point, I had to edit `flameviewColoring.java` to be compatible with IE. From what I can find, Internet Explorer uses JScript, which in it's latest version supports ECMA 5 [](https://en.wikipedia.org/wiki/JScript#JScript). This means no maps, no named functions, etc.
> Lastly, and not completely related to this issue, I changed the name of `page.template` to `template.html` because my IDE won't provide syntax highlighting unless the file ends with -.html, and it was a big help here. If it's deemed unecessary I can just drop the associated commit.
> Let me know what you think!
>  https://bugs.openjdk.java.net/browse/JMC-6531
>  https://github.com/aptmac/d3-flame-graph
>  https://github.com/spiermar/d3-flame-graph/issues/84
>  https://github.com/aptmac/d3-flame-graph/commit/c508e2ab95de2a48f03d655d6e7f306273dcaa12#diff-e866318288d23357a14da878e2435b49L5211
>  https://github.com/aptmac/d3-flame-graph/commit/c508e2ab95de2a48f03d655d6e7f306273dcaa12#diff-e866318288d23357a14da878e2435b49R5238
>  https://github.com/aptmac/jmc/commit/b64b4349057a67aeeb6b5ef560261cdb616a9d24#diff-9cb007d54dc422cf345941df647ef24cR102
>  https://en.wikipedia.org/wiki/JScript#JScript
The pull request has been updated with 1 additional commit.
- c4c9e91a: fix spacing of <execution> tags in the pom.xml
- all: https://git.openjdk.java.net/jmc/pull/41/files
- new: https://git.openjdk.java.net/jmc/pull/41/files/3b354650..c4c9e91a
- full: https://webrevs.openjdk.java.net/jmc/41/webrev.01
- incr: https://webrevs.openjdk.java.net/jmc/41/webrev.00-01
Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
Fetch: git fetch https://git.openjdk.java.net/jmc pull/41/head:pull/41
More information about the jmc-dev