I am trying to label some circles in a circle pack layout
with text that flows along the circle itself.
Here is one experimental jsfiddle:
As you can see, it is possible to render text along the circle, centered at its top. Though browser's rendering of curved SVG text is terrible. But let's say we don't care about it.
Here is another jsfiddle
I would like to place curved labels on this graph, under these conditions:
- The circle represents a province (only depth==1) (BRITISH COLUMBIA, ALBERTA, and so forth)
- The sum of sizes of all children (in other words, number of parliament seats allotted) of the province is greater than 5.
- The name of the province should be all UPPERCASE.
You can see some of my attempts in the code itself. I have been trying for hours. My main problem is that circles in the circle are now somewhere in X Y space, whereas, in the first jsfiddle, all circles have centers in coordinate system origin.
Maybe you can help me by taking a fresh look at this.
Underlying data is based on this table:
(NOTE: This is somewhat related to the question 'Circle packs as nodes of a D3 force layout' I asked the other day, however this is an independent experiment.)
I decided to use regular SVG arcs instead of d3.svg.arc(). I still think it is a right decision. However, here is what I have now: :) jsfiddle
startOffset = "<length>"
, the docs say: If a <length> other than a percentage is given (which is what you have given it), then the ‘startOffset’ represents a distance along the path measured in the current user coordinate system. Following the docs, then one lands on distance along a path. At the moment, this looks like the only connection between the textPath element and the possibility of specifying x,y coords. Here hoping this is not some rabbit trail – Plexiform