highcharts - chart names for multiple pie chart series in one chart -
i need display multiple pie charts related same data. such want them part of same chart , implement them individual series.
this works no problems until tried put labels/titles on each individual pie chart. seems can have title on entire group. see jsfiddle
is there way have titles on each chart?
see above jsfiddle example
i encountered same problem, , found solution via highcharts support forum : http://highcharts.uservoice.com/forums/55896-general/suggestions/3073133-pie-title
the highcharts dude has written plugin can see working on following jsfiddle : http://jsfiddle.net/highcharts/tnsra/
i have copy-pasted plugin in highcharts-plugins.js file included in website, works charm!
here's plugin code :
/** * pie title plugin * last revision: 2012-12-21 */ (function (highcharts) { highcharts.wrap(highcharts.seriestypes.pie.prototype, 'render', function (proceed) { var chart = this.chart, center = this.center || (this.yaxis && this.yaxis.center), titleoption = this.options.title, box; proceed.call(this); if (center && titleoption) { box = { x: chart.plotleft + center[0] - 0.5 * center[2], y: chart.plottop + center[1] - 0.5 * center[2], width: center[2], height: center[2] }; if (!this.title) { this.title = this.chart.renderer.label(titleoption.text) .css(titleoption.style) .add() .align(titleoption, null, box); } else { this.title.align(titleoption, null, box); } } }); }(highcharts));
and how configure title (put in series elements) :
title: { // align: 'left', // x: 0 // style: { color: xxx, fontstyle: etc } text: '<b>pie 1</b><br>subtext', verticalalign: 'top', y: -40 },
Comments
Post a Comment