* Initialize the analysis functionality
()
| 9 | * Initialize the analysis functionality |
| 10 | */ |
| 11 | function initializeAnalysis() { |
| 12 | const analysisDataElement = document.getElementById("analysis-data"); |
| 13 | if (!analysisDataElement) { |
| 14 | return; // No analysis data available |
| 15 | } |
| 16 | |
| 17 | // Check if the element has any content before parsing |
| 18 | const textContent = analysisDataElement.textContent.trim(); |
| 19 | if (!textContent) { |
| 20 | return; // No data loaded yet (will be loaded on demand) |
| 21 | } |
| 22 | |
| 23 | try { |
| 24 | analysisData = JSON.parse(textContent); |
| 25 | |
| 26 | if ( |
| 27 | analysisData && |
| 28 | analysisData.all_files && |
| 29 | analysisData.all_files.length > 0 |
| 30 | ) { |
| 31 | setupFileDropdown(); |
| 32 | createLineCountChart(analysisData.all_files[0]); // Start with first file |
| 33 | } |
| 34 | } catch (error) { |
| 35 | console.error("Error parsing analysis data:", error); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Setup the file dropdown change handler |
no test coverage detected