2013-03-17 103 views
0

我的X軸包含多年。如何刪除格式中的千位分隔符?或者,我該如何告訴Highcharts這是一年?刪除Highcharts x軸標籤千位分隔符

http://jsfiddle.net/nicholasduffy/BDQVV/

$(function() { 
    var chart = new Highcharts.Chart({ 
      chart: { 
       renderTo: 'container', 
       type: 'column', 
      }, 
      xAxis : { 
       label: { 
        formatter: function() { 
         return Highcharts.numberFormat(this.x, 0, '', ''); // Remove the thousands sep? 
        } 
       } 
      }, 
      series: [{"data": [[2006, 1], [2007, 5], [2008, 7], [2009, 7], [2010, 13], [2011, 14], [2012, 16], [2013, 20]], "name": "Series1"}, {"data": [[2012, 3], [2013, 3]], "name": "Series2"}, {"data": [[2002, 1], [2003, 1], [2004, 6], [2005, 7], [2006, 10], [2007, 17], [2008, 23], [2009, 25], [2010, 34], [2011, 44], [2012, 51], [2013, 64]], "name": "Series3"}] 
    }); 
}); 

回答

4

你接近。它是標籤,而不是標籤。此外,該值THIS.VALUE,不this.x

xAxis : { 
      labels: { 
       formatter: function() { 
        return Highcharts.numberFormat(this.value, 0, '', ''); // Remove the thousands sep? 
       } 
      } 
     }, 

http://jsfiddle.net/H2XQR/

+0

完美,謝謝。 – duffn 2013-03-17 18:30:39