mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-02 14:59:00 -07:00
heatmaps: part 15
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -63,6 +63,15 @@ function createOracleHeatmapOption(mode, name) {
|
||||
format: formatAmount,
|
||||
},
|
||||
},
|
||||
defaults:
|
||||
mode === "payments"
|
||||
? {
|
||||
from: "2015",
|
||||
to: "today",
|
||||
yMin: -5,
|
||||
yMax: 2,
|
||||
}
|
||||
: undefined,
|
||||
tooltip: defaultTooltip,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user