A custom formatter function that returns label to be displayed on axisX.
Notesvar  chart =  new  CanvasJS.Chart("container",
{
 .
 .
axisX:{
        labelFormatter: function ( e ) {
               return "x: " + e.value;  
         }  
},
 .
 .
});
chart.render();
e: { // parameter sent to function
       chart,
       axis,
       value,
       label
 }
If you have to access any preset options of the chart, you can access them via e.chart.options. For example e.chart.options.title.text
8 Comments
am trying to plot x-axis labels using labelFormatter from a json object where it consists of date and value.
May I know how to do that ?
I have figured it out
can we fire a click event on labels???
Sorry, events are not supported on axis labels as of now.
Is it possible to give a enter in the string of label for multiple information…?
Zillur, you can set labelMaxWidth to split a string to multiple lines.
Hi
Is there a way to format the label with html, like doing the label with a border or place a where i need
Isaac,
label doesn’t support HTML property, for formatting it plese look into labelFontFamily, labelFontColor, labelFontSize, labelFontWeight, labelFontStyle.
And as of now label does’t support border.