Search code examples
javascriptgraphhighcharts

Highcharts data label vertical alignment - bug


Im facing an issue with highcharts js library where im trying to put the value of the point inside the shape. for this im using inside: true, verticalAlign: 'middle' for data label which seem to work just fine but whenever the point is at the start or at the end of the chart the label does not align correctly. I have already tried offset and padding but its for the whole axis not the label. I would really appreciate any suggestion, clues or solutions

http://jsfiddle.net/Andam/6km2fw31/1/ enter image description here


Solution

  • Highcharts tries to position data labels on a plot area due to default justify option for overflow. As a solution change overflow to allow.

    dataLabels: {
      enabled: true,
      verticalAlign: 'middle',
        crop: false,
        overflow: 'allow'
    }
    

    Live demo: http://jsfiddle.net/BlackLabel/f2r7hL3j/

    API Reference: https://api.highcharts.com/highcharts/series.column.dataLabels.overflow