Graph Label Formatting

The labels in line and bar chart cannot be formatted in Millions or other required units. By default, it should be formatted the same as Y-axis labels.

Hi @ayush.das
In charts label formatter, there is option of advance label formatter. Click on Switch to advance and add the below script in the code window. You will get the values in Millions and other required units.

function format_label ( data ) {
    /*  data: { 
             value: number|Array|Object, value of coordinate system, 
            dataIndex: number, index of x-axis, 
            seriesIndex: number, index of current series, 
         }  
 */ 
 // Write your JS code here 
 var value = data.value;
 if (typeof value == "number") {

  if (value > 999999999999) {

    return value > 999999999999

      ? (value / 1000000000000).toFixed(1).toLocaleString() + "T"

      : value;

  } else if (value > 999999999) {

    return value > 999999999

      ? (value / 1000000000).toFixed(1).toLocaleString() + "B"

      : value;

  } else if (value > 999999) {

    return value > 999999

      ? (value / 1000000).toFixed(1).toLocaleString() + "M"

      : value;

  } else if (value > 999) {

    return value > 999

      ? (value / 1000).toFixed(1).toLocaleString() + "K"

      : value;

  } else if (value < -999999999999) {

    return value > 999999999999

      ? (value / 1000000000000).toFixed(1).toLocaleString() + "T"

      : value;

  } else if (value < -999999999) {

    return value < 999999999

      ? (value / 1000000000).toFixed(1).toLocaleString() + "B"

      : value;

  } else if (value < -999999) {

    return value < -999999

      ? (value / 1000000).toFixed(1).toLocaleString() + "M"

      : value;

  } else if (value < -999) {

    return value < 999

      ? (value / 1000).toFixed(1).toLocaleString() + "K"

      : value;

  } else {

    return value.toLocaleString();

  }

}

return value;
}
 
return format_label ( data );