hxzt_hzdj.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. var weatherIcons = {
  2. 'Sunny': 'https://uploadfile.huiyi8.com/up/6a/a1/16/6aa116b7f58c59cfb52b606c96161330.png',
  3. 'Cloudy': 'https://uploadfile.huiyi8.com/up/6a/a1/16/6aa116b7f58c59cfb52b606c96161330.png',
  4. 'Showers': 'https://uploadfile.huiyi8.com/up/6a/a1/16/6aa116b7f58c59cfb52b606c96161330.png'
  5. };
  6. var seriesLabel = {
  7. normal: {
  8. show: true,
  9. textBorderColor: '#333',
  10. textBorderWidth: 2
  11. }
  12. }
  13. option_hxzt_hzdj = {
  14. title: {
  15. text: 'Weather Statistics'
  16. },
  17. tooltip: {
  18. trigger: 'axis',
  19. axisPointer: {
  20. type: 'shadow'
  21. }
  22. },
  23. legend: {
  24. data: ['City Alpha', 'City Beta', 'City Gamma']
  25. },
  26. grid: {
  27. left: 100
  28. },
  29. toolbox: {
  30. show: true,
  31. feature: {
  32. saveAsImage: {}
  33. }
  34. },
  35. xAxis: {
  36. type: 'value',
  37. name: 'Days',
  38. axisLabel: {
  39. formatter: '{value}'
  40. }
  41. },
  42. yAxis: {
  43. type: 'category',
  44. inverse: true,
  45. data: ['Sunny', 'Cloudy', 'Showers'],
  46. axisLabel: {
  47. formatter: function (value) {
  48. return '{' + value + '| }\n{value|' + value + '}';
  49. },
  50. margin: 20,
  51. rich: {
  52. value: {
  53. lineHeight: 30,
  54. align: 'center'
  55. },
  56. Sunny: {
  57. height: 40,
  58. align: 'center',
  59. backgroundColor: {
  60. image: weatherIcons.Sunny,
  61. }
  62. },
  63. Cloudy: {
  64. height: 40,
  65. align: 'center',
  66. backgroundColor: {
  67. image: weatherIcons.Cloudy
  68. }
  69. },
  70. Showers: {
  71. height: 40,
  72. align: 'center',
  73. backgroundColor: {
  74. image: weatherIcons.Showers
  75. }
  76. }
  77. }
  78. }
  79. },
  80. series: [
  81. {
  82. name: 'City Alpha',
  83. type: 'bar',
  84. data: [165, 170, 30],
  85. label: seriesLabel,
  86. markPoint: {
  87. symbolSize: 1,
  88. symbolOffset: [0, '50%'],
  89. label: {
  90. formatter: '{a|{a}\n}{b|{b} }{c|{c}}',
  91. backgroundColor: 'rgb(242,242,242)',
  92. borderColor: '#aaa',
  93. borderWidth: 1,
  94. borderRadius: 4,
  95. padding: [4, 10],
  96. lineHeight: 26,
  97. // shadowBlur: 5,
  98. // shadowColor: '#000',
  99. // shadowOffsetX: 0,
  100. // shadowOffsetY: 1,
  101. position: 'right',
  102. distance: 20,
  103. rich: {
  104. a: {
  105. align: 'center',
  106. color: '#fff',
  107. fontSize: 18,
  108. textShadowBlur: 2,
  109. textShadowColor: '#000',
  110. textShadowOffsetX: 0,
  111. textShadowOffsetY: 1,
  112. textBorderColor: '#333',
  113. textBorderWidth: 2
  114. },
  115. b: {
  116. color: '#333'
  117. },
  118. c: {
  119. color: '#ff8811',
  120. textBorderColor: '#000',
  121. textBorderWidth: 1,
  122. fontSize: 22
  123. }
  124. }
  125. },
  126. // data: [
  127. // {type: 'max', name: 'max days: '},
  128. // {type: 'min', name: 'min days: '}
  129. // ]
  130. }
  131. },
  132. {
  133. name: 'City Beta',
  134. type: 'bar',
  135. label: seriesLabel,
  136. data: [150, 105, 110]
  137. },
  138. {
  139. name: 'City Gamma',
  140. type: 'bar',
  141. label: seriesLabel,
  142. data: [220, 82, 63]
  143. }
  144. ]
  145. };