NG2-Charts在数据标签上成千上万的分隔符



在此示例中
http://embed.plnkr.co/7fgsiurjcf0m0ffeoml2/

If I Change data to: 
    data: [2000, 3000, 4000, 8000, 12000, 12850]
Is it possible put thousand sepator on dataset label ? 
Like this : 
5,000
10,000
15,000

我找到了它!我需要在Xaxes属性上使用回调函数。这样:

barChartOptions = {
  scaleShowVerticalLines: false,
  responsive: true,
  scales: {
    yAxes: [{
      ticks: {
        fontSize: 13,
        fontStyle: 'normal',
      }
    }],
    xAxes: [{
      ticks: {
          callback: (dataLabel, index)=> {                  
            let decimalPipe = new DecimalPipe('pt-BR');
            return decimalPipe.transform(dataLabel, '1.0-0');
          }
      }
    }]
  },
  ...

谢谢!

最新更新