Friday, December 16, 2016

Format Axis labels in High Charts

There are a number of formatting options in HighCharts.

To format a data label, formatter can be used as demonstrated at http://stackoverflow.com/questions/24708198/how-to-format-highcharts-datalabels-decimal-points.

A tooltip formatter formats tooltip e.g. http://stackoverflow.com/questions/16991335/highcharts-tooltip-formatter

To format axis labels a formatter can be configured as

formatter: function () {
    var ret = '',multi,axis = this.axis,numericSymbols = ['k', 'M', 'G', 'T', 'P', 'E'],
        i = numericSymbols.length;
    while (i-- && ret === '') {
        multi = Math.pow(1000, i + 1);
        if (axis.tickInterval >= multi && numericSymbols[i] !== null) {
            ret = Highcharts.numberFormat(this.value / multi, -1) + numericSymbols[i];
        }
    }
    if (ret === '') ret = this.value;
    return ret;
}

I have created a fiddle to demonstrate this at http://jsfiddle.net/Lng7w9v0/

No comments:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...