使用自定义的js函数后,在Mac7中,Highcharts的选择范围在IE7中永不停止,为​​什么?

时间:2017-07-17 01:47:08

标签: highcharts internet-explorer-7

我的网站想要在xAxis.afterSetExtremes时使用一个函数。但是在IE7中,当我在xAxis中选择一个范围时,第二次单击无法停止选择。为什么呢?

此问题仅发生在IE7中。

测试页面为:Here

整个代码是:

<!DOCTYPE html>
<html lang="zh_CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/huidu.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
  <script src="/js/html5shiv.min.js"></script>
  <script src="/js/respond.min.js"></script>
<![endif]-->  
</head>
<body>
<div class="container">
  <div class="panel panel-default">
    <div class="panel-body">
      <div id="diantui" style="min-width:300px;height:400px">
      </div>
    </div>
  </div>


  <script>
   function togglePlotbands() {
       this.plotLinesAndBands.forEach(function(plotband) {
           var ii = 1;
       });
   }

   window.onload = function(){
       var all_data = [];
       all_data.push({x:1495641600000 , y: 1});
       all_data.push({x:1497110300000 , y: 3});
       all_data.push({x:1497210300000 , y: 4});
       all_data.push({x:1497410300000 , y: 3});
       all_data.push({x:1497510300000 , y: 2});
       all_data.push({x:1497715300000 , y: 1});
       all_data.push({x:1500134400000 , y: 2});


       var hc_obj = {
           chart: {
               type: 'line',
               zoomType: 'x',
               renderTo: 'diantui',
               events: {
                   load: function() {
                       togglePlotbands.call(this.xAxis[0]);
                   }
               }
           },
           xAxis: {
               plotBands: [
                   {color: '#FFFFEF',from: 1497110400000,to: 1497715200000,label: {text: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxfsdfsfsdfsfsdf'}}
               ],
               events: {
                   afterSetExtremes: togglePlotbands
               }
           },
           plotOptions: {
               line: {
                   connectNulls: true,
                   marker: {
                       enabled: false
                   },
               }
           },
           series: [
           ]

       };

       hc_obj['series'].push({name: 'xxx', data: all_data, visible: true});

       var chart = new Highcharts.Chart(hc_obj);
   }
  </script>
</div>
<script src="//cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script src="//cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
<script src="http://cdn.hcharts.cn/highcharts/modules/exporting.js"></script>
<script src="/js/ie10-viewport-bug-workaround.js"></script>

</body>
</html>

0 个答案:

没有答案