app: add height datasets

This commit is contained in:
k
2024-07-22 11:08:58 +02:00
parent 8b08a82f07
commit 232276d106
9 changed files with 389 additions and 55 deletions
+67 -36
View File
@@ -1,4 +1,5 @@
import { colors } from "../../utils/colors";
import { createRecapPresets } from "../templates/recap";
export function createPresets(scale: ResourceScale) {
return {
@@ -141,42 +142,72 @@ export function createPresets(scale: ResourceScale) {
},
{
scale,
name: "Mined",
tree: [
{
scale,
icon: IconTablerCube,
name: "Daily Sum",
title: "Daily Sum Of Blocks Mined",
description: "",
bottom: [
{
title: "Target",
color: colors.white,
datasetPath: `/date-to-blocks-mined-1d-target`,
options: {
lineStyle: 3,
},
},
{
title: "1W Avg.",
color: colors.momentumYellow,
datasetPath: `/date-to-blocks-mined-1w-sma`,
defaultVisible: false,
},
{
title: "1M Avg.",
color: colors.bitcoin,
datasetPath: `/date-to-blocks-mined-1m-sma`,
},
{
title: "Mined",
color: colors.darkBitcoin,
datasetPath: `/date-to-blocks-mined`,
},
],
},
],
name: "Size",
tree: createRecapPresets({
scale,
title: "Block Size",
color: colors.darkWhite,
keySum: "/date-to-block-size-1d-sum",
keyAverage: "/date-to-block-size-1d-average",
keyMax: "/date-to-block-size-1d-max",
key90p: "/date-to-block-size-1d-90p",
key75p: "/date-to-block-size-1d-75p",
keyMedian: "/date-to-block-size-1d-median",
key25p: "/date-to-block-size-1d-25p",
key10p: "/date-to-block-size-1d-10p",
keyMin: "/date-to-block-size-1d-min",
}),
},
{
scale,
name: "Weight",
tree: createRecapPresets({
scale,
title: "Block Weight",
color: colors.darkWhite,
keyAverage: "/date-to-block-weight-1d-average",
keyMax: "/date-to-block-weight-1d-max",
key90p: "/date-to-block-weight-1d-90p",
key75p: "/date-to-block-weight-1d-75p",
keyMedian: "/date-to-block-weight-1d-median",
key25p: "/date-to-block-weight-1d-25p",
key10p: "/date-to-block-weight-1d-10p",
keyMin: "/date-to-block-weight-1d-min",
}),
},
{
scale,
name: "VBytes",
tree: createRecapPresets({
scale,
title: "Block VBytes",
color: colors.darkWhite,
keyAverage: "/date-to-block-vbytes-1d-average",
keyMax: "/date-to-block-vbytes-1d-max",
key90p: "/date-to-block-vbytes-1d-90p",
key75p: "/date-to-block-vbytes-1d-75p",
keyMedian: "/date-to-block-vbytes-1d-median",
key25p: "/date-to-block-vbytes-1d-25p",
key10p: "/date-to-block-vbytes-1d-10p",
keyMin: "/date-to-block-vbytes-1d-min",
}),
},
{
scale,
name: "Interval",
tree: createRecapPresets({
scale,
title: "Block Interval",
color: colors.darkWhite,
keyAverage: "/date-to-block-interval-1d-average",
keyMax: "/date-to-block-interval-1d-max",
key90p: "/date-to-block-interval-1d-90p",
key75p: "/date-to-block-interval-1d-75p",
keyMedian: "/date-to-block-interval-1d-median",
key25p: "/date-to-block-interval-1d-25p",
key10p: "/date-to-block-interval-1d-10p",
keyMin: "/date-to-block-interval-1d-min",
}),
},
]
: [
+268
View File
@@ -0,0 +1,268 @@
export function createRecapPresets({
scale,
title,
keyAverage,
color,
keySum,
keyMax,
key90p,
key75p,
keyMedian,
key25p,
key10p,
keyMin,
}: {
scale: ResourceScale;
title: string;
color: Color;
keySum?: AnyDatasetPath;
keyAverage?: AnyDatasetPath;
keyMax?: AnyDatasetPath;
key90p?: AnyDatasetPath;
key75p?: AnyDatasetPath;
keyMedian?: AnyDatasetPath;
key25p?: AnyDatasetPath;
key10p?: AnyDatasetPath;
keyMin?: AnyDatasetPath;
}): PartialPreset[] {
return [
...(keySum
? ([
{
scale,
icon: IconTablerSum,
name: "Daily Sum",
title: `${title} Daily Sum`,
description: "",
bottom: [
{
title: "Sum",
color,
datasetPath: keySum,
},
],
},
] as PartialPreset[])
: []),
...(keyAverage
? [
{
scale,
icon: IconTablerMathAvg,
name: "Daily Average",
title: `${title} Daily Average`,
description: "",
bottom: [
{
title: "Average",
color,
datasetPath: keyAverage,
},
],
},
]
: []),
...(keyMax || key90p || key75p || keyMedian || key25p || key10p || keyMin
? ([
{
scale,
icon: IconTablerPercentage,
name: "Daily Percentiles",
title: `${title} Daily Percentiles`,
description: "",
bottom: [
...(keyMax
? [
{
title: "Max",
color,
datasetPath: keyMax,
},
]
: []),
...(key90p
? [
{
title: "90%",
color,
datasetPath: key90p,
},
]
: []),
...(key75p
? [
{
title: "75%",
color,
datasetPath: key75p,
},
]
: []),
...(keyMedian
? [
{
title: "Median",
color,
datasetPath: keyMedian,
},
]
: []),
...(key25p
? [
{
title: "25%",
color,
datasetPath: key25p,
},
]
: []),
...(key10p
? [
{
title: "10%",
color,
datasetPath: key10p,
},
]
: []),
...(keyMin
? [
{
title: "Min",
color,
datasetPath: keyMin,
},
]
: []),
],
},
] as PartialPreset[])
: []),
...(keyMax
? ([
{
scale,
icon: IconTablerArrowBarToUp,
name: "Daily Max",
title: `${title} Daily Max`,
description: "",
bottom: [
{
title: "Max",
color,
datasetPath: keyMax,
},
],
},
] as PartialPreset[])
: []),
...(key90p
? ([
{
scale,
icon: IconTablerPercentage90,
name: "Daily 90th Percentile",
title: `${title} Daily 90th Percentile`,
description: "",
bottom: [
{
title: "90%",
color,
datasetPath: key90p,
},
],
},
] as PartialPreset[])
: []),
...(key75p
? ([
{
scale,
icon: IconTablerPercentage75,
name: "Daily 75th Percentile",
title: `${title} Size 75th Percentile`,
description: "",
bottom: [
{
title: "75%",
color,
datasetPath: key75p,
},
],
},
] as PartialPreset[])
: []),
...(keyMedian
? ([
{
scale,
icon: IconTablerPercentage50,
name: "Daily Median",
title: `${title} Daily Median`,
description: "",
bottom: [
{
title: "Median",
color,
datasetPath: keyMedian,
},
],
},
] as PartialPreset[])
: []),
...(key25p
? ([
{
scale,
icon: IconTablerPercentage25,
name: "Daily 25th Percentile",
title: `${title} Daily 25th Percentile`,
description: "",
bottom: [
{
title: "25%",
color,
datasetPath: key25p,
},
],
},
] as PartialPreset[])
: []),
...(key10p
? ([
{
scale,
icon: IconTablerPercentage10,
name: "Daily 10th Percentile",
title: `${title} Daily 10th Percentile`,
description: "",
bottom: [
{
title: "10%",
color,
datasetPath: key10p,
},
],
},
] as PartialPreset[])
: []),
...(keyMin
? ([
{
scale,
icon: IconTablerArrowBarToDown,
name: "Daily Min",
title: `${title} Daily Min`,
description: "",
bottom: [
{
title: "Min",
color,
datasetPath: keyMin,
},
],
},
] as PartialPreset[])
: []),
];
}