charts1.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. 'use strict';
  2. app.controller('charts1Ctrl', ["$scope", "$rootScope", "$state", "$timeout", "$interval", "$http", "$cookieStore", "Restangular", "api_hkreport", function($scope, $rootScope, $state, $timeout, $interval, $http, $cookieStore, Restangular, api_hkreport) {
  3. // // 球
  4. // var dom_ball = document.getElementById("container_ball");
  5. // var myChart_ball = echarts.init(dom_ball);
  6. // var app = {};
  7. // var option_ball = null;
  8. // option_ball = {
  9. // globe: {
  10. // baseTexture: "assets/images/daping/xingxing.png",
  11. // shading: 'realistic',
  12. // realisticMaterial: {
  13. // roughness: 10
  14. // },
  15. // postEffect: {
  16. // enable: true
  17. // },
  18. // light: {
  19. // main: {
  20. // intensity: 0.1,
  21. // shadow: false
  22. // },
  23. // ambientCubemap: {
  24. // }
  25. // }
  26. // }
  27. // };;
  28. // if (option_ball && typeof option_ball === "object") {
  29. // myChart_ball.setOption(option_ball, true);
  30. // }
  31. // 事件处理近五年统计分析图
  32. var dom_call = document.getElementById("incident_handle");
  33. var myChart_incident_handle = echarts.init(dom_call);
  34. myChart_incident_handle.showLoading({  
  35. text: '数据加载中...',
  36. color: '#c23531',
  37. textColor: '#fff',
  38. maskColor: 'rgba(255,255,255,0)',
  39. zlevel: 0
  40. });
  41. var app = {};
  42. var option_incident_handle = null;
  43. option_incident_handle = {
  44. backgroundColor: "transparent",
  45. tooltip: {},
  46. grid: {
  47. top: '8%',
  48. left: '1%',
  49. right: '1%',
  50. bottom: '8%',
  51. containLabel: true,
  52. },
  53. xAxis: [{
  54. type: 'category',
  55. boundaryGap: true,
  56. axisLine: { //坐标轴轴线相关设置。数学上的x轴
  57. show: true,
  58. lineStyle: {
  59. color: 'rgba(255,255,255,0.4)'
  60. },
  61. },
  62. axisLabel: { //坐标轴刻度标签的相关设置
  63. textStyle: {
  64. color: 'rgba(255,255,255,1)',
  65. margin: 15,
  66. },
  67. },
  68. axisTick: {
  69. show: false,
  70. },
  71. data: ['2015', '2016', '2017', '2018', '2019'],
  72. }],
  73. yAxis: [{
  74. type: 'value',
  75. min: 0,
  76. splitNumber: 5,
  77. splitLine: {
  78. show: true,
  79. lineStyle: {
  80. color: 'rgba(255,255,255,0.6)'
  81. }
  82. },
  83. axisLine: {
  84. show: false,
  85. },
  86. axisLabel: {
  87. margin: 20,
  88. textStyle: {
  89. color: 'rgba(255,255,255,1)',
  90. },
  91. },
  92. axisTick: {
  93. show: false,
  94. },
  95. }],
  96. series: [{
  97. name: '注册总量',
  98. type: 'line',
  99. showAllSymbol: true,
  100. symbol: 'emptyCircle',
  101. symbolSize: 6,
  102. lineStyle: {
  103. normal: {
  104. color: "#228ed7", // 线条颜色
  105. },
  106. borderColor: '#f0f'
  107. },
  108. itemStyle: {
  109. normal: {
  110. color: "#228ed7",
  111. }
  112. },
  113. tooltip: {
  114. show: false
  115. },
  116. areaStyle: { //区域填充样式
  117. normal: {
  118. //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。
  119. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  120. offset: 0,
  121. // color: 'rgba(0,154,120,1)'
  122. color: 'rgba(34,142,215,0.5)'
  123. },
  124. {
  125. offset: 1,
  126. color: 'rgba(0,0,0, 0)'
  127. }
  128. ], false),
  129. // shadowColor: 'rgba(53,142,215, 0.9)', //阴影颜色
  130. shadowColor: 'rgba(34,142,215, 0.5)', //阴影颜色
  131. shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
  132. }
  133. },
  134. data: [393, 438, 485, 631, 689]
  135. },
  136. {
  137. name: '最新注册量',
  138. type: 'bar',
  139. barWidth: 20,
  140. tooltip: {
  141. show: false
  142. },
  143. itemStyle: {
  144. normal: {
  145. color: function(params) {
  146. var colorList = ['#228ed7', '#118178', '#9735ab', '#f98f3b', '#ecc625', '#1cfffb', '#1dfff1'];
  147. return colorList[params.dataIndex];
  148. }
  149. }
  150. },
  151. data: [393, 438, 485, 631, 689]
  152. }
  153. ]
  154. };;
  155. // 工作组处理事件统计及占比
  156. var dom_incident_group = document.getElementById("charts1_incident_group");
  157. var myChart_incident_group = echarts.init(dom_incident_group);
  158. myChart_incident_group.showLoading({  
  159. text: '数据加载中...',
  160. color: '#c23531',
  161. textColor: '#fff',
  162. maskColor: 'rgba(255,255,255,0)',
  163. zlevel: 0
  164. });
  165. var app = {};
  166. var option_incident_group = null;
  167. option_incident_group = {
  168. title: {
  169. subtext: '0',
  170. text: "事件总数(件)",
  171. itemGap: 3,
  172. "x": '44%',
  173. "y": '33%',
  174. textAlign: "center",
  175. "textStyle": {
  176. "fontWeight": 'normal',
  177. "fontSize": 16,
  178. "color": '#18f0ff',
  179. },
  180. "subtextStyle": {
  181. "fontWeight": 'normal',
  182. "fontSize": 22,
  183. "color": 'white',
  184. "lineHeight": 44
  185. },
  186. },
  187. grid: {
  188. top: '8%',
  189. left: '1%',
  190. right: '1%',
  191. bottom: '8%',
  192. containLabel: true,
  193. },
  194. legend: {
  195. orient: 'vertical',
  196. x: 'left',
  197. y: 'bottom',
  198. left:"23%",
  199. data:['工作组1','工作组2','工作组3','工作组4','工作组5','工作组6'],
  200. textStyle: {
  201. color: 'white',
  202. borderColor: '#fff',
  203. fontSize:13
  204. },
  205. formatter: function(param) {
  206. console.log(param);
  207. // for (var i = 0; i < $scope.incident_handler_group_data.length; i++) {
  208. // if ($scope.incident_handler_group_data[i].name == param) {
  209. // return ' ' + $scope.incident_handler_group_data[i].toname + ' ' + $scope.incident_handler_group_data[i].tovalue + ' ' + $scope.incident_handler_group_data[i].proportion + '%';
  210. // }
  211. // }
  212. for (var i = 0; i < $scope.incident_handler_group_data.length; i++) {
  213. if ($scope.incident_handler_group_data[i].name == param) {
  214. return ' ' + $scope.incident_handler_group_data[i].toname;
  215. }
  216. }
  217. },
  218. itemWidth:15,
  219. width:450,
  220. height:100,
  221. itemGap:20,
  222. },
  223. series: [
  224. {
  225. name:'访问来源',
  226. type:'pie',
  227. radius: ['40%', '50%'],
  228. center: ['45%', '40%'],
  229. avoidLabelOverlap: true,
  230. label: {
  231. align: 'left',
  232. normal: {
  233. show: true,
  234. position: 'outside',
  235. rich:"rich",
  236. formatter:function(param){
  237. // console.log(param)
  238. return param.value+' '+param.percent+"%"
  239. },
  240. color:"rgba(255,255,255,0.6)"
  241. },
  242. // emphasis: {
  243. // show: false,
  244. // textStyle: {
  245. // fontSize: '30',
  246. // fontWeight: 'bold'
  247. // }
  248. // }
  249. },
  250. labelLine: {
  251. normal: {
  252. show: true
  253. }
  254. },
  255. data:[
  256. {value:335, name:'工作组1'},
  257. {value:310, name:'工作组2'},
  258. {value:234, name:'工作组3'},
  259. {value:135, name:'工作组4'},
  260. {value:1548, name:'工作组5'},
  261. {value:154, name:'工作组6'}
  262. ]
  263. }
  264. ],
  265. color:["#228ed7","#d0402f","#f98f3b","#ecc625","#118178","#c053d5"]
  266. };;
  267. // 人员处理事件TOP10
  268. // var people_myColor = ['#18f0ff', '#18f0ff', '#18f0ff', '#18f0ff', '#18f0ff', '#18f0ff', '#00ccff', '#ddf514', '#f5db14', '#ff333d'];
  269. var people_myColor = ['rgba(34,142,215,1)', 'rgba(34,142,215,1)', 'rgba(34,142,215,1)', 'rgba(34,142,215,1)', 'rgba(34,142,215,1)', 'rgba(34,142,215,1)', 'rgba(34,142,215,1)','rgba(208,64,47,1)', 'rgba(249,143,59,1)', 'rgba(236,198,37,1)'];
  270. var people_myColor2 = ['rgba(34,142,215,0)', 'rgba(34,142,215,0)', 'rgba(34,142,215,0)', 'rgba(34,142,215,0)', 'rgba(34,142,215,0)', 'rgba(34,142,215,0)', 'rgba(34,142,215,0)','rgba(208,64,47,0)', 'rgba(249,143,59,0)', 'rgba(236,198,37,0)'];
  271. var dom_incident_people = document.getElementById("charts1_incident_people");
  272. var myChart_incident_people = echarts.init(dom_incident_people);
  273. myChart_incident_people.showLoading({  
  274. text: '数据加载中...',
  275. color: '#c23531',
  276. textColor: '#fff',
  277. maskColor: 'rgba(255,255,255,0)',
  278. zlevel: 0
  279. });
  280. var app = {};
  281. var option_incident_people = null;
  282. option_incident_people = {
  283. grid: {
  284. left: '11%',
  285. top: '12%',
  286. right: '0%',
  287. bottom: '8%',
  288. containLabel: true
  289. },
  290. xAxis: [{
  291. show: false,
  292. }],
  293. yAxis: [{
  294. axisTick: 'none',
  295. axisLine: 'none',
  296. show :true,
  297. offset: '27',
  298. axisLabel: {
  299. textStyle: {
  300. color: 'white',
  301. fontSize: '14',
  302. }
  303. },
  304. data: ['李丹', '林水', '东西', '德古拉', '古田', '杨云', '米勒', '莫妮卡', '土豆', '杨云']
  305. },
  306. ],
  307. series: [{
  308. name: '条',
  309. type: 'bar',
  310. yAxisIndex: 0,
  311. data: [4, 13, 25, 29, 38, 44, 50, 52, 60, 72],
  312. label: {
  313. normal: {
  314. show: true,
  315. position: 'left',
  316. textStyle: {
  317. color: '#18f0ff',
  318. fontSize: '16',
  319. }
  320. }
  321. },
  322. barWidth: 12,
  323. barMaxWidth:10,
  324. itemStyle: {
  325. normal: {
  326. // color: function(params) {
  327. // var num = people_myColor.length;
  328. // return people_myColor[params.dataIndex % num]
  329. // },
  330. color:function(params){
  331. var num = people_myColor.length;
  332. return new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
  333. offset: 0,
  334. color: people_myColor[params.dataIndex % num]
  335. },
  336. {
  337. offset: 1,
  338. color: people_myColor2[params.dataIndex % num]
  339. }
  340. ])
  341. }
  342. // color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
  343. // offset: 0,
  344. // color: "#6f3d9e"
  345. // },
  346. // {
  347. // offset: 1,
  348. // color: "#3637a3"
  349. // }
  350. // ])
  351. }
  352. },
  353. z: 2
  354. },
  355. ]
  356. };;
  357. // 事件分类统计占比
  358. var dom_incident_classification = document.getElementById("charts1_incident_classification");
  359. var myChart_incident_classification = echarts.init(dom_incident_classification);
  360. myChart_incident_classification.showLoading({  
  361. text: '数据加载中...',
  362. color: '#c23531',
  363. textColor: '#fff',
  364. maskColor: 'rgba(255,255,255,0)',
  365. zlevel: 0
  366. });
  367. var app = {};
  368. var option_incident_classification = null;
  369. option_incident_classification = {
  370. tooltip: {
  371. trigger: 'item',
  372. formatter: "{a} <br/>{b} : {c}%"
  373. },
  374. legend: {
  375. orient: 'vertical',
  376. align:'auto',
  377. data: ['访问','咨询','订单','点击','展现','展现1','展现2'],
  378. x: 'left',
  379. y: 'bottom',
  380. left:"22%",
  381. textStyle: {
  382. color: 'white',
  383. borderColor: '#fff',
  384. fontSize:13
  385. },
  386. itemWidth:15,
  387. width:450,
  388. height:120,
  389. itemGap:20,
  390. // formatter: function(param) {
  391. // for (var i = 0; i < $scope.incident_category_proportion_data.length; i++) {
  392. // if ($scope.incident_category_proportion_data[i].category == param) {
  393. // return ' ' + $scope.incident_category_proportion_data[i].tocategory + ' ' + $scope.incident_category_proportion_data[i].num + ' ' + $scope.incident_category_proportion_data[i].proportion + '%';
  394. // }
  395. // }
  396. // },
  397. formatter: function(param) {
  398. for (var i = 0; i < $scope.incident_category_proportion_data.length; i++) {
  399. if ($scope.incident_category_proportion_data[i].category == param) {
  400. return ' ' + $scope.incident_category_proportion_data[i].tocategory;
  401. }
  402. }
  403. },
  404. },
  405. calculable: true,
  406. series: [
  407. {
  408. name:'漏斗图',
  409. type:'funnel',
  410. left: '25%',
  411. top: 60,
  412. bottom: 60,
  413. width: '50%',
  414. height:180,
  415. min: 0,
  416. minSize: '0%',
  417. maxSize: '100%',
  418. sort: 'descending',
  419. gap: 2,
  420. label: {
  421. align: 'left',
  422. normal: {
  423. show: true,
  424. position: 'outside',
  425. rich:"rich",
  426. formatter:function(param){
  427. // console.log(param)
  428. return param.value+' '+param.percent+"%"
  429. },
  430. color:"rgba(255,255,255,0.6)"
  431. },
  432. },
  433. itemStyle:{
  434. borderColor:"transparent"
  435. },
  436. labelLine: {
  437. length: 10,
  438. lineStyle: {
  439. width: 1,
  440. type: 'solid'
  441. }
  442. },
  443. emphasis: {
  444. label: {
  445. fontSize: 20
  446. }
  447. },
  448. data: [
  449. {value: 60, name: '访问'},
  450. {value: 40, name: '咨询'},
  451. {value: 20, name: '订单'},
  452. {value: 80, name: '点击'},
  453. {value: 100, name: '展现'},
  454. {value: 120, name: '展现1'},
  455. {value: 140, name: '展现2'}
  456. ]
  457. }
  458. ],
  459. color:["rgb(17,129,120)","rgb(192,83,213)","rgb(34,142,215)","rgb(249,143,59)","rgb(236,198,37)","rgb(208,64,47)","rgb(151,53,171)"]
  460. };
  461. // 调用数据
  462. var nowYear=moment(new Date().getTime()).format('YYYY');
  463. var fiveYearAgo=String(Number(nowYear-4));
  464. var nowDay=moment(new Date().getTime()).format("YYYY-MM-DD");
  465. var seventDayAgo=moment(new Date().getTime() - 86400000*30).format("YYYY-MM-DD");
  466. // 获取事件处理近五年统计数据
  467. // --开始
  468. $scope.incident_handle_list=[];
  469. function getIncident_handleData(time) {
  470. api_hkreport.incidentreport(time, 'incident_trend').then(function(res) {
  471. option_incident_handle.xAxis[0].data=[];
  472. option_incident_handle.series[0].data=[];
  473. option_incident_handle.series[1].data=[];
  474. $scope.incident_handle_list=[];
  475. for(var i=0;i<res.quantityStatisticsList.length;i++){
  476. $scope.incident_handle_list.unshift(res.quantityStatisticsList[i])
  477. }
  478. console.log($scope.incident_handle_list);
  479. for(var i=0;i<$scope.incident_handle_list.length;i++){
  480. if($scope.incident_handle_list[i].date=="2015"){
  481. $scope.incident_handle_list[i].allzzl="100";
  482. $scope.incident_handle_list[i].zzl0="100";
  483. $scope.incident_handle_list[i].zzl1="100";
  484. $scope.incident_handle_list[i].zzl2="100";
  485. $scope.incident_handle_list[i].zzl3="100";
  486. $scope.incident_handle_list[i].zzl4="100";
  487. }
  488. }
  489. if(res.quantityStatisticsList.length>0){
  490. for(var i=0;i<res.quantityStatisticsList.length;i++){
  491. option_incident_handle.xAxis[0].data.push(res.quantityStatisticsList[i].date);
  492. option_incident_handle.series[0].data.push(res.quantityStatisticsList[i].sum);
  493. option_incident_handle.series[1].data.push(res.quantityStatisticsList[i].sum);
  494. }
  495. }
  496. myChart_incident_handle.setOption(option_incident_handle);
  497. myChart_incident_handle.hideLoading();
  498. })
  499. }
  500. getIncident_handleData({
  501. "start":fiveYearAgo,
  502. "end":nowYear
  503. })
  504. // --结束
  505. // 获取工作组处理事件统计及占比数据
  506. // --开始
  507. $scope.incident_handler_group_data=[];
  508. function getIncident_groupData(time){
  509. api_hkreport.incidentreport(time, 'incident_handler_group').then(function(res) {
  510. option_incident_group.legend.data=[];
  511. option_incident_group.series[0].data=[];
  512. $scope.incident_handler_group_data=res.pieChart;
  513. for(var i=0;i<$scope.incident_handler_group_data.length;i++){
  514. if($scope.incident_handler_group_data[i].name&&$scope.incident_handler_group_data[i].name.length==3){
  515. $scope.incident_handler_group_data[i]["toname"]=$scope.incident_handler_group_data[i].name+" "
  516. }else{
  517. $scope.incident_handler_group_data[i]["toname"]=$scope.incident_handler_group_data[i].name
  518. }
  519. if($scope.incident_handler_group_data[i].value&&$scope.incident_handler_group_data[i].value>=100&&$scope.incident_handler_group_data[i].value<1000){
  520. $scope.incident_handler_group_data[i]["tovalue"]=String($scope.incident_handler_group_data[i].value)+" "
  521. }else if($scope.incident_handler_group_data[i].value&&$scope.incident_handler_group_data[i].value>=10&&$scope.incident_handler_group_data[i].value<100){
  522. $scope.incident_handler_group_data[i]["tovalue"]=String($scope.incident_handler_group_data[i].value)+" "
  523. }else if($scope.incident_handler_group_data[i].value&&$scope.incident_handler_group_data[i].value>=0&&$scope.incident_handler_group_data[i].value<10){
  524. $scope.incident_handler_group_data[i]["tovalue"]=String($scope.incident_handler_group_data[i].value)+" "
  525. }else{
  526. $scope.incident_handler_group_data[i]["tovalue"]=String($scope.incident_handler_group_data[i].value)+" "
  527. }
  528. }
  529. if(res.pieChart.length>0){
  530. for(var i=0;i<res.pieChart.length;i++){
  531. option_incident_group.legend.data.push(res.pieChart[i].name);
  532. option_incident_group.series[0].data.push({value:res.pieChart[i].value,name:res.pieChart[i].name})
  533. }
  534. }
  535. option_incident_group.title.subtext=res.pieChartSum;
  536. myChart_incident_group.setOption(option_incident_group);
  537. myChart_incident_group.hideLoading();
  538. })
  539. }
  540. getIncident_groupData({
  541. "start":nowYear+"-01-01",
  542. "end":nowDay
  543. })
  544. // --结束
  545. // 获取解决中数据
  546. // 开始
  547. $scope.incident_solveNowData="";
  548. function getIncident_solveNowData(time){
  549. api_hkreport.incidentreport(time, 'large_screen_incident_handler_total').then(function(res) {
  550. console.log(res);
  551. $scope.incident_solveNowData=res.data[0].sum
  552. })
  553. }
  554. getIncident_solveNowData({
  555. })
  556. // 结束
  557. // 获取已解决数据
  558. // 开始
  559. $scope.incident_solveData="";
  560. function getIncident_solveData(time){
  561. api_hkreport.incidentreport(time, 'large_screen_incident_resolved_total').then(function(res) {
  562. console.log(res);
  563. $scope.incident_solveData=res.data[0].sum
  564. })
  565. }
  566. getIncident_solveData({
  567. })
  568. // 结束
  569. // 获取人员处理事件TOP10数据
  570. // --开始
  571. function getIncident_peopleData(time){
  572. api_hkreport.incidentreport(time, 'incident_handler').then(function(res) {
  573. option_incident_people.yAxis[0].data=[];
  574. option_incident_people.series[0].data=[];
  575. var pieData=res.pieChart;
  576. for(var i=0;i<pieData.length;i++){
  577. if(pieData[i].account=="管理员"){
  578. pieData.splice(i,1)
  579. }
  580. }
  581. if(pieData.length>9){
  582. for(var i=0;i<10;i++){
  583. option_incident_people.yAxis[0].data.unshift(pieData[i].account);
  584. option_incident_people.series[0].data.unshift(pieData[i].value)
  585. }
  586. }else{
  587. for(var i=0;i<pieData.length;i++){
  588. option_incident_people.yAxis[0].data.unshift(pieData[i].account);
  589. option_incident_people.series[0].data.unshift(pieData[i].value)
  590. }
  591. }
  592. myChart_incident_people.setOption(option_incident_people);
  593. myChart_incident_people.hideLoading();
  594. })
  595. }
  596. getIncident_peopleData({
  597. "start":nowYear+"-01-01",
  598. "end":nowDay
  599. })
  600. // --结束
  601. // 获取事件分类统计占比数据
  602. // --开始
  603. $scope.incident_category_proportion_data=[];
  604. function getIncident_classificationData(time){
  605. api_hkreport.incidentreport(time, 'incident_category_proportion').then(function(res) {
  606. option_incident_classification.legend.data=[];
  607. option_incident_classification.series[0].data=[];
  608. $scope.incident_category_proportion_data=res.lsit;
  609. for(var i=0;i<$scope.incident_category_proportion_data.length;i++){
  610. // 3.5个空格一个字符
  611. if($scope.incident_category_proportion_data[i].category&&$scope.incident_category_proportion_data[i].category.length==4){
  612. $scope.incident_category_proportion_data[i]["tocategory"]=$scope.incident_category_proportion_data[i].category+" "
  613. }else if($scope.incident_category_proportion_data[i].category&&$scope.incident_category_proportion_data[i].category.length==3){
  614. $scope.incident_category_proportion_data[i]["tocategory"]=$scope.incident_category_proportion_data[i].category+" "
  615. }
  616. else{
  617. $scope.incident_category_proportion_data[i]["tocategory"]=$scope.incident_category_proportion_data[i].category+""
  618. }
  619. }
  620. if(res.lsit.length>0){
  621. for(var i=0;i<res.lsit.length;i++){
  622. option_incident_classification.legend.data.push(res.lsit[i].category);
  623. option_incident_classification.series[0].data.push({value:res.lsit[i].num,name:res.lsit[i].category})
  624. }
  625. }
  626. myChart_incident_classification.setOption(option_incident_classification);
  627. myChart_incident_classification.hideLoading();
  628. })
  629. }
  630. getIncident_classificationData({
  631. "start":nowYear+"-01-01",
  632. "end":nowDay
  633. })
  634. // --结束
  635. // 获取当前时间
  636. $interval(function(){
  637. $scope.jry_year=new Date().getFullYear();//获取当前年份
  638. $scope.jry_month=new Date().getMonth()+1;//获取当前月份
  639. $scope.jry_data=new Date().getDate();//获取当前日号
  640. $scope.jry_hours=new Date().getHours();//获取当前小时
  641. $scope.jry_minute=new Date().getMinutes();//获取当前分钟
  642. $scope.jry_second=new Date().getSeconds();//获取当前秒
  643. var jry_week_index=new Date().getDay();//获取当前星期索引
  644. var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
  645. $scope.jry_week=weekday[jry_week_index];//获取当前星期几
  646. $scope.getMinute=function(res){
  647. if(Number(res)<10){
  648. return "0"+res
  649. }else{
  650. return res
  651. }
  652. }
  653. $scope.getSecond=function(res){
  654. if(Number(res)<10){
  655. return "0"+res
  656. }else{
  657. return res
  658. }
  659. }
  660. },1000)
  661. // 定时刷新
  662. function getDataInter(time){
  663. $interval(function(){
  664. getIncident_solveNowData({});
  665. getIncident_solveData({});
  666. getIncident_handleData({
  667. "start":fiveYearAgo,
  668. "end":nowYear
  669. });
  670. getIncident_groupData({
  671. "start":nowYear+"-01-01",
  672. "end":nowDay
  673. });
  674. getIncident_peopleData({
  675. "start":nowYear+"-01-01",
  676. "end":nowDay
  677. });
  678. getIncident_classificationData({
  679. "start":nowYear+"-01-01",
  680. "end":nowDay
  681. })
  682. },time)
  683. }
  684. getDataInter(300000)
  685. TagCanvas.Start('myCanvas', 'tags', {
  686. textColour: '',
  687. // outlineColour: '#fff',
  688. weight:true,
  689. reverse: true,
  690. depth: 0.8,
  691. dragControl: true,
  692. decel:0.95,
  693. maxSpeed: 0.05,
  694. initial: [-0.2, 0]
  695. });
  696. }]);