【问题标题】:With ng2-google-charts how do I format the number as a percentage?使用 ng2-google-charts 如何将数字格式化为百分比?
【发布时间】:2020-10-29 14:32:09
【问题描述】:

使用 ng2-google-charts 和 angular 10 如何将数字格式化为百分比?

我使用“GeoChart”作为图表类型。

图表界面是

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

  {
    columns: [1],
    type: 'NumberFormat',
    options: {
     suffix: '%'
    }
  }
],

【问题讨论】:

    标签: angular ng2-google-chart


    【解决方案1】:

    一个固定的模式

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-01
      • 2011-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-03
      • 1970-01-01
      • 2023-02-08
      相关资源
      最近更新 更多