Няма описание
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.

charts-chartjs.js 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. /**
  2. * Charts ChartsJS
  3. */
  4. 'use strict';
  5. (function () {
  6. // Color Variables
  7. const purpleColor = '#836AF9',
  8. yellowColor = '#ffe800',
  9. cyanColor = '#28dac6',
  10. orangeColor = '#FF8132',
  11. orangeLightColor = '#FDAC34',
  12. oceanBlueColor = '#299AFF',
  13. greyColor = '#4F5D70',
  14. greyLightColor = '#EDF1F4',
  15. blueColor = '#2B9AFF',
  16. blueLightColor = '#84D0FF';
  17. let cardColor, headingColor, labelColor, borderColor, legendColor;
  18. if (isDarkStyle) {
  19. cardColor = config.colors_dark.cardColor;
  20. headingColor = config.colors_dark.headingColor;
  21. labelColor = config.colors_dark.textMuted;
  22. legendColor = config.colors_dark.bodyColor;
  23. borderColor = config.colors_dark.borderColor;
  24. } else {
  25. cardColor = config.colors.cardColor;
  26. headingColor = config.colors.headingColor;
  27. labelColor = config.colors.textMuted;
  28. legendColor = config.colors.bodyColor;
  29. borderColor = config.colors.borderColor;
  30. }
  31. // Set height according to their data-height
  32. // --------------------------------------------------------------------
  33. const chartList = document.querySelectorAll('.chartjs');
  34. chartList.forEach(function (chartListItem) {
  35. chartListItem.height = chartListItem.dataset.height;
  36. });
  37. // Bar Chart
  38. // --------------------------------------------------------------------
  39. const barChart = document.getElementById('barChart');
  40. if (barChart) {
  41. const barChartVar = new Chart(barChart, {
  42. type: 'bar',
  43. data: {
  44. labels: [
  45. '7/12',
  46. '8/12',
  47. '9/12',
  48. '10/12',
  49. '11/12',
  50. '12/12',
  51. '13/12',
  52. '14/12',
  53. '15/12',
  54. '16/12',
  55. '17/12',
  56. '18/12',
  57. '19/12'
  58. ],
  59. datasets: [
  60. {
  61. data: [275, 90, 190, 205, 125, 85, 55, 87, 127, 150, 230, 280, 190],
  62. backgroundColor: cyanColor,
  63. borderColor: 'transparent',
  64. maxBarThickness: 15,
  65. borderRadius: {
  66. topRight: 15,
  67. topLeft: 15
  68. }
  69. }
  70. ]
  71. },
  72. options: {
  73. responsive: true,
  74. maintainAspectRatio: false,
  75. animation: {
  76. duration: 500
  77. },
  78. plugins: {
  79. tooltip: {
  80. rtl: isRtl,
  81. backgroundColor: cardColor,
  82. titleColor: headingColor,
  83. bodyColor: legendColor,
  84. borderWidth: 1,
  85. borderColor: borderColor
  86. },
  87. legend: {
  88. display: false
  89. }
  90. },
  91. scales: {
  92. x: {
  93. grid: {
  94. color: borderColor,
  95. drawBorder: false,
  96. borderColor: borderColor
  97. },
  98. ticks: {
  99. color: labelColor
  100. }
  101. },
  102. y: {
  103. min: 0,
  104. max: 400,
  105. grid: {
  106. color: borderColor,
  107. drawBorder: false,
  108. borderColor: borderColor
  109. },
  110. ticks: {
  111. stepSize: 100,
  112. color: labelColor
  113. }
  114. }
  115. }
  116. }
  117. });
  118. }
  119. // Horizontal Bar Chart
  120. // --------------------------------------------------------------------
  121. const horizontalBarChart = document.getElementById('horizontalBarChart');
  122. if (horizontalBarChart) {
  123. const horizontalBarChartVar = new Chart(horizontalBarChart, {
  124. type: 'bar',
  125. data: {
  126. labels: ['MON', 'TUE', 'WED ', 'THU', 'FRI', 'SAT', 'SUN'],
  127. datasets: [
  128. {
  129. data: [710, 350, 470, 580, 230, 460, 120],
  130. backgroundColor: config.colors.info,
  131. borderColor: 'transparent',
  132. maxBarThickness: 15
  133. }
  134. ]
  135. },
  136. options: {
  137. indexAxis: 'y',
  138. responsive: true,
  139. maintainAspectRatio: false,
  140. animation: {
  141. duration: 500
  142. },
  143. elements: {
  144. bar: {
  145. borderRadius: {
  146. topRight: 15,
  147. bottomRight: 15
  148. }
  149. }
  150. },
  151. plugins: {
  152. tooltip: {
  153. rtl: isRtl,
  154. backgroundColor: cardColor,
  155. titleColor: headingColor,
  156. bodyColor: legendColor,
  157. borderWidth: 1,
  158. borderColor: borderColor
  159. },
  160. legend: {
  161. display: false
  162. }
  163. },
  164. scales: {
  165. x: {
  166. min: 0,
  167. grid: {
  168. color: borderColor,
  169. borderColor: borderColor
  170. },
  171. ticks: {
  172. color: labelColor
  173. }
  174. },
  175. y: {
  176. grid: {
  177. borderColor: borderColor,
  178. display: false,
  179. drawBorder: false
  180. },
  181. ticks: {
  182. color: labelColor
  183. }
  184. }
  185. }
  186. }
  187. });
  188. }
  189. // Line Chart
  190. // --------------------------------------------------------------------
  191. const lineChart = document.getElementById('lineChart');
  192. if (lineChart) {
  193. const lineChartVar = new Chart(lineChart, {
  194. type: 'line',
  195. data: {
  196. labels: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140],
  197. datasets: [
  198. {
  199. data: [80, 150, 180, 270, 210, 160, 160, 202, 265, 210, 270, 255, 290, 360, 375],
  200. label: 'Europe',
  201. borderColor: config.colors.danger,
  202. tension: 0.5,
  203. pointStyle: 'circle',
  204. backgroundColor: config.colors.danger,
  205. fill: false,
  206. pointRadius: 1,
  207. pointHoverRadius: 5,
  208. pointHoverBorderWidth: 5,
  209. pointBorderColor: 'transparent',
  210. pointHoverBorderColor: cardColor,
  211. pointHoverBackgroundColor: config.colors.danger
  212. },
  213. {
  214. data: [80, 125, 105, 130, 215, 195, 140, 160, 230, 300, 220, 170, 210, 200, 280],
  215. label: 'Asia',
  216. borderColor: config.colors.primary,
  217. tension: 0.5,
  218. pointStyle: 'circle',
  219. backgroundColor: config.colors.primary,
  220. fill: false,
  221. pointRadius: 1,
  222. pointHoverRadius: 5,
  223. pointHoverBorderWidth: 5,
  224. pointBorderColor: 'transparent',
  225. pointHoverBorderColor: cardColor,
  226. pointHoverBackgroundColor: config.colors.primary
  227. },
  228. {
  229. data: [80, 99, 82, 90, 115, 115, 74, 75, 130, 155, 125, 90, 140, 130, 180],
  230. label: 'Africa',
  231. borderColor: yellowColor,
  232. tension: 0.5,
  233. pointStyle: 'circle',
  234. backgroundColor: yellowColor,
  235. fill: false,
  236. pointRadius: 1,
  237. pointHoverRadius: 5,
  238. pointHoverBorderWidth: 5,
  239. pointBorderColor: 'transparent',
  240. pointHoverBorderColor: cardColor,
  241. pointHoverBackgroundColor: yellowColor
  242. }
  243. ]
  244. },
  245. options: {
  246. responsive: true,
  247. maintainAspectRatio: false,
  248. scales: {
  249. x: {
  250. grid: {
  251. color: borderColor,
  252. drawBorder: false,
  253. borderColor: borderColor
  254. },
  255. ticks: {
  256. color: labelColor
  257. }
  258. },
  259. y: {
  260. scaleLabel: {
  261. display: true
  262. },
  263. min: 0,
  264. max: 400,
  265. ticks: {
  266. color: labelColor,
  267. stepSize: 100
  268. },
  269. grid: {
  270. color: borderColor,
  271. drawBorder: false,
  272. borderColor: borderColor
  273. }
  274. }
  275. },
  276. plugins: {
  277. tooltip: {
  278. // Updated default tooltip UI
  279. rtl: isRtl,
  280. backgroundColor: cardColor,
  281. titleColor: headingColor,
  282. bodyColor: legendColor,
  283. borderWidth: 1,
  284. borderColor: borderColor
  285. },
  286. legend: {
  287. position: 'top',
  288. align: 'start',
  289. rtl: isRtl,
  290. labels: {
  291. usePointStyle: true,
  292. padding: 35,
  293. boxWidth: 6,
  294. boxHeight: 6,
  295. color: legendColor
  296. }
  297. }
  298. }
  299. }
  300. });
  301. }
  302. // Radar Chart
  303. // --------------------------------------------------------------------
  304. const radarChart = document.getElementById('radarChart');
  305. if (radarChart) {
  306. // For radar gradient color
  307. const gradientBlue = radarChart.getContext('2d').createLinearGradient(0, 0, 0, 150);
  308. gradientBlue.addColorStop(0, 'rgba(85, 85, 255, 0.9)');
  309. gradientBlue.addColorStop(1, 'rgba(151, 135, 255, 0.8)');
  310. const gradientRed = radarChart.getContext('2d').createLinearGradient(0, 0, 0, 150);
  311. gradientRed.addColorStop(0, 'rgba(255, 85, 184, 0.9)');
  312. gradientRed.addColorStop(1, 'rgba(255, 135, 135, 0.8)');
  313. const radarChartVar = new Chart(radarChart, {
  314. type: 'radar',
  315. data: {
  316. labels: ['STA', 'STR', 'AGI', 'VIT', 'CHA', 'INT'],
  317. datasets: [
  318. {
  319. label: 'Donté Panlin',
  320. data: [25, 59, 90, 81, 60, 82],
  321. fill: true,
  322. pointStyle: 'dash',
  323. backgroundColor: gradientRed,
  324. borderColor: 'transparent',
  325. pointBorderColor: 'transparent'
  326. },
  327. {
  328. label: 'Mireska Sunbreeze',
  329. data: [40, 100, 40, 90, 40, 90],
  330. fill: true,
  331. pointStyle: 'dash',
  332. backgroundColor: gradientBlue,
  333. borderColor: 'transparent',
  334. pointBorderColor: 'transparent'
  335. }
  336. ]
  337. },
  338. options: {
  339. responsive: true,
  340. maintainAspectRatio: false,
  341. animation: {
  342. duration: 500
  343. },
  344. scales: {
  345. r: {
  346. ticks: {
  347. maxTicksLimit: 1,
  348. display: false,
  349. color: labelColor
  350. },
  351. grid: {
  352. color: borderColor
  353. },
  354. angleLines: { color: borderColor },
  355. pointLabels: {
  356. color: labelColor
  357. }
  358. }
  359. },
  360. plugins: {
  361. legend: {
  362. rtl: isRtl,
  363. position: 'top',
  364. labels: {
  365. padding: 25,
  366. color: legendColor
  367. }
  368. },
  369. tooltip: {
  370. // Updated default tooltip UI
  371. rtl: isRtl,
  372. backgroundColor: cardColor,
  373. titleColor: headingColor,
  374. bodyColor: legendColor,
  375. borderWidth: 1,
  376. borderColor: borderColor
  377. }
  378. }
  379. }
  380. });
  381. }
  382. // Polar Chart
  383. // --------------------------------------------------------------------
  384. const polarChart = document.getElementById('polarChart');
  385. if (polarChart) {
  386. const polarChartVar = new Chart(polarChart, {
  387. type: 'polarArea',
  388. data: {
  389. labels: ['Africa', 'Asia', 'Europe', 'America', 'Antarctica', 'Australia'],
  390. datasets: [
  391. {
  392. label: 'Population (millions)',
  393. backgroundColor: [purpleColor, yellowColor, orangeColor, oceanBlueColor, greyColor, cyanColor],
  394. data: [19, 17.5, 15, 13.5, 11, 9],
  395. borderWidth: 0
  396. }
  397. ]
  398. },
  399. options: {
  400. responsive: true,
  401. maintainAspectRatio: false,
  402. animation: {
  403. duration: 500
  404. },
  405. scales: {
  406. r: {
  407. ticks: {
  408. display: false,
  409. color: labelColor
  410. },
  411. grid: {
  412. display: false
  413. }
  414. }
  415. },
  416. plugins: {
  417. tooltip: {
  418. // Updated default tooltip UI
  419. rtl: isRtl,
  420. backgroundColor: cardColor,
  421. titleColor: headingColor,
  422. bodyColor: legendColor,
  423. borderWidth: 1,
  424. borderColor: borderColor
  425. },
  426. legend: {
  427. rtl: isRtl,
  428. position: 'right',
  429. labels: {
  430. usePointStyle: true,
  431. padding: 25,
  432. boxWidth: 8,
  433. boxHeight: 8,
  434. color: legendColor
  435. }
  436. }
  437. }
  438. }
  439. });
  440. }
  441. // Bubble Chart
  442. // --------------------------------------------------------------------
  443. const bubbleChart = document.getElementById('bubbleChart');
  444. if (bubbleChart) {
  445. const bubbleChartVar = new Chart(bubbleChart, {
  446. type: 'bubble',
  447. data: {
  448. animation: {
  449. duration: 10000
  450. },
  451. datasets: [
  452. {
  453. label: 'Dataset 1',
  454. backgroundColor: purpleColor,
  455. borderColor: purpleColor,
  456. data: [
  457. {
  458. x: 20,
  459. y: 74,
  460. r: 10
  461. },
  462. {
  463. x: 10,
  464. y: 110,
  465. r: 5
  466. },
  467. {
  468. x: 30,
  469. y: 165,
  470. r: 7
  471. },
  472. {
  473. x: 40,
  474. y: 200,
  475. r: 20
  476. },
  477. {
  478. x: 90,
  479. y: 185,
  480. r: 7
  481. },
  482. {
  483. x: 50,
  484. y: 240,
  485. r: 7
  486. },
  487. {
  488. x: 60,
  489. y: 275,
  490. r: 10
  491. },
  492. {
  493. x: 70,
  494. y: 305,
  495. r: 5
  496. },
  497. {
  498. x: 80,
  499. y: 325,
  500. r: 4
  501. },
  502. {
  503. x: 100,
  504. y: 310,
  505. r: 5
  506. },
  507. {
  508. x: 110,
  509. y: 240,
  510. r: 5
  511. },
  512. {
  513. x: 120,
  514. y: 270,
  515. r: 7
  516. },
  517. {
  518. x: 130,
  519. y: 300,
  520. r: 6
  521. }
  522. ]
  523. },
  524. {
  525. label: 'Dataset 2',
  526. backgroundColor: yellowColor,
  527. borderColor: yellowColor,
  528. data: [
  529. {
  530. x: 30,
  531. y: 72,
  532. r: 5
  533. },
  534. {
  535. x: 40,
  536. y: 110,
  537. r: 7
  538. },
  539. {
  540. x: 20,
  541. y: 135,
  542. r: 6
  543. },
  544. {
  545. x: 10,
  546. y: 160,
  547. r: 12
  548. },
  549. {
  550. x: 50,
  551. y: 285,
  552. r: 5
  553. },
  554. {
  555. x: 60,
  556. y: 235,
  557. r: 5
  558. },
  559. {
  560. x: 70,
  561. y: 275,
  562. r: 7
  563. },
  564. {
  565. x: 80,
  566. y: 290,
  567. r: 4
  568. },
  569. {
  570. x: 90,
  571. y: 250,
  572. r: 10
  573. },
  574. {
  575. x: 100,
  576. y: 220,
  577. r: 7
  578. },
  579. {
  580. x: 120,
  581. y: 230,
  582. r: 4
  583. },
  584. {
  585. x: 110,
  586. y: 320,
  587. r: 15
  588. },
  589. {
  590. x: 130,
  591. y: 330,
  592. r: 7
  593. }
  594. ]
  595. }
  596. ]
  597. },
  598. options: {
  599. responsive: true,
  600. maintainAspectRatio: false,
  601. scales: {
  602. x: {
  603. min: 0,
  604. max: 140,
  605. grid: {
  606. color: borderColor,
  607. drawBorder: false,
  608. borderColor: borderColor
  609. },
  610. ticks: {
  611. stepSize: 10,
  612. color: labelColor
  613. }
  614. },
  615. y: {
  616. min: 0,
  617. max: 400,
  618. grid: {
  619. color: borderColor,
  620. drawBorder: false,
  621. borderColor: borderColor
  622. },
  623. ticks: {
  624. stepSize: 100,
  625. color: labelColor
  626. }
  627. }
  628. },
  629. plugins: {
  630. legend: {
  631. display: false
  632. },
  633. tooltip: {
  634. // Updated default tooltip UI
  635. rtl: isRtl,
  636. backgroundColor: cardColor,
  637. titleColor: headingColor,
  638. bodyColor: legendColor,
  639. borderWidth: 1,
  640. borderColor: borderColor
  641. }
  642. }
  643. }
  644. });
  645. }
  646. // LineArea Chart
  647. // --------------------------------------------------------------------
  648. const lineAreaChart = document.getElementById('lineAreaChart');
  649. if (lineAreaChart) {
  650. const lineAreaChartVar = new Chart(lineAreaChart, {
  651. type: 'line',
  652. data: {
  653. labels: [
  654. '7/12',
  655. '8/12',
  656. '9/12',
  657. '10/12',
  658. '11/12',
  659. '12/12',
  660. '13/12',
  661. '14/12',
  662. '15/12',
  663. '16/12',
  664. '17/12',
  665. '18/12',
  666. '19/12',
  667. '20/12',
  668. ''
  669. ],
  670. datasets: [
  671. {
  672. label: 'Africa',
  673. data: [40, 55, 45, 75, 65, 55, 70, 60, 100, 98, 90, 120, 125, 140, 155],
  674. tension: 0,
  675. fill: true,
  676. backgroundColor: blueColor,
  677. pointStyle: 'circle',
  678. borderColor: 'transparent',
  679. pointRadius: 0.5,
  680. pointHoverRadius: 5,
  681. pointHoverBorderWidth: 5,
  682. pointBorderColor: 'transparent',
  683. pointHoverBackgroundColor: blueColor,
  684. pointHoverBorderColor: cardColor
  685. },
  686. {
  687. label: 'Asia',
  688. data: [70, 85, 75, 150, 100, 140, 110, 105, 160, 150, 125, 190, 200, 240, 275],
  689. tension: 0,
  690. fill: true,
  691. backgroundColor: blueLightColor,
  692. pointStyle: 'circle',
  693. borderColor: 'transparent',
  694. pointRadius: 0.5,
  695. pointHoverRadius: 5,
  696. pointHoverBorderWidth: 5,
  697. pointBorderColor: 'transparent',
  698. pointHoverBackgroundColor: blueLightColor,
  699. pointHoverBorderColor: cardColor
  700. },
  701. {
  702. label: 'Europe',
  703. data: [240, 195, 160, 215, 185, 215, 185, 200, 250, 210, 195, 250, 235, 300, 315],
  704. tension: 0,
  705. fill: true,
  706. backgroundColor: greyLightColor,
  707. pointStyle: 'circle',
  708. borderColor: 'transparent',
  709. pointRadius: 0.5,
  710. pointHoverRadius: 5,
  711. pointHoverBorderWidth: 5,
  712. pointBorderColor: 'transparent',
  713. pointHoverBackgroundColor: greyLightColor,
  714. pointHoverBorderColor: cardColor
  715. }
  716. ]
  717. },
  718. options: {
  719. responsive: true,
  720. maintainAspectRatio: false,
  721. plugins: {
  722. legend: {
  723. position: 'top',
  724. rtl: isRtl,
  725. align: 'start',
  726. labels: {
  727. usePointStyle: true,
  728. padding: 35,
  729. boxWidth: 6,
  730. boxHeight: 6,
  731. color: legendColor
  732. }
  733. },
  734. tooltip: {
  735. // Updated default tooltip UI
  736. rtl: isRtl,
  737. backgroundColor: cardColor,
  738. titleColor: headingColor,
  739. bodyColor: legendColor,
  740. borderWidth: 1,
  741. borderColor: borderColor
  742. }
  743. },
  744. scales: {
  745. x: {
  746. grid: {
  747. color: 'transparent',
  748. borderColor: borderColor
  749. },
  750. ticks: {
  751. color: labelColor
  752. }
  753. },
  754. y: {
  755. min: 0,
  756. max: 400,
  757. grid: {
  758. color: 'transparent',
  759. borderColor: borderColor
  760. },
  761. ticks: {
  762. stepSize: 100,
  763. color: labelColor
  764. }
  765. }
  766. }
  767. }
  768. });
  769. }
  770. // Doughnut Chart
  771. // --------------------------------------------------------------------
  772. const doughnutChart = document.getElementById('doughnutChart');
  773. if (doughnutChart) {
  774. const doughnutChartVar = new Chart(doughnutChart, {
  775. type: 'doughnut',
  776. data: {
  777. labels: ['Tablet', 'Mobile', 'Desktop'],
  778. datasets: [
  779. {
  780. data: [10, 10, 80],
  781. backgroundColor: [cyanColor, orangeLightColor, config.colors.primary],
  782. borderWidth: 0,
  783. pointStyle: 'rectRounded'
  784. }
  785. ]
  786. },
  787. options: {
  788. responsive: true,
  789. animation: {
  790. duration: 500
  791. },
  792. cutout: '68%',
  793. plugins: {
  794. legend: {
  795. display: false
  796. },
  797. tooltip: {
  798. callbacks: {
  799. label: function (context) {
  800. const label = context.labels || '',
  801. value = context.parsed;
  802. const output = ' ' + label + ' : ' + value + ' %';
  803. return output;
  804. }
  805. },
  806. // Updated default tooltip UI
  807. rtl: isRtl,
  808. backgroundColor: cardColor,
  809. titleColor: headingColor,
  810. bodyColor: legendColor,
  811. borderWidth: 1,
  812. borderColor: borderColor
  813. }
  814. }
  815. }
  816. });
  817. }
  818. // Scatter Chart
  819. // --------------------------------------------------------------------
  820. const scatterChart = document.getElementById('scatterChart');
  821. if (scatterChart) {
  822. const scatterChartVar = new Chart(scatterChart, {
  823. type: 'scatter',
  824. data: {
  825. datasets: [
  826. {
  827. label: 'iPhone',
  828. data: [
  829. {
  830. x: 72,
  831. y: 225
  832. },
  833. {
  834. x: 81,
  835. y: 270
  836. },
  837. {
  838. x: 90,
  839. y: 230
  840. },
  841. {
  842. x: 103,
  843. y: 305
  844. },
  845. {
  846. x: 103,
  847. y: 245
  848. },
  849. {
  850. x: 108,
  851. y: 275
  852. },
  853. {
  854. x: 110,
  855. y: 290
  856. },
  857. {
  858. x: 111,
  859. y: 315
  860. },
  861. {
  862. x: 109,
  863. y: 350
  864. },
  865. {
  866. x: 116,
  867. y: 340
  868. },
  869. {
  870. x: 113,
  871. y: 260
  872. },
  873. {
  874. x: 117,
  875. y: 275
  876. },
  877. {
  878. x: 117,
  879. y: 295
  880. },
  881. {
  882. x: 126,
  883. y: 280
  884. },
  885. {
  886. x: 127,
  887. y: 340
  888. },
  889. {
  890. x: 133,
  891. y: 330
  892. }
  893. ],
  894. backgroundColor: config.colors.primary,
  895. borderColor: 'transparent',
  896. pointBorderWidth: 2,
  897. pointHoverBorderWidth: 2,
  898. pointRadius: 5
  899. },
  900. {
  901. label: 'Samsung Note',
  902. data: [
  903. {
  904. x: 13,
  905. y: 95
  906. },
  907. {
  908. x: 22,
  909. y: 105
  910. },
  911. {
  912. x: 17,
  913. y: 115
  914. },
  915. {
  916. x: 19,
  917. y: 130
  918. },
  919. {
  920. x: 21,
  921. y: 125
  922. },
  923. {
  924. x: 35,
  925. y: 125
  926. },
  927. {
  928. x: 13,
  929. y: 155
  930. },
  931. {
  932. x: 21,
  933. y: 165
  934. },
  935. {
  936. x: 25,
  937. y: 155
  938. },
  939. {
  940. x: 18,
  941. y: 190
  942. },
  943. {
  944. x: 26,
  945. y: 180
  946. },
  947. {
  948. x: 43,
  949. y: 180
  950. },
  951. {
  952. x: 53,
  953. y: 202
  954. },
  955. {
  956. x: 61,
  957. y: 165
  958. },
  959. {
  960. x: 67,
  961. y: 225
  962. }
  963. ],
  964. backgroundColor: yellowColor,
  965. borderColor: 'transparent',
  966. pointRadius: 5
  967. },
  968. {
  969. label: 'OnePlus',
  970. data: [
  971. {
  972. x: 70,
  973. y: 195
  974. },
  975. {
  976. x: 72,
  977. y: 270
  978. },
  979. {
  980. x: 98,
  981. y: 255
  982. },
  983. {
  984. x: 100,
  985. y: 215
  986. },
  987. {
  988. x: 87,
  989. y: 240
  990. },
  991. {
  992. x: 94,
  993. y: 280
  994. },
  995. {
  996. x: 99,
  997. y: 300
  998. },
  999. {
  1000. x: 102,
  1001. y: 290
  1002. },
  1003. {
  1004. x: 110,
  1005. y: 275
  1006. },
  1007. {
  1008. x: 111,
  1009. y: 250
  1010. },
  1011. {
  1012. x: 94,
  1013. y: 280
  1014. },
  1015. {
  1016. x: 92,
  1017. y: 340
  1018. },
  1019. {
  1020. x: 100,
  1021. y: 335
  1022. },
  1023. {
  1024. x: 108,
  1025. y: 330
  1026. }
  1027. ],
  1028. backgroundColor: cyanColor,
  1029. borderColor: 'transparent',
  1030. pointBorderWidth: 2,
  1031. pointHoverBorderWidth: 2,
  1032. pointRadius: 5
  1033. }
  1034. ]
  1035. },
  1036. options: {
  1037. responsive: true,
  1038. maintainAspectRatio: false,
  1039. animation: {
  1040. duration: 800
  1041. },
  1042. plugins: {
  1043. legend: {
  1044. position: 'top',
  1045. rtl: isRtl,
  1046. align: 'start',
  1047. labels: {
  1048. usePointStyle: true,
  1049. padding: 25,
  1050. boxWidth: 6,
  1051. boxHeight: 6,
  1052. color: legendColor
  1053. }
  1054. },
  1055. tooltip: {
  1056. // Updated default tooltip UI
  1057. rtl: isRtl,
  1058. backgroundColor: cardColor,
  1059. titleColor: headingColor,
  1060. bodyColor: legendColor,
  1061. borderWidth: 1,
  1062. borderColor: borderColor
  1063. }
  1064. },
  1065. scales: {
  1066. x: {
  1067. min: 0,
  1068. max: 140,
  1069. grid: {
  1070. color: borderColor,
  1071. drawTicks: false,
  1072. drawBorder: false,
  1073. borderColor: borderColor
  1074. },
  1075. ticks: {
  1076. stepSize: 10,
  1077. color: labelColor
  1078. }
  1079. },
  1080. y: {
  1081. min: 0,
  1082. max: 400,
  1083. grid: {
  1084. color: borderColor,
  1085. drawTicks: false,
  1086. drawBorder: false,
  1087. borderColor: borderColor
  1088. },
  1089. ticks: {
  1090. stepSize: 100,
  1091. color: labelColor
  1092. }
  1093. }
  1094. }
  1095. }
  1096. });
  1097. }
  1098. })();