2016-03-22 12 views
1

JSONデータから基本的なエリアチャートを生成する次のコードをチャート上に作成していますが、カンマ区切りの数字を整数、チャートの様々な例で提案されているが、ハイチャート:カンマを追加してインターッサーに出力する方法

Highcharts.setOptions({ 
       lang: { 
        thousandsSep: ',' 
       } 
      }); 

私の作業コードを動作していないように見えるように私はこのビットを追加483,533,30だけではなく48353330.

としてコンマを示さなければなりませんここに見ることができますfiddle

$(document).ready(function() { 
    Highcharts.setOptions({ 
        lang: { 
         thousandsSep: ',' 
        } 
       }); 

var options = { 
       chart: { 
        renderTo: 'container', 
        type: 'area', 
        marginRight: 130, 
        marginBottom: 25 
       }, 
       title: { 
        text: 'Deposit Institution', 
        x: -20 //center 
       }, 
       subtitle: { 
        text: '', 
        x: -20 
       }, 
       xAxis: { 
        categories: [] 
       }, 
       yAxis: { 
        title: { 
         text: 'Amount' 
        }, 
        plotLines: [{ 
         value: 0, 
         width: 1, 
         color: '#808080' 
        }] 
       }, 
       tooltip: { 
        formatter: function() { 
          return '<b>'+ this.series.name +'</b><br/>'+ 
          this.x +': $'+ this.y; 
        } 
       }, 
       legend: { 
        layout: 'vertical', 
        align: 'right', 
        verticalAlign: 'top', 
        x: -10, 
        y: 100, 
        borderWidth: 0 
       }, 
       series: [] 
      } 

        $.getJSON("data1.json", function(json) { 
       options.xAxis.categories = json[0]['data']; 
       options.series[0] = json[1]; 
       options.series[1] = json[2]; 
       chart = new Highcharts.Chart(options); 
      }); 


     }); 

答えて

2
tooltip: { 
    formatter: function() { 
    return '<b>' + this.series.name + '</b><br/>' + 
     this.x + ': $' + Highcharts.numberFormat(this.y, 0, '', ','); 
    } 
} 

私はそれはそれはコンマPN入れて何をしようとしたあなたのツールチップのフォーマッタ機能に http://api.highcharts.com/highcharts#Highcharts.numberFormat

0

Y Xまたはでこれを試してみてください:

yAxis: { 
    labels: { 
    formatter:function() { 
     return Highcharts.numberFormat(this.value, 0, '', ','); 
    } 
    } 
} 
+0

感謝をHighcharts.numberFormatを追加してみてくださいy軸、私はチャート自体にカンマを入れていません – user244394

関連する問題