利用jQuery实现饼图服务器资源统计代码



10 38 13



特效描述:利用jQuery实现 饼图服务器 资源统计代码,利用jQuery实现饼图服务器资源统计代码

代码结构

1. 引入CSS

<link rel="stylesheet" type="text/css" href="css/style.css" media="screen">
<link rel="stylesheet" type="text/css" href="css/jquery.easy-pie-chart.css" media="screen">
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen">
<link rel="stylesheet" type="text/css" href="css/jquery.easy-pie-chart.css" media="screen">

2. 引入JS

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/html5.js"></script>
<script type="text/javascript" src="js/excanvas.js"></script>
<script type="text/javascript" src="js/jquery.easy-pie-chart.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/html5.js"></script>
<script type="text/javascript" src="js/excanvas.js"></script>
<script type="text/javascript" src="js/jquery.easy-pie-chart.js"></script>

3. HTML代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<!--[if IE]>
<![endif]-->
<script type="text/javascript">
var initPieChart = function() {
	$('.percentage').easyPieChart({
		animate: 1000
	});
	$('.percentage-light').easyPieChart({
		barColor: function(percent) {
			percent /= 100;
			return "rgb(" + Math.round(255 * (1-percent)) + ", " + Math.round(255 * percent) + ", 0)";
		},
		trackColor: '#666',
		scaleColor: false,
		lineCap: 'butt',
		lineWidth: 15,
		animate: 1000
	});
	$('.updateEasyPieChart').on('click', function(e) {
	  e.preventDefault();
	  $('.percentage, .percentage-light').each(function() {
		var newValue = Math.round(100*Math.random());
		$(this).data('easyPieChart').update(newValue);
		$('span', this).text(newValue);
	  });
	});
};
</script>
</head>
<body onLoad="initPieChart();">
<div class="container">
	<h1>EASY饼图</h1>
	<div class="chart">
		<div class="percentage" data-percent="55"><span>55</span>%</div>
		<div class="label">新的访问</div>
	</div>
	<div class="chart">
		<div class="percentage" data-percent="46"><span>46</span>%</div>
		<div class="label">跳出率</div>
	</div>
	<div class="chart">
		<div class="percentage" data-percent="92"><span>92</span>%</div>
		<div class="label">服务器负载</div>
	</div>
	<div class="chart">
		<div class="percentage" data-percent="84"><span>752</span>MB</div>
		<div class="label">使用的RAM</div>
	</div>
	<div style="clear:both;"></div>
	<div class="dark">
		<div class="chart">
			<div class="percentage-light" data-percent="55"><span>55</span>%</div>
			<div class="label">新的访问</div>
		</div>
		<div class="chart">
			<div class="percentage-light" data-percent="46"><span>46</span>%</div>
			<div class="label">跳出率</div>
		</div>
		<div class="chart">
			<div class="percentage-light" data-percent="92"><span>92</span>%</div>
			<div class="label">服务器负载</div>
		</div>
		<div class="chart">
			<div class="percentage-light" data-percent="84"><span>752</span>MB</div>
			<div class="label">使用的RAM</div>
		</div>
		<div style="clear:both;"></div>
	</div>
	<p><a href="#" class="button updateEasyPieChart">更新饼图</a></p>
</div>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>
</body>
</html>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 切换按钮 表单 表单美化 表单插件 表单美化插件 按钮控制
×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到