global: fixes

This commit is contained in:
nym21
2025-10-03 14:15:23 +02:00
parent cfdf8fdbca
commit d9c4653f82
9 changed files with 106 additions and 98 deletions
@@ -2551,37 +2551,85 @@ export function createPartialOptions({ colors, brk }) {
],
},
]),
{
name: "Coins Destroyed",
title: `Coins Destroyed ${title}`,
bottom: list.flatMap(({ color, name, id: _id }) => {
const id = fixId(_id);
return /** @type {const} */ ([
createBaseSeries({
metric: `${id}coinblocks_destroyed`,
name: useGroupName ? name : "sum",
color,
}),
createBaseSeries({
metric: `${id}coinblocks_destroyed_cumulative`,
name: useGroupName ? name : "cumulative",
color,
defaultActive: false,
}),
createBaseSeries({
metric: `${id}coindays_destroyed`,
name: useGroupName ? name : "sum",
color,
}),
createBaseSeries({
metric: `${id}coindays_destroyed_cumulative`,
name: useGroupName ? name : "cumulative",
color,
defaultActive: false,
}),
]);
}),
},
...("list" in args
? [
{
name: "Coins Destroyed",
tree: [
{
name: "Sum",
title: `Sum of Coins Destroyed ${title}`,
bottom: list.flatMap(({ color, name, id: _id }) => {
const id = fixId(_id);
return /** @type {const} */ ([
createBaseSeries({
metric: `${id}coinblocks_destroyed`,
name,
color,
}),
createBaseSeries({
metric: `${id}coindays_destroyed`,
name,
color,
}),
]);
}),
},
{
name: "Cumulative",
title: `Cumulative Coins Destroyed ${title}`,
bottom: list.flatMap(({ color, name, id: _id }) => {
const id = fixId(_id);
return /** @type {const} */ ([
createBaseSeries({
metric: `${id}coinblocks_destroyed_cumulative`,
name,
color,
}),
createBaseSeries({
metric: `${id}coindays_destroyed_cumulative`,
name,
color,
}),
]);
}),
},
],
},
]
: [
{
name: "Coins Destroyed",
title: `Coins Destroyed ${title}`,
bottom: list.flatMap(({ color, name, id: _id }) => {
const id = fixId(_id);
return /** @type {const} */ ([
createBaseSeries({
metric: `${id}coinblocks_destroyed`,
name: "sum",
color,
}),
createBaseSeries({
metric: `${id}coinblocks_destroyed_cumulative`,
name: "cumulative",
color,
defaultActive: false,
}),
createBaseSeries({
metric: `${id}coindays_destroyed`,
name: "sum",
color,
}),
createBaseSeries({
metric: `${id}coindays_destroyed_cumulative`,
name: "cumulative",
color,
defaultActive: false,
}),
]);
}),
},
]),
],
});
}
@@ -2713,24 +2761,22 @@ export function createPartialOptions({ colors, brk }) {
bottom: [
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
metric: `${id}_price_returns`,
title: "Returns",
title: "total",
type: "Baseline",
}),
createPriceLine({
unit: "percentage",
}),
...(brk.hasMetric(cagr)
? [
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
metric: cagr,
title: "cagr",
type: "Baseline",
}),
createPriceLine({
unit: "percentage",
colors: [colors.lime, colors.pink],
}),
]
: []),
createPriceLine({
unit: "percentage",
}),
],
};
}),
@@ -234,10 +234,6 @@ export function init({
iseries.update(last);
break;
}
case "dateindex": {
iseries.update(last);
break;
}
default: {
if (index === "weekindex") {
date.setUTCDate(date.getUTCDate() - ((date.getUTCDay() + 6) % 7));
@@ -257,7 +253,7 @@ export function init({
0,
1,
);
} else {
} else if (index !== "dateindex") {
throw Error("Unsupported");
}
@@ -270,7 +266,7 @@ export function init({
}
iseries.update(last);
} else {
latest.time = time;
last.time = time;
iseries.update(last);
}
}