Withdrawn: 6531: Make the flame chart view render labels on windows

Alex Macdonald aptmac at openjdk.java.net
Tue Aug 25 14:22:21 UTC 2020


On Wed, 22 Jan 2020 21:57:59 GMT, Alex Macdonald <aptmac at openjdk.org> wrote:

> This PR addresses JMC-6531 [[0]](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 [[1]](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:
> ![windows-works](https://user-images.githubusercontent.com/10425301/72937103-7cd3b900-3d36-11ea-9939-8c71880cfbee.png)
> 
> For reference, here's the same view in Linux:
> ![2020-01-22-165007_1913x1031_scrot](https://user-images.githubusercontent.com/10425301/72937506-4480aa80-3d37-11ea-9628-431f240dd457.png)
> 
> 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 [[2]](https://github.com/spiermar/d3-flame-graph/issues/84).   I made
> a fork of the d3-flame-graph repo [[1]](https://github.com/aptmac/d3-flame-graph), which accomplishes two things:
> - substitutes `<foreignObject>` for `<text>`
>   [[3]](https://github.com/aptmac/d3-flame-graph/commit/c508e2ab95de2a48f03d655d6e7f306273dcaa12#diff-e866318288d23357a14da878e2435b49L5211)
> - trims the text in the labels because the ellipsis css doesn't work
>   [[4]](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`
> [[5]](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
> [[6]](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!  [0] https://bugs.openjdk.java.net/browse/JMC-6531
> [1] https://github.com/aptmac/d3-flame-graph
> [2] https://github.com/spiermar/d3-flame-graph/issues/84
> [3]
> https://github.com/aptmac/d3-flame-graph/commit/c508e2ab95de2a48f03d655d6e7f306273dcaa12#diff-e866318288d23357a14da878e2435b49L5211
> [4]
> https://github.com/aptmac/d3-flame-graph/commit/c508e2ab95de2a48f03d655d6e7f306273dcaa12#diff-e866318288d23357a14da878e2435b49R5238
> [5]
> https://github.com/aptmac/jmc/commit/b64b4349057a67aeeb6b5ef560261cdb616a9d24#diff-9cb007d54dc422cf345941df647ef24cR102
> [6] https://en.wikipedia.org/wiki/JScript#JScript

This pull request has been closed without being integrated.

-------------

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


More information about the jmc-dev mailing list