labelFormatter : Function

A custom formatter function that returns stripLine’s label.


Notes
  • labelFormatter overrides the label property.
  • You can use formatNumber and formatDate functions to format number/date values inside the formatter function.

var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
axisY:{
    stripLines: [{
        .
        value:12,
        labelFormatter: function ( e ) {
               return "$" + e.stripLine.value;  
         }  
        .
    }]
},
 .
 .
});
chart.render();

  • By using labelFormatter, you can return any value to be displayed as stripLine’s label.
    Below is the structure of object passed as parameter to the function
    e: { // parameter sent to function
           chart,
           axis,
           stripLine
     }
    

Try it Yourself by Editing the Code below.



In order to provide better support,we have closed the comments and switched completely to our Forums.
If you have any questions, please feel free to ask in our forums.