Update index.html
Browse files- index.html +10 -8
index.html
CHANGED
|
@@ -173,7 +173,7 @@
|
|
| 173 |
}
|
| 174 |
}
|
| 175 |
|
| 176 |
-
|
| 177 |
function normalizeData(rawData) {
|
| 178 |
if (!rawData || typeof rawData !== 'object' || Object.keys(rawData).length === 0) {
|
| 179 |
console.error("Cannot normalize empty or invalid data.");
|
|
@@ -205,7 +205,8 @@
|
|
| 205 |
// Update min/max EXCLUDING the base value itself for color scaling
|
| 206 |
if (sampler !== BASE_SAMPLER || scheduler !== BASE_SCHEDULER) {
|
| 207 |
if (normValue < minValue) minValue = normValue;
|
| 208 |
-
|
|
|
|
| 209 |
}
|
| 210 |
} else {
|
| 211 |
normalized[sampler][scheduler] = undefined;
|
|
@@ -213,15 +214,16 @@
|
|
| 213 |
}
|
| 214 |
}
|
| 215 |
// Handle edge case where only the base value exists or all others are invalid
|
| 216 |
-
if (!isFinite(minValue) || !isFinite(maxValue)) {
|
| 217 |
console.warn("Could not determine valid min/max range for heatmap scaling (excluding base). Using default range [0.5, 1.5] for colors.");
|
| 218 |
-
|
|
|
|
| 219 |
maxValue = Math.max(1.5, baseNormalizedValue * 1.5);
|
| 220 |
} else {
|
| 221 |
-
// Ensure the base value is within the
|
| 222 |
-
//
|
| 223 |
-
minValue = Math.min(minValue, baseNormalizedValue * 0.9);
|
| 224 |
-
maxValue = Math.max(maxValue, baseNormalizedValue * 1.1);
|
| 225 |
}
|
| 226 |
console.log(`Normalized range for heatmap (excluding base): [${minValue.toFixed(2)}, ${maxValue.toFixed(2)}]`);
|
| 227 |
|
|
|
|
| 173 |
}
|
| 174 |
}
|
| 175 |
|
| 176 |
+
// --- Normalization Function ---
|
| 177 |
function normalizeData(rawData) {
|
| 178 |
if (!rawData || typeof rawData !== 'object' || Object.keys(rawData).length === 0) {
|
| 179 |
console.error("Cannot normalize empty or invalid data.");
|
|
|
|
| 205 |
// Update min/max EXCLUDING the base value itself for color scaling
|
| 206 |
if (sampler !== BASE_SAMPLER || scheduler !== BASE_SCHEDULER) {
|
| 207 |
if (normValue < minValue) minValue = normValue;
|
| 208 |
+
// --- FIXED ERROR HERE ---
|
| 209 |
+
if (normValue > maxValue) maxValue = normValue; // Corrected from 'value' to 'normValue'
|
| 210 |
}
|
| 211 |
} else {
|
| 212 |
normalized[sampler][scheduler] = undefined;
|
|
|
|
| 214 |
}
|
| 215 |
}
|
| 216 |
// Handle edge case where only the base value exists or all others are invalid
|
| 217 |
+
if (!isFinite(minValue) || !isFinite(maxValue) || minValue >= maxValue) { // Check if range is valid
|
| 218 |
console.warn("Could not determine valid min/max range for heatmap scaling (excluding base). Using default range [0.5, 1.5] for colors.");
|
| 219 |
+
// Set a reasonable default range relative to the base value
|
| 220 |
+
minValue = Math.min(0.5, baseNormalizedValue * 0.5);
|
| 221 |
maxValue = Math.max(1.5, baseNormalizedValue * 1.5);
|
| 222 |
} else {
|
| 223 |
+
// Ensure the base value is conceptually within the range for smoother color transitions near white
|
| 224 |
+
// Widen range slightly if necessary to avoid extreme colors right next to white base
|
| 225 |
+
minValue = Math.min(minValue, baseNormalizedValue * 0.9); // e.g., ensure range includes at least 0.9
|
| 226 |
+
maxValue = Math.max(maxValue, baseNormalizedValue * 1.1); // e.g., ensure range includes at least 1.1
|
| 227 |
}
|
| 228 |
console.log(`Normalized range for heatmap (excluding base): [${minValue.toFixed(2)}, ${maxValue.toFixed(2)}]`);
|
| 229 |
|