Need a special offer?Find out if your project fits.
+
API reference
  • API Reference for older versions
  • Table of contents

    amcharts.getNumberFormatPattern

    amcharts.getNumberFormatPattern(format: FormatObject)

    Converts the FormatObject to the amCharts number formatting string.

    To learn how the number format is set in amCharts, see the number formatting section

    Parameters

    Parameter/Type Description
    format
    FormatObject
    Contains the number format set in the component.

    Returns

    This method returns a string representing the amCharts number formatting string. For example: '$'#,###.00|'($'#,###.00')'.

    Example

    1) Applying the formatting to the Value axis of the chart:

    // Create a number formatter for the value axis
    valueAxis.numberFormatter = new am4core.NumberFormatter();
    // Get a FormatObject from Flexmonster
    let numberFormat = flexmonster.amcharts
                       .getNumberFormatPattern(rawData.meta.formats[0]);
    // Apply number formatting to the value axis
    valueAxis.numberFormatter.numberFormat = numberFormat;

    2) Applying the formatting to the chart's tooltip text:

    let numberFormat = flexmonster.amcharts
                       .getNumberFormatPattern(rawData.meta.formats[0]);
    series.columns.template.tooltipText = 
    "{valueY.value.formatNumber('" + numberFormat + "')}";

    See also

    amcharts.getData
    amcharts.getCategoryName
    amcharts.getMeasureNameByIndex
    amcharts.getNumberOfMeasures