jquery.peity.js簡介

來源:互聯網
上載者:User

標籤:c   class   blog   java   a   tar   

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>  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.