我通过了json encoded string(g)。 EXT2包括[“chrome”、“15”、“firefox”、“20”)从Xcode到javascript(g. arr)的阵列。 现在,我想通过这一阵列,充满活力地扼杀高潮。 超文本代码为
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=20, user-scalable=no;" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Pie chart</title>
<!-- 1. Add these JavaScript inclusions in the head of your page -->
<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript" src="highcharts.js"></script>
<script type="text/javascript" src="jquery.form.js"></script>
<!-- 2. Add the JavaScript to initialize the chart on document ready -->
<script type="text/javascript">
var chart;
var arr = $TEXT2;
$(document).ready(function(){
chart = new Highcharts.Chart({
chart: {
renderTo: container ,
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: Interactive Pie
},
tooltip: {
formatter: function() {
return <b> + this.point.name + </b>: + this.y + % ;
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: pointer ,
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
type: pie ,
name: Browser share ,
data: []
}]
});
});
</script>
<body>
<br>
<!-- 3. Add the container -->
<div id="container" style="width: 300px; height: 350px; margin: 0 auto"></div>
<!-- 2. Add the JavaScript to initialize the chart on document ready -->
</body>
</html>
I am trying to use getjson method although m unaware of its usage. Since i want to pass my array i.e arr to data[] in Highcharts,I am doing:
$.getJSON("arr", function(json) {
chart.series = json;
var chart = new Highcharts.Chart(chart);
});
Can anyone help me on dis. Thanks in advance.