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