Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Label text displayed underlined at Y-axis in highcharts

I am getting y-axis label text underlined with blue color in iphone for drawing highchart.

Following is my code

  $scope.chartConfig.options.yAxis.splice(dataset.id,0,{
        id: dataset.id,
        lineColor : dataset.pointColor,
        lineWidth : 1,
        title: {
            text: null,
            style: {
               color: dataset.pointColor
            }
        },
        labels: {
            style: {
                color: dataset.pointColor,
                fontSize:'10px'
            },
            useHTML : true,
            formatter: function() {
            if(this.value > 99 || this.value < -99){
                var yAxisValue = parseFloat(this.value);
            var valueStringLength = (yAxisValue).toString().split(".")[0].length;
            var labelValue = (this.value/Math.pow(10, valueStringLength-1)).toFixed(2);
            labelValue = labelValue + "<span>&times;</span>10^"+(valueStringLength-1);
            return labelValue ;
        }else{
            return Math.round(this.value);
        }
    },
    align: 'center',
    x: indexPositive?32:-32
  },
  opposite: indexPositive
});

When I return value from else part of formatter function, I get the Label text underlined and in blue color. I have tried to insert textDecoration: 'none' in style attribute but no effect on it. I tried with other way by adding line Highcharts.Tick.prototype.drilldown = function(){}; in the code but no effect.

I am surprised with the behavior of label text. How internally it is applying style to text?

Please help..

Thanks.

like image 990
Mr. Noddy Avatar asked Nov 30 '25 00:11

Mr. Noddy


1 Answers

Thanks friends for all your response, however my friend solved this problem by putting following code.

return "<div><span>"+Math.round(this.value)+"</span></div>";

in the place of

return Math.round(this.value);
like image 170
Mr. Noddy Avatar answered Dec 02 '25 14:12

Mr. Noddy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!