Accepted answer

looks like it's not possible to do that from within the formatter.

but you could set them after the chart is rendered (loaded). try something like this

$.each(chartobj.series[0].data, function(i, point) {
    if(point.y > 100) {

in the load callback (or if you need it in the redraw callback).

see example here.


i've been trying to figure some of this out myself... it looks like instead of -= 20;

could you use...

this.series.options.datalabels.x = -20;

... at this point i'm trying to understand if i'm able to discern the location of a datalabel so that i can reposition it if necessary.


although bhesh's answer solves the problem for x/y positioning, highcharts ignores any changes to the style property of datalabels (see the problem here). however, you can override the styles of an individual point by passing it through the data object:

series: [{ data: [29.9, 106, { y: 135, datalabels: { style: { fontsize: 20 } } }]

example from highcharts docs

i was able to get dynamic styles by iterating over my data before passing the whole object to highcharts to render.


here's what i ended up with. the settimeout is necessary or the datalabel property doesn't exist on the point:

formatter: function () {
    var point = this.point;
    window.settimeout(function () {
        if (point.s < 0) {
                y: point.ploty + 20
    //this.series.options.datalabels.y = -6;
    var sty = this.point.s < 0 ? 'color:#d00' : 'color:#090;' //other style has no effect:(
    return '<span style="' + sty + '">' + math.abs(this.point.s) + '</span>';

Related Query

More Query from same tag