我无法让 HighCharts 在 Android Webview 中呈现。这是在 Android 4.0+ 上
下面是我的html代码
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="author" content="Script Tutorials" />
<title>How to create active charts using Highcharts | Script Tutorials</title>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
</head>
<body>
<div id="chart_1" class="chart"></div>
<script type='text/javascript'>
$(document).ready(function() {
// First chart initialization
var chart1 = new Highcharts.Chart({
chart: {
renderTo: 'chart_1',
type: 'area',
height: 350,
},
title: {
text: 'Tools developers plans to use to make html5 games (in %)'
},
xAxis: {
categories: ['Processing.js', 'Impact.js', 'Other', 'Ease.js', 'Box2D.js', 'WebGL', 'DOM', 'CSS', 'Canvas', 'Javascript']
},
yAxis: {
title: {
text: 'Interviewed'
}
},
series: [{
name: 'Dev #1',
data: [5, 10, 20, 22, 25, 28, 30, 40, 80, 90]
}, {
name: 'Dev #2',
data: [15, 15, 18, 40, 30, 25, 60, 60, 80, 70]
}, {
name: 'Dev #3',
data: [1, 3, 6, 0, 50, 25, 50, 60, 30, 100]
}]
});
});</script>
</body>
</html>
我从资产目录中读取 html 文件,使用 bufferedreader 将其转换为字符串,然后使用
webview.loaddata(customHtml, "text/html", "UTF-8");