2014-03-04 2 views
0

드릴 다운이 발생할 때 플롯 밴드 및 플롯 선을 숨기려면 하이 차트에 드릴 다운 차트가 있습니다.Highcharts 드릴 다운 차트 : 드릴 다운 또는 드릴 업에서 플롯 밴드 및 선 표시/숨기기

드릴 다운 이벤트를 사용하여 플롯 밴드를 성공적으로 숨기지 만 드릴 다운이 표시되면 플롯 밴드 레이블이 다시 나타납니다. http://jsfiddle.net/jmunger/KFpJC/

숨기거나 다음과 같이 밴드와 라인 인을 표시하는 코드 :

events: { 
     drilldown: function() { 
      var myAxis = this.xAxis[0]; 
      var myPlotBands = myAxis.plotLinesAndBands; 
      $.each(myPlotBands, function (i, linesAndBands) { 
       if (linesAndBands.label) { 
        linesAndBands.label.hide(); 
        linesAndBands.label.opacity = 0; 
       } 
       linesAndBands.svgElem.hide(); 
      }); 
     }, 
     drillup: function() { 
      $.each(this.xAxis[0].plotLinesAndBands, function (i, linesAndBands) { 
       linesAndBands.svgElem.show(); 
       if (linesAndBands.label) { 
        linesAndBands.label.show(); 
       } 
      }); 
     } 
    } 

레이블을 드릴 다운에 숨겨져 있는지 확인하는 방법이 있나요

이 바이올린을 참조하십시오 드릴 업에서 다시 나타 납니까?

linesAndBands.label.hide(); 

은 레이블을 효과적으로 숨기지 만 드릴 다운 차트가 나타나면 다시 나타납니다.

답변

1

대신 .hide()의 대신 .css()을 usee 수 있습니다 : 다른 그래픽은 플로팅 영역에 배치 한 후에는 (X/Y 위치 및 가시성을) 위치에있어 http://jsfiddle.net/KFpJC/2/

 events: { 
      drilldown: function() { 
       var myAxis = this.xAxis[0]; 
       var myPlotBands = myAxis.plotLinesAndBands; 
       $.each(myPlotBands, function (i, linesAndBands) { 
        linesAndBands.svgElem.hide(); 
        if (linesAndBands.label) { 
         linesAndBands.label.css({ 
          display: 'none' 
         }); 
        } 
       }); 
      }, 
      drillup: function() { 
       $.each(this.xAxis[0].plotLinesAndBands, function (i, linesAndBands) { 
        linesAndBands.svgElem.show(); 
        if (linesAndBands.label) { 
         linesAndBands.label.css({ 
          display: 'block' 
         }); 
        } 
       }); 
      } 
     } 

대부분의 아마, 라벨 반환하기 때문이다.

+0

위대한 작품입니다. –

+0

드릴 다운에서 내보낼 때 드릴 업을위한 플롯 밴드가 표시되지만 실현되었습니다. 이거 버그 야? –

+0

아니요, 버그가 아닙니다. 일반적으로 차트에서 SVG 요소를 숨기는 대신 plotBands를 제거/추가해야합니다. –