mtxhMobileBody.htm 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. marginTop: 30,
  19. marginRight: 10,
  20. marginBottom: 55,
  21. animation: {
  22. duration: 1000
  23. }
  24. },
  25. title: {
  26. text: "每天消耗",
  27. style: {
  28. fontSize: 16
  29. }
  30. },
  31. exporting: {
  32. enabled: false
  33. },
  34. credits: {
  35. enabled: false
  36. },
  37. xAxis: {
  38. labels: {
  39. step: 2,
  40. rotation: 0,
  41. align: "center",
  42. style: {
  43. fontSize: "12px",
  44. }
  45. },
  46. categories: eval($("#categories").val()),
  47. },
  48. yAxis: {
  49. title: {
  50. text: null
  51. }
  52. },
  53. legend: {
  54. enabled: true,
  55. x: 0,
  56. y: 13,
  57. align: "center",
  58. layout: "horizontal",
  59. verticalAlign: "bottom",
  60. floating: false,
  61. backgroundColor: "rgba(0,0,0,0)",
  62. borderColor: "#CCC",
  63. borderWidth: 1,
  64. shadow: false,
  65. },
  66. tooltip: {
  67. followPointer: true,
  68. followTouchMove: true, // 跟随手指滑动显示
  69. formatter: function () {
  70. return "<b>" + this.x + "时</b><br/>" + this.series.name +
  71. ": " + "<b>" + this.y + "Kg</b><br/>";
  72. }
  73. },
  74. series: [{
  75. name: "今天",
  76. data: eval($("#dataToday").val()),
  77. }, {
  78. name: "昨天",
  79. data: eval($("#dataYtd").val()),
  80. }]
  81. });
  82. });
  83. </script>
  84. </head>
  85. <body>
  86. <input type="hidden" value="$!type" id="type">
  87. <input type="hidden" id="categories" name="categories" value="$!categories" />
  88. <input type="hidden" id="dataToday" name="dataToday" value="$!dataToday" />
  89. <input type="hidden" id="dataYtd" name="dataYtd" value="$!dataYtd" />
  90. <div id="container" style="width: 100%; height: 100%;"></div>
  91. </body>
  92. </html>