loadEcharts.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. var Echarts = function () {
  2. var init = function () {
  3. xcwttj();
  4. loadqsjkdw();;
  5. };
  6. /**巡查问题统计**/
  7. var xcwttj = function () {
  8. var myCharts = echarts.init(document.getElementById('spwttjEchart'));
  9. var option = {
  10. tooltip: {
  11. trigger: 'axis',
  12. axisPointer: {
  13. type: 'none'
  14. },
  15. formatter: function (params) {
  16. return params[0].name + ': ' + params[0].value;
  17. }
  18. },
  19. grid:{
  20. top:'5px',
  21. bottom:'30px',
  22. left:'45px',
  23. right:'5px'
  24. },
  25. xAxis: {
  26. data: ['张三', '李四', '王二', '周五', '李三', '张飞','赵云' ],
  27. axisTick: {show: false},
  28. axisLine: {show: true,
  29. lineStyle:{
  30. color:'#353E47'
  31. }},
  32. axisLabel: {
  33. textStyle: {
  34. color: '#ffffff'
  35. },
  36. interval:0
  37. }
  38. },
  39. yAxis: {
  40. splitLine: {show: true,
  41. lineStyle:{
  42. color:'#353E47'
  43. }
  44. },
  45. axisTick: {show: false},
  46. axisLine: {show: true,
  47. lineStyle:{
  48. color:'#353E47'
  49. }},
  50. axisLabel: {
  51. textStyle: {
  52. color: '#ffffff'
  53. },
  54. formatter:function(value,index){
  55. var r = '';
  56. if(value>100000000){//亿
  57. r = (value/100000000).toFixed(1) + '亿';
  58. }else if(value>10000){//万
  59. r = (value/10000).toFixed(1) + '万';
  60. }else{
  61. r = value;
  62. }
  63. return r;
  64. }
  65. }
  66. },
  67. series: [{
  68. name: 'hill',
  69. type: 'scatter',
  70. barCategoryGap: '10%',
  71. symbol: 'circle',
  72. symbolSize:35,
  73. itemStyle: {
  74. normal: {
  75. color: function(params) {
  76. var colorList = [
  77. '#4BB60B','#2EE466','#53D6CB','#4ED3FE','#4E5FFE','#9F31FD','#E221FF'
  78. ];
  79. return colorList[params.dataIndex%colorList.length]
  80. },
  81. label:{
  82. show:true,
  83. position:'inside',
  84. // formatter:'{c}'
  85. formatter:function(value,index){
  86. var r = '';
  87. if(value.data>100000000){//亿
  88. r = (value.data/100000000).toFixed(1) + '亿';
  89. }else if(value.data>10000){//万
  90. r = (value.data/10000).toFixed(1) + '万';
  91. }else{
  92. r = value.data;
  93. }
  94. return r;
  95. }
  96. }
  97. },
  98. emphasis: {
  99. // opacity: 1
  100. }
  101. },
  102. data: [50000, 62537, 20005,124757,72433,29634,85356],
  103. z: 10
  104. }]
  105. };
  106. myCharts.clear();
  107. myCharts.setOption(option);
  108. };
  109. /**全市监控点位统计**/
  110. var loadqsjkdw = function () {
  111. var myCharts = echarts.init(document.getElementById('qsjkdwEcharts'));
  112. var option = {
  113. grid: {
  114. left: '5px',
  115. right: '0%',
  116. bottom: '18%',
  117. top:'10%',
  118. },
  119. tooltip: {
  120. show: "true",
  121. trigger: 'axis',
  122. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  123. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  124. },
  125. formatter:'{b0}:{c0}'
  126. },
  127. yAxis: {
  128. show:false,
  129. splitLine: {show: false,
  130. lineStyle:{
  131. color:'#353E47'
  132. }
  133. },
  134. axisTick: {show: false},
  135. axisLine: {show: true,
  136. lineStyle:{
  137. color:'#353E47'
  138. }},
  139. axisLabel: {
  140. textStyle: {
  141. color: '#ffffff'
  142. },
  143. formatter:function(value,index){
  144. var r = '';
  145. if(value>100000000){//亿
  146. r = (value/100000000).toFixed(1) + '亿';
  147. }else if(value>10000){//万
  148. r = (value/10000).toFixed(1) + '万';
  149. }else{
  150. r = value;
  151. }
  152. return r;
  153. }
  154. }
  155. },
  156. xAxis: [
  157. {
  158. type: 'category',
  159. axisTick: {
  160. show: false
  161. },
  162. axisLine: {
  163. show: true,
  164. lineStyle: {
  165. color: '#353E47',
  166. }
  167. },
  168. axisLabel:{
  169. textStyle:{
  170. color:'#fff'
  171. },
  172. interval:0
  173. },
  174. data: ["南京","苏州","无锡","常州","南通","徐州","淮安","镇江","泰州"]
  175. }
  176. ],
  177. series: [
  178. {
  179. name: '',
  180. type: 'bar',
  181. barWidth:'20px',
  182. itemStyle: {
  183. normal: {
  184. show: true,
  185. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  186. offset: 0,
  187. color: '#00d891'
  188. }, {
  189. offset: 1,
  190. color: '#00579a'
  191. }]),
  192. barBorderRadius: 50,
  193. borderWidth: 0,
  194. borderColor: '#333',
  195. }
  196. },
  197. label: {
  198. normal: {
  199. show: true,
  200. position: 'top',
  201. textStyle: {
  202. color: '#fff'
  203. }
  204. }
  205. },
  206. data:[
  207. {value:'23', name:'亭湖区'},
  208. {value:'24', name:'盐都区'},
  209. {value:'25', name:'大丰区'},
  210. {value:'26', name:'响水县'},
  211. {value:'27', name:'滨海县'},
  212. {value:'28', name:'阜宁县'},
  213. {value:'30', name:'射阳县'},
  214. {value:'31', name:'建湖县'},
  215. {value:'32', name:'东台市'}
  216. ]
  217. }
  218. ]
  219. };
  220. myCharts.clear();
  221. myCharts.setOption(option);
  222. myCharts.on("click",function(e){
  223. loadsqjkdw();
  224. });
  225. };
  226. var loadsqjkdw = function () {
  227. var myCharts = echarts.init(document.getElementById('qsjkdwEcharts'));
  228. var option = {
  229. tooltip: {
  230. trigger: 'item',
  231. formatter: '{a} <br/>{b} : {c}'
  232. },
  233. toolbox:{
  234. show:true,
  235. showTitle:true,
  236. top:0,
  237. right:20,
  238. iconStyle:{
  239. normal:{color:'#30B5FF'}
  240. },
  241. feature:{
  242. myBack:{
  243. show:true,
  244. title:'返回',
  245. icon:'path://M940.748908 897.124226s-8.766506 22.571552-20.437775 0c0 0-130.44811-393.710528-448.442318-294.543139v122.214024s-5.099973 71.856272-67.774042 25.057546L91.42784 479.953413s-66.293503-36.076599 4.026941-85.421729L411.444222 123.033132s47.507255-33.882413 58.944055 21.68282l0.351192 131.869262c0.060409 0.059385 592.695474 28.434319 470.009439 620.539012z',
  246. onclick:function (a) {
  247. loadqsjkdw();
  248. }
  249. }
  250. }
  251. },
  252. xAxis: {
  253. type: 'category',
  254. axisLine:{
  255. show: true,
  256. lineStyle:{
  257. color:'#353E47'
  258. }
  259. },
  260. axisTick: {
  261. show:false
  262. },
  263. axisLabel : {
  264. formatter: '{value}',
  265. textStyle: {
  266. color: '#fff'
  267. }
  268. },
  269. data: ['办案区','办公区','业务区','其他']
  270. },
  271. grid: {
  272. left: '0px',
  273. right: '10px',
  274. bottom: '10px',
  275. top:'25px',
  276. containLabel: true
  277. },
  278. yAxis: {
  279. type: 'value',
  280. show:false,
  281. axisLine:{
  282. show: true,
  283. lineStyle:{
  284. color:'#353E47'
  285. }
  286. },
  287. splitLine: {show: true,
  288. lineStyle:{
  289. color:'#353E47'
  290. }
  291. },
  292. axisTick: {
  293. show:false
  294. },
  295. axisLabel : {
  296. textStyle: {
  297. color: '#fff'
  298. },
  299. formatter:function(value,index){
  300. var r = '';
  301. if(value>100000000){//亿
  302. r = (value/100000000).toFixed(1) + '亿';
  303. }else if(value>10000000){//万
  304. r = (value/10000000).toFixed(1) + '千万';
  305. }else if(value>10000){//万
  306. r = (value/10000).toFixed(1) + '万';
  307. }else{
  308. r = value;
  309. }
  310. return r;
  311. }
  312. }
  313. },
  314. series: [
  315. {
  316. name: '县区监控点位分布',
  317. type: 'line',
  318. lineStyle:{
  319. normal:{
  320. color:'#2EE466'
  321. }
  322. },
  323. itemStyle: {
  324. normal: {
  325. show: true,
  326. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  327. offset: 0,
  328. color: '#00d891'
  329. }, {
  330. offset: 1,
  331. color: '#00579a'
  332. }]),
  333. barBorderRadius: 50,
  334. borderWidth: 0,
  335. borderColor: '#333',
  336. }
  337. },
  338. label: {
  339. normal: {
  340. show: true,
  341. position: 'top',
  342. textStyle: {
  343. color: '#fff'
  344. }
  345. }
  346. },
  347. data: [102555,22226,44248,9634]
  348. }
  349. ]
  350. };
  351. myCharts.clear();
  352. myCharts.setOption(option);
  353. };
  354. return {
  355. init: init
  356. }
  357. }();