heatmaps: part 15

This commit is contained in:
nym21
2026-06-01 12:04:44 +02:00
parent cb9f277d49
commit 200cd1011e
6 changed files with 49 additions and 16 deletions
+28 -4
View File
@@ -347,8 +347,20 @@ function updateDateControls(option) {
const currentYear = new Date().getUTCFullYear();
const fromChoices = createFromChoices(currentYear);
const toChoices = createToChoices(currentYear);
const defaultFromChoice = fromChoices.at(-1) ?? fromChoices[0];
const defaultToChoice = toChoices[0];
const fallbackFromChoice = fromChoices.at(-1) ?? fromChoices[0];
const fallbackToChoice = toChoices[0];
const defaultFromChoice = findChoiceByKey(
fromChoices,
option.defaults?.from ?? "",
fallbackFromChoice,
rangeChoiceLabel,
);
const defaultToChoice = findChoiceByKey(
toChoices,
option.defaults?.to ?? "",
fallbackToChoice,
rangeChoiceLabel,
);
const persistedFrom = createHeatmapPersistedValue(
option,
@@ -437,8 +449,20 @@ function updateYControls(option) {
return;
}
const defaultMinChoice = choices[0];
const defaultMaxChoice = choices.at(-1) ?? choices[0];
const fallbackMinChoice = choices[0];
const fallbackMaxChoice = choices.at(-1) ?? choices[0];
const defaultMinChoice = findChoiceByKey(
choices,
String(option.defaults?.yMin ?? ""),
fallbackMinChoice,
axisChoiceKey,
);
const defaultMaxChoice = findChoiceByKey(
choices,
String(option.defaults?.yMax ?? ""),
fallbackMaxChoice,
axisChoiceKey,
);
const persistedMin = createHeatmapPersistedValue(
option,
"y-min",
+9
View File
@@ -63,6 +63,15 @@ function createOracleHeatmapOption(mode, name) {
format: formatAmount,
},
},
defaults:
mode === "payments"
? {
from: "2015",
to: "today",
yMin: -5,
yMax: 2,
}
: undefined,
tooltip: defaultTooltip,
};
}
+6
View File
@@ -19,6 +19,12 @@
* @property {number} start
* @property {number} end
*
* @typedef {Object} HeatmapDefaults
* @property {string} [from]
* @property {string} [to]
* @property {number} [yMin]
* @property {number} [yMax]
*
* @typedef {Object} HeatmapGridAddResult
* @property {number} col
* @property {boolean} maxChanged