久久资源网

jQuery饼图服务器数据统计代码

jQuery饼图服务器数据统计代码

2019-04-28 08:53:51 其它特效

售价:5.00积分 会员免费

特别声明:资源售价只是赞助,不代表代码或者素材本身点数。收取费用仅维持本站的日常运营所需!

jQuery饼图服务器数据统计代码

jQuery基于EASY饼图制作服务器新的访问,跳出率,负载,使用情况等canvas图表统计数据模板代码。

 

使用方法

1、head引入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">

2、head引入js文件

<script type="text/javascript" src="js/jquery.min.js"></script>

<!--[if IE]>
<script type="text/javascript" src="js/html5.js"></script>
<![endif]-->

<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">
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>

3、body引入HTML代码

<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>


</body>

资源出处:https://www.moyublog.com/codes/1631.html

关注微信