feat: Doing more polishing (M8b)
This commit is contained in:
@@ -63,6 +63,7 @@ export function createDashboard(root, scenario) {
|
||||
spark: $(root, `.gauge[data-ind="${id}"] .gauge__spark`),
|
||||
}]));
|
||||
const sparkLen = {};
|
||||
const shownValue = {};
|
||||
|
||||
function trend(series, eps, goodUp) {
|
||||
if (!series || series.length < 2) return ["", ""];
|
||||
@@ -82,7 +83,14 @@ export function createDashboard(root, scenario) {
|
||||
g.fill.style.width = `${v}%`;
|
||||
g.el.classList.toggle("is-low", v < 30);
|
||||
g.el.classList.toggle("is-high", v >= 70);
|
||||
g.value.textContent = Math.round(v);
|
||||
const r = Math.round(v);
|
||||
g.value.textContent = r;
|
||||
if (shownValue[id] !== undefined && shownValue[id] !== r) {
|
||||
g.value.classList.remove("is-up", "is-down");
|
||||
void g.value.offsetWidth; // restart the animation
|
||||
g.value.classList.add(r > shownValue[id] ? "is-up" : "is-down");
|
||||
}
|
||||
shownValue[id] = r;
|
||||
if (id === "opinion") g.band.textContent = t("opinion." + bandIndex(v, OPINION_CUTS));
|
||||
|
||||
const series = state.history.series[id] ?? [];
|
||||
|
||||
Reference in New Issue
Block a user