2014-08-27 83 views
1

我正在一個應用程序中,我有幾個webViews,並在其中我使用JavaScript庫HighCharts呈現各種圖表。 這裏是在這樣的Web視圖放置UIWebView切斷內容的底部

enter image description here

「國家名稱」及以上的一切都是Web視圖的一部分,而「傳奇」是一個UILabel我的視圖控制器的視圖的一部分。 正如您所看到的,「Country Name」中的'y'在底部被切斷。我在底部製作了透明標籤,甚至設置了webView.scrollView.clipsToBounds = NO以及更改了滾動視圖的contentInsets,但這並沒有真正改變任何內容(並且我意識到將clipsToBounds關閉可能是錯誤的,我只是檢查問題是否有任何用它來做)。 (編輯:替換完整的html片段)

這是我使用的html模板。在最後的html中,所有「%%」都被替換爲「%」,「%@」被替換爲圖表數據。

<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
     <script type="text/javascript" src="jquery-1.8.2.min.js"></script> 
     <script type="text/javascript"> 
      $(function() { 
       $('#chart_container').highcharts({ 
               chart: { 
               type: '%@', 
               spacing: [10, 0, 0, 0], 
               zoomType: 'x' 
               }, 
               title: { 
               text: null 
               }, 
               xAxis: { 
               categories: %@, 
               title: { 
               text: '%@', 
               style: { 
               fontSize: '13.0px' 
               } 
               }, 
               minRange: 1, 
               labels: { 
               rotation: -45, 
               style: { 
               fontSize: '13.0px' 
               } 
               } 
               }, 
               yAxis: { 
               title: { 
               text: '%@', 
               style: { 
               fontSize: '12.0px' 
               } 
               }, 
               labels: { 
               style: { 
               fontSize: '14.0px' 
               } 
               } 
               }, 
               tooltip: { 
               shared: true, 
               headerFormat: '<span style="font-size: 18.0px">{point.key}</span><br/>', 
               %@ 
               style: { 
               fontSize: '16.0px' 
               } 
               }, 
               legend: { 
               enabled: false 
               }, 
               %@ 
               series: %@, 
               credits: { 
               enabled: false 
               }, 
               exporting: { 
               enabled: false 
               } 
               }); 
       }); 

       function toggleSeries(index) { 
        var chart = $('#chart_container').highcharts(); 
        chart.tooltip.hide(); 
        %@ 
       } 
     </script> 
     </head> 

<body style="height: 100%%; min-height: 100%%; margin:0; padding:0; overflow: visible"> 
    <script src="highcharts.js"> 
     </script> 
    <script src="exporting.js"> 
     </script> 
    <div id="chart_container" style="height: 100%%; overflow: visible"></div> 
</body> 

任何想法來自哪裏這個問題,怎麼能解決嗎?

+0

你能顯示完整的Highcharts代碼嗎?你有沒有試圖將'chart.marginBottom'設置爲比默認值更高的值? – 2014-08-28 10:01:27

+0

@PawełFus我給這個問題添加了完整的html。我試圖在圖表div上設置保證金。 – johnyu 2014-08-28 10:39:12

+0

爲什麼你有:'height:100 %%' - 是否正確?只是問問。另外,爲什麼你禁用了間距:'spacing:[10,0,0,0]'?在底部添加一些間距,將工作。 – 2014-08-28 10:42:55

回答

1

問題已在設定的圖表:

spacing: [10, 0, 0, 0] 

除去在此之後,自動計算間隔從這個問題阻止。