0

With ng2-google-charts and angular 10 how do I format the number as a percentage?

I'm using 'GeoChart' as the chart type.

The chart interface is

public geoChart: GoogleChartInterface = {
chartType: 'GeoChart',
dataTable: [
  ['Country', 'Issuance (2019)'],
  ['GB', 20]
],
formatters: [

  {
    columns: [1],
    type: 'NumberFormat',
    options: {
     suffix: '%'
    }
  }
],
Interlated
  • 5,108
  • 6
  • 48
  • 79

1 Answers1

0

A pattern fixed it

public geoChart: GoogleChartInterface = {
chartType: 'GeoChart',
dataTable: [
  ['Country', 'Issuance (2019)'],
  ['GB', 20]
],
formatters: [
  {
    columns: [1],
    type: 'NumberFormat',
    options: {
      pattern: '#0',
     suffix: '%'
    }
  }
],
Interlated
  • 5,108
  • 6
  • 48
  • 79