amcharts.getNumberFormatPattern

webdatarocks.amcharts.getNumberFormatPattern(format: Object): String

Returns a number formatting string for a chart. Accepts one argument – format which is a Format Object of WebDataRocks. 

Examples

  1. Here is an example of how to apply number formatting to the value axis of a chart:
    /* Create a number formatter for the value axis: */
    valueAxis.numberFormatter = new am4core.NumberFormatter();
    /* Get a format object from WebDataRocks: */
    var numberFormat = pivot.amcharts.getNumberFormatPattern(rawData.meta.formats[0]);
    /* Apply number formatting to the value axis: */
    valueAxis.numberFormatter.numberFormat = numberFormat;
  2. Here is an example of how to apply number formatting to the chart’s tooltip text:
    var numberFormat = pivot.amcharts.getNumberFormatPattern(rawData.meta.formats[0]);
    series.columns.template.tooltipText = "{valueY.value.formatNumber('" + numberFormat + "')}";

See also