diff --git a/src/renderers/MeasurementRenderer.js b/src/renderers/MeasurementRenderer.js index edaaa3dff9ce8e5220d13787fb52a66eba3f22d1..f7ae73ca7adfa73b362e322666fe76ffa1f8c890 100644 --- a/src/renderers/MeasurementRenderer.js +++ b/src/renderers/MeasurementRenderer.js @@ -38,7 +38,6 @@ const conformityColors = { nofail: '#9e9e9e' }; -// Render all measurement results in a tabbed layout export function renderMeasurementResults(measurementResults, language) { console.debug('renderMeasurementResults called with:', measurementResults); const container = document.getElementById('measurementResults'); @@ -459,7 +458,7 @@ export function renderSingleMeasurementResult(resultObj, language, tabPanel) { margin: { t: 20, b: 40 } }; Plotly.newPlot(graphDiv, allTraces, layout).then(() => { - // Force a resize after a short delay to ensure full width + // Force a resize to ensure full width setTimeout(() => { Plotly.Plots.resize(graphDiv); }, 100); const caption = document.createElement('div'); caption.innerHTML = '<b>' + group[0].name + '</b>'; @@ -501,8 +500,11 @@ export function renderSingleMeasurementResult(resultObj, language, tabPanel) { } } else { cell.textContent = cellData; - if (tableData[0][cellIndex] && tableData[0][cellIndex].toLowerCase().includes('conformity') && conformityMapping[cellIndex] !== undefined) { - cell.style.backgroundColor = conformityMapping[cellIndex]; + if (tableData[0][cellIndex] && tableData[0][cellIndex].toLowerCase().includes('conformity')) { + const confKey = cellData.trim().toLowerCase(); + if (conformityColors[confKey]) { + cell.style.backgroundColor = conformityColors[confKey]; + } } } cell.style.padding = '4px'; @@ -520,9 +522,10 @@ export function renderSingleMeasurementResult(resultObj, language, tabPanel) { let mapping = {}; let col = 1; // Column 0 is X-Axis. for (let i = 0; i < dataHeaders.length; i++) { - col++; // value column. + mapping[col] = palette[i % palette.length]; // Color the data header column + col++; if (extraInfo[i] && extraInfo[i].conformity) { - mapping[col] = palette[i % palette.length]; + mapping[col] = palette[i % palette.length]; // Color the conformity header column col++; } }