A method for automatically finding the best eligible label position and font size for a label that's going to go along a path inside of an area, similar to this example but with two embellishments:
The measurement gets thrown off a little bit by the curve function and the fact that text is rotated letter by letter instead of continuously, but the results seem good enough.
See also: Automatic label placement along a path Streamgraph label positions #2 Stacked area label placement #2
https://d3js.org/d3.v4.min.js
https://d3plus.org/js/d3plus-shape.v0.13.full.min.js