2016-09-23 82 views
0

我使用以下代码,它在Safari中完美渲染,但在Chrome中完全渲染。我在Chrome中看到控制台没有错误。jquery在Safari中呈现,但不是Chrome

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
<script src="https://code.highcharts.com/highcharts.js"></script> 
<script src="https://code.highcharts.com/modules/exporting.js"></script> 



<!--http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-basic/ --> 


<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> 

<script type="text/javascript"> 
$(document).ready(function() { 
    console.log('inside function'); 
    $('#container').highcharts({ 
     title: { 
      text: 'Monthly Active Users', 
      x: -20 //center 
     }, 
     subtitle: { 
      text: 'Users who visited on more than 2 days in the last 30 days', 
      x: -20 
     }, 
     xAxis: { 
      categories: ["11/09/2016","12/09/2016","13/09/2016","14/09/2016","15/09/2016","16/09/2016","17/09/2016","18/09/2016","19/09/2016","20/09/2016","21/09/2016","22/09/2016",] //insert date here 
     }, 
     yAxis: { 
      title: { 
       text: 'Percent (%)' 
      }, 
      plotLines: [{ 
       value: 0, 
       width: 1, 
       color: '#808080' 
      }] 
     }, 
     tooltip: { 
      valueSuffix: '%' 
     }, 
     legend: { 
      layout: 'vertical', 
      align: 'right', 
      verticalAlign: 'middle', 
      borderWidth: 0 
     }, 
     series: [{ 
      name: 'Monthly Active Users', 
      data: [ 
      4.2359074617139,4.3266102797658,4.3492372606297,4.3000323310702,4.297253634895,4.1612903225806,4.1867954911433,4.3338683788122,4.3089690392595,4.3795620437956,4.3037974683544,4.294284812125,] 
     }] 
    }); 
}); 
</script> 
+1

Chrome中出现什么问题?截图?或者请提供演示链接。 –

回答

0

这里是一个完全正常的工作片断

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
 
<script src="https://code.highcharts.com/highcharts.js"></script> 
 
<script src="https://code.highcharts.com/modules/exporting.js"></script> 
 

 

 

 
<!--http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-basic/ --> 
 

 

 
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> 
 

 
<script type="text/javascript"> 
 
$(document).ready(function() { 
 
    console.log('inside function'); 
 
    $('#container').highcharts({ 
 
     title: { 
 
      text: 'Monthly Active Users', 
 
      x: -20 //center 
 
     }, 
 
     subtitle: { 
 
      text: 'Users who visited on more than 2 days in the last 30 days', 
 
      x: -20 
 
     }, 
 
     xAxis: { 
 
      categories: ["11/09/2016","12/09/2016","13/09/2016","14/09/2016","15/09/2016","16/09/2016","17/09/2016","18/09/2016","19/09/2016","20/09/2016","21/09/2016","22/09/2016",] //insert date here 
 
     }, 
 
     yAxis: { 
 
      title: { 
 
       text: 'Percent (%)' 
 
      }, 
 
      plotLines: [{ 
 
       value: 0, 
 
       width: 1, 
 
       color: '#808080' 
 
      }] 
 
     }, 
 
     tooltip: { 
 
      valueSuffix: '%' 
 
     }, 
 
     legend: { 
 
      layout: 'vertical', 
 
      align: 'right', 
 
      verticalAlign: 'middle', 
 
      borderWidth: 0 
 
     }, 
 
     series: [{ 
 
      name: 'Monthly Active Users', 
 
      data: [ 
 
      4.2359074617139,4.3266102797658,4.3492372606297,4.3000323310702,4.297253634895,4.1612903225806,4.1867954911433,4.3338683788122,4.3089690392595,4.3795620437956,4.3037974683544,4.294284812125,] 
 
     }] 
 
    }); 
 
}); 
 
</script>

与您的代码,关于Chrome工作。你能否提供更多关于你如何运行的细节以及控制台是否有任何警告(而不是错误)

0

我刚才在chrome中运行代码,它呈现得很好。我使用的是Chrome版本52.0.2743.116 m。

enter image description here

+0

是的,它正在chrome..this应该是评论不是答案 –

+0

我dd没有足够的权限提前添加评论。我是新来的stackoverflow和几秒钟前我的答案之一是upvoted,所以现在能够评论。此外,我不得不提供一个图像,以提供渲染图像和控制台的视图。 – rushi

相关问题