Jquery.peity.js Introduction

Source: Internet
Author: User

jquery Simple Chart Peity.js

[JavaScript]
  1. "http://www.w3.org/1999/xhtml" >
  2. <title> Untitled Page </title>
  3. <script type="Text/javascript" src="jquery.js"></script>
  4. <script type="Text/javascript" src="jquery.peity.js"></script>
  5. <script type="Text/javascript">
  6. JQuery (function() {
  7. $ (". Bar-colours-1"). Peity ("Bar", {
  8. Colours: ["Red", "green", "Blue"],width:100,height:100
  9. })
  10. $ (". Bar-colours-2"). Peity ("Bar", {
  11. Colours: function(value) {
  12. return value > 0? "Green"  :  "Red"   
  13. },width:100,height:100
  14. })
  15. $ (". bar-colours-3"). Peity ("Bar", {
  16. Colours: function(_, I, all) {
  17. var g = parseint ((i/all.length) * 255)
  18. return "RGB (255," + G + ", 0)"
  19. },width:100,height:100
  20. })
  21. $ (". Pie-colours-1"). Peity ("pie", {
  22. Colours: ["Cyan", "Magenta", "Yellow" , "BLACK" ],diameter:100
  23. })
  24. $ (". Pie-colours-2"). Peity ("pie", {
  25. Colours: function(_, I, all) {
  26. var g = parseint ((i/all.length) * 255)
  27. return "RGB (255," + G + ", 0)"
  28. },diameter:100
  29. })
  30. var  Updatingchart = $ (". Updating-chart"). Peity ("line", {width:150,height:50})
  31. SetInterval (function() {
  32. var random = Math.Round (Math.random () *)
  33. var values = Updatingchart.text (). Split (",")
  34. Values.shift ()
  35. Values.push (Random)
  36. Updatingchart
  37. . Text (Values.join (","))
  38. . Change ()
  39. }, 1000)
  40. })
  41. </script>
  42. <body>
  43. <span class="bar-colours-1">5,3,9,6,5,9,7,3,5,2</span>
  44. <span class="bar-colours-2">5,3,2,-1,-3,-2,2,3,5,2</span>
  45. <span class="bar-colours-3">0,-3,-6,-4,-5,-4,-7,-3,-5,-2</span>
  46. <br/>
  47. <span class="pie-colours-1">4,7,6,5</span>
  48. <span class="pie-colours-2">5,3,9,6,5</span>
  49. <br/>
  50. <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>
  51. </body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.