Home Forums Feature Requests & Feedback logarithmic function Reply To: logarithmic function

#35718

@elanchezhiyan,

You can use unicode characters in labelFormatter to display power (subscript) values in the axis labels. Please check out the code snippet for the same.

var unicodeStringForSubscript = ["\u2070", "\u00B9", "\u00B2", "\u00B3", "\u2074", "\u2075", "\u2076", "\u2077", "\u2078", "\u2079"]
.
.
 axisX:{
      title: "Logarithmic Axis",
      logarithmic: true,
      logarithmBase: 10,
      labelFormatter: function(e) {
        return 10 + unicodeStringForSubscript[Math.ceil(Math.log(e.value)/Math.log(10))] ;
      }
.
.

Also, take a look at this JSFiddle for a complete working code.

Display power values in X-Axis Labels

—-
Manoj Mohan
Team CanvasJS