sparkline.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('线状图')" />
  5. </head>
  6. <body class="gray-bg">
  7. <div class="wrapper wrapper-content animated fadeInDown">
  8. <div class="row">
  9. <div class="col-sm-5">
  10. <div class="jumbotron">
  11. <h1>Sparkline</h1>
  12. <p>这是另一个可视化图表库</p>
  13. <p><a href="http://omnipotent.net/jquery.sparkline" target="_blank" class="btn btn-primary btn-lg" role="button">了解 Sparkline</a>
  14. </p>
  15. </div>
  16. </div>
  17. <div class="col-sm-7">
  18. <div class="ibox float-e-margins">
  19. <div class="ibox-title">
  20. <h5>Sparkline图表 <small>自定义颜色</small></h5>
  21. <div class="ibox-tools">
  22. <a class="close-link">
  23. <i class="fa fa-times"></i>
  24. </a>
  25. </div>
  26. </div>
  27. <div>
  28. <table class="table table-bordered white-bg">
  29. <thead>
  30. <tr>
  31. <th>图表</th>
  32. <th>类型</th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. <tr>
  37. <td>
  38. <span id="sparkline1"></span>
  39. </td>
  40. <td>
  41. 内联线性图
  42. </td>
  43. </tr>
  44. <tr>
  45. <td>
  46. <span id="sparkline2"></span>
  47. </td>
  48. <td>
  49. 柱状图
  50. </td>
  51. </tr>
  52. <tr>
  53. <td>
  54. <span id="sparkline3"></span>
  55. </td>
  56. <td>
  57. 饼状图
  58. </td>
  59. </tr>
  60. <tr>
  61. <td>
  62. <span id="sparkline4"></span>
  63. </td>
  64. <td>
  65. 长线性图
  66. </td>
  67. </tr>
  68. <tr>
  69. <td>
  70. <span id="sparkline5"></span>
  71. </td>
  72. <td>
  73. 三态图
  74. </td>
  75. </tr>
  76. <tr>
  77. <td>
  78. <span id="sparkline6"></span>
  79. </td>
  80. <td>
  81. 散点图
  82. </td>
  83. </tr>
  84. </tbody>
  85. </table>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="row">
  91. <div class="col-sm-4">
  92. <div class="ibox float-e-margins">
  93. <div class="ibox-title">
  94. <h5>自定义饼状图尺寸</h5>
  95. <div class="ibox-tools">
  96. <a class="collapse-link">
  97. <i class="fa fa-chevron-up"></i>
  98. </a>
  99. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  100. <i class="fa fa-wrench"></i>
  101. </a>
  102. <ul class="dropdown-menu dropdown-user">
  103. <li><a href="#">选项1</a>
  104. </li>
  105. <li><a href="#">选项2</a>
  106. </li>
  107. </ul>
  108. <a class="close-link">
  109. <i class="fa fa-times"></i>
  110. </a>
  111. </div>
  112. </div>
  113. <div class="ibox-content text-center h-200">
  114. <span id="sparkline7"></span>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="col-sm-4">
  119. <div class="ibox float-e-margins">
  120. <div class="ibox-title">
  121. <h5>自定义柱状图尺寸</h5>
  122. <div class="ibox-tools">
  123. <a class="collapse-link">
  124. <i class="fa fa-chevron-up"></i>
  125. </a>
  126. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  127. <i class="fa fa-wrench"></i>
  128. </a>
  129. <ul class="dropdown-menu dropdown-user">
  130. <li><a href="#">选项1</a>
  131. </li>
  132. <li><a href="#">选项2</a>
  133. </li>
  134. </ul>
  135. <a class="close-link">
  136. <i class="fa fa-times"></i>
  137. </a>
  138. </div>
  139. </div>
  140. <div class="ibox-content text-center h-200">
  141. <span id="sparkline8"></span>
  142. </div>
  143. </div>
  144. </div>
  145. <div class="col-sm-4">
  146. <div class="ibox float-e-margins">
  147. <div class="ibox-title">
  148. <h5>自定义线性图尺寸</h5>
  149. <div class="ibox-tools">
  150. <a class="collapse-link">
  151. <i class="fa fa-chevron-up"></i>
  152. </a>
  153. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  154. <i class="fa fa-wrench"></i>
  155. </a>
  156. <ul class="dropdown-menu dropdown-user">
  157. <li><a href="#">选项1</a>
  158. </li>
  159. <li><a href="#">选项2</a>
  160. </li>
  161. </ul>
  162. <a class="close-link">
  163. <i class="fa fa-times"></i>
  164. </a>
  165. </div>
  166. </div>
  167. <div class="ibox-content text-center h-200">
  168. <span id="sparkline9"></span>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. <th:block th:include="include :: footer" />
  175. <th:block th:include="include :: sparkline-js" />
  176. <script type="text/javascript">
  177. $(function () {
  178. $("#sparkline1").sparkline([34, 43, 43, 35, 44, 32, 44, 52, 25], {
  179. type: 'line',
  180. lineColor: '#17997f',
  181. fillColor: '#1ab394',
  182. });
  183. $("#sparkline2").sparkline([5, 6, 7, 2, 0, -4, -2, 4], {
  184. type: 'bar',
  185. barColor: '#1ab394',
  186. negBarColor: '#c6c6c6'});
  187. $("#sparkline3").sparkline([1, 1, 2], {
  188. type: 'pie',
  189. sliceColors: ['#1ab394', '#b3b3b3', '#e4f0fb']});
  190. $("#sparkline4").sparkline([34, 43, 43, 35, 44, 32, 15, 22, 46, 33, 86, 54, 73, 53, 12, 53, 23, 65, 23, 63, 53, 42, 34, 56, 76, 15, 54, 23, 44], {
  191. type: 'line',
  192. lineColor: '#17997f',
  193. fillColor: '#ffffff',
  194. });
  195. $("#sparkline5").sparkline([1, 1, 0, 1, -1, -1, 1, -1, 0, 0, 1, 1], {
  196. type: 'tristate',
  197. posBarColor: '#1ab394',
  198. negBarColor: '#bfbfbf'});
  199. $("#sparkline6").sparkline([4, 6, 7, 7, 4, 3, 2, 1, 4, 4, 5, 6, 3, 4, 5, 8, 7, 6, 9, 3, 2, 4, 1, 5, 6, 4, 3, 7, ], {
  200. type: 'discrete',
  201. lineColor: '#1ab394'});
  202. $("#sparkline7").sparkline([52, 12, 44], {
  203. type: 'pie',
  204. height: '150px',
  205. sliceColors: ['#1ab394', '#b3b3b3', '#e4f0fb']});
  206. $("#sparkline8").sparkline([5, 6, 7, 2, 0, 4, 2, 4, 5, 7, 2, 4, 12, 14, 4, 2, 14, 12, 7], {
  207. type: 'bar',
  208. barWidth: 8,
  209. height: '150px',
  210. barColor: '#1ab394',
  211. negBarColor: '#c6c6c6'});
  212. $("#sparkline9").sparkline([34, 43, 43, 35, 44, 32, 15, 22, 46, 33, 86, 54, 73, 53, 12, 53, 23, 65, 23, 63, 53, 42, 34, 56, 76, 15, 54, 23, 44], {
  213. type: 'line',
  214. lineWidth: 1,
  215. height: '150px',
  216. lineColor: '#17997f',
  217. fillColor: '#ffffff',
  218. });
  219. });
  220. </script>
  221. </body>
  222. </html>