index1.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. $(function (e) {
  2. 'use strict'
  3. // CHARTJS SALES CHART OPEN
  4. var ctx = document.getElementById('saleschart').getContext('2d');
  5. new Chart(ctx, {
  6. type: 'bar',
  7. data: {
  8. labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  9. datasets: [{
  10. barPercentage: 0.1,
  11. barThickness: 6,
  12. barGap: 0,
  13. maxBarThickness: 8,
  14. minBarLength: 2,
  15. label: 'Total Sales',
  16. data: [19, 10, 15, 8, 6, 10, 13],
  17. backgroundColor: [
  18. 'rgba(5, 195, 251, 0.2)',
  19. 'rgba(5, 195, 251, 0.2)',
  20. '#05c3fb',
  21. 'rgba(5, 195, 251, 0.2)',
  22. 'rgba(5, 195, 251, 0.2)',
  23. '#05c3fb',
  24. '#05c3fb'
  25. ],
  26. borderColor: [
  27. 'rgba(5, 195, 251, 0.5)',
  28. 'rgba(5, 195, 251, 0.5)',
  29. '#05c3fb',
  30. 'rgba(5, 195, 251, 0.5)',
  31. 'rgba(5, 195, 251, 0.5)',
  32. '#05c3fb',
  33. '#05c3fb'
  34. ],
  35. pointBorderWidth: 2,
  36. pointRadius: 2,
  37. pointHoverRadius: 2,
  38. borderRadius: 10,
  39. borderWidth: 1
  40. },]
  41. },
  42. options: {
  43. maintainAspectRatio: false,
  44. plugins: {
  45. legend: {
  46. display: false,
  47. labels: {
  48. display: false
  49. }
  50. },
  51. tooltip: {
  52. enabled: false
  53. }
  54. },
  55. responsive: true,
  56. scales: {
  57. x: {
  58. categoryPercentage: 1.0,
  59. barPercentage: 1.0,
  60. barDatasetSpacing: 0,
  61. display: false,
  62. barThickness: 5,
  63. barRadius: 0,
  64. gridLines: {
  65. color: 'transparent',
  66. zeroLineColor: 'transparent'
  67. },
  68. ticks: {
  69. fontSize: 2,
  70. fontColor: 'transparent'
  71. }
  72. },
  73. y: {
  74. display: false,
  75. ticks: {
  76. display: false,
  77. }
  78. }
  79. },
  80. title: {
  81. display: false,
  82. },
  83. elements: {
  84. point: {
  85. radius: 0
  86. }
  87. }
  88. }
  89. });
  90. // CHARTJS SALES CHART CLOSED
  91. // CHARTJS LEADS CHART OPEN
  92. var ctx1 = document.getElementById('leadschart').getContext('2d');
  93. new Chart(ctx1, {
  94. type: 'line',
  95. data: {
  96. labels: ['Date 1', 'Date 2', 'Date 3', 'Date 4', 'Date 5', 'Date 6', 'Date 7', 'Date 8', 'Date 9', 'Date 10', 'Date 11', 'Date 12', 'Date 13', 'Date 14', 'Date 15'],
  97. datasets: [{
  98. label: 'Total Sales',
  99. data: [45, 23, 32, 67, 49, 72, 52, 55, 46, 54, 32, 74, 88, 36, 36, 32, 48, 54],
  100. backgroundColor: 'transparent',
  101. borderColor: '#f46ef4',
  102. borderWidth: '2.5',
  103. pointBorderColor: 'transparent',
  104. pointBackgroundColor: 'transparent',
  105. lineTension: 0.3
  106. },]
  107. },
  108. options: {
  109. maintainAspectRatio: false,
  110. plugins: {
  111. legend: {
  112. display: false,
  113. labels: {
  114. display: false
  115. }
  116. },
  117. tooltip: {
  118. enabled: false
  119. }
  120. },
  121. responsive: true,
  122. scales: {
  123. x: {
  124. ticks: {
  125. beginAtZero: true,
  126. fontSize: 10,
  127. fontColor: "transparent",
  128. },
  129. title: {
  130. display: false,
  131. },
  132. grid: {
  133. display: true,
  134. color: 'transparent ',
  135. drawBorder: false,
  136. },
  137. categoryPercentage: 1.0,
  138. barPercentage: 1.0,
  139. barDatasetSpacing: 0,
  140. display: false,
  141. barThickness: 5,
  142. },
  143. y: {
  144. display: false,
  145. ticks: {
  146. display: false,
  147. }
  148. }
  149. },
  150. title: {
  151. display: false,
  152. },
  153. elements: {
  154. point: {
  155. radius: 0
  156. }
  157. }
  158. }
  159. });
  160. // CHARTJS LEADS CHART CLOSED
  161. // PROFIT CHART OPEN
  162. var ctx2 = document.getElementById('profitchart').getContext('2d');
  163. new Chart(ctx2, {
  164. type: 'bar',
  165. data: {
  166. labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  167. datasets: [{
  168. barPercentage: 0.1,
  169. barThickness: 6,
  170. maxBarThickness: 8,
  171. minBarLength: 2,
  172. label: 'Total Sales',
  173. barGap: 0,
  174. barSizeRatio: 1,
  175. data: [10, 12, 5, 6, 3, 11, 12],
  176. backgroundColor: '#4ecc48',
  177. borderColor: '#4ecc48',
  178. pointBackgroundColor: '#fff',
  179. pointHoverBackgroundColor: '#4ecc48',
  180. pointBorderColor: '#4ecc48',
  181. pointHoverBorderColor: '#4ecc48',
  182. pointBorderWidth: 2,
  183. pointRadius: 2,
  184. pointHoverRadius: 2,
  185. borderRadius: 10,
  186. borderWidth: 1
  187. },]
  188. },
  189. options: {
  190. maintainAspectRatio: false,
  191. plugins: {
  192. legend: {
  193. display: false,
  194. labels: {
  195. display: false
  196. }
  197. },
  198. tooltip: {
  199. enabled: false
  200. }
  201. },
  202. responsive: true,
  203. scales: {
  204. x: {
  205. categoryPercentage: 1.0,
  206. barPercentage: 1.0,
  207. barDatasetSpacing: 0,
  208. display: false,
  209. barThickness: 5,
  210. gridLines: {
  211. color: 'transparent',
  212. zeroLineColor: 'transparent'
  213. },
  214. ticks: {
  215. fontSize: 2,
  216. fontColor: 'transparent'
  217. }
  218. },
  219. y: {
  220. display: false,
  221. ticks: {
  222. display: false,
  223. }
  224. }
  225. },
  226. title: {
  227. display: false,
  228. },
  229. elements: {
  230. point: {
  231. radius: 0
  232. }
  233. }
  234. }
  235. });
  236. // PROFIT CHART CLOSED
  237. // COST CHART OPEN
  238. var ctx3 = document.getElementById('costchart').getContext('2d');
  239. new Chart(ctx3, {
  240. type: 'line',
  241. data: {
  242. labels: ['Date 1', 'Date 2', 'Date 3', 'Date 4', 'Date 5', 'Date 6', 'Date 7', 'Date 8', 'Date 9', 'Date 10', 'Date 11', 'Date 12', 'Date 13', 'Date 14', 'Date 15', 'Date 16', 'Date 17'],
  243. datasets: [{
  244. label: 'Total Sales',
  245. data: [28, 56, 36, 32, 48, 54, 37, 58, 66, 53, 21, 24, 14, 45, 0, 32, 67, 49, 52, 55, 46, 54, 130],
  246. backgroundColor: 'transparent',
  247. borderColor: '#f7ba48',
  248. borderWidth: '2.5',
  249. pointBorderColor: 'transparent',
  250. pointBackgroundColor: 'transparent',
  251. lineTension: 0.3
  252. },]
  253. },
  254. options: {
  255. maintainAspectRatio: false,
  256. plugins: {
  257. legend: {
  258. display: false,
  259. labels: {
  260. display: false
  261. }
  262. },
  263. tooltip: {
  264. enabled: false
  265. }
  266. },
  267. responsive: true,
  268. scales: {
  269. x: {
  270. categoryPercentage: 1.0,
  271. barPercentage: 1.0,
  272. barDatasetSpacing: 0,
  273. display: false,
  274. barThickness: 5,
  275. gridLines: {
  276. color: 'transparent',
  277. zeroLineColor: 'transparent'
  278. },
  279. ticks: {
  280. fontSize: 2,
  281. fontColor: 'transparent'
  282. }
  283. },
  284. y: {
  285. display: false,
  286. ticks: {
  287. display: false,
  288. }
  289. }
  290. },
  291. title: {
  292. display: false,
  293. },
  294. elements: {
  295. point: {
  296. radius: 0
  297. }
  298. }
  299. }
  300. });
  301. // COST CHART CLOSED
  302. // FLOAT CHART OPEN
  303. $.plot('#flotback-chart', [{
  304. data: dashData10,
  305. color: 'rgba(255,255,255, 0.2)',
  306. lines: {
  307. lineWidth: 1
  308. }
  309. }], {
  310. series: {
  311. stack: 0,
  312. shadowSize: 0,
  313. lines: {
  314. show: true,
  315. lineWidth: 1.8,
  316. fill: true,
  317. fillColor: {
  318. colors: [{
  319. opacity: 0
  320. }, {
  321. opacity: 0.3
  322. }]
  323. }
  324. }
  325. },
  326. grid: {
  327. borderWidth: 0,
  328. labelMargin: 5,
  329. hoverable: true
  330. },
  331. yaxis: {
  332. show: false,
  333. color: 'rgba(72, 94, 144, .1)',
  334. min: 0,
  335. max: 130,
  336. font: {
  337. size: 10,
  338. color: '#8392a5'
  339. }
  340. },
  341. xaxis: {
  342. show: false,
  343. color: 'rgba(72, 94, 144, .1)',
  344. ticks: [
  345. [0, '10'],
  346. [10, '20'],
  347. [20, '30'],
  348. [30, '40'],
  349. [40, '50'],
  350. [50, '60'],
  351. [60, '70'],
  352. [70, '80'],
  353. [80, '90'],
  354. [90, '100'],
  355. [100, '110'],
  356. [120, '120'],
  357. ],
  358. font: {
  359. size: 10,
  360. color: '#8392a5'
  361. },
  362. reserveSpace: false
  363. }
  364. });
  365. // FLOAT CHART CLOSED
  366. // RECENT ORDERS OPEN
  367. var myCanvas = document.getElementById("recentorders");
  368. myCanvas.height = "225";
  369. new Chart(myCanvas, {
  370. type: 'bar',
  371. data: {
  372. labels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  373. datasets: [{
  374. barThickness: 8,
  375. label: 'This Month',
  376. data: [27, 50, 28, 50, 28, 30, 22],
  377. backgroundColor: '#61c9fc',
  378. borderWidth: 2,
  379. hoverBackgroundColor: '#61c9fc',
  380. hoverBorderWidth: 0,
  381. borderColor: '#61c9fc',
  382. hoverBorderColor: '#61c9fc',
  383. borderRadius: 10,
  384. }, {
  385. barThickness: 8,
  386. label: 'This Month',
  387. data: [32, 58, 68, 65, 40, 68, 58],
  388. backgroundColor: '#f38ff3',
  389. borderWidth: 2,
  390. hoverBackgroundColor: '#f38ff3',
  391. hoverBorderWidth: 0,
  392. borderColor: '#f38ff3',
  393. hoverBorderColor: '#f38ff3',
  394. borderRadius: 10,
  395. }]
  396. },
  397. options: {
  398. responsive: true,
  399. maintainAspectRatio: false,
  400. layout: {
  401. padding: {
  402. left: 0,
  403. right: 0,
  404. top: 0,
  405. bottom: 0
  406. }
  407. },
  408. plugins: {
  409. legend: {
  410. display: false,
  411. labels: {
  412. display: false
  413. }
  414. },
  415. tooltip: {
  416. enabled: false
  417. }
  418. },
  419. scales: {
  420. y: {
  421. display: false,
  422. grid: {
  423. display: false,
  424. drawBorder: false,
  425. zeroLineColor: 'rgba(142, 156, 173,0.1)',
  426. color: "rgba(142, 156, 173,0.1)",
  427. },
  428. scaleLabel: {
  429. display: false,
  430. },
  431. ticks: {
  432. beginAtZero: true,
  433. stepSize: 25,
  434. suggestedMin: 0,
  435. suggestedMax: 100,
  436. fontColor: "#8492a6",
  437. userCallback: function (tick) {
  438. return tick.toString() + '%';
  439. }
  440. },
  441. },
  442. x: {
  443. display: false,
  444. stacked: false,
  445. ticks: {
  446. beginAtZero: true,
  447. fontColor: "#8492a6",
  448. },
  449. grid: {
  450. color: "rgba(142, 156, 173,0.1)",
  451. display: false
  452. },
  453. }
  454. },
  455. legend: {
  456. display: false
  457. },
  458. elements: {
  459. point: {
  460. radius: 0
  461. }
  462. }
  463. }
  464. });
  465. // RECENT ORDERS CLOSED
  466. // DATA TABLE
  467. $('#data-table').DataTable({
  468. "order": [
  469. [0, "desc"]
  470. ],
  471. order: [],
  472. columnDefs: [{ orderable: false, targets: [0, 4, 5] }],
  473. language: {
  474. searchPlaceholder: 'Search...',
  475. sSearch: '',
  476. }
  477. });
  478. // SELECT2
  479. $('.select2').select2({
  480. minimumResultsForSearch: Infinity
  481. });
  482. // WORLD MAP MARKER
  483. $('#world-map-markers1').vectorMap({
  484. map: 'world_mill_en',
  485. scaleColors: ['#6c5ffc', '#e82646', '#05c3fb'],
  486. normalizeFunction: 'polynomial',
  487. hoverOpacity: 0.7,
  488. hoverColor: false,
  489. regionStyle: {
  490. initial: {
  491. fill: '#edf0f5'
  492. }
  493. },
  494. markerStyle: {
  495. initial: {
  496. r: 6,
  497. 'fill': '#6c5ffc',
  498. 'fill-opacity': 0.9,
  499. 'stroke': '#fff',
  500. 'stroke-width': 9,
  501. 'stroke-opacity': 0.2
  502. },
  503. hover: {
  504. 'stroke': '#fff',
  505. 'fill-opacity': 1,
  506. 'stroke-width': 1.5
  507. }
  508. },
  509. backgroundColor: 'transparent',
  510. markers: [{
  511. latLng: [40.3, -101.38],
  512. name: 'USA',
  513. }, {
  514. latLng: [22.5, 1.51],
  515. name: 'India'
  516. }, {
  517. latLng: [50.02, 80.55],
  518. name: 'Bahrain'
  519. }, {
  520. latLng: [3.2, 73.22],
  521. name: 'Maldives'
  522. }, {
  523. latLng: [35.88, 14.5],
  524. name: 'Malta'
  525. },]
  526. });
  527. });
  528. function getCssValuePrefix() {
  529. 'use strict'
  530. var retuenValue = ''; //default to standard syntax
  531. var prefixes = ['-o-', '-ms-', '-moz-', '-webkit-'];
  532. // Create a temporary DOM object for testing
  533. var dom = document.createElement('div');
  534. for (var i = 0; i < prefixes.length; i++) {
  535. // Attempt to set the style
  536. dom.style.background = prefixes[i] + 'linear-gradient(#ffffff, #000000)';
  537. // Detect if the style was successfully set
  538. if (dom.style.background) {
  539. retuenValue = prefixes[i];
  540. }
  541. }
  542. dom = null;
  543. dom.remove();
  544. return retuenValue;
  545. }
  546. // TRANSACTIONS
  547. var myCanvas = document.getElementById("transactions");
  548. myCanvas.height = "330";
  549. var myCanvasContext = myCanvas.getContext("2d");
  550. var gradientStroke1 = myCanvasContext.createLinearGradient(0, 80, 0, 280);
  551. gradientStroke1.addColorStop(0, 'rgba(108, 95, 252, 0.8)');
  552. gradientStroke1.addColorStop(1, 'rgba(108, 95, 252, 0.2) ');
  553. var gradientStroke2 = myCanvasContext.createLinearGradient(0, 80, 0, 280);
  554. gradientStroke2.addColorStop(0, 'rgba(5, 195, 251, 0.8)');
  555. gradientStroke2.addColorStop(1, 'rgba(5, 195, 251, 0.2) ');
  556. document.getElementById('transactions').innerHTML = '';
  557. var myChart;
  558. myChart = new Chart(myCanvas, {
  559. type: 'line',
  560. data: {
  561. labels: ["Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec"],
  562. type: 'line',
  563. datasets: [{
  564. label: 'Total Sales',
  565. data: [100, 210, 180, 454, 454, 230, 230, 656, 656, 350, 350, 210],
  566. backgroundColor: gradientStroke1,
  567. borderColor: "#05c3fb",
  568. pointBackgroundColor: '#fff',
  569. pointHoverBackgroundColor: gradientStroke1,
  570. pointBorderColor: "#05c3fb",
  571. pointHoverBorderColor: gradientStroke1,
  572. pointBorderWidth: 0,
  573. pointRadius: 0,
  574. pointHoverRadius: 0,
  575. borderWidth: 3,
  576. fill: 'origin',
  577. lineTension: 0.3
  578. }, {
  579. label: 'Total Orders',
  580. data: [200, 530, 110, 110, 480, 520, 780, 435, 475, 738, 454, 454],
  581. backgroundColor: 'transparent',
  582. borderColor: "#05c3fb",
  583. pointBackgroundColor: '#fff',
  584. pointHoverBackgroundColor: gradientStroke2,
  585. pointBorderColor: "#05c3fb",
  586. pointHoverBorderColor: gradientStroke2,
  587. pointBorderWidth: 0,
  588. pointRadius: 0,
  589. pointHoverRadius: 0,
  590. borderWidth: 3,
  591. fill: 'origin',
  592. lineTension: 0.3
  593. }]
  594. },
  595. options: {
  596. responsive: true,
  597. maintainAspectRatio: false,
  598. plugins: {
  599. legend: {
  600. display: false,
  601. labels: {
  602. usePointStyle: false,
  603. }
  604. },
  605. tooltip: {
  606. enabled: false
  607. }
  608. },
  609. scales: {
  610. x: {
  611. display: true,
  612. grid: {
  613. display: false,
  614. drawBorder: false,
  615. color: 'rgba(119, 119, 142, 0.08)'
  616. },
  617. ticks: {
  618. autoSkip: true,
  619. color: '#b0bac9'
  620. },
  621. scaleLabel: {
  622. display: false,
  623. labelString: 'Month',
  624. fontColor: 'transparent'
  625. }
  626. },
  627. y: {
  628. ticks: {
  629. min: 0,
  630. max: 1050,
  631. stepSize: 150,
  632. color: "#b0bac9",
  633. },
  634. display: true,
  635. grid: {
  636. display: true,
  637. drawBorder: false,
  638. zeroLineColor: 'rgba(142, 156, 173,0.1)',
  639. color: "rgba(142, 156, 173,0.1)",
  640. },
  641. scaleLabel: {
  642. display: false,
  643. labelString: 'sales',
  644. fontColor: 'transparent'
  645. }
  646. }
  647. },
  648. title: {
  649. display: false,
  650. text: 'Normal Legend'
  651. }
  652. }
  653. });
  654. function index(myVarVal, myVarVal1) {
  655. 'use strict'
  656. let gradientStroke = myCanvasContext.createLinearGradient(0, 80, 0, 280);;
  657. gradientStroke.addColorStop(0, `rgba(${myVarVal}, 0.8)` || 'rgba(108, 95, 252, 0.8)');
  658. gradientStroke.addColorStop(1, `rgba(${myVarVal}, 0.2)` || 'rgba(108, 95, 252, 0.2) ');
  659. myChart.data.datasets[0] = {
  660. label: 'Total Sales',
  661. data: [100, 210, 180, 454, 454, 230, 230, 656, 656, 350, 350, 210],
  662. backgroundColor: gradientStroke,
  663. borderColor: `rgb(${myVarVal})`,
  664. pointBackgroundColor: '#fff',
  665. pointHoverBackgroundColor: gradientStroke,
  666. pointBorderColor: `rgb(${myVarVal})`,
  667. pointHoverBorderColor: gradientStroke,
  668. pointBorderWidth: 0,
  669. pointRadius: 0,
  670. pointHoverRadius: 0,
  671. borderWidth: 3,
  672. fill: 'origin',
  673. lineTension: 0.3
  674. }
  675. myChart.update();
  676. }