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.
  1. var chart = new CanvasJS.Chart("container",
  2. {
  3. .
  4. .
  5. axisX:{
  6. stripLines: [{
  7. .
  8. value:12,
  9. labelFormatter: function ( e ) {
  10. return "$" + e.stripLine.value;
  11. }
  12. .
  13. }]
  14. },
  15. .
  16. .
  17. });
  18. 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
    1. e: { // parameter sent to function
    2. chart,
    3. axis,
    4. stripLine
    5. }

Try Editing The Code


If you have any questions, please feel free to ask in our forums.Ask Question