da709a6889456158cf5c2c6af78c1ab1b2b5f287.svn-base 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%
  3. String path = request.getContextPath();
  4. %>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <!--框架必需start-->
  10. <script type="text/javascript" src="<%=path%>/libs/js/jquery.js"></script>
  11. <script type="text/javascript" src="<%=path%>/libs/js/language/cn.js"></script>
  12. <script type="text/javascript" src="<%=path%>/libs/js/framework.js"></script>
  13. <link href="<%=path%>/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  14. <link rel="stylesheet" type="text/css" id="skin" prePath="<%=path%>/"/>
  15. <link rel="stylesheet" type="text/css" id="customSkin"/>
  16. <!--框架必需end-->
  17. <script src="<%=path%>/libs/thirdparty/highcharts/js/highcharts.js"></script>
  18. <script src="<%=path%>/libs/thirdparty/highcharts/js/highcharts-more.js"></script>
  19. <script>
  20. $(function () {
  21. /**
  22. * Get the current time
  23. */
  24. function getNow () {
  25. var now = allGetServerTime();
  26. return {
  27. hours: now.getHours() + now.getMinutes() / 60,
  28. minutes: now.getMinutes() * 12 / 60 + now.getSeconds() * 12 / 3600,
  29. seconds: now.getSeconds() * 12 / 60
  30. };
  31. };
  32. /**
  33. * Pad numbers
  34. */
  35. function pad(number, length) {
  36. // Create an array of the remaining length +1 and join it with 0's
  37. return new Array((length || 2) + 1 - String(number).length).join(0) + number;
  38. }
  39. var now = getNow();
  40. // Create the chart
  41. $('#container').highcharts({
  42. chart: {
  43. type: 'gauge',
  44. plotBackgroundColor: null,
  45. plotBackgroundImage: null,
  46. plotBorderWidth: 0,
  47. plotShadow: false,
  48. height: 200
  49. },
  50. credits: {
  51. enabled: false
  52. },
  53. title: {
  54. text: '标题'
  55. },
  56. pane: {
  57. background: [{
  58. // default background
  59. }, {
  60. // reflex for supported browsers
  61. backgroundColor: Highcharts.svg ? {
  62. radialGradient: {
  63. cx: 0.5,
  64. cy: -0.4,
  65. r: 1.9
  66. },
  67. stops: [
  68. [0.5, 'rgba(255, 255, 255, 0.2)'],
  69. [0.5, 'rgba(200, 200, 200, 0.2)']
  70. ]
  71. } : null
  72. }]
  73. },
  74. yAxis: {
  75. labels: {
  76. distance: -20
  77. },
  78. min: 0,
  79. max: 12,
  80. lineWidth: 0,
  81. showFirstLabel: false,
  82. minorTickInterval: 'auto',
  83. minorTickWidth: 1,
  84. minorTickLength: 5,
  85. minorTickPosition: 'inside',
  86. minorGridLineWidth: 0,
  87. minorTickColor: '#666',
  88. tickInterval: 1,
  89. tickWidth: 2,
  90. tickPosition: 'inside',
  91. tickLength: 10,
  92. tickColor: '#666',
  93. title: {
  94. text: '',
  95. style: {
  96. color: '#BBB',
  97. fontWeight: 'normal',
  98. fontSize: '8px',
  99. lineHeight: '10px'
  100. },
  101. y: 10
  102. }
  103. },
  104. tooltip: {
  105. formatter: function () {
  106. return this.series.chart.tooltipText;
  107. }
  108. },
  109. series: [{
  110. data: [{
  111. id: 'hour',
  112. y: now.hours,
  113. dial: {
  114. radius: '60%',
  115. baseWidth: 4,
  116. baseLength: '95%',
  117. rearLength: 0
  118. }
  119. }, {
  120. id: 'minute',
  121. y: now.minutes,
  122. dial: {
  123. baseLength: '95%',
  124. rearLength: 0
  125. }
  126. }, {
  127. id: 'second',
  128. y: now.seconds,
  129. dial: {
  130. radius: '100%',
  131. baseWidth: 1,
  132. rearLength: '20%'
  133. }
  134. }],
  135. animation: false,
  136. dataLabels: {
  137. enabled: false
  138. }
  139. }]
  140. },
  141. // Move
  142. function (chart) {
  143. setInterval(function () {
  144. var hour = chart.get('hour'),
  145. minute = chart.get('minute'),
  146. second = chart.get('second'),
  147. now = getNow(),
  148. // run animation unless we're wrapping around from 59 to 0
  149. animation = now.seconds == 0 ?
  150. false :
  151. {
  152. easing: 'easeOutElastic'
  153. };
  154. // Cache the tooltip text
  155. chart.tooltipText =
  156. pad(Math.floor(now.hours), 2) + ':' +
  157. pad(Math.floor(now.minutes * 5), 2) + ':' +
  158. pad(now.seconds * 5, 2);
  159. hour.update(now.hours, true, animation);
  160. minute.update(now.minutes, true, animation);
  161. second.update(now.seconds, true, animation);
  162. }, 1000);
  163. });
  164. });
  165. // Extend jQuery with some easing (copied from jQuery UI)
  166. $.extend($.easing, {
  167. easeOutElastic: function (x, t, b, c, d) {
  168. var s=1.70158;var p=0;var a=c;
  169. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  170. if (a < Math.abs(c)) { a=c; var s=p/4; }
  171. else var s = p/(2*Math.PI) * Math.asin (c/a);
  172. return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  173. }
  174. });
  175. </script>
  176. </head>
  177. <body>
  178. <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
  179. </body>
  180. </html>