2017-08-24 55 views
0

我如何使人口金字塔与成千上万的分隔符? 的问题是,我必须把这种格式:谷歌图表金字塔人口数字格式

 var formatter = new google.visualization.NumberFormat({ 
      pattern: ';' 
     }); 

因为我不想负的符号出现做。

回答

1

我添加一个例子:

http://jsfiddle.net/dnenjgkg/9/

var dataArray = [`enter code here` 
    ['Age', 'Male', 'Female'], 
    ['0-4 years', 106, -104], 
    ['5-9 years', 91, -86 ], 
    ['10-14 years', 79, -77 ], 
    ['15-19 years', 6008, -6004 ], 
    ['20-24 years', 62, -58 ], 
    ['25-29 years', 56, -53 ], 
    ['30-34 years', 51, -46 ], 
    ['35-39 years', 48, -41 ], 
    ['40-44 years', 43, -35 ], 
    ['45-49 years', 39, -30 ], 
    ['50-54 years', 33, -27 ], 
    ['55-59 years', 32, -25 ], 
    ['60-64 years', 27, -20 ], 
    ['64-69 years', 19, -16 ], 
    ['70-74 years', 13, -12 ], 
    ['75-79 years', 8, -7 ], 
    ['80-84 years', 3, -3 ], 
    ['85-89 years', 1, -1 ], 
    ['90-94 years', 0, 0 ], 
    ['95+ years', 0, 0 ] 
    ]; 

    var formatter = new google.visualization.NumberFormat({ 
    pattern: ';' 
    }); 

    formatter.format(data, 1) 
    formatter.format(data, 2) 

    ----- 

    if i change this for this: 

变种格式化=新google.visualization.NumberFormat({ 图案: '###,###' }); 用逗号表示,但在女性上出现' - '

+0

谢谢您的例子,把'formatter.format(数据,1) formatter.format(data,2)',它对我有用! – Jaeger