jquery.peity.js简介

jQuery简单图表peity.js

 

[javascript] 
  1. <html xmlns="http://www.w3.org/1999/xhtml">  
  2. <head>  
  3.     <title>无标题页</title>  
  4.     <script type="text/javascript" src="jQuery.js"></script>  
  5.     <script type="text/javascript" src="jquery.peity.js"></script>  
  6.     <script type="text/javascript">  
  7.         jQuery(function(){  
  8.             $(".bar-colours-1").peity("bar", {  
  9.               colours: ["red""green""blue"],width: 100,height:100  
  10.             })  
  11.             $(".bar-colours-2").peity("bar", {  
  12.               colours: function(value) {  
  13.                 return value > 0 ? "green" : "red"  
  14.               },width: 100,height:100  
  15.             })  
  16.             $(".bar-colours-3").peity("bar", {  
  17.               colours: function(_, i, all) {  
  18.                 var g = parseInt((i / all.length) * 255)  
  19.                 return "rgb(255, " + g + ", 0)"  
  20.               },width: 100,height:100  
  21.             })  
  22.             $(".pie-colours-1").peity("pie", {  
  23.               colours: ["cyan""magenta""yellow""black"],diameter:100  
  24.             })  
  25.             $(".pie-colours-2").peity("pie", {  
  26.               colours: function(_, i, all) {  
  27.                 var g = parseInt((i / all.length) * 255)  
  28.                 return "rgb(255, " + g + ", 0)"  
  29.               },diameter:100  
  30.             })  
  31.              
  32.              
  33.             var updatingChart = $(".updating-chart").peity("line", { width: 150,height:50})  
  34.             setInterval(function() {  
  35.               var random = Math.round(Math.random() * 10)  
  36.               var values = updatingChart.text().split(",")  
  37.               values.shift()  
  38.               values.push(random)  
  39.               updatingChart  
  40.                 .text(values.join(","))  
  41.                 .change()  
  42.             }, 1000)  
  43.         })  
  44.     </script>  
  45. </head>  
  46. <body>  
  47.     <span class="bar-colours-1">5,3,9,6,5,9,7,3,5,2</span>  
  48.     <span class="bar-colours-2">5,3,2,-1,-3,-2,2,3,5,2</span>  
  49.     <span class="bar-colours-3">0,-3,-6,-4,-5,-4,-7,-3,-5,-2</span>  
  50.     <br />  
  51.     <span class="pie-colours-1">4,7,6,5</span>  
  52.     <span class="pie-colours-2">5,3,9,6,5</span>  
  53.     <br />  
  54.     <span class="updating-chart">5,3,9,6,5,9,7,3,5,2,5,3,9,6,5,9,7,3,5,2</span>  
  55. </body>  
  56. </html>  

转载于:https://www.cnblogs.com/ada-zheng/p/3760923.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值