example.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  6. <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  7. <meta http-equiv="Content-Type" content="text/html"/>
  8. <title>流水线管理页</title>
  9. <!-- Favicon-->
  10. <link rel="icon" href="favicon.ico" type="image/x-icon">
  11. <!-- Google Fonts -->
  12. <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet"
  13. type="text/css">
  14. <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">
  15. <!-- Bootstrap Core Css -->
  16. <link rel="stylesheet" href="css/third/bootstrap.min.css"
  17. integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  18. <!-- Waves Effect Css -->
  19. <link href="plugins/node-waves/waves.css" rel="stylesheet"/>
  20. <!-- Animation Css -->
  21. <link href="plugins/animate-css/animate.css" rel="stylesheet"/>
  22. <!-- Morris Chart Css-->
  23. <link href="plugins/morrisjs/morris.css" rel="stylesheet"/>
  24. <!-- Custom Css -->
  25. <link href="css/style-frontend.css" rel="stylesheet">
  26. <!-- AdminBSB Themes. You can choose a theme from css/themes instead of get all themes -->
  27. <link href="css/themes/all-themes.css" rel="stylesheet"/>
  28. <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  29. <script src="css/third/jq.3.2.1.min.js"></script>
  30. <script src="css/third/popper.1.12.9.js"
  31. integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
  32. crossorigin="anonymous"></script>
  33. <script src="css/third/boot.min.js"
  34. integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
  35. crossorigin="anonymous"></script>
  36. <link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
  37. <meta name="viewport" content="width=device-width, initial-scale=1">
  38. <style>
  39. /* css 代码 */
  40. </style>
  41. <script src="css/third/hchart.js"></script>
  42. <script src="css/third/exporting.js"></script>
  43. <script src="css/third/cn.js"></script>
  44. <script language="JavaScript">
  45. function startTime()
  46. {
  47. var today=new Date();//定义日期对象
  48. var yyyy = today.getFullYear();//通过日期对象的getFullYear()方法返回年
  49. var MM = today.getMonth()+1;//通过日期对象的getMonth()方法返回年
  50. var dd = today.getDate();//通过日期对象的getDate()方法返回年
  51. var hh=today.getHours();//通过日期对象的getHours方法返回小时
  52. var mm=today.getMinutes();//通过日期对象的getMinutes方法返回分钟
  53. var ss=today.getSeconds();//通过日期对象的getSeconds方法返回秒
  54. // 如果分钟或小时的值小于10,则在其值前加0,比如如果时间是下午3点20分9秒的话,则显示15:20:09
  55. MM=checkTime(MM);
  56. dd=checkTime(dd);
  57. mm=checkTime(mm);
  58. ss=checkTime(ss);
  59. var day; //用于保存星期(getDay()方法得到星期编号)
  60. if(today.getDay()==0) day = "星期日 "
  61. if(today.getDay()==1) day = "星期一 "
  62. if(today.getDay()==2) day = "星期二 "
  63. if(today.getDay()==3) day = "星期三 "
  64. if(today.getDay()==4) day = "星期四 "
  65. if(today.getDay()==5) day = "星期五 "
  66. if(today.getDay()==6) day = "星期六 "
  67. document.getElementById('nowDateTimeSpan').innerHTML=yyyy+"-"+MM +"-"+ dd +" " + hh+":"+mm+":"+ss+" " + day;
  68. setTimeout('startTime()',1000);//每一秒中重新加载startTime()方法
  69. }
  70. function checkTime(i)
  71. {
  72. if (i<10){
  73. i="0" + i;
  74. }
  75. return i;
  76. }
  77. </script>
  78. <style>
  79. .time1{width:100%; height:50px; background:#FFF000; line-height:50px; text-align:center;}
  80. </style>
  81. </head>
  82. <body onload="startTime()">
  83. 当前时间:<font color="black"><span id="nowDateTimeSpan"></span></font>
  84. <div class="row">
  85. <div class=" col-lg-3 col-md-3 col-sm-6 col-xs-12">
  86. <div class="info-box bg-pink " onclick="addContent1()">
  87. 合格数
  88. <script>
  89. function addContent1() {
  90. $('a[href="#home"]').tab('show');
  91. }
  92. </script>
  93. </div>
  94. </div>
  95. <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
  96. <div class="info-box bg-cyan " onclick="addContent2()">
  97. 不合格数
  98. <script>
  99. function addContent2() {
  100. $('a[href="#profile"]').tab('show');
  101. }
  102. </script>
  103. </div>
  104. </div>
  105. <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
  106. <div class="info-box bg-light-green " onclick="addContent3()">
  107. 堆积数
  108. <script>
  109. function addContent3() {
  110. $('a[href="#contact"]').tab('show');
  111. }
  112. </script>
  113. </div>
  114. </div>
  115. <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
  116. <div class="info-box bg-orange " onclick="addContent4()">
  117. 工作时长
  118. <script>
  119. function addContent4() {
  120. $('a[href="#time"]').tab('show');
  121. }
  122. </script>
  123. </div>
  124. </div>
  125. </div>
  126. <div>
  127. <ul class="nav nav-tabs" id="myTab" role="tablist" style="display: none">
  128. <li class="nav-item">
  129. <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home"
  130. aria-selected="true">Home</a>
  131. </li>
  132. <li class="nav-item">
  133. <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile"
  134. aria-selected="false">Profile</a>
  135. </li>
  136. <li class="nav-item">
  137. <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact"
  138. aria-selected="false">Contact</a>
  139. </li>
  140. <li class="nav-item">
  141. <a class="nav-link" id="time-tab" data-toggle="tab" href="#time" role="tab" aria-controls="time"
  142. aria-selected="false">Time</a>
  143. </li>
  144. </ul>
  145. <div class="tab-content" id="myTabContent">
  146. <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
  147. <div id="container" class="text-center" style="width: 50%;height:400px;margin: 0 auto"></div>
  148. </div>
  149. <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
  150. <div id="container2" style="width:50%;height:400px;margin: 0 auto"></div>
  151. </div>
  152. <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
  153. <div id="container3" style="width:50%;height:400px;margin: 0 auto"></div>
  154. </div>
  155. <div class="tab-pane fade" id="time" role="tabpanel" aria-labelledby="contact-tab">
  156. <div id="container5" style="width:50%;height:400px;margin: 0 auto"></div>
  157. </div>
  158. </div>
  159. </div>
  160. <script>
  161. var chart = Highcharts.chart('container2', {
  162. chart: {
  163. type: 'column'
  164. },
  165. title: {
  166. text: '月平均降雨量'
  167. },
  168. subtitle: {
  169. text: '数据来源: WorldClimate.com'
  170. },
  171. xAxis: {
  172. categories: [
  173. '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'
  174. ],
  175. crosshair: true
  176. },
  177. yAxis: {
  178. min: 0,
  179. title: {
  180. text: '降雨量 (mm)'
  181. }
  182. },
  183. tooltip: {
  184. // head + 每个 point + footer 拼接成完整的 table
  185. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  186. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  187. '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
  188. footerFormat: '</table>',
  189. shared: true,
  190. useHTML: true
  191. },
  192. plotOptions: {
  193. column: {
  194. borderWidth: 0
  195. }
  196. },
  197. series: [{
  198. name: '东京',
  199. data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
  200. }, {
  201. name: '纽约',
  202. data: [83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2, 83.5, 106.6, 92.3]
  203. }, {
  204. name: '伦敦',
  205. data: [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2]
  206. }, {
  207. name: '柏林',
  208. data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1]
  209. }]
  210. });
  211. </script>
  212. <script>
  213. var chart = Highcharts.chart('container1', {
  214. chart: {
  215. type: 'bar'
  216. },
  217. title: {
  218. text: '堆叠条形图'
  219. },
  220. xAxis: {
  221. categories: ['苹果', '橘子', '梨', '葡萄', '香蕉']
  222. },
  223. yAxis: {
  224. min: 0,
  225. title: {
  226. text: '水果消费总量'
  227. }
  228. },
  229. legend: {
  230. /* 图例显示顺序反转
  231. * 这是因为堆叠的顺序默认是反转的,可以设置
  232. * yAxis.reversedStacks = false 来达到类似的效果
  233. */
  234. reversed: true
  235. },
  236. plotOptions: {
  237. series: {
  238. stacking: 'normal'
  239. }
  240. },
  241. series: [{
  242. name: '小张',
  243. data: [5, 3, 4, 7, 2]
  244. }, {
  245. name: '小彭',
  246. data: [2, 2, 3, 2, 1]
  247. }, {
  248. name: '小潘',
  249. data: [3, 4, 4, 2, 5]
  250. }]
  251. });
  252. </script>
  253. <script>
  254. var chart = Highcharts.chart('container3', {
  255. chart: {
  256. type: 'column'
  257. },
  258. title: {
  259. text: '全球各大城市人口排行'
  260. },
  261. subtitle: {
  262. text: '数据截止 2017-03,来源: <a href="https://en.wikipedia.org/wiki/List_of_cities_proper_by_population">Wikipedia</a>'
  263. },
  264. xAxis: {
  265. type: 'category',
  266. labels: {
  267. rotation: -45 // 设置轴标签旋转角度
  268. }
  269. },
  270. yAxis: {
  271. min: 0,
  272. title: {
  273. text: '人口 (百万)'
  274. }
  275. },
  276. legend: {
  277. enabled: false
  278. },
  279. tooltip: {
  280. pointFormat: '人口总量: <b>{point.y:.1f} 百万</b>'
  281. },
  282. series: [{
  283. name: '总人口',
  284. data: [
  285. ['上海', 24.25],
  286. ['卡拉奇', 23.50],
  287. ['北京', 21.51],
  288. ['德里', 16.78],
  289. ['拉各斯', 16.06],
  290. ['天津', 15.20],
  291. ['伊斯坦布尔', 14.16],
  292. ['东京', 13.51],
  293. ['广州', 13.08],
  294. ['孟买', 12.44],
  295. ['莫斯科', 12.19],
  296. ['圣保罗', 12.03],
  297. ['深圳', 10.46],
  298. ['雅加达', 10.07],
  299. ['拉合尔', 10.05],
  300. ['首尔', 9.99],
  301. ['武汉', 9.78],
  302. ['金沙萨', 9.73],
  303. ['开罗', 9.27],
  304. ['墨西哥', 8.87]
  305. ],
  306. dataLabels: {
  307. enabled: true,
  308. rotation: -90,
  309. color: '#FFFFFF',
  310. align: 'right',
  311. format: '{point.y:.1f}', // :.1f 为保留 1 位小数
  312. y: 10
  313. }
  314. }]
  315. });
  316. </script>
  317. <script>
  318. var chart = Highcharts.chart('container4', {
  319. chart: {
  320. type: 'line'
  321. },
  322. title: {
  323. text: '月平均气温'
  324. },
  325. subtitle: {
  326. text: '数据来源: WorldClimate.com'
  327. },
  328. xAxis: {
  329. categories: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
  330. },
  331. yAxis: {
  332. title: {
  333. text: '气温 (°C)'
  334. }
  335. },
  336. plotOptions: {
  337. line: {
  338. dataLabels: {
  339. // 开启数据标签
  340. enabled: true
  341. },
  342. // 关闭鼠标跟踪,对应的提示框、点击事件会失效
  343. enableMouseTracking: false
  344. }
  345. },
  346. series: [{
  347. name: '东京',
  348. data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
  349. }, {
  350. name: '伦敦',
  351. data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
  352. }]
  353. });
  354. </script>
  355. <script src="js/basic.js"></script>
  356. <script>
  357. function showChart() {
  358. var data = [];
  359. var ratedata = [];
  360. var stackmax = 0;
  361. var failmax=0;
  362. for (i = 0; i < passNumber.length; i++) {
  363. if (stackmax < stackeverynum[i]) {
  364. stackmax = stackeverynum[i];
  365. }
  366. if (failmax < failrate[i]) {
  367. failmax = failrate[i];
  368. }
  369. data.push(stackeverynum[i]);
  370. ratedata.push(Math.floor(failrate[i]));
  371. }
  372. stackmax = Math.max(stackmax,5);
  373. failmax =Math.max(failmax,5);
  374. stackAndFailChart = Highcharts.chart('container', {
  375. chart: {
  376. zoomType: 'xy'
  377. },
  378. title: {
  379. text: null
  380. },
  381. credits: {
  382. enabled: false // 禁用版权信息
  383. },
  384. exporting: {
  385. enabled: false
  386. },
  387. xAxis: [{
  388. categories: namedata,
  389. crosshair: true,
  390. title: {
  391. text: '员工',
  392. style: {
  393. fontSize: '15px'
  394. }
  395. },
  396. labels: {
  397. style: {
  398. fontSize: '20px'
  399. }
  400. }
  401. }],
  402. yAxis: [{ // Primary yAxis
  403. labels: {
  404. format: '{value}',
  405. style: {
  406. color: Highcharts.getOptions().colors[0],
  407. fontSize: '20px'
  408. }
  409. },
  410. min: 0,
  411. max: 1.5 * stackmax,
  412. title: {
  413. text: '堆积数',
  414. style: {
  415. color: Highcharts.getOptions().colors[0],
  416. fontSize: '15px'
  417. }
  418. }
  419. }, { // Secondary yAxis
  420. title: {
  421. text: '不良率',
  422. style: {
  423. color: 'red',
  424. fontSize: '15px'
  425. }
  426. },
  427. min: 0,
  428. max: 1.5 * failmax,
  429. labels: {
  430. formatter: function() {
  431. return Math.floor(this.value) + "%";
  432. },
  433. style: {
  434. color: 'red',
  435. fontSize: '20px'
  436. }
  437. },
  438. opposite: true
  439. }],
  440. tooltip: {
  441. shared: true
  442. },
  443. legend: {
  444. layout: 'vertical',
  445. align: 'right',
  446. x: -120,
  447. verticalAlign: 'top',
  448. y: 0,
  449. floating: true,
  450. backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
  451. },
  452. series: [{
  453. name: '堆积数',
  454. type: 'column',
  455. data: data,
  456. tooltip: {
  457. valueSuffix: ' mm'
  458. }
  459. }, {
  460. name: '不良率',
  461. type: 'spline',
  462. yAxis: 1,
  463. data: ratedata,
  464. color: 'red',
  465. tooltip: {
  466. valueSuffix: '%'
  467. }
  468. }]
  469. });
  470. }
  471. function updateChart(){
  472. var data = [];
  473. var ratedata = [];
  474. var stackmax = 0;
  475. var failmax=0;
  476. for (i = 0; i < passNumber.length; i++) {
  477. if (stackmax < stackeverynum[i]) {
  478. stackmax = stackeverynum[i];
  479. }
  480. if (failmax < failrate[i]) {
  481. failmax = failrate[i];
  482. }
  483. data.push(stackeverynum[i]);
  484. ratedata.push(Math.floor(failrate[i]));
  485. }
  486. stackmax = Math.max(stackmax,5);
  487. failmax =Math.max(failmax,5);
  488. // https://api.hcharts.cn/highcharts#Series.addPoint;
  489. stackAndFailChart.series[0].setData(data);
  490. stackAndFailChart.series[1].setData(ratedata);
  491. }
  492. var stackAndFailChart = null;
  493. $(document).ready(on_document_load);
  494. setInterval(function(){
  495. $("#container").width(window.innerWidth);
  496. $("#container").height(window.innerHeight);
  497. },1000);
  498. </script>
  499. </body>
  500. </html>