whoami7 - Manager
:
/
home
/
kckglobal
/
public_html
/
portal
/
storage
/
framework
/
views
/
Upload File:
files >> /home/kckglobal/public_html/portal/storage/framework/views/36fe81840f25bbfdfdfbd47e0c0b3f4c.php
<div <?php echo e($attributes); ?>></div> <script> function initializeChart() { const chartData = <?php echo json_encode($chartData, 15, 512) ?> || []; const allDates = <?php echo json_encode($allDates, 15, 512) ?> || []; const colors = <?php echo json_encode($colors, 15, 512) ?> || ['#7cd6fd']; if (chartData.length === 0 || allDates.length === 0) { console.error('Chart data or dates are empty'); return; } // Prepare datasets with proper start and end dates const datasets = chartData.map(obj => { const values = allDates.map(date => { // If date is before objective start date, return 0 if (date < obj.start_date) { return 0; } // Find matching data point const point = obj.data.find(item => item.x === date); if (point) { return point.y; } // Only interpolate values up to the last check-in date if (date <= obj.end_date) { // For dates between start and end with no check-in, // find the last known value before this date const lastKnownPoint = obj.data .filter(item => item.x <= date) .sort((a, b) => b.x.localeCompare(a.x))[0]; return lastKnownPoint ? lastKnownPoint.y : 0; // Default to 0 if no last known point } // For dates after the last check-in, maintain the final value const finalPoint = obj.data[obj.data.length - 1]; return finalPoint ? finalPoint.y : 0; }); return { name: obj.name, values: values }; }); frappe.chart = new frappe.Chart("#<?php echo e($attributes['id']); ?>", { data: { labels: allDates, datasets: datasets }, type: 'line', height: <?php echo e($attributes['height']); ?>, colors: colors, // Use dynamic colors // colors: ['#7cd6fd', '#743ee2', '#ff5858', '#ffc107'], axisOptions: { xIsSeries: true, }, yAxis: { title: 'Percentage (%)', min: 0, max: 100, }, // tooltipOptions: { // formatTooltipX: d => moment(d).format('MMM D, YYYY'), // formatTooltipY: d => d + '%' // }, tooltipOptions: { formatTooltipX: d => moment(d).format('MMM D, YYYY'), formatTooltipY: d => { // Limit objective name length to 20 characters with "..." if longer const truncatedName = d.length > 15 ? d.slice(0, 15) + "..." : d; return truncatedName + '%'; } }, lineOptions: { hideDots: 0, heatline: 0, } }); } initializeChart(); </script> <?php /**PATH /home/kckglobal/public_html/portal/Modules/Performance/Resources/views/components/line-chart.blade.php ENDPATH**/ ?>
Copyright ©2021 || Defacer Indonesia