Closed nagisa closed 2 years ago
I agree, that seems like a good change! Any takers? I think CSS should be fine here, although we do need to make sure that SVG supports all the relevant CSS constructs (I don't know that SVGs have "full" CSS support).
text-anchor
is a native SVG attribute so it should be supported quite widely. In addition to that, the positioning of the text strings at the top of a flamegraph could be further simplified with the use of dominant-baseline="hanging"
.
I’ve used a somewhat modified version of the
inferno
crate to construct flamegraphs for a blog post of mine. I have made a couple of changes that I think some contributor here may be interested in implementing properly in the project proper.The flamegraph has two strings that are expected to be aligned to the right side of the image: the “Search”/“Reset search” at the top and “Matched: 42%” at the bottom. Right now they are aligned by giving the 100px of “space” from the side, which can fail to fit the string if the font size is increased or a wider font is used.
Instead consider using a
text-anchor: end
and placing the text node at a constant location where the strings should end:I have used CSS here to specify this attribute, but specifying it as a proper SVG attribute may make more sense if these flamegraphs are intended to work without CSS present.