nhsjClientMain.htm 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>sd</title>
  5. <script type="text/javascript">
  6. $(function(){
  7. if ($("#qyid").val() > 0) {
  8. var chartADiv = $("#chartB");
  9. $("#chartDiv_L").attr("style", "width:" + chartADiv.width() + "px");
  10. $("#chartDiv_L").attr("style", "height:" + (chartADiv.height() - 7) + "px");
  11. jQuery.ajax({
  12. type : "get",
  13. url : "getHkClientNhsjTjt.htm",
  14. data : {"qyid" : $("#qyid").val()},
  15. dataType : "json",
  16. async : true,
  17. success : function(data) {
  18. nhsj(data, "chartDiv_L");
  19. }
  20. });
  21. }
  22. });
  23. function nhsj(data, id) {
  24. var chart = new Highcharts.chart(id, {
  25. chart: {
  26. zoomType: 'xy',
  27. backgroundColor : 'transparent',
  28. spacingLeft : 0,
  29. spacingBottom : 0,
  30. },
  31. title: {
  32. text: ''
  33. },
  34. xAxis: [{
  35. categories: data.h,
  36. crosshair: true
  37. }],
  38. yAxis: [{ // Primary yAxis
  39. labels: {
  40. format: '{value}',
  41. style: {
  42. color: "#3a8ecf"
  43. }
  44. },
  45. title: {
  46. text: '水量(t)',
  47. style: {
  48. color: "#3a8ecf"
  49. }
  50. }
  51. }, { // Secondary yAxis
  52. title: {
  53. text: '电量(kw*h)',
  54. style: {
  55. color: "#f6bd0f"
  56. }
  57. },
  58. labels: {
  59. format: '{value}',
  60. style: {
  61. color: "#f6bd0f"
  62. }
  63. },
  64. opposite: true,
  65. allowDecimals: false,
  66. gridLineColor: "#142c4c"
  67. }],
  68. tooltip: {
  69. shared: true
  70. },
  71. colors: ["#3a8ecf", "#f6bd0f"],
  72. credits: {
  73. enabled: false
  74. },
  75. legend: {
  76. enabled : false,
  77. layout: 'vertical',
  78. align: 'left',
  79. x: 60,
  80. verticalAlign: 'top',
  81. y: 20,
  82. floating: true,
  83. backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
  84. },
  85. series: [{
  86. name: '电量',
  87. type: 'column',
  88. yAxis: 1,
  89. data: data.dl,
  90. tooltip: {
  91. valueSuffix: ' kw*h'
  92. }
  93. }, {
  94. name: '水量',
  95. type: 'column',
  96. data: data.sl,
  97. tooltip: {
  98. valueSuffix: ' t'
  99. }
  100. }]
  101. });
  102. }
  103. </script>
  104. </head>
  105. <body>
  106. <input type="hidden" id="qyid" value="$!qyid"/>
  107. <div>
  108. <div id="chartDiv_L"></div>
  109. </div>
  110. </body>
  111. </html>