Answer the question
In order to leave comments, you need to log in
How to render multiline svg text?
You need to do this:
Well, when hovering, some more logic.
I did this codepen.io/tvsjke/pen/zNyyYW , and got stuck at some points.
1. What is the best way to make multiline text above each circle? Tried a solution with tspan, but something I don't really like. Maybe not through svg at all?
2. How to draw an arc for a group of circles? What to be attached to?
I just started getting acquainted with svg, don't kick it too hard. I would be grateful for any advice.
Answer the question
In order to leave comments, you need to log in
In SVG, you can insert foreignObject - in particular, html, where line wrapping is easily solved.
If you're new to SVG, it's best to use a library like D3js for the fastest results . Here is an example of how to embed a piece of HTML content into SVG in D3js. And another approach is an example of automatic generation of SVG elements for each line of text.
In your case, as I understand it, the graph is not dynamic, once drawn and forgotten. In this case, you can instruct your designer to draw it in a vector, and output static SVG code. You can easily deal with it and hang logic on hover. For example, Adobe Illustrator can export graphics to SVG.
Also, since the labels are static, you can simply draw one element <text>
per row.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question