Skip to content

Commit

Permalink
Added support for percentage value in yAxis.labels.distance option …
Browse files Browse the repository at this point in the history
…for gauge series. Closes #10587.
  • Loading branch information
pawelfus committed Apr 19, 2019
1 parent c1c9083 commit f24025f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
11 changes: 9 additions & 2 deletions js/parts-more/RadialAxis.js
Expand Up @@ -616,8 +616,15 @@ addEvent(Tick, 'afterGetLabelPosition', function (e) {
) % 360;

if (axis.isRadial) { // Both X and Y axes in a polar chart
ret = axis.getPosition(this.pos, (axis.center[2] / 2) +
pick(labelOptions.distance, -25));
ret = axis.getPosition(
this.pos,
(axis.center[2] / 2) +
H.relativeLength(
pick(labelOptions.distance, -25),
axis.center[2] / 2,
-axis.center[2] / 2
)
);

// Automatically rotated
if (labelOptions.rotation === 'auto') {
Expand Down
13 changes: 10 additions & 3 deletions js/parts/Axis.js
Expand Up @@ -2504,10 +2504,17 @@ H.extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */{
*/

/**
* Angular gauges and solid gauges only. The label's pixel distance
* from the perimeter of the plot area.
* Angular gauges and solid gauges only.
* The label's pixel distance from the perimeter of the plot area.
*
* @type {number}
* Since v7.1.2: If it's a percentage string, it is interpreted the
* same as [series.radius](#plotOptions.gauge.radius), so label can be
* aligned under the gauge's shape.
*
* @sample {highcharts} highcharts/yaxis/labels-distance/
* Labels centered under the arc
*
* @type {number|string}
* @default -25
* @product highcharts
* @apioption yAxis.labels.distance
Expand Down

0 comments on commit f24025f

Please sign in to comment.