2017-12-04 22 views
1

Angular js와 함께 highcharts에서 천 단위 연산자를 시도하고 있습니다.thousands 하이 차트에있는 연산자

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

을 그리고 난 다음 코드 this.{points[0].y:,.0f}으로 만 연산자를 정의 할 때 그것은 나에게 "Unexpected Expression { and injector " and [$injector:unpr] unresolved dependencies error을 보여주고있다 :

나는 차트를 호출하기 전에 설정 옵션이라고했다.

tooltip: { 
     style: { 
      fontFamily: 'Roboto', 
      fontSize: '12px' 
     }, 
     formatter: function() { 
      var headerFormat = '<span style="color: #000">Date: <b>' + Highcharts.dateFormat('%Y-%m-%d', new Date(this.x)) + '</b></span><br/>'; 
      var seriesOneLine = '<span style="color:' + this.points[0].color + '">\u25CF</span> ' + this.points[0].series.name + ': <b>' + this.{points[0].y:,.0f}+ '</b><br/>'; 
      var seriesTwoLine = '<span style="color:' + this.points[1].color + '">\u25CF</span> ' + this.points[1].series.name + ': <b>' + Math.round(this.points[1].y) + '</b><br/>'; 
      var seriesThreeLine = '<span style="color:' + this.points[2].color + '">\u25CF</span> Threshold %: <b>'+this.points[2].point.data.alertThresholdPercentage.toFixed(2)+'%</b><br/>'; 
      return headerFormat + seriesOneLine + seriesTwoLine + seriesThreeLine; 
     } 
    } 
}, 

솔루션 용 포인터는 매우 유용합니다. 천에 대한

+1

검증 예를 추가하십시오이 형식처럼 사용할 수 있습니다 구분합니다. 시작 샘플은 https://jsfiddle.net/0mdzwb0j/ – Patata

답변

1

formatter: function() { 
     return '<b>' + this.series.name + ': ' + Highcharts.numberFormat((this.y.toFixed(2)/1000), 0, '.') + 'k'; 
         } 
+0

일 수 있습니다. 고마워요. –