Radar label overap
by Rajesh Danabal
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
<div id="container" style="height: 600px"></div>
JavaScript
$(function () {
var HighCharts = $('#container').highcharts({
chart: {
polar: true
},
xAxis: {
tickmarkPlacement: 'on',
labels: {
staggerLines: 1
},
categories: [
'Comforts and soothes oneself',
'Gives me a feeling of tranquillity and rest',
'To celebrate something special',
'To enjoy the company of others',
'To feel attractive',
'To feel different and special',
'To feel high spirited',
'To feel refreshed',
'To feel relaxed and calm',
'To forget everyday worries',
'To spend quality time with friends / family',
'To share the moments with friends'
]
},
series: [{ pointPlacement: 'on',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
HighCharts.wrap(HighCharts.Tick.prototype, 'getLabelPosition', function (proceed, x, y, label, horiz, labelOptions, tickmarkOffset, index, step) {
var axis = this.axis,
optionsY = labelOptions.y,
ret,
align = labelOptions.align,
angle = ((axis.translate(this.pos) + axis.startAngleRad + Math.PI / 2) / Math.PI * 180) % 360;
if (axis.isRadial) {
ret = axis.getPosition(this.pos, (axis.center[2] / 2) + Highcharts.pick(labelOptions.distance, -25));
// Automatically rotated
if (labelOptions.rotation === 'auto') {
label.attr({
rotation: angle
});
// Vertically centered
} else if (optionsY === null) {
optionsY = axis.chart.renderer.fontMetrics(label.styles.fontSize).b - label.getBBox().height / 2;
}
// Automatic alignment
if (align === null) {
if (axis.isCircular) {
//KZ20141117: smaller brackets for align center
// if (angle > 20 && angle < 160) {
if (angle > 1 && angle <...