widget-charts2.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. //[widget charts Javascript]
  2. //Project: Unique Admin - Responsive Admin Template
  3. //Primary use: Used only for the widget charts
  4. $( document ).ready(function() {
  5. "use strict";
  6. if( $('#bubble-chart').length > 0 ){
  7. var ctx5 = document.getElementById("bubble-chart").getContext("2d");
  8. var data5 = {
  9. datasets: [
  10. {
  11. label: 'First Dataset',
  12. data: [
  13. {
  14. x: 80,
  15. y: 60,
  16. r: 10
  17. },
  18. {
  19. x: 40,
  20. y: 40,
  21. r: 10
  22. },
  23. {
  24. x: 30,
  25. y: 40,
  26. r: 20
  27. },
  28. {
  29. x: 20,
  30. y: 10,
  31. r: 10
  32. },
  33. {
  34. x: 50,
  35. y: 30,
  36. r: 10
  37. }
  38. ],
  39. backgroundColor:"#689f38",
  40. hoverBackgroundColor: "#33691e",
  41. },
  42. {
  43. label: 'Second Dataset',
  44. data: [
  45. {
  46. x: 40,
  47. y: 30,
  48. r: 10
  49. },
  50. {
  51. x: 25,
  52. y: 20,
  53. r: 10
  54. },
  55. {
  56. x: 35,
  57. y: 30,
  58. r: 10
  59. }
  60. ],
  61. backgroundColor:"#38649f",
  62. hoverBackgroundColor: "#244674",
  63. }]
  64. };
  65. var bubbleChart = new Chart(ctx5,{
  66. type:"bubble",
  67. data:data5,
  68. options: {
  69. elements: {
  70. points: {
  71. borderWidth: 1,
  72. borderColor: 'rgb(33, 33, 33)'
  73. }
  74. },
  75. scales: {
  76. xAxes: [
  77. {
  78. ticks: {
  79. min: -10,
  80. max: 100,
  81. fontFamily: "Nunito Sans",
  82. fontColor:"#878787"
  83. },
  84. gridLines: {
  85. color: "rgba(135,135,135,0)",
  86. }
  87. }],
  88. yAxes: [
  89. {
  90. ticks: {
  91. fontFamily: "Nunito Sans",
  92. fontColor:"#878787"
  93. },
  94. gridLines: {
  95. color: "rgba(135,135,135,0)",
  96. }
  97. }]
  98. },
  99. animation: {
  100. duration: 3000
  101. },
  102. responsive: true,
  103. legend: {
  104. labels: {
  105. fontFamily: "Nunito Sans",
  106. fontColor:"#878787"
  107. }
  108. },
  109. tooltip: {
  110. backgroundColor:'rgba(33,33,33,1)',
  111. cornerRadius:0,
  112. footerFontFamily:"'Nunito Sans'"
  113. }
  114. }
  115. });
  116. }
  117. if( $('#pie-chart').length > 0 ){
  118. var ctx6 = document.getElementById("pie-chart").getContext("2d");
  119. var data6 = {
  120. labels: [
  121. "lab 1",
  122. "lab 2",
  123. "lab 3"
  124. ],
  125. datasets: [
  126. {
  127. data: [300, 50, 100],
  128. backgroundColor: [
  129. "#689f38",
  130. "#38649f",
  131. "#389f99"
  132. ],
  133. hoverBackgroundColor: [
  134. "#33691e",
  135. "#244674",
  136. "#18625e"
  137. ]
  138. }]
  139. };
  140. var pieChart = new Chart(ctx6,{
  141. type: 'pie',
  142. data: data6,
  143. options: {
  144. animation: {
  145. duration: 3000
  146. },
  147. responsive: true,
  148. legend: {
  149. labels: {
  150. fontFamily: "Nunito Sans",
  151. fontColor:"#878787"
  152. }
  153. },
  154. tooltip: {
  155. backgroundColor:'rgba(33,33,33,1)',
  156. cornerRadius:0,
  157. footerFontFamily:"'Nunito Sans'"
  158. },
  159. elements: {
  160. arc: {
  161. borderWidth: 0
  162. }
  163. }
  164. }
  165. });
  166. }
  167. if( $('#doughnut-chart').length > 0 ){
  168. var ctx7 = document.getElementById("doughnut-chart").getContext("2d");
  169. var data7 = {
  170. labels: [
  171. "lab 1",
  172. "lab 2",
  173. "lab 3"
  174. ],
  175. datasets: [
  176. {
  177. data: [300, 50, 100],
  178. backgroundColor: [
  179. "#389f99",
  180. "#ee1044",
  181. "#ff8f00"
  182. ],
  183. hoverBackgroundColor: [
  184. "#18625e",
  185. "#b31338",
  186. "#c0720f"
  187. ]
  188. }]
  189. };
  190. var doughnutChart = new Chart(ctx7, {
  191. type: 'doughnut',
  192. data: data7,
  193. options: {
  194. animation: {
  195. duration: 3000
  196. },
  197. responsive: true,
  198. legend: {
  199. labels: {
  200. fontFamily: "Nunito Sans",
  201. fontColor:"#878787"
  202. }
  203. },
  204. tooltip: {
  205. backgroundColor:'rgba(33,33,33,1)',
  206. cornerRadius:0,
  207. footerFontFamily:"'Nunito Sans'"
  208. },
  209. elements: {
  210. arc: {
  211. borderWidth: 0
  212. }
  213. }
  214. }
  215. });
  216. }
  217. // Bar chart
  218. new Chart(document.getElementById("bar-chart1"), {
  219. type: 'bar',
  220. data: {
  221. labels: ["January", "February", "March", "April", "May"],
  222. datasets: [
  223. {
  224. label: "Dataset",
  225. backgroundColor: ["#689f38", "#38649f","#389f99","#ee1044","#ff8f00"],
  226. data: [8545,6589,5894,4985,1548]
  227. }
  228. ]
  229. },
  230. options: {
  231. legend: { display: false },
  232. title: {
  233. display: true,
  234. text: 'My dataset'
  235. }
  236. }
  237. });
  238. if( $('#bar-chart2').length > 0 ){
  239. var ctx2 = document.getElementById("bar-chart2").getContext("2d");
  240. var data2 = {
  241. labels: ["January", "February", "March", "April", "May", "June", "July"],
  242. datasets: [
  243. {
  244. label: "My First dataset",
  245. backgroundColor: "#689f38",
  246. borderColor: "#689f38",
  247. data: [15, 20, 70, 51, 36, 85, 50]
  248. },
  249. {
  250. label: "My Second dataset",
  251. backgroundColor: "#38649f",
  252. borderColor: "#38649f",
  253. data: [28, 48, 40, 19, 86, 27, 90]
  254. },
  255. {
  256. label: "My Third dataset",
  257. backgroundColor: "#389f99",
  258. borderColor: "#389f99",
  259. data: [8, 28, 50, 29, 76, 77, 40]
  260. }
  261. ]
  262. };
  263. var hBar = new Chart(ctx2, {
  264. type:"bar",
  265. data:data2,
  266. options: {
  267. tooltips: {
  268. mode:"label"
  269. },
  270. scales: {
  271. yAxes: [{
  272. stacked: true,
  273. gridLines: {
  274. color: "rgba(135,135,135,0)",
  275. },
  276. ticks: {
  277. fontFamily: "Nunito Sans",
  278. fontColor:"#878787"
  279. }
  280. }],
  281. xAxes: [{
  282. stacked: true,
  283. gridLines: {
  284. color: "rgba(135,135,135,0)",
  285. },
  286. ticks: {
  287. fontFamily: "Nunito Sans",
  288. fontColor:"#878787"
  289. }
  290. }],
  291. },
  292. elements:{
  293. point: {
  294. hitRadius:40
  295. }
  296. },
  297. animation: {
  298. duration: 3000
  299. },
  300. responsive: true,
  301. maintainAspectRatio:false,
  302. legend: {
  303. display: false,
  304. },
  305. tooltip: {
  306. backgroundColor:'rgba(33,33,33,1)',
  307. cornerRadius:0,
  308. footerFontFamily:"'Nunito Sans'"
  309. }
  310. }
  311. });
  312. };
  313. // Horizental Bar Chart
  314. new Chart(document.getElementById("bar-chart-horizontal1"), {
  315. type: 'horizontalBar',
  316. data: {
  317. labels: ["January", "February", "March", "April", "May"],
  318. datasets: [
  319. {
  320. label: "Dataset",
  321. backgroundColor: ["#689f38", "#38649f","#389f99","#ee1044","#ff8f00"],
  322. data: [8545,6589,5894,4985,1548]
  323. }
  324. ]
  325. },
  326. options: {
  327. legend: { display: false },
  328. title: {
  329. display: true,
  330. text: 'My dataset'
  331. }
  332. }
  333. });
  334. if( $('#bar-chart-horizontal2').length > 0 ){
  335. var ctx2 = document.getElementById("bar-chart-horizontal2").getContext("2d");
  336. var data2 = {
  337. labels: ["January", "February", "March", "April", "May", "June", "July"],
  338. datasets: [
  339. {
  340. label: "My First dataset",
  341. backgroundColor: "#689f38",
  342. borderColor: "#689f38",
  343. data: [10, 59, 40, 75, 50, 45, 80]
  344. },
  345. {
  346. label: "My Second dataset",
  347. backgroundColor: "#38649f",
  348. borderColor: "#38649f",
  349. data: [48, 88, 50, 58, 34, 67, 65]
  350. }
  351. ]
  352. };
  353. var hBar = new Chart(ctx2, {
  354. type:"horizontalBar",
  355. data:data2,
  356. options: {
  357. tooltips: {
  358. mode:"label"
  359. },
  360. scales: {
  361. yAxes: [{
  362. stacked: true,
  363. gridLines: {
  364. color: "rgba(135,135,135,0)",
  365. },
  366. ticks: {
  367. fontFamily: "Nunito Sans",
  368. fontColor:"#878787"
  369. }
  370. }],
  371. xAxes: [{
  372. stacked: true,
  373. gridLines: {
  374. color: "rgba(135,135,135,0)",
  375. },
  376. ticks: {
  377. fontFamily: "Nunito Sans",
  378. fontColor:"#878787"
  379. }
  380. }],
  381. },
  382. elements:{
  383. point: {
  384. hitRadius:40
  385. }
  386. },
  387. animation: {
  388. duration: 3000
  389. },
  390. responsive: true,
  391. legend: {
  392. display: false,
  393. },
  394. tooltip: {
  395. backgroundColor:'rgba(33,33,33,1)',
  396. cornerRadius:0,
  397. footerFontFamily:"'Nunito Sans'"
  398. }
  399. }
  400. });
  401. }
  402. //Polar Chart
  403. new Chart(document.getElementById("polar-chart1"), {
  404. type: 'polarArea',
  405. data: {
  406. labels: ["January", "February", "March", "April"],
  407. datasets: [
  408. {
  409. label: "Dataset",
  410. backgroundColor: ["#689f38", "#38649f","#389f99","#ee1044","#ff8f00"],
  411. data: [2584,5698,5987,3485]
  412. }
  413. ]
  414. },
  415. options: {
  416. title: {
  417. display: true,
  418. text: 'Mt Dataset'
  419. }
  420. }
  421. });
  422. if( $('#polar-chart2').length > 0 ){
  423. var ctx4 = document.getElementById("polar-chart2").getContext("2d");
  424. var data4 = {
  425. datasets: [{
  426. data: [
  427. 11,
  428. 16,
  429. 7,
  430. 3,
  431. 14
  432. ],
  433. backgroundColor: [
  434. "#689f38",
  435. "#38649f",
  436. "#389f99",
  437. "#ee1044",
  438. "#ff8f00"
  439. ],
  440. hoverBackgroundColor: [
  441. "#33691e",
  442. "#244674",
  443. "#18625e",
  444. "#b31338",
  445. "#c0720f"
  446. ],
  447. label: 'My dataset' // for legend
  448. }],
  449. labels: [
  450. "lab 1",
  451. "lab 2",
  452. "lab 3",
  453. "lab 4",
  454. "lab 5"
  455. ]
  456. };
  457. var polarChart = new Chart(ctx4, {
  458. type: "polarArea",
  459. data: data4,
  460. options: {
  461. elements: {
  462. arc: {
  463. borderColor: "#fff",
  464. borderWidth: 0
  465. }
  466. },
  467. scale: {
  468. ticks: {
  469. beginAtZero: true,
  470. fontFamily: "Nunito Sans",
  471. },
  472. gridLines: {
  473. color: "rgba(135,135,135,0)",
  474. }
  475. },
  476. animation: {
  477. duration: 3000
  478. },
  479. responsive: true,
  480. legend: {
  481. labels: {
  482. fontFamily: "Nunito Sans",
  483. fontColor:"#878787"
  484. }
  485. },
  486. tooltip: {
  487. backgroundColor:'rgba(33,33,33,1)',
  488. cornerRadius:0,
  489. footerFontFamily:"'Nunito Sans'"
  490. }
  491. }
  492. });
  493. }
  494. //Radar chart
  495. new Chart(document.getElementById("radar-chart1"), {
  496. type: 'radar',
  497. data: {
  498. labels: ["January", "February", "March", "April", "May"],
  499. datasets: [
  500. {
  501. label: "250",
  502. fill: true,
  503. backgroundColor: "rgba(179,181,198,0.2)",
  504. borderColor: "rgba(179,181,198,1)",
  505. pointBorderColor: "#fff",
  506. pointBackgroundColor: "rgba(179,181,198,1)",
  507. data: [8.77,55.61,21.69,6.62,6.82]
  508. }, {
  509. label: "4050",
  510. fill: true,
  511. backgroundColor: "rgba(239, 72, 62, 0.2)",
  512. borderColor: "rgba(239, 72, 62, 1)",
  513. pointBorderColor: "#fff",
  514. pointBackgroundColor: "#ff4c52",
  515. pointBorderColor: "#fff",
  516. data: [25.48,54.16,7.61,8.06,4.45]
  517. }
  518. ]
  519. },
  520. options: {
  521. title: {
  522. display: true,
  523. text: 'My dataset'
  524. }
  525. }
  526. });
  527. if( $('#radar-chart2').length > 0 ){
  528. var ctx3 = document.getElementById("radar-chart2").getContext("2d");
  529. var data3 = {
  530. labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
  531. datasets: [
  532. {
  533. label: "My First dataset",
  534. backgroundColor: "rgba(116, 96, 238, 0.6)",
  535. borderColor: "rgba(116, 96, 238, 0.6)",
  536. pointBackgroundColor: "rgba(116, 96, 238, 0.6)",
  537. pointBorderColor: "#fff",
  538. pointHoverBackgroundColor: "#fff",
  539. pointHoverBorderColor: "rgba(116, 96, 238, 0.6)",
  540. data: [65, 59, 90, 81, 56, 55, 40]
  541. },
  542. {
  543. label: "My Second dataset",
  544. backgroundColor: "rgba(57, 139, 247, 1)",
  545. borderColor: "rgba(57, 139, 247, 1)",
  546. pointBackgroundColor: "rgba(57, 139, 247, 1)",
  547. pointBorderColor: "#fff",
  548. pointHoverBackgroundColor: "#fff",
  549. pointHoverBorderColor: "rgba(57, 139, 247, 1)",
  550. data: [28, 48, 40, 19, 96, 27, 100]
  551. }
  552. ]
  553. };
  554. var radarChart = new Chart(ctx3, {
  555. type: "radar",
  556. data: data3,
  557. options: {
  558. scale: {
  559. ticks: {
  560. beginAtZero: true,
  561. fontFamily: "Nunito Sans",
  562. },
  563. gridLines: {
  564. color: "rgba(135,135,135,0)",
  565. },
  566. pointLabels:{
  567. fontFamily: "Nunito Sans",
  568. fontColor:"#878787"
  569. },
  570. },
  571. animation: {
  572. duration: 3000
  573. },
  574. responsive: true,
  575. legend: {
  576. labels: {
  577. fontFamily: "Nunito Sans",
  578. fontColor:"#878787"
  579. }
  580. },
  581. elements: {
  582. arc: {
  583. borderWidth: 0
  584. }
  585. },
  586. tooltip: {
  587. backgroundColor:'rgba(33,33,33,1)',
  588. cornerRadius:0,
  589. footerFontFamily:"'Nunito Sans'"
  590. }
  591. }
  592. });
  593. }
  594. //Line Chart
  595. new Chart(document.getElementById("line-chart1"), {
  596. type: 'line',
  597. data: {
  598. labels: [4500,3500,3200,3050,2700,2450,2200,1750,1499,2050],
  599. datasets: [{
  600. data: [86,114,106,106,107,111,133,221,783,2478],
  601. label: "January",
  602. borderColor: "#689f38",
  603. fill: false
  604. }, {
  605. data: [282,350,411,502,635,809,947,1402,3700,5267],
  606. label: "February",
  607. borderColor: "#38649f",
  608. fill: false
  609. }, {
  610. data: [168,170,178,190,203,276,408,547,675,734],
  611. label: "March",
  612. borderColor: "#389f99",
  613. fill: false
  614. }, {
  615. data: [40,20,10,16,24,38,74,167,508,784],
  616. label: "April",
  617. borderColor: "#ee1044",
  618. fill: false
  619. }, {
  620. data: [6,3,2,2,7,26,82,172,312,433],
  621. label: "May",
  622. borderColor: "#ff8f00",
  623. fill: false
  624. }
  625. ]
  626. },
  627. options: {
  628. title: {
  629. display: true,
  630. text: 'My Dateset'
  631. }
  632. }
  633. });
  634. if( $('#line-chart2').length > 0 ){
  635. var ctx1 = document.getElementById("line-chart2").getContext("2d");
  636. var data1 = {
  637. labels: ["January", "February", "March", "April", "May", "June", "July"],
  638. datasets: [
  639. {
  640. label: "fir",
  641. backgroundColor: "#ff8f00",
  642. borderColor: "#ff8f00",
  643. pointBorderColor: "#ff8f00",
  644. pointHighlightStroke: "#ff8f00",
  645. data: [0, 59, 40, 75, 50, 45, 80]
  646. },
  647. {
  648. label: "sec",
  649. backgroundColor: "#ee1044",
  650. borderColor: "#ee1044",
  651. pointBorderColor: "#ee1044",
  652. pointBackgroundColor: "#ee1044",
  653. data: [48, 88, 50, 58, 34, 67, 65],
  654. }
  655. ]
  656. };
  657. var areaChart = new Chart(ctx1, {
  658. type:"line",
  659. data:data1,
  660. options: {
  661. tooltips: {
  662. mode:"label"
  663. },
  664. elements:{
  665. point: {
  666. hitRadius:90
  667. }
  668. },
  669. scales: {
  670. yAxes: [{
  671. stacked: true,
  672. gridLines: {
  673. color: "rgba(135,135,135,0)",
  674. },
  675. ticks: {
  676. fontFamily: "Nunito Sans",
  677. fontColor:"#878787"
  678. }
  679. }],
  680. xAxes: [{
  681. stacked: true,
  682. gridLines: {
  683. color: "rgba(135,135,135,0)",
  684. },
  685. ticks: {
  686. fontFamily: "Nunito Sans",
  687. fontColor:"#878787"
  688. }
  689. }]
  690. },
  691. animation: {
  692. duration: 3000
  693. },
  694. responsive: true,
  695. legend: {
  696. display: false,
  697. },
  698. tooltip: {
  699. backgroundColor:'rgba(33,33,33,1)',
  700. cornerRadius:0,
  701. footerFontFamily:"'Nunito Sans'"
  702. }
  703. }
  704. });
  705. }
  706. }); // End of use strict