scscsMobileBody.htm 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>时采食次数</title>
  5. <script type="text/javascript">
  6. var defaultColors = ["#3a8ecf", "#a9b2cf"];
  7. Highcharts.setOptions({
  8. colors: defaultColors,
  9. lang: {
  10. resetZoom: "重置"
  11. }
  12. });
  13. $(function () {
  14. $("#container").highcharts({
  15. chart: {
  16. type: "column",
  17. backgroundColor: "rgba(0,0,0,0)", // 背景颜色
  18. margin: [50, 10, 55, 40],
  19. animation: {
  20. duration: 1000
  21. }
  22. },
  23. title: {
  24. text: "时采食次数",
  25. style: {
  26. fontSize: 16
  27. }
  28. },
  29. exporting: {
  30. enabled: false
  31. },
  32. credits: {
  33. enabled: false
  34. },
  35. xAxis: {
  36. labels: {
  37. step: 2,
  38. rotation: 0,
  39. align: "center",
  40. style: {
  41. fontSize: "12px",
  42. }
  43. },
  44. categories: eval($("#categories").val()),
  45. },
  46. yAxis: {
  47. min: 0,
  48. title: {
  49. text: null
  50. }
  51. },
  52. legend: {
  53. enabled: true,
  54. x: 0,
  55. y: 13,
  56. align: "center",
  57. layout: "horizontal",
  58. verticalAlign: "bottom",
  59. floating: false,
  60. backgroundColor: "rgba(0,0,0,0)",
  61. borderColor: "#CCC",
  62. borderWidth: 1,
  63. shadow: false,
  64. },
  65. tooltip: {
  66. followPointer: true,
  67. followTouchMove: true, // 跟随手指滑动显示
  68. formatter: function () {
  69. return "<b>" + this.x + "时</b><br/>" + this.series.name +
  70. ": " + "<b>" + this.y + "次</b><br/>";
  71. }
  72. },
  73. series: [{
  74. name: "今天",
  75. data: eval($("#dataToday").val()),
  76. }, {
  77. name: "昨天",
  78. data: eval($("#dataYtd").val()),
  79. }]
  80. });
  81. });
  82. </script>
  83. </head>
  84. <body>
  85. <input type="hidden" value="$!type" id="type">
  86. <input type="hidden" id="categories" name="categories" value="$!categories" />
  87. <input type="hidden" id="dataToday" name="dataToday" value="$!dataToday" />
  88. <input type="hidden" id="dataYtd" name="dataYtd" value="$!dataYtd" />
  89. <div id="container" style="width: 100%; height: 100%;"></div>
  90. </body>
  91. </html>