1

I want to make the label to appear dynamically based on the size of the column.

For example if the column is smaller than 2px no label should appear. I dont want it to be based upon the value. I want it to be based upon the actual pixel size of the column.

Where is says if(this.y == 30) I want it to say something like if(column.height == 2)

dataLabels: 
            {
                enabled: true,
                formatter:function() 
                {

                    if(this.y == 30)
                    {
                    return ''
                   }
                   else{
                   return this.y + '%';

                    }
                }

my fidle below: http://jsfiddle.net/Malvinator/2t0r3am5/

Malvinator
  • 21
  • 3

1 Answers1

1

I have tested this solution and works, have used 40 to test on your fiddle but can change that to the desired pixel height

formatter: function() {
    if (this.point.shapeArgs.height < 40) {
        return ''
    } else {
        return this.y + '%'
    }
}
Tik
  • 822
  • 6
  • 14
  • Thank you that worked perfect. I used it on Waterfall and on stacked columns for Jaspersoft graphs. Exactly what I was looking for. – Malvinator Jun 15 '17 at 18:27