heatmaps: part 22

This commit is contained in:
nym21
2026-06-01 17:54:42 +02:00
parent 88c38e74f9
commit 2bbc535b58
12 changed files with 448 additions and 178 deletions
+2 -2
View File
@@ -34,13 +34,13 @@ export function createDateControls(option, onChange) {
const persistedFrom = createHeatmapPersistedValue(
option,
"from",
"hm_from",
"from",
rangeChoiceLabel(defaultFromChoice),
);
const persistedTo = createHeatmapPersistedValue(
option,
"to",
"hm_to",
"to",
rangeChoiceLabel(defaultToChoice),
);
+10 -5
View File
@@ -18,24 +18,24 @@ export function createYControls(option, onChange) {
choices,
String(option.defaults?.yMin ?? ""),
fallbackMinChoice,
axisChoiceKey,
axisChoiceValueKey,
);
const defaultMaxChoice = findChoiceByKey(
choices,
String(option.defaults?.yMax ?? ""),
fallbackMaxChoice,
axisChoiceKey,
axisChoiceValueKey,
);
const persistedMin = createHeatmapPersistedValue(
option,
"y-min",
"hm_y_min",
"min",
axisChoiceKey(defaultMinChoice),
);
const persistedMax = createHeatmapPersistedValue(
option,
"y-max",
"hm_y_max",
"max",
axisChoiceKey(defaultMaxChoice),
);
@@ -105,10 +105,15 @@ export function createYControls(option, onChange) {
/** @param {HeatmapAxisChoice} choice */
function axisChoiceKey(choice) {
return String(choice.value);
return choice.key ?? choice.label;
}
/** @param {HeatmapAxisChoice} choice */
function axisChoiceLabel(choice) {
return choice.label;
}
/** @param {HeatmapAxisChoice} choice */
function axisChoiceValueKey(choice) {
return String(choice.value);
}