2015-01-20 3 views
0

막대 그래프가 누적되어 있으므로 데이터 레이블이 해당 영역에 맞지 않으면 숨기려고합니다. 범주 8의 예제에서는 데이터 레이블 "4"를 전혀 가지지 않습니다. 이 비슷한 질문 bolow입니다 : Highcharts stacked bar chart hide data labels not to overlap 그러나 내 문제는 내가 아니라 당신은 루프를 이동해야 내가 labales에게그래프를 플로팅하고 내보낼 때 데이터 레이블을 제거하십시오.

$.each(this.chartObject.series,function(i,data_series){ 
      if (data_series.visible){ 
       $.each(data_series.data,function(j,data){ 
       if(data.yBottom != null && data.plotY != null){ 
        if(data.yBottom - data.plotY < 15){ 
        if (typeof data.dataLabel != 'undefined'){ 
         data.dataLabel.hide(); 
        } 
        } 
       } 
      }); 
      } 
     }); 

답변

2

을 숨길 수있는 그래프를 생성 한 후이 코드를 수행 한

수출에 lables를 숨길 필요가있다 콜백에서 차트/이벤트 /로드로 이동합니다.

chart: { 
     events: { 
      load: function() { 
       var chart = this; 

       $.each(chart.series, function (i, serie) { 
        $.each(serie.data, function (j, data) { 

          if (data.yBottom - data.plotY < 15) data.dataLabel.hide(); 
        }); 
       }); 
      } 
     }, 
     renderTo: 'chart', 
     defaultSeriesType: 'bar' 
    }, 

예 : http://jsfiddle.net/HA5xE/20

+2

감사 세바스찬 Bochan, 그것의 작동 :) – Thorin

관련 문제