Development Cycle Dashboard

Development Cycle Dashboard

Development Progress Overview

Track tasks across different phases and monitor overall progress.

Total Tasks

0

Tasks In Progress

0

Tasks Completed

0

Tasks Blocked

0
Tasks by Phase
Tasks by Status

Configure Development Tasks

Add, edit, or remove tasks and their details.

Add/Edit Task

ID Task Name Phase Start Date End Date Status Assigned To Actions

No task data available.

'; return; } // Aggregate data by status const statusCounts = d3.rollup(developmentTasks, v => v.length, d => d.status); const chartData = Array.from(statusCounts, ([status, count]) => ({ status, count })); // Define a consistent order and color for statuses const statusOrder = ['Blocked', 'Not Started', 'In Progress', 'Completed']; const statusColors = { 'Not Started': '#6c757d', // Gray 'In Progress': '#007bff', // Blue 'Completed': '#28a745', // Green 'Blocked': '#dc3545' // Red }; chartData.sort((a, b) => statusOrder.indexOf(a.status) - statusOrder.indexOf(b.status)); const margin = { top: 20, right: 20, bottom: 40, left: 40 }; const width = tasksByStatusChartContainer.clientWidth - margin.left - margin.right; const height = tasksByStatusChartContainer.clientHeight - margin.top - margin.bottom - 30; // Account for title height const svg = d3.select(tasksByStatusChartContainer) .append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", `translate(${margin.left},${margin.top})`); // X scale const x = d3.scaleBand() .domain(chartData.map(d => d.status)) .range([0, width]) .padding(0.1); // Y scale const y = d3.scaleLinear() .domain([0, d3.max(chartData, d => d.count) * 1.2]) // 20% buffer .range([height, 0]); // Add X axis svg.append("g") .attr("class", "axis x-axis") .attr("transform", `translate(0,${height})`) .call(d3.axisBottom(x)) .selectAll("text") .style("text-anchor", "end") .attr("dx", "-.8em") .attr("dy", ".15em") .attr("transform", "rotate(-45)"); // Add Y axis svg.append("g") .attr("class", "axis y-axis") .call(d3.axisLeft(y).tickFormat(d3.format("d"))); // Integer ticks // Tooltip const tooltip = d3.select("body").append("div") .attr("class", "chart-tooltip") .style("opacity", 0); // Add bars svg.selectAll(".bar") .data(chartData) .enter().append("rect") .attr("class", "bar") .attr("x", d => x(d.status)) .attr("y", d => y(d.count)) .attr("width", x.bandwidth()) .attr("height", d => height - y(d.count)) .attr("fill", d => statusColors[d.status] || 'steelblue') // Use defined colors .on("mouseover", function(event, d) { d3.select(this).attr("fill", d3.rgb(this.getAttribute('fill')).darker(0.5)); tooltip.transition() .duration(200) .style("opacity", .9); tooltip.html(`Status: ${d.status}
Tasks: ${d.count}`) .style("left", (event.pageX + 10) + "px") .style("top", (event.pageY - 28) + "px"); }) .on("mouseout", function(d) { d3.select(this).attr("fill", statusColors[d.status] || 'steelblue'); // Restore original color tooltip.transition() .duration(500) .style("opacity", 0); }); } // --- PDF Download Function --- /** * Generates and downloads a PDF of the current dashboard content. */ window.downloadPdf = async function() { if (!dashboardTab) { console.error('Error: Dashboard tab content not found for PDF generation.'); return; } // Temporarily hide elements not needed in PDF const elementsToHide = document.querySelectorAll('.tab-nav, .nav-buttons, #downloadPdfButton, .chart-tooltip'); elementsToHide.forEach(el => el.style.display = 'none'); // Ensure the dashboard tab is active for capture dashboardTab.classList.add('active'); // Capture summary metrics const summaryCanvas = await html2canvas(document.querySelector('.summary-metrics'), { scale: 2, useCORS: true, logging: false }); const summaryImgData = summaryCanvas.toDataURL('image/png'); // Capture tasks by phase chart const phaseChartCanvas = await html2canvas(tasksByPhaseChartContainer, { scale: 2, useCORS: true, logging: false }); const phaseChartImgData = phaseChartCanvas.toDataURL('image/png'); // Capture tasks by status chart const statusChartCanvas = await html2canvas(tasksByStatusChartContainer, { scale: 2, useCORS: true, logging: false }); const statusChartImgData = statusChartCanvas.toDataURL('image/png'); // Re-show hidden elements immediately after capture elementsToHide.forEach(el => el.style.display = ''); const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'portrait', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); let yOffset = 40; // Add title to PDF pdf.setFontSize(22); pdf.text("Development Cycle Report", pdfWidth / 2, yOffset, { align: 'center' }); yOffset += 20; // Add current date/time to PDF pdf.setFontSize(10); pdf.text(`Generated on: ${new Date().toLocaleString()}`, pdfWidth / 2, yOffset, { align: 'center' }); yOffset += 40; // Add Summary Metrics Image pdf.setFontSize(18); pdf.text("Summary Metrics", pdfWidth / 2, yOffset, { align: 'center' }); yOffset += 10; const summaryImgHeight = (summaryCanvas.height * (pdfWidth - 40)) / summaryCanvas.width; pdf.addImage(summaryImgData, 'PNG', 20, yOffset, pdfWidth - 40, summaryImgHeight); yOffset += summaryImgHeight + 30; // Add Tasks by Phase Chart Image pdf.setFontSize(18); pdf.text("Tasks by Phase Chart", pdfWidth / 2, yOffset, { align: 'center' }); yOffset += 10; const phaseChartImgHeight = (phaseChartCanvas.height * (pdfWidth - 40)) / phaseChartCanvas.width; // Check if image fits on current page, add new page if not if (yOffset + phaseChartImgHeight > pdf.internal.pageSize.getHeight() - 20) { pdf.addPage(); yOffset = 40; // Reset yOffset for new page } pdf.addImage(phaseChartImgData, 'PNG', 20, yOffset, pdfWidth - 40, phaseChartImgHeight); yOffset += phaseChartImgHeight + 30; // Add Tasks by Status Chart Image pdf.setFontSize(18); pdf.text("Tasks by Status Chart", pdfWidth / 2, yOffset, { align: 'center' }); yOffset += 10; const statusChartImgHeight = (statusChartCanvas.height * (pdfWidth - 40)) / statusChartCanvas.width; // Check if image fits on current page, add new page if not if (yOffset + statusChartImgHeight > pdf.internal.pageSize.getHeight() - 20) { pdf.addPage(); yOffset = 40; // Reset yOffset for new page } pdf.addImage(statusChartImgData, 'PNG', 20, yOffset, pdfWidth - 40, statusChartImgHeight); yOffset += statusChartImgHeight + 30; // Add a section for detailed task data (tabular format) pdf.addPage(); pdf.setFontSize(18); pdf.text("Detailed Task Information", pdf.internal.pageSize.getWidth() / 2, 40, { align: 'center' }); const tableData = developmentTasks.map(t => [ t.id, t.taskName, t.phase, t.startDate, t.endDate || 'N/A', t.status, t.assignedTo || 'N/A', t.notes || 'N/A' ]); pdf.autoTable({ head: [['ID', 'Task Name', 'Phase', 'Start Date', 'End Date', 'Status', 'Assigned To', 'Notes']], body: tableData, startY: 60, theme: 'grid', styles: { fontSize: 7, cellPadding: 3 }, // Smaller font for more columns headStyles: { fillColor: [242, 242, 242], textColor: [51, 51, 51], fontStyle: 'bold' }, alternateRowStyles: { fillColor: [251, 251, 251] }, margin: { top: 70, left: 5, right: 5 } // Adjust margins for more columns }); pdf.save('development_cycle_report.pdf'); }; // --- Event Listeners and Initial Render --- downloadPdfButton.addEventListener('click', downloadPdf); // Initial setup // Sort tasks by start date initially developmentTasks.sort((a, b) => new Date(a.startDate) - new Date(b.startDate)); updateConfigTable(); renderDashboardMetrics(); renderTasksByPhaseChart(); renderTasksByStatusChart(); updateNavigationButtons(); // Set initial button states });
Scroll to Top