indiktab 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # indiktab
  2. ! $ARGS[0]
  3. ! ARGS[1] ... percentage
  4. ! ARGS[2] ... real value
  5. ! ARGS[3] ... text for type 3 bar
  6. ap = ARGS[1]
  7. ar = ARGS[2]
  8. if ap > 100:ap = 100
  9. if ap < 0:ap = 0
  10. $apc = ap
  11. $apg = 100-ap
  12. if Enable_Android = 1:
  13. $vbcolor = 'gray'
  14. else
  15. $vbcolor = '#d0d0d0'
  16. end
  17. $vfcolor='rgb(<<(16777216 + bcolor) mod 256>>,<<(16777216 + bcolor)/256 mod 256>>,<<(16777216 + bcolor)/65536>>)'
  18. if $ARGS[0] = '1':
  19. if Enable_Android = 1:
  20. if ap >= 65:
  21. $vcolor = 'green'
  22. elseif ap >= 35:
  23. $vcolor = 'blue'
  24. else
  25. $vcolor = 'red'
  26. end
  27. else
  28. if ap >= 85:
  29. $vcolor = 'green'
  30. elseif ap >= 70:
  31. $vcolor = '#b3b300'
  32. elseif ap >= 50:
  33. $vcolor = '#00CED1'
  34. elseif ap >= 20:
  35. $vcolor = 'blue'
  36. elseif ap >= 10:
  37. $vcolor = '#ff6600'
  38. else
  39. $vcolor = 'red'
  40. end
  41. end
  42. if ap = 0: $vcolor = $vbcolor
  43. if ap = 100: $vbcolor = $vcolor
  44. $result = '<TABLE cellpadding="0" cellspacing="0" width="220"><TR><TD bgcolor="<<$vcolor>>" width="<<$apc>>%"></TD><TD bgcolor="<<$vbcolor>>" width="<<$apg>>%"></TD><TD width="40" align="right"><<ar>></TD></TR></TABLE>'
  45. end
  46. if $ARGS[0] = '2':
  47. if Enable_Android = 1:
  48. if ap >= 85:
  49. $vcolor = 'red'
  50. elseif ap >= 65:
  51. $vcolor = 'orange'
  52. elseif ap >= 45:
  53. $vcolor = 'yellow>'
  54. elseif ap >= 25:
  55. $vcolor = 'green'
  56. else
  57. $vcolor = 'blue'
  58. end
  59. else
  60. if ap >= 90:
  61. $vcolor = '#ff0000'
  62. elseif ap >= 80:
  63. $vcolor = '#ff1a1a'
  64. elseif ap >= 70:
  65. $vcolor = '#ff3333'
  66. elseif ap >= 60:
  67. $vcolor = '#ff4d4d'
  68. elseif ap >= 50:
  69. $vcolor = '#ff6666'
  70. elseif ap >= 40:
  71. $vcolor = '#ff8080'
  72. elseif ap >= 30:
  73. $vcolor = '#e68080'
  74. elseif ap >= 20:
  75. $vcolor = '#cc8080'
  76. elseif ap >= 10:
  77. $vcolor = '#b38080'
  78. else
  79. $vcolor = '#998080'
  80. end
  81. end
  82. if ap = 0: $vcolor = $vbcolor
  83. if ap = 100: $vbcolor = $vcolor
  84. $result = '<font color="<<$vfcolor>>"><TABLE cellpadding="0" cellspacing="0" width="220"><TR><TD bgcolor="<<$vcolor>>" width="<<$apc>>%"></TD><TD bgcolor="<<$vbcolor>>" width="<<$apg>>%"></TD><TD width="40" align="right"><<ar>></TD></TR></TABLE></font>'
  85. end
  86. if $ARGS[0] = '3':
  87. ap = ar
  88. if Enable_Android = 1:
  89. if ap >= 130:
  90. $vcolor = 'green'
  91. elseif ap >= 70:
  92. $vcolor = 'blue'
  93. else
  94. $vcolor = 'red'
  95. end
  96. else
  97. if ap < 20:
  98. $vcolor = '#b3b300'
  99. elseif ap < 60:
  100. $vcolor = '#00CED1'
  101. elseif ap <= 140:
  102. $vcolor = 'blue'
  103. elseif ap <= 180:
  104. $vcolor = '#00CED1'
  105. else
  106. $vcolor = '#b3b300'
  107. end
  108. end
  109. if ap < 100:
  110. ap = (100-ap)/2
  111. apg = 50 - ap
  112. $result = '<TABLE cellpadding="0" cellspacing="0" width="220"><TR><TD bgcolor="<<$vbcolor>>" width="<<apg>>%"></TD><TD bgcolor="<<$vcolor>>" width="<<ap>>%"></TD><TD bgcolor="<<$vbcolor>>" width="50%"><<$ARGS[3]>></TD><TD width="40" align="right">-<<100-ar>></TD></TR></TABLE>'
  113. else
  114. ap = (ap - 100)/2
  115. apg = 50 - ap
  116. $result = '<TABLE cellpadding="0" cellspacing="0" width="220"><TR><TD bgcolor="<<$vbcolor>>" width="50%"><<$ARGS[3]>></TD><TD bgcolor="<<$vcolor>>" width="<<ap>>%"></TD><TD bgcolor="<<$vbcolor>>" width="<<apg>>%"></TD><TD width="40" align="right"><<ar-100>></TD></TR></TABLE>'
  117. end
  118. end
  119. killvar 'ap'
  120. killvar 'ar'
  121. killvar '$apg'
  122. killvar '$apc'
  123. killvar '$vcolor'
  124. killvar '$vfcolor'
  125. --- indiktab ---------------------------------