Chéramy Alexandre
Chéramy Alexandre

Reputation: 464

HighCharts : dataLabels errorBar

I want to add on my chart (errorBar type), the min and max values ​​of each point.

as the following link: JSFiddle

I can do it on my various graphics with the following code:

    dataLabels: {
        enabled: true,
        style: {
            font: 'bold 11px Arial',
            textShadow: '0 0 3px white, 0 0 3px white '
        }
   }

Is it possible to do? Thx

Upvotes: 1

Views: 263

Answers (3)

Ana Maria
Ana Maria

Reputation: 16

For people still searching for this:

Highchart fixed the labels for the error bars. You can now place a custom high and low label using data labels and custom formatter

 dataLabels: {
        inside: false,
        enabled: true,
        formatter: function() {
          return (this.point.y == this.point.high ? "High: " : "Low: ") + this.point.y
        }
      }

https://jsfiddle.net/amalborn/5xLzn204/1/

Upvotes: 0

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

Indeed it looks like a bug, so I reported it https://github.com/highslide-software/highcharts.com/issues/2770

Upvotes: 1

Mark
Mark

Reputation: 108512

This looks like a bug (or at least an oversite) with highcharts. I can't find any combination of dataLabels options that'll work with an errorbar type chart. If you really need this ability, I'd resort to doing it myself with a Renderer.text call:

function(chart){
    var points = chart.series[0].points;
    for (var i = 0; i < points.length; i++){
        var p = points[i];
        chart.renderer.text("High: "+p.high, p.plotX+chart.plotLeft-20, p.highPlot+chart.plotTop-5).add();
        chart.renderer.text("Low: "+p.low, p.plotX+chart.plotLeft-20, p.lowPlot+chart.plotTop+12).add();
}

Results in (fiddle here):

enter image description here

Upvotes: 2

Related Questions