2016-11-29 3 views
0

デモ私のプロジェクトのベースはhereです。ドリルアップでシリーズが削除されないjsfiddleのハイチャートでの問題

私は自分の国と情報についてこれを変更しましたが、ここではドリルアップ機能に問題があります。

再現手順: オープンリンクでjsfiddle上記とマップにCA(カリフォルニア州)をクリックして、それから見て「戻るUSAへ<」西海岸のどこか

次のクリックボタンをクリックしてくださいカリフォルニアのドリルダウンがマップから削除されていないことを確認します。戻るボタンをクリックすると、これらを削除する必要があります。ここで

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/

関連する問題