2016-11-29 5 views
0

데모 프로젝트를 기반으로하는 데모는 here입니다.드릴을 사용하여 계열이 제거되지 않는 jsfiddle의 하이 차트 문제

본인의 나라 및 정보에 대해 변경되었지만 드릴 업 기능에 대한 문제가 여기에 있습니다.

생식 단계 : 열기 링크에서 jsfiddle 위지도에서 CA (캘리포니아)을 클릭 한 후보고 '돌아 미국으로 <'서쪽 해안에 다른 곳

다음 클릭 버튼을 클릭 캘리포니아 드릴 다운이지도에서 제거되지 않았 음을 나타냅니다. 뒤로 버튼을 클릭하면 제거해야합니다. 여기

issue with old map showing outside selection

메인 코드의 몸입니다 : 내가 그 일을하는 한 가지 방법을 알고

Highcharts.mapChart('container', { 
    chart: { 
     events: { 
      drilldown: function (e) { 

       if (!e.seriesOptions) { 
        var chart = this, 
         mapKey = 'countries/us/' + e.point.drilldown + '-all', 
         // Handle error, the timeout is cleared on success 
         fail = setTimeout(function() { 
          if (!Highcharts.maps[mapKey]) { 
           chart.showLoading('<i class="icon-frown"></i> Failed loading ' + e.point.name); 

           fail = setTimeout(function() { 
            chart.hideLoading(); 
           }, 1000); 
          } 
         }, 3000); 

        // Show the spinner 
        chart.showLoading('<i class="icon-spinner icon-spin icon-3x"></i>'); // Font Awesome spinner 

        // Load the drilldown map 
        $.getScript('https://code.highcharts.com/mapdata/' + mapKey + '.js', function() { 

         data = Highcharts.geojson(Highcharts.maps[mapKey]); 

         // Set a non-random bogus value 
         $.each(data, function (i) { 
          this.value = i; 
         }); 

         // Hide loading and add series 
         chart.hideLoading(); 
         clearTimeout(fail); 
         chart.addSeriesAsDrilldown(e.point, { 
          name: e.point.name, 
          data: data, 
          dataLabels: { 
           enabled: true, 
           format: '{point.name}' 
          } 
         }); 
        }); 
       } 


       this.setTitle(null, { text: e.point.name }); 
      }, 
      drillup: function() { 
       this.setTitle(null, { text: 'USA' }); 
      } 
     } 
    }, 

, 그리고 이것은 window.history.go (-1)에서 일을하는 것입니다 드릴 업 기능은 확대/축소 그래픽을 제거하고 한 번의 클릭으로 버튼을 해제합니다. history.go (-1)는 버튼을 깨지 않지만 클릭 한 번으로 제대로 작동하지 않습니다.

나는 비슷한 문제를 여기에 발견 : Proper way to remove all series data from a highcharts chart?하지만 코드가 다르기 때문에 이것은 막대 차트를 처리합니다.

이 문제에 대한 해결책은 내가하지 jsfiddle에 캐시를 절약도이 문제를 해결할 수 있다고 생각했지만 나도 일하는 것을 얻을 수 없었다

for (var i = 0; i < chart.series.length; i++) 

while(chart.series.length > 0) 
chart.series[0].remove(true); 

에 변경하는 것입니다.

도움이 될 것입니다. 감사.

답변

1

5.0.3에서 5.0.4 버전까지의 회귀 버그입니다. 최신 개발 버전에서 수정되었으므로 5.0.3/최신 github 버전을 사용하십시오.

<script src="http://github.highcharts.com/master/highmaps.src.js"></script> 
<script src="http://code.highcharts.com/maps/modules/data.js"></script> 
<script src="http://github.highcharts.com/maps/modules/drilldown.js"></script> 
<script src="https://code.highcharts.com/mapdata/countries/us/us-all.js"></script> 

http://jsfiddle.net/dsjLp3h1/

<script src="http://code.highcharts.com/maps/5.0.3/highmaps.js"></script> 
<script src="http://code.highcharts.com/maps/modules/data.js"></script> 
<script src="http://code.highcharts.com/maps/5.0.3/modules/drilldown.js"></script> 
<script src="https://code.highcharts.com/mapdata/countries/us/us-all.js"></script> 

http://jsfiddle.net/dsjLp3h1/1/