angular - 使用 ng2-google-charts 如何将数字格式化为百分比?
问题描述
使用 ng2-google-charts 和 angular 10 如何将数字格式化为百分比?
我使用“GeoChart”作为图表类型。
图表界面是
public geoChart: GoogleChartInterface = {
chartType: 'GeoChart',
dataTable: [
['Country', 'Issuance (2019)'],
['GB', 20]
],
formatters: [
{
columns: [1],
type: 'NumberFormat',
options: {
suffix: '%'
}
}
],
解决方案
一个模式固定它
public geoChart: GoogleChartInterface = {
chartType: 'GeoChart',
dataTable: [
['Country', 'Issuance (2019)'],
['GB', 20]
],
formatters: [
{
columns: [1],
type: 'NumberFormat',
options: {
pattern: '#0',
suffix: '%'
}
}
],
推荐阅读
- laravel - 根据 CORS 预检响应中的标头“Access-Control-Allow-Headers”,标头“内容类型”是不允许的
- r - 在 R 中使用 POSIXct 处理切换到夏令时
- assembly - 为什么添加后输出为0?
- java - 在android studio中传递文件时出错
- python - 从元组列表创建稀疏矩阵
- laravel - Laravel 中的错误异常
- latex - Latex:表格:堆叠多行命令中的旋转文本问题
- c# - 绑定到 ViewModel 中的对象属性,或者如何使用具有相同属性名称的多个模型
- typescript - Vuex:处理列表和详细数据的最佳方式
- laravel - Vue 中的干预图像损坏