* Create the line count chart for a specific file
(fileName)
| 55 | * Create the line count chart for a specific file |
| 56 | */ |
| 57 | function createLineCountChart(fileName) { |
| 58 | const canvas = document.getElementById("line-count-chart"); |
| 59 | if (!canvas || !analysisData) return; |
| 60 | |
| 61 | const ctx = canvas.getContext("2d"); |
| 62 | |
| 63 | // Destroy existing chart if it exists |
| 64 | if (lineCountChart) { |
| 65 | lineCountChart.destroy(); |
| 66 | } |
| 67 | |
| 68 | const chartData = prepareChartData(fileName); |
| 69 | |
| 70 | lineCountChart = new Chart(ctx, { |
| 71 | type: "line", |
| 72 | data: chartData, |
| 73 | options: { |
| 74 | responsive: true, |
| 75 | maintainAspectRatio: false, |
| 76 | plugins: { |
| 77 | title: { |
| 78 | display: true, |
| 79 | text: `Line Count Over Rounds: ${fileName}`, |
| 80 | }, |
| 81 | legend: { |
| 82 | display: true, |
| 83 | position: "top", |
| 84 | }, |
| 85 | }, |
| 86 | scales: { |
| 87 | x: { |
| 88 | title: { |
| 89 | display: true, |
| 90 | text: "Round", |
| 91 | }, |
| 92 | type: "linear", |
| 93 | position: "bottom", |
| 94 | }, |
| 95 | y: { |
| 96 | title: { |
| 97 | display: true, |
| 98 | text: "Line Count", |
| 99 | }, |
| 100 | beginAtZero: true, |
| 101 | }, |
| 102 | }, |
| 103 | interaction: { |
| 104 | intersect: false, |
| 105 | mode: "index", |
| 106 | }, |
| 107 | }, |
| 108 | }); |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Update the existing chart with data for a new file |
no test coverage detected