Nessuna descrizione
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.

dashboards-manutenzioni.js 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. /**
  2. * Dashboard Manutenzioni
  3. */
  4. 'use strict';
  5. document.addEventListener('DOMContentLoaded', function (e) {
  6. let cardColor, headingColor, legendColor, labelColor, shadeColor, borderColor, fontFamily;
  7. cardColor = config.colors.cardColor;
  8. headingColor = config.colors.headingColor;
  9. legendColor = config.colors.bodyColor;
  10. labelColor = config.colors.textMuted;
  11. borderColor = config.colors.borderColor;
  12. fontFamily = config.fontFamily;
  13. // Verifica se i dati della dashboard sono disponibili
  14. let dashboardData;
  15. if (typeof window.dashboardData !== 'undefined') {
  16. dashboardData = window.dashboardData;
  17. } else if (typeof dashboardData !== 'undefined') {
  18. dashboardData = dashboardData;
  19. } else {
  20. console.warn('Dashboard data non disponibile');
  21. return;
  22. }
  23. // Debug: mostra i dati nella console
  24. console.log('Dashboard Data:', dashboardData);
  25. // Grafico Segnalazioni nel Tempo
  26. const segnalazioniTempoChartEl = document.querySelector('#segnalazioniTempoChart');
  27. const hasValidTempoData = dashboardData.labelsTempo && dashboardData.datiTempo &&
  28. Array.isArray(dashboardData.labelsTempo) && Array.isArray(dashboardData.datiTempo) &&
  29. dashboardData.labelsTempo.length > 0 && dashboardData.datiTempo.length > 0 &&
  30. !dashboardData.labelsTempo.includes('Nessun dato') &&
  31. dashboardData.datiTempo.some(val => val > 0);
  32. if (segnalazioniTempoChartEl && hasValidTempoData) {
  33. const segnalazioniTempoChartConfig = {
  34. chart: {
  35. height: 350,
  36. type: 'line',
  37. toolbar: { show: false },
  38. zoom: { enabled: false }
  39. },
  40. colors: [config.colors.primary],
  41. stroke: {
  42. curve: 'smooth',
  43. width: 3
  44. },
  45. series: [{
  46. name: 'Segnalazioni',
  47. data: dashboardData.datiTempo
  48. }],
  49. xaxis: {
  50. categories: dashboardData.labelsTempo,
  51. labels: {
  52. style: {
  53. fontSize: '13px',
  54. fontFamily: fontFamily,
  55. colors: labelColor
  56. }
  57. },
  58. axisTicks: {
  59. show: false
  60. },
  61. axisBorder: {
  62. show: false
  63. }
  64. },
  65. yaxis: {
  66. labels: {
  67. style: {
  68. fontSize: '13px',
  69. fontFamily: fontFamily,
  70. colors: labelColor
  71. }
  72. }
  73. },
  74. grid: {
  75. borderColor: borderColor,
  76. strokeDashArray: 4,
  77. padding: {
  78. top: -20,
  79. bottom: -10,
  80. left: 0
  81. }
  82. },
  83. tooltip: {
  84. theme: 'dark'
  85. },
  86. states: {
  87. hover: {
  88. filter: {
  89. type: 'none'
  90. }
  91. },
  92. active: {
  93. filter: {
  94. type: 'none'
  95. }
  96. }
  97. }
  98. };
  99. const segnalazioniTempoChart = new ApexCharts(segnalazioniTempoChartEl, segnalazioniTempoChartConfig);
  100. segnalazioniTempoChart.render();
  101. } else if (segnalazioniTempoChartEl) {
  102. segnalazioniTempoChartEl.innerHTML = '<div class="text-center p-4 text-muted"><i class="bx bx-info-circle me-2"></i>Nessun dato disponibile per questo periodo</div>';
  103. console.log('Segnalazioni nel Tempo: dati non validi', dashboardData.labelsTempo, dashboardData.datiTempo);
  104. }
  105. // Grafico Distribuzione per Stato (Torta)
  106. const distribuzioneStatoChartEl = document.querySelector('#distribuzioneStatoChart');
  107. if (distribuzioneStatoChartEl && dashboardData.labelsStato && dashboardData.datiStato &&
  108. Array.isArray(dashboardData.labelsStato) && Array.isArray(dashboardData.datiStato) &&
  109. dashboardData.labelsStato.length > 0 && dashboardData.datiStato.length > 0 &&
  110. !dashboardData.labelsStato.includes('Nessun dato')) {
  111. const distribuzioneStatoChartConfig = {
  112. chart: {
  113. height: 350,
  114. type: 'donut'
  115. },
  116. labels: dashboardData.labelsStato,
  117. series: dashboardData.datiStato,
  118. colors: [config.colors.primary, config.colors.warning, config.colors.info, config.colors.success],
  119. legend: {
  120. position: 'bottom',
  121. labels: {
  122. colors: headingColor,
  123. useSeriesColors: false,
  124. fontSize: '13px',
  125. fontFamily: fontFamily
  126. }
  127. },
  128. plotOptions: {
  129. pie: {
  130. donut: {
  131. size: '75%'
  132. }
  133. }
  134. }
  135. };
  136. const distribuzioneStatoChart = new ApexCharts(distribuzioneStatoChartEl, distribuzioneStatoChartConfig);
  137. distribuzioneStatoChart.render();
  138. } else if (distribuzioneStatoChartEl) {
  139. distribuzioneStatoChartEl.innerHTML = '<div class="text-center p-4 text-muted">Nessun dato disponibile</div>';
  140. }
  141. // Grafico Distribuzione per Priorità (Barre)
  142. const distribuzionePrioritaChartEl = document.querySelector('#distribuzionePrioritaChart');
  143. if (distribuzionePrioritaChartEl && dashboardData.labelsPriorita && dashboardData.datiPriorita &&
  144. Array.isArray(dashboardData.labelsPriorita) && Array.isArray(dashboardData.datiPriorita) &&
  145. dashboardData.labelsPriorita.length > 0 && dashboardData.datiPriorita.length > 0 &&
  146. !dashboardData.labelsPriorita.includes('Nessun dato')) {
  147. const distribuzionePrioritaChartConfig = {
  148. chart: {
  149. height: 300,
  150. type: 'bar',
  151. toolbar: { show: false }
  152. },
  153. colors: [config.colors.danger, config.colors.warning, config.colors.info, config.colors.success],
  154. plotOptions: {
  155. bar: {
  156. horizontal: false,
  157. columnWidth: '55%',
  158. borderRadius: 8,
  159. startingShape: 'rounded',
  160. endingShape: 'rounded',
  161. borderRadiusApplication: 'around'
  162. }
  163. },
  164. dataLabels: {
  165. enabled: false
  166. },
  167. series: [{
  168. name: 'Segnalazioni',
  169. data: dashboardData.datiPriorita
  170. }],
  171. xaxis: {
  172. categories: dashboardData.labelsPriorita,
  173. labels: {
  174. style: {
  175. fontSize: '13px',
  176. fontFamily: fontFamily,
  177. colors: labelColor
  178. }
  179. },
  180. axisTicks: {
  181. show: false
  182. },
  183. axisBorder: {
  184. show: false
  185. }
  186. },
  187. yaxis: {
  188. labels: {
  189. style: {
  190. fontSize: '13px',
  191. fontFamily: fontFamily,
  192. colors: labelColor
  193. }
  194. }
  195. },
  196. grid: {
  197. borderColor: borderColor,
  198. strokeDashArray: 4,
  199. padding: {
  200. top: -20,
  201. bottom: -10,
  202. left: 0
  203. }
  204. },
  205. states: {
  206. hover: {
  207. filter: {
  208. type: 'none'
  209. }
  210. },
  211. active: {
  212. filter: {
  213. type: 'none'
  214. }
  215. }
  216. }
  217. };
  218. const distribuzionePrioritaChart = new ApexCharts(distribuzionePrioritaChartEl, distribuzionePrioritaChartConfig);
  219. distribuzionePrioritaChart.render();
  220. } else if (distribuzionePrioritaChartEl) {
  221. distribuzionePrioritaChartEl.innerHTML = '<div class="text-center p-4 text-muted">Nessun dato disponibile</div>';
  222. }
  223. // Grafico Segnalazioni per Reparto (Barre)
  224. const segnalazioniRepartoChartEl = document.querySelector('#segnalazioniRepartoChart');
  225. if (segnalazioniRepartoChartEl && dashboardData.labelsReparto && dashboardData.datiReparto &&
  226. Array.isArray(dashboardData.labelsReparto) && Array.isArray(dashboardData.datiReparto) &&
  227. dashboardData.labelsReparto.length > 0 && dashboardData.datiReparto.length > 0 &&
  228. !dashboardData.labelsReparto.includes('Nessun dato')) {
  229. const segnalazioniRepartoChartConfig = {
  230. chart: {
  231. height: 300,
  232. type: 'bar',
  233. toolbar: { show: false }
  234. },
  235. colors: [config.colors.primary],
  236. plotOptions: {
  237. bar: {
  238. horizontal: false,
  239. columnWidth: '55%',
  240. borderRadius: 8,
  241. startingShape: 'rounded',
  242. endingShape: 'rounded',
  243. borderRadiusApplication: 'around'
  244. }
  245. },
  246. dataLabels: {
  247. enabled: false
  248. },
  249. series: [{
  250. name: 'Segnalazioni',
  251. data: dashboardData.datiReparto
  252. }],
  253. xaxis: {
  254. categories: dashboardData.labelsReparto,
  255. labels: {
  256. style: {
  257. fontSize: '13px',
  258. fontFamily: fontFamily,
  259. colors: labelColor
  260. },
  261. rotate: -45,
  262. rotateAlways: true
  263. },
  264. axisTicks: {
  265. show: false
  266. },
  267. axisBorder: {
  268. show: false
  269. }
  270. },
  271. yaxis: {
  272. labels: {
  273. style: {
  274. fontSize: '13px',
  275. fontFamily: fontFamily,
  276. colors: labelColor
  277. }
  278. }
  279. },
  280. grid: {
  281. borderColor: borderColor,
  282. strokeDashArray: 4,
  283. padding: {
  284. top: -20,
  285. bottom: -10,
  286. left: 0
  287. }
  288. },
  289. states: {
  290. hover: {
  291. filter: {
  292. type: 'none'
  293. }
  294. },
  295. active: {
  296. filter: {
  297. type: 'none'
  298. }
  299. }
  300. }
  301. };
  302. const segnalazioniRepartoChart = new ApexCharts(segnalazioniRepartoChartEl, segnalazioniRepartoChartConfig);
  303. segnalazioniRepartoChart.render();
  304. } else if (segnalazioniRepartoChartEl) {
  305. segnalazioniRepartoChartEl.innerHTML = '<div class="text-center p-4 text-muted">Nessun dato disponibile</div>';
  306. }
  307. // Grafico Top Manutentori (Barre Orizzontali)
  308. const topManutentoriChartEl = document.querySelector('#topManutentoriChart');
  309. if (topManutentoriChartEl && dashboardData.labelsManutentori && dashboardData.datiManutentori &&
  310. Array.isArray(dashboardData.labelsManutentori) && Array.isArray(dashboardData.datiManutentori) &&
  311. dashboardData.labelsManutentori.length > 0 && dashboardData.datiManutentori.length > 0 &&
  312. !dashboardData.labelsManutentori.includes('Nessun dato')) {
  313. const topManutentoriChartConfig = {
  314. chart: {
  315. height: 300,
  316. type: 'bar',
  317. toolbar: { show: false }
  318. },
  319. colors: [config.colors.success],
  320. plotOptions: {
  321. bar: {
  322. horizontal: true,
  323. barHeight: '70%',
  324. borderRadius: 8,
  325. startingShape: 'rounded',
  326. endingShape: 'rounded',
  327. borderRadiusApplication: 'around'
  328. }
  329. },
  330. dataLabels: {
  331. enabled: true
  332. },
  333. series: [{
  334. name: 'Segnalazioni Risolte',
  335. data: dashboardData.datiManutentori
  336. }],
  337. xaxis: {
  338. categories: dashboardData.labelsManutentori,
  339. labels: {
  340. style: {
  341. fontSize: '13px',
  342. fontFamily: fontFamily,
  343. colors: labelColor
  344. }
  345. },
  346. axisTicks: {
  347. show: false
  348. },
  349. axisBorder: {
  350. show: false
  351. }
  352. },
  353. yaxis: {
  354. labels: {
  355. style: {
  356. fontSize: '13px',
  357. fontFamily: fontFamily,
  358. colors: labelColor
  359. }
  360. }
  361. },
  362. grid: {
  363. borderColor: borderColor,
  364. strokeDashArray: 4,
  365. padding: {
  366. top: -20,
  367. bottom: -10,
  368. left: 0
  369. }
  370. },
  371. states: {
  372. hover: {
  373. filter: {
  374. type: 'none'
  375. }
  376. },
  377. active: {
  378. filter: {
  379. type: 'none'
  380. }
  381. }
  382. }
  383. };
  384. const topManutentoriChart = new ApexCharts(topManutentoriChartEl, topManutentoriChartConfig);
  385. topManutentoriChart.render();
  386. } else if (topManutentoriChartEl) {
  387. topManutentoriChartEl.innerHTML = '<div class="text-center p-4 text-muted">Nessun dato disponibile</div>';
  388. }
  389. // Grafico Top Reparti (Barre Orizzontali)
  390. const topRepartiChartEl = document.querySelector('#topRepartiChart');
  391. console.log('Top Reparti Chart Element:', topRepartiChartEl);
  392. console.log('Labels Reparto:', dashboardData.labelsReparto);
  393. console.log('Dati Reparto:', dashboardData.datiReparto);
  394. if (topRepartiChartEl && dashboardData.labelsReparto && dashboardData.datiReparto &&
  395. Array.isArray(dashboardData.labelsReparto) && Array.isArray(dashboardData.datiReparto) &&
  396. dashboardData.labelsReparto.length > 0 && dashboardData.datiReparto.length > 0) {
  397. // Filtra i dati validi (escludi "Nessun dato")
  398. const repartiData = dashboardData.labelsReparto
  399. .map((label, index) => ({
  400. label: label,
  401. value: dashboardData.datiReparto[index]
  402. }))
  403. .filter(item => item.label !== 'Nessun dato' && item.value > 0)
  404. .sort((a, b) => b.value - a.value)
  405. .slice(0, 5);
  406. console.log('Reparti Data processati:', repartiData);
  407. if (repartiData.length === 0) {
  408. topRepartiChartEl.innerHTML = '<div class="text-center p-4 text-muted">Nessun dato disponibile</div>';
  409. return;
  410. }
  411. const topRepartiChartConfig = {
  412. chart: {
  413. height: 300,
  414. type: 'bar',
  415. toolbar: { show: false }
  416. },
  417. colors: [config.colors.primary],
  418. plotOptions: {
  419. bar: {
  420. horizontal: true,
  421. barHeight: '70%',
  422. borderRadius: 8,
  423. startingShape: 'rounded',
  424. endingShape: 'rounded',
  425. borderRadiusApplication: 'around'
  426. }
  427. },
  428. dataLabels: {
  429. enabled: true
  430. },
  431. series: [{
  432. name: 'Segnalazioni',
  433. data: repartiData.map(item => item.value)
  434. }],
  435. xaxis: {
  436. categories: repartiData.map(item => item.label),
  437. labels: {
  438. style: {
  439. fontSize: '13px',
  440. fontFamily: fontFamily,
  441. colors: labelColor
  442. }
  443. },
  444. axisTicks: {
  445. show: false
  446. },
  447. axisBorder: {
  448. show: false
  449. }
  450. },
  451. yaxis: {
  452. labels: {
  453. style: {
  454. fontSize: '13px',
  455. fontFamily: fontFamily,
  456. colors: labelColor
  457. }
  458. }
  459. },
  460. grid: {
  461. borderColor: borderColor,
  462. strokeDashArray: 4,
  463. padding: {
  464. top: -20,
  465. bottom: -10,
  466. left: 0
  467. },
  468. xaxis: {
  469. lines: {
  470. show: true
  471. }
  472. },
  473. yaxis: {
  474. lines: {
  475. show: false
  476. }
  477. }
  478. },
  479. states: {
  480. hover: {
  481. filter: {
  482. type: 'none'
  483. }
  484. },
  485. active: {
  486. filter: {
  487. type: 'none'
  488. }
  489. }
  490. },
  491. tooltip: {
  492. theme: 'dark'
  493. }
  494. };
  495. try {
  496. const topRepartiChart = new ApexCharts(topRepartiChartEl, topRepartiChartConfig);
  497. topRepartiChart.render();
  498. console.log('Top Reparti Chart renderizzato con successo');
  499. } catch (error) {
  500. console.error('Errore nel rendering del grafico Top Reparti:', error);
  501. topRepartiChartEl.innerHTML = '<div class="text-center p-4 text-danger"><i class="bx bx-error-circle me-2"></i>Errore nel caricamento del grafico</div>';
  502. }
  503. } else {
  504. console.warn('Top Reparti Chart: condizioni non soddisfatte', {
  505. element: topRepartiChartEl,
  506. hasLabels: !!dashboardData.labelsReparto,
  507. hasData: !!dashboardData.datiReparto,
  508. labelsLength: dashboardData.labelsReparto?.length,
  509. datiLength: dashboardData.datiReparto?.length
  510. });
  511. if (topRepartiChartEl) {
  512. topRepartiChartEl.innerHTML = '<div class="text-center p-4 text-muted">Nessun dato disponibile</div>';
  513. }
  514. }
  515. // Grafico Costi per Reparto (Barre)
  516. const costiRepartoChartEl = document.querySelector('#costiRepartoChart');
  517. if (costiRepartoChartEl && dashboardData.labelsCostiReparto && dashboardData.datiCostiReparto &&
  518. Array.isArray(dashboardData.labelsCostiReparto) && Array.isArray(dashboardData.datiCostiReparto) &&
  519. dashboardData.labelsCostiReparto.length > 0 && dashboardData.datiCostiReparto.length > 0 &&
  520. !dashboardData.labelsCostiReparto.includes('Nessun dato')) {
  521. const costiRepartoChartConfig = {
  522. chart: {
  523. height: 350,
  524. type: 'bar',
  525. toolbar: { show: false }
  526. },
  527. colors: [config.colors.warning],
  528. plotOptions: {
  529. bar: {
  530. horizontal: false,
  531. columnWidth: '55%',
  532. borderRadius: 8,
  533. startingShape: 'rounded',
  534. endingShape: 'rounded',
  535. borderRadiusApplication: 'around'
  536. }
  537. },
  538. dataLabels: {
  539. enabled: false
  540. },
  541. series: [{
  542. name: 'Costi (€)',
  543. data: dashboardData.datiCostiReparto
  544. }],
  545. xaxis: {
  546. categories: dashboardData.labelsCostiReparto,
  547. labels: {
  548. style: {
  549. fontSize: '13px',
  550. fontFamily: fontFamily,
  551. colors: labelColor
  552. },
  553. rotate: -45,
  554. rotateAlways: true
  555. },
  556. axisTicks: {
  557. show: false
  558. },
  559. axisBorder: {
  560. show: false
  561. }
  562. },
  563. yaxis: {
  564. labels: {
  565. style: {
  566. fontSize: '13px',
  567. fontFamily: fontFamily,
  568. colors: labelColor
  569. },
  570. formatter: function(val) {
  571. return '€' + val.toFixed(2);
  572. }
  573. }
  574. },
  575. grid: {
  576. borderColor: borderColor,
  577. strokeDashArray: 4,
  578. padding: {
  579. top: -20,
  580. bottom: -10,
  581. left: 0
  582. }
  583. },
  584. states: {
  585. hover: {
  586. filter: {
  587. type: 'none'
  588. }
  589. },
  590. active: {
  591. filter: {
  592. type: 'none'
  593. }
  594. }
  595. },
  596. tooltip: {
  597. y: {
  598. formatter: function(val) {
  599. return '€' + val.toFixed(2);
  600. }
  601. }
  602. }
  603. };
  604. const costiRepartoChart = new ApexCharts(costiRepartoChartEl, costiRepartoChartConfig);
  605. costiRepartoChart.render();
  606. } else if (costiRepartoChartEl) {
  607. costiRepartoChartEl.innerHTML = '<div class="text-center p-4 text-muted">Nessun dato disponibile</div>';
  608. }
  609. // Grafico Distribuzione per Tipo (Torta)
  610. const distribuzioneTipoChartEl = document.querySelector('#distribuzioneTipoChart');
  611. if (distribuzioneTipoChartEl && dashboardData.labelsTipo && dashboardData.datiTipo &&
  612. Array.isArray(dashboardData.labelsTipo) && Array.isArray(dashboardData.datiTipo) &&
  613. dashboardData.labelsTipo.length > 0 && dashboardData.datiTipo.length > 0 &&
  614. !dashboardData.labelsTipo.includes('Nessun dato')) {
  615. const distribuzioneTipoChartConfig = {
  616. chart: {
  617. height: 300,
  618. type: 'donut'
  619. },
  620. labels: dashboardData.labelsTipo,
  621. series: dashboardData.datiTipo,
  622. colors: [config.colors.primary, config.colors.success, config.colors.warning, config.colors.info, config.colors.danger],
  623. legend: {
  624. position: 'bottom',
  625. labels: {
  626. colors: headingColor,
  627. useSeriesColors: false,
  628. fontSize: '13px',
  629. fontFamily: fontFamily
  630. }
  631. },
  632. plotOptions: {
  633. pie: {
  634. donut: {
  635. size: '75%'
  636. }
  637. }
  638. }
  639. };
  640. const distribuzioneTipoChart = new ApexCharts(distribuzioneTipoChartEl, distribuzioneTipoChartConfig);
  641. distribuzioneTipoChart.render();
  642. } else if (distribuzioneTipoChartEl) {
  643. distribuzioneTipoChartEl.innerHTML = '<div class="text-center p-4 text-muted">Nessun dato disponibile</div>';
  644. }
  645. // Grafico Costi per Tipo (Barre)
  646. const costiTipoChartEl = document.querySelector('#costiTipoChart');
  647. if (costiTipoChartEl && dashboardData.labelsCostiTipo && dashboardData.datiCostiTipo &&
  648. Array.isArray(dashboardData.labelsCostiTipo) && Array.isArray(dashboardData.datiCostiTipo) &&
  649. dashboardData.labelsCostiTipo.length > 0 && dashboardData.datiCostiTipo.length > 0 &&
  650. !dashboardData.labelsCostiTipo.includes('Nessun dato')) {
  651. const costiTipoChartConfig = {
  652. chart: {
  653. height: 350,
  654. type: 'bar',
  655. toolbar: { show: false }
  656. },
  657. colors: [config.colors.success],
  658. plotOptions: {
  659. bar: {
  660. horizontal: false,
  661. columnWidth: '55%',
  662. borderRadius: 8,
  663. startingShape: 'rounded',
  664. endingShape: 'rounded',
  665. borderRadiusApplication: 'around'
  666. }
  667. },
  668. dataLabels: {
  669. enabled: false
  670. },
  671. series: [{
  672. name: 'Costi (€)',
  673. data: dashboardData.datiCostiTipo
  674. }],
  675. xaxis: {
  676. categories: dashboardData.labelsCostiTipo,
  677. labels: {
  678. style: {
  679. fontSize: '13px',
  680. fontFamily: fontFamily,
  681. colors: labelColor
  682. },
  683. rotate: -45,
  684. rotateAlways: true
  685. },
  686. axisTicks: {
  687. show: false
  688. },
  689. axisBorder: {
  690. show: false
  691. }
  692. },
  693. yaxis: {
  694. labels: {
  695. style: {
  696. fontSize: '13px',
  697. fontFamily: fontFamily,
  698. colors: labelColor
  699. },
  700. formatter: function(val) {
  701. return '€' + val.toFixed(2);
  702. }
  703. }
  704. },
  705. grid: {
  706. borderColor: borderColor,
  707. strokeDashArray: 4,
  708. padding: {
  709. top: -20,
  710. bottom: -10,
  711. left: 0
  712. }
  713. },
  714. states: {
  715. hover: {
  716. filter: {
  717. type: 'none'
  718. }
  719. },
  720. active: {
  721. filter: {
  722. type: 'none'
  723. }
  724. }
  725. },
  726. tooltip: {
  727. y: {
  728. formatter: function(val) {
  729. return '€' + val.toFixed(2);
  730. }
  731. }
  732. }
  733. };
  734. const costiTipoChart = new ApexCharts(costiTipoChartEl, costiTipoChartConfig);
  735. costiTipoChart.render();
  736. } else if (costiTipoChartEl) {
  737. costiTipoChartEl.innerHTML = '<div class="text-center p-4 text-muted">Nessun dato disponibile</div>';
  738. }
  739. });