static.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. /**
  2. * Created by 30947 on 2018/7/18.
  3. */
  4. $(function(){
  5. char1();
  6. char2();
  7. char3();
  8. char4();
  9. char5();
  10. })
  11. //统计分析图
  12. function char1() {
  13. var myChart = echarts.init($("#char1")[0]);
  14. option = {
  15. tooltip : {
  16. trigger: 'item',
  17. formatter: "{a} <br/>{b} : {c} ({d}%)"
  18. },
  19. legend: {
  20. orient : 'vertical',
  21. x : 'right',
  22. textStyle : {
  23. color : '#ffffff',
  24. },
  25. data:['客运车','危险品车','网约车','学生校车']
  26. },
  27. calculable : false,
  28. series : [
  29. {
  30. name:'车类型',
  31. type:'pie',
  32. radius : ['40%', '70%'],
  33. itemStyle : {
  34. normal : {
  35. label : {
  36. show : false
  37. },
  38. labelLine : {
  39. show : false
  40. }
  41. },
  42. emphasis : {
  43. label : {
  44. show : true,
  45. position : 'center',
  46. textStyle : {
  47. fontSize : '20',
  48. fontWeight : 'bold'
  49. }
  50. }
  51. }
  52. },
  53. data:[
  54. {value:335, name:'客运车'},
  55. {value:310, name:'危险品车'},
  56. {value:234, name:'网约车'},
  57. {value:135, name:'学生校车'}
  58. ]
  59. }
  60. ]
  61. };
  62. myChart.setOption(option);
  63. window.addEventListener('resize', function () {myChart.resize();})
  64. }
  65. function char2() {
  66. var myChart = echarts.init($("#char2")[0]);
  67. option = {
  68. tooltip : {
  69. trigger: 'axis',
  70. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  71. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  72. }
  73. },
  74. grid: {show:'true',borderWidth:'0'},
  75. legend: {
  76. data:['行驶', '停车','熄火','离线'],
  77. textStyle : {
  78. color : '#ffffff',
  79. }
  80. },
  81. calculable :false,
  82. xAxis : [
  83. {
  84. type : 'value',
  85. axisLabel: {
  86. show: true,
  87. textStyle: {
  88. color: '#fff'
  89. }
  90. },
  91. splitLine:{
  92. lineStyle:{
  93. color:['#f2f2f2'],
  94. width:0,
  95. type:'solid'
  96. }
  97. }
  98. }
  99. ],
  100. yAxis : [
  101. {
  102. type : 'category',
  103. data : ['客运车','危险品车','网约车','学生校车'],
  104. axisLabel: {
  105. show: true,
  106. textStyle: {
  107. color: '#fff'
  108. }
  109. },
  110. splitLine:{
  111. lineStyle:{
  112. width:0,
  113. type:'solid'
  114. }
  115. }
  116. }
  117. ],
  118. series : [
  119. {
  120. name:'行驶',
  121. type:'bar',
  122. stack: '总量',
  123. itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
  124. data:[320, 302, 301, 334]
  125. },
  126. {
  127. name:'停车',
  128. type:'bar',
  129. stack: '总量',
  130. itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
  131. data:[120, 132, 101, 134]
  132. },
  133. {
  134. name:'熄火',
  135. type:'bar',
  136. stack: '总量',
  137. itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
  138. data:[220, 182, 191, 234]
  139. },
  140. {
  141. name:'离线',
  142. type:'bar',
  143. stack: '总量',
  144. itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
  145. data:[150, 212, 201, 154]
  146. }
  147. ]
  148. };
  149. myChart.setOption(option);
  150. window.addEventListener('resize', function () {myChart.resize();})
  151. }
  152. function char3() {
  153. var myChart = echarts.init($("#char3")[0]);
  154. option = {
  155. legend: {
  156. data:['车辆行驶数量'],
  157. textStyle : {
  158. color : '#ffffff',
  159. }
  160. },
  161. grid: {show:'true',borderWidth:'0'},
  162. calculable : false,
  163. tooltip : {
  164. trigger: 'axis',
  165. formatter: "Temperature : <br/>{b}km : {c}°C"
  166. },
  167. xAxis : [
  168. {
  169. type : 'value',
  170. axisLabel : {
  171. formatter: '{value}',
  172. textStyle: {
  173. color: '#fff'
  174. }
  175. },
  176. splitLine:{
  177. lineStyle:{
  178. width:0,
  179. type:'solid'
  180. }
  181. }
  182. }
  183. ],
  184. yAxis : [
  185. {
  186. type : 'category',
  187. axisLine : {onZero: false},
  188. axisLabel : {
  189. formatter: '{value} km',
  190. textStyle: {
  191. color: '#fff'
  192. }
  193. },
  194. splitLine:{
  195. lineStyle:{
  196. width:0,
  197. type:'solid'
  198. }
  199. },
  200. boundaryGap : false,
  201. data : ['0', '10', '20', '30', '40', '50', '60', '70', '80']
  202. }
  203. ],
  204. series : [
  205. {
  206. name:'车辆行驶数量',
  207. type:'line',
  208. smooth:true,
  209. itemStyle: {
  210. normal: {
  211. lineStyle: {
  212. shadowColor : 'rgba(0,0,0,0.4)'
  213. }
  214. }
  215. },
  216. data:[15, 0, 20, 45, 22.1, 25, 70, 55, 76]
  217. }
  218. ]
  219. };
  220. myChart.setOption(option);
  221. window.addEventListener('resize', function () {myChart.resize();})
  222. }
  223. function char4() {
  224. var myChart = echarts.init($("#char4")[0]);
  225. option = {
  226. grid: {show:'true',borderWidth:'0'},
  227. tooltip : {
  228. trigger: 'axis',
  229. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  230. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  231. },
  232. formatter: function (params) {
  233. var tar = params[0];
  234. return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value;
  235. }
  236. },
  237. xAxis : [
  238. {
  239. type : 'category',
  240. splitLine: {show:false},
  241. data : ['客运车','危险品车','网约车','学生校车'],
  242. axisLabel: {
  243. show: true,
  244. textStyle: {
  245. color: '#fff'
  246. }
  247. }
  248. }
  249. ],
  250. yAxis : [
  251. {
  252. type : 'value',
  253. splitLine: {show:false},
  254. axisLabel: {
  255. show: true,
  256. textStyle: {
  257. color: '#fff'
  258. }
  259. }
  260. }
  261. ],
  262. series : [
  263. {
  264. name:'报警数量',
  265. type:'bar',
  266. stack: '总量',
  267. itemStyle : { normal: {label : {show: true, position: 'inside'}}},
  268. data:[2900, 1200, 300, 200, 900, 300]
  269. }
  270. ]
  271. };
  272. myChart.setOption(option);
  273. window.addEventListener('resize', function () {myChart.resize();})
  274. }
  275. function char5() {
  276. var myChart = echarts.init($("#char5")[0]);
  277. option = {
  278. grid: {show:'true',borderWidth:'0'},
  279. tooltip : {
  280. trigger: 'axis',
  281. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  282. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  283. },
  284. formatter: function (params) {
  285. var tar = params[0];
  286. return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value;
  287. }
  288. },
  289. xAxis : [
  290. {
  291. type : 'category',
  292. splitLine: {show:false},
  293. data : ['客运车','危险品车','网约车','学生校车'],
  294. axisLabel: {
  295. show: true,
  296. textStyle: {
  297. color: '#fff'
  298. }
  299. }
  300. }
  301. ],
  302. yAxis : [
  303. {
  304. type : 'value',
  305. splitLine: {show:false},
  306. axisLabel: {
  307. show: true,
  308. textStyle: {
  309. color: '#fff'
  310. }
  311. }
  312. }
  313. ],
  314. series : [
  315. {
  316. name:'报警数量',
  317. type:'bar',
  318. stack: '总量',
  319. itemStyle : { normal: {label : {show: true, position: 'inside'}}},
  320. data:[2900, 1200, 300, 200, 900, 300]
  321. }
  322. ]
  323. };
  324. myChart.setOption(option);
  325. window.addEventListener('resize', function () {myChart.resize();})
  326. }