You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

646 lines
17 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. "use strict";
  2. $(document).ready(function() {
  3. $(window).on('resize',function() {
  4. categoryChart();
  5. strackingChart();
  6. pieChart();
  7. donutChart();
  8. });
  9. categoryChart();
  10. strackingChart();
  11. pieChart();
  12. donutChart();
  13. /*categories chart*/
  14. function categoryChart() {
  15. var data = [
  16. ["January", 20],
  17. ["February", 8],
  18. ["March", 4],
  19. ["April", 13],
  20. ["May", 5],
  21. ["June", 9]
  22. ];
  23. $.plot("#placeholder", [data], {
  24. series: {
  25. bars: {
  26. show: true,
  27. barWidth: 0.6,
  28. align: "center",
  29. }
  30. },
  31. xaxis: {
  32. mode: "categories",
  33. tickLength: 0,
  34. tickColor: '#f5f5f5',
  35. },
  36. colors: ["#01C0C8", "#83D6DE"],
  37. labelBoxBorderColor: "red"
  38. });
  39. };
  40. /*Stracking chart*/
  41. function strackingChart() {
  42. var d1 = [];
  43. for (var i = 0; i <= 10; i += 1) {
  44. d1.push([i, parseInt(Math.random() * 30)]); /*yellow*/
  45. }
  46. var d2 = [];
  47. for (var i = 0; i <= 10; i += 1) {
  48. d2.push([i, parseInt(Math.random() * 30)]); /*blue*/
  49. }
  50. var d3 = [];
  51. for (var i = 0; i <= 10; i += 1) {
  52. d3.push([i, parseInt(Math.random() * 30)]); /*red*/
  53. }
  54. var stack = 0,
  55. bars = false,
  56. lines = true,
  57. steps = false;
  58. function plotWithOptions() {
  59. $.plot("#placeholder1", [d1, d2, d3], {
  60. series: {
  61. stack: stack,
  62. lines: {
  63. show: lines,
  64. fill: true,
  65. steps: steps
  66. },
  67. bars: {
  68. show: bars,
  69. barWidth: 0.6
  70. }
  71. }
  72. });
  73. }
  74. plotWithOptions();
  75. };
  76. /*pie chart-Withour legend*/
  77. function pieChart() {
  78. var data1 = [{
  79. label: "Sales & Marketing",
  80. data: 2034,
  81. color: "#25A6F7"
  82. }, {
  83. label: "Research & Development",
  84. data: 16410,
  85. color: "#01C0C8"
  86. }, {
  87. label: "General & Administration",
  88. data: 4670,
  89. color: "#42E1FE"
  90. }];
  91. $.plot('#placeholder2', data1, {
  92. series: {
  93. pie: {
  94. show: true
  95. }
  96. },
  97. legend: {
  98. show: false
  99. }
  100. });
  101. };
  102. /*Donut Hole*/
  103. function donutChart() {
  104. var data2 = [{
  105. label: "Sales & Marketing",
  106. data: 2034,
  107. color: "#FB9678"
  108. }, {
  109. label: "Research & Development",
  110. data: 16410,
  111. color: "#4F5467"
  112. }, {
  113. label: "General & Administration",
  114. data: 4670,
  115. color: "#01C0C8"
  116. }];
  117. $.plot('#placeholder3', data2, {
  118. series: {
  119. pie: {
  120. innerRadius: 0.7,
  121. show: true
  122. },
  123. legend: {
  124. show: true,
  125. position: "center"
  126. }
  127. }
  128. });
  129. }
  130. // series types chart
  131. $(function() {
  132. var d1 = [];
  133. for (var i = 0; i < 14; i += 0.5) {
  134. d1.push([i, Math.sin(i)]);
  135. }
  136. var d2 = [
  137. [0, 3],
  138. [4, 8],
  139. [8, 5],
  140. [9, 13]
  141. ];
  142. var d3 = [];
  143. for (var i = 0; i < 14; i += 0.5) {
  144. d3.push([i, Math.cos(i)]);
  145. }
  146. var d4 = [];
  147. for (var i = 0; i < 14; i += 0.1) {
  148. d4.push([i, Math.sqrt(i * 10)]);
  149. }
  150. var d5 = [];
  151. for (var i = 0; i < 14; i += 0.5) {
  152. d5.push([i, Math.sqrt(i)]);
  153. }
  154. var d6 = [];
  155. for (var i = 0; i < 14; i += 0.5 + Math.random()) {
  156. d6.push([i, Math.sqrt(2 * i + Math.sin(i) + 5)]);
  157. }
  158. $.plot("#seriestypes", [{
  159. data: d1,
  160. lines: { show: true, fill: true }
  161. }, {
  162. data: d2,
  163. bars: { show: true }
  164. }, {
  165. data: d3,
  166. points: { show: true }
  167. }, {
  168. data: d4,
  169. lines: { show: true }
  170. }, {
  171. data: d5,
  172. lines: { show: true },
  173. points: { show: true }
  174. }, {
  175. data: d6,
  176. lines: { show: true, steps: true }
  177. }]);
  178. // Add the Flot version string to the footer
  179. $("#footer").prepend("Flot " + $.plot.version + " &ndash; ");
  180. });
  181. //real-time update
  182. $(function() {
  183. // We use an inline data source in the example, usually data would
  184. // be fetched from a server
  185. var data = [],
  186. totalPoints = 300;
  187. function getRandomData() {
  188. if (data.length > 0)
  189. data = data.slice(1);
  190. // Do a random walk
  191. while (data.length < totalPoints) {
  192. var prev = data.length > 0 ? data[data.length - 1] : 50,
  193. y = prev + Math.random() * 10 - 5;
  194. if (y < 0) {
  195. y = 0;
  196. } else if (y > 100) {
  197. y = 100;
  198. }
  199. data.push(y);
  200. }
  201. // Zip the generated y values with the x values
  202. var res = [];
  203. for (var i = 0; i < data.length; ++i) {
  204. res.push([i, data[i]])
  205. }
  206. return res;
  207. }
  208. // Set up the control widget
  209. var updateInterval = 30;
  210. $("#updateInterval").val(updateInterval).change(function() {
  211. var v = $(this).val();
  212. if (v && !isNaN(+v)) {
  213. updateInterval = +v;
  214. if (updateInterval < 1) {
  215. updateInterval = 1;
  216. } else if (updateInterval > 2000) {
  217. updateInterval = 2000;
  218. }
  219. $(this).val("" + updateInterval);
  220. }
  221. });
  222. var plot = $.plot("#realtimeupdate", [getRandomData()], {
  223. series: {
  224. shadowSize: 0 // Drawing is faster without shadows
  225. },
  226. yaxis: {
  227. min: 0,
  228. max: 100
  229. },
  230. xaxis: {
  231. show: false
  232. }
  233. });
  234. function update() {
  235. plot.setData([getRandomData()]);
  236. // Since the axes don't change, we don't need to call plot.setupGrid()
  237. plot.draw();
  238. setTimeout(update, updateInterval);
  239. }
  240. update();
  241. // Add the Flot version string to the footer
  242. $("#footer").prepend("Flot " + $.plot.version + " &ndash; ");
  243. });
  244. //Percentiles
  245. $(function() {
  246. var males = { "8%": [
  247. [2, 20.0],
  248. [3, 30.3],
  249. [4, 40.0],
  250. [5, 50.5],
  251. [6, 60.7],
  252. [7, 70.6],
  253. [8, 80.6],
  254. [9, 90.3],
  255. [10, 100.3],
  256. [11, 110.4],
  257. [12, 146.5],
  258. [13, 151.7],
  259. [14, 159.9],
  260. [15, 165.4],
  261. [16, 167.8],
  262. [17, 168.7],
  263. [18, 169.5],
  264. [19, 168.0]
  265. ], "90%": [
  266. [2, 96.8],
  267. [3, 105.2],
  268. [4, 113.9],
  269. [5, 120.8],
  270. [6, 127.0],
  271. [7, 133.1],
  272. [8, 139.1],
  273. [9, 143.9],
  274. [10, 151.3],
  275. [11, 161.1],
  276. [12, 164.8],
  277. [13, 173.5],
  278. [14, 179.0],
  279. [15, 182.0],
  280. [16, 186.9],
  281. [17, 185.2],
  282. [18, 186.3],
  283. [19, 186.6]
  284. ], "25%": [
  285. [2, 89.2],
  286. [3, 94.9],
  287. [4, 104.4],
  288. [5, 111.4],
  289. [6, 117.5],
  290. [7, 120.2],
  291. [8, 127.1],
  292. [9, 132.9],
  293. [10, 136.8],
  294. [11, 144.4],
  295. [12, 149.5],
  296. [13, 154.1],
  297. [14, 163.1],
  298. [15, 169.2],
  299. [16, 170.4],
  300. [17, 171.2],
  301. [18, 172.4],
  302. [19, 170.8]
  303. ], "10%": [
  304. [2, 86.9],
  305. [3, 92.6],
  306. [4, 99.9],
  307. [5, 107.0],
  308. [6, 114.0],
  309. [7, 113.5],
  310. [8, 123.6],
  311. [9, 129.2],
  312. [10, 133.0],
  313. [11, 140.6],
  314. [12, 145.2],
  315. [13, 149.7],
  316. [14, 158.4],
  317. [15, 163.5],
  318. [16, 166.9],
  319. [17, 167.5],
  320. [18, 167.1],
  321. [19, 165.3]
  322. ], "mean": [
  323. [2, 91.9],
  324. [3, 98.5],
  325. [4, 107.1],
  326. [5, 114.4],
  327. [6, 120.6],
  328. [7, 124.7],
  329. [8, 131.1],
  330. [9, 136.8],
  331. [10, 142.3],
  332. [11, 150.0],
  333. [12, 154.7],
  334. [13, 161.9],
  335. [14, 168.7],
  336. [15, 173.6],
  337. [16, 175.9],
  338. [17, 176.6],
  339. [18, 176.8],
  340. [19, 176.7]
  341. ], "75%": [
  342. [2, 94.5],
  343. [3, 102.1],
  344. [4, 110.8],
  345. [5, 117.9],
  346. [6, 124.0],
  347. [7, 129.3],
  348. [8, 134.6],
  349. [9, 141.4],
  350. [10, 147.0],
  351. [11, 156.1],
  352. [12, 160.3],
  353. [13, 168.3],
  354. [14, 174.7],
  355. [15, 178.0],
  356. [16, 180.2],
  357. [17, 181.7],
  358. [18, 181.3],
  359. [19, 182.5]
  360. ], "85%": [
  361. [2, 96.2],
  362. [3, 103.8],
  363. [4, 111.8],
  364. [5, 119.6],
  365. [6, 125.6],
  366. [7, 131.5],
  367. [8, 138.0],
  368. [9, 143.3],
  369. [10, 149.3],
  370. [11, 159.8],
  371. [12, 162.5],
  372. [13, 171.3],
  373. [14, 177.5],
  374. [15, 180.2],
  375. [16, 183.8],
  376. [17, 183.4],
  377. [18, 183.5],
  378. [19, 185.5]
  379. ], "50%": [
  380. [2, 91.9],
  381. [3, 98.2],
  382. [4, 106.8],
  383. [5, 114.6],
  384. [6, 120.8],
  385. [7, 125.2],
  386. [8, 130.3],
  387. [9, 137.1],
  388. [10, 141.5],
  389. [11, 149.4],
  390. [12, 153.9],
  391. [13, 162.2],
  392. [14, 169.0],
  393. [15, 174.8],
  394. [16, 176.0],
  395. [17, 176.8],
  396. [18, 176.4],
  397. [19, 177.4]
  398. ] };
  399. var females = { "15%": [
  400. [2, 84.8],
  401. [3, 93.7],
  402. [4, 100.6],
  403. [5, 105.8],
  404. [6, 113.3],
  405. [7, 119.3],
  406. [8, 124.3],
  407. [9, 131.4],
  408. [10, 136.9],
  409. [11, 143.8],
  410. [12, 149.4],
  411. [13, 151.2],
  412. [14, 152.3],
  413. [15, 155.9],
  414. [16, 154.7],
  415. [17, 157.0],
  416. [18, 156.1],
  417. [19, 155.4]
  418. ], "90%": [
  419. [2, 95.6],
  420. [3, 104.1],
  421. [4, 111.9],
  422. [5, 119.6],
  423. [6, 127.6],
  424. [7, 133.1],
  425. [8, 138.7],
  426. [9, 147.1],
  427. [10, 152.8],
  428. [11, 161.3],
  429. [12, 166.6],
  430. [13, 167.9],
  431. [14, 169.3],
  432. [15, 170.1],
  433. [16, 172.4],
  434. [17, 169.2],
  435. [18, 171.1],
  436. [19, 172.4]
  437. ], "25%": [
  438. [2, 87.2],
  439. [3, 95.9],
  440. [4, 101.9],
  441. [5, 107.4],
  442. [6, 114.8],
  443. [7, 121.4],
  444. [8, 126.8],
  445. [9, 133.4],
  446. [10, 138.6],
  447. [11, 146.2],
  448. [12, 152.0],
  449. [13, 153.8],
  450. [14, 155.7],
  451. [15, 158.4],
  452. [16, 157.0],
  453. [17, 158.5],
  454. [18, 158.4],
  455. [19, 158.1]
  456. ], "10%": [
  457. [2, 84.0],
  458. [3, 91.9],
  459. [4, 99.2],
  460. [5, 105.2],
  461. [6, 112.7],
  462. [7, 118.0],
  463. [8, 123.3],
  464. [9, 130.2],
  465. [10, 135.0],
  466. [11, 141.1],
  467. [12, 148.3],
  468. [13, 150.0],
  469. [14, 150.7],
  470. [15, 154.3],
  471. [16, 153.6],
  472. [17, 155.6],
  473. [18, 154.7],
  474. [19, 153.1]
  475. ], "mean": [
  476. [2, 90.2],
  477. [3, 98.3],
  478. [4, 105.2],
  479. [5, 112.2],
  480. [6, 119.0],
  481. [7, 125.8],
  482. [8, 131.3],
  483. [9, 138.6],
  484. [10, 144.2],
  485. [11, 151.3],
  486. [12, 156.7],
  487. [13, 158.6],
  488. [14, 160.5],
  489. [15, 162.1],
  490. [16, 162.9],
  491. [17, 162.2],
  492. [18, 163.0],
  493. [19, 163.1]
  494. ], "75%": [
  495. [2, 93.2],
  496. [3, 101.5],
  497. [4, 107.9],
  498. [5, 116.6],
  499. [6, 122.8],
  500. [7, 129.3],
  501. [8, 135.2],
  502. [9, 143.7],
  503. [10, 148.7],
  504. [11, 156.9],
  505. [12, 160.8],
  506. [13, 163.0],
  507. [14, 165.0],
  508. [15, 165.8],
  509. [16, 168.7],
  510. [17, 166.2],
  511. [18, 167.6],
  512. [19, 168.0]
  513. ], "85%": [
  514. [2, 94.5],
  515. [3, 102.8],
  516. [4, 110.4],
  517. [5, 119.0],
  518. [6, 125.7],
  519. [7, 131.5],
  520. [8, 137.9],
  521. [9, 146.0],
  522. [10, 151.3],
  523. [11, 159.9],
  524. [12, 164.0],
  525. [13, 166.5],
  526. [14, 167.5],
  527. [15, 168.5],
  528. [16, 171.5],
  529. [17, 168.0],
  530. [18, 169.8],
  531. [19, 170.3]
  532. ], "50%": [
  533. [2, 90.2],
  534. [3, 98.1],
  535. [4, 105.2],
  536. [5, 111.7],
  537. [6, 118.2],
  538. [7, 125.6],
  539. [8, 130.5],
  540. [9, 138.3],
  541. [10, 143.7],
  542. [11, 151.4],
  543. [12, 156.7],
  544. [13, 157.7],
  545. [14, 161.0],
  546. [15, 162.0],
  547. [16, 162.8],
  548. [17, 162.2],
  549. [18, 162.8],
  550. [19, 163.3]
  551. ] };
  552. var dataset = [
  553. { label: "Female mean", data: females["mean"], lines: { show: true }, color: "rgb(255,50,50)" },
  554. { id: "f15%", data: females["1%"], lines: { show: true, lineWidth: 0, fill: false }, color: "rgb(255,50,50)" },
  555. { id: "f25%", data: females["3%"], lines: { show: true, lineWidth: 0, fill: 0.2 }, color: "rgb(255,50,50)", fillBetween: "f15%" },
  556. { id: "f50%", data: females["6%"], lines: { show: true, lineWidth: 0.5, fill: 0.4, shadowSize: 0 }, color: "rgb(255,50,50)", fillBetween: "f25%" },
  557. { id: "f75%", data: females["8%"], lines: { show: true, lineWidth: 0, fill: 0.4 }, color: "rgb(255,50,50)", fillBetween: "f50%" },
  558. { id: "f85%", data: females["12%"], lines: { show: true, lineWidth: 0, fill: 0.2 }, color: "rgb(255,50,50)", fillBetween: "f75%" },
  559. { label: "Male mean", data: males["mean"], lines: { show: true }, color: "#01C0C8producxt" },
  560. { id: "m15%", data: males["10%"], lines: { show: true, lineWidth: 0, fill: false }, color: "#99E6E9" },
  561. { id: "m25%", data: males["12%"], lines: { show: true, lineWidth: 0, fill: 0.2 }, color: "#99E6E9", fillBetween: "m15%" },
  562. { id: "m50%", data: males["20%"], lines: { show: true, lineWidth: 0.5, fill: 0.4, shadowSize: 0 }, color: "rgb(50,50,255)", fillBetween: "m25%" },
  563. { id: "m75%", data: males["22%"], lines: { show: true, lineWidth: 0, fill: 0.4 }, color: "#99E6E9", fillBetween: "m50%" },
  564. { id: "m85%", data: males["25%"], lines: { show: true, lineWidth: 0, fill: 0.2 }, color: "#99E6E9", fillBetween: "m75%" }
  565. ];
  566. $.plot($("#percentiles"), dataset, {
  567. xaxis: {
  568. tickDecimals: 0
  569. },
  570. yaxis: {
  571. tickFormatter: function(v) {
  572. return v + " cm";
  573. }
  574. },
  575. legend: {
  576. position: "se"
  577. }
  578. });
  579. // Add the Flot version string to the footer
  580. $("#footer").prepend("Flot " + $.plot.version + " &ndash; ");
  581. });
  582. });