I would like to place a title in the center of a pie/donut chart in HighCharts.
I don't see anything in the chart options that would directly enable this, so I'm thinking it requires using the Highcharts SVG renderer -- chart.renderer.text('My Text', x, y)
.
I have that set up but I can't get the text to be centered inside the pie. Percentages don't seem to be accepted for x and y values. Is there a programmatic way to get it centered inside the plot, and to survive container resizing?
Update: Setting x and y to 50% works fine to center a circle (using renderer.circle(x, y, radius)
)—but not to center text (using renderer.text(text, x, y)
).
See result here: http://jsfiddle.net/supertrue/e2qpa/
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…