html+js+highcharts繪制圓餅圖表的簡單實(shí)例
更新時(shí)間:2016年08月04日 11:17:54 投稿:jingxian
下面小編就為大家?guī)硪黄猦tml+js+highcharts繪制圓餅圖表的簡單實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
實(shí)例如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>html+js+highcharts繪制圓餅圖表的簡單實(shí)例</title>
<script type="text/javascript" src="jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="highcharts.js" ></script>
</head>
<body>
<div id="content">
<br><br><br>
<!--DEMO start-->
<div id="pie_chart" class="chart_combo"></div>
<script type="text/javascript">
var chart;
$(function () {
var totalMoney=999
<span style="white-space:pre"> </span>var zccw=178
<span style="white-space:pre"> </span>var sycw=821
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'pie_chart',
plotBackgroundColor: 'white',//背景顏色
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: '總車位:'+totalMoney +' 剩余車位:'+ sycw ,
verticalAlign:'bottom',
y:-60
},
tooltip: {//鼠標(biāo)移動(dòng)到每個(gè)餅圖顯示的內(nèi)容
pointFormat: '{point.name}: <b>{point.percentage}%</b>',
percentageDecimals: 1,
formatter: function() {
return this.point.name+':'+totalMoney*this.point.percentage/100;
}
},
plotOptions: {
pie: {
size:'60%',
borderWidth: 0,
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000',
distance: -50,//通過設(shè)置這個(gè)屬性,將每個(gè)小餅圖的顯示名稱和每個(gè)餅圖重疊
style: {
fontSize: '10px',
lineHeight: '10px'
},
formatter: function(index) {
return '<span style="color:#00008B;font-weight:bold">' + this.point.name + '</span>';
}
},
padding:20
}
},
series: [{//設(shè)置每小個(gè)餅圖的顏色、名稱、百分比
type: 'pie',
name: null,
data: [
{name:'在場(chǎng)車輛',color:'#3DA9FF',y:zccw},
{name:'剩余車位',color:'#008FE0',y:sycw},
]
}]
});
});
});
</script>
</div>
</body>
</html>

以上這篇html+js+highcharts繪制圓餅圖表的簡單實(shí)例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
您可能感興趣的文章:
- JS highcharts動(dòng)態(tài)柱狀圖原理及實(shí)現(xiàn)
- JS highcharts實(shí)現(xiàn)動(dòng)態(tài)曲線代碼示例
- highcharts.js數(shù)據(jù)綁定方式代碼實(shí)例
- Javascript highcharts 餅圖顯示數(shù)量和百分比實(shí)例代碼
- 淺析jquery的js圖表組件highcharts
- Highcharts 非常實(shí)用的Javascript統(tǒng)計(jì)圖demo示例
- 純JAVASCRIPT圖表動(dòng)畫插件Highcharts Examples
- jQuery.Highcharts.js繪制柱狀圖餅狀圖曲線圖
- JavaScript圖表插件highcharts詳解
相關(guān)文章
圖片的左右移動(dòng),js動(dòng)畫效果實(shí)現(xiàn)代碼
圖片的左右移動(dòng),具備像蕩秋千一樣的動(dòng)畫效果,圖片自己可重新定義,移動(dòng)速度和距離也可在代碼內(nèi)設(shè)定,挺簡單的Js生成動(dòng)畫的特效代碼,僅供參考。2010-12-12
鼠標(biāo)移動(dòng)到一張圖片時(shí)變?yōu)榱硪粡垐D片
鼠標(biāo)移動(dòng)到一張圖片時(shí)變?yōu)榱硪粡垐D片...2006-12-12
感應(yīng)鼠標(biāo)的圖片遮罩動(dòng)畫效果
感應(yīng)鼠標(biāo)的圖片遮罩動(dòng)畫效果,鼠標(biāo)放上后會(huì)動(dòng)畫顯示文字提示,有意思哦,有興趣的朋友運(yùn)行一下看效果。2010-10-10

