1. 程式人生 > 實用技巧 >jqplot畫餅狀圖(模式二)

jqplot畫餅狀圖(模式二)

<html>
<head>
<title>practise and templet</title>

<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<!--畫餅圖必須引入的樣式-->
<link rel="stylesheet" type="text/css" href="jquery.jqplot.css" />
<script type="text/javascript" src="jquery-1.4.min.js" ></script>

<!--支援ie的js-->
<script type="text/javascript" src="excanvas.js" ></script>
<script type="text/javascript" src="jquery.jqplot.js" ></script>
<script type="text/javascript" src="jqplot.pieRenderer.js" ></script>
<script type="text/javascript" src="jqplot.donutRenderer.min.js" ></script>


<script type="text/javascript">
$(function(){

var data = [
['語文', 12],['英語', 9], ['數學', 14],
['物理', 16],['化學', 7], ['生物', 9]
];
var plot2 = jQuery.jqplot ('chart1', [data],
{
seriesDefaults: {

renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
// Turn off filling of slices.
// 設定不填充餅塊
fill: false,
showDataLabels: true,
// Add a margin to seperate the slices.
// 餅塊之間的距離為4px
sliceMargin: 4,
// stroke the slices with a little thicker line.
// 餅塊的線寬為5px
lineWidth: 5
}
},
legend: { show:true, location: 'e' }
}
);

});
</script>
</head>

<body>
<!--容器-->
<div id="chart1" style="height:300px; width:400px;"></div>
</body>
</html>

====================================

wKioL1OccWzx5RT_AADN_9xciH8414.jpg

jq庫在我的下載裡下載

轉載於:https://blog.51cto.com/962410314/1426473