Chart
Data visualization and chart components
Components for data visualization and charting.
Prerequisites
- Complete the installation
- Add the dependency to your app's
package.json
{
"dependencies": {
"@tetherto/mdk-react-devkit": "*",
"@tetherto/mdk-react-adapter": "*",
"@tetherto/mdk-ui-foundation": "*"
}
}Run npm install from the mdk/ui workspace root after your app is under apps/ so npm links workspace packages.
- Import styles:
import '@tetherto/mdk-react-devkit/styles.css'
Components
@tetherto/mdk-react-devkit
Chart container
import { ChartContainer } from '@tetherto/mdk-react-devkit'A layout wrapper for charts that provides a title/header row, interactive legend, range selector, highlighted value display, loading/empty states, and a stats footer.
Prop data shapes
Props are generated from this component's TypeScript types, the source of truth. The following are supplementary (object-prop shapes, allowed values, or passthrough props), not the full prop list.
LegendItem
| Field | Type | Required | Description |
|---|---|---|---|
label | string | yes | Legend label |
color | string | yes | Color string (hex, hsl, etc.) |
hidden | boolean | no | Whether this dataset is currently hidden |
HighlightedValueProps
| Field | Type | Required | Description |
|---|---|---|---|
value | string | number | yes | The primary value to display |
unit | string | no | Unit suffix |
className | string | no | Additional class |
style | React.CSSProperties | no | Inline style |
RangeSelectorProps
| Field | Type | Required | Description |
|---|---|---|---|
options | RangeSelectorOption[] | yes | { label, value } items |
value | string | yes | Currently selected value |
onChange | (value: string) => void | yes | Fires when user picks a range |
Notes
minMaxAvgandtimeRangeare only rendered when the chart is not loading or empty
Example
/**
* Runnable example for ChartContainer.
*/
import { useState } from 'react'
import { ChartContainer } from '@tetherto/mdk-react-devkit'
const RANGE_OPTIONS = [
{ label: '1H', value: '1h' },
{ label: '24H', value: '24h' },
{ label: '7D', value: '7d' },
]
const LEGEND_DATA = [
{ label: 'Pool A', color: '#59E8E8' },
{ label: 'Pool B', color: '#FF9500' },
]
const MockChart = () => (
<div
style={{
height: 160,
background: 'var(--mdk-color-surface-secondary, #1a1a2e)',
borderRadius: 4,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: 'var(--mdk-color-text-secondary, #888)',
fontSize: 13,
}}
>
Chart content
</div>
)
export const ChartContainerExample = () => {
const [range, setRange] = useState('24h')
return (
<div className="mdk-example-row" style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
{/* Basic with title only */}
<ChartContainer title="Simple Chart">
<MockChart />
</ChartContainer>
{/* Full-featured: highlighted value, legend, range selector, min/max/avg */}
<ChartContainer
title="Hashrate"
highlightedValue={{ value: 102.4, unit: 'TH/s' }}
legendData={LEGEND_DATA}
rangeSelector={{ options: RANGE_OPTIONS, value: range, onChange: setRange }}
minMaxAvg={{ min: '10 TH/s', avg: '55 TH/s', max: '100 TH/s' }}
>
<MockChart />
</ChartContainer>
{/* Loading state */}
<ChartContainer title="Loading" loading>
<MockChart />
</ChartContainer>
{/* Empty state */}
<ChartContainer title="No Data" empty emptyMessage="No data available for this period">
<MockChart />
</ChartContainer>
</div>
)
}Related API
@tetherto/mdk-react-devkit
Import the public APIs on this page from @tetherto/mdk-react-devkit.
ActualEbitdaCard
Stat card summarising the realised EBITDA for the selected reporting window vs the prior period
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
value | Required | number | - | - |
AreaChart
Presentational Chart.js area chart (Line with fill). Data must be provided via props; this component does no fetching of its own
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Required | ChartData<"line", (number | Point | null)[], unknown> | - | Chart data - required, provided by parent |
className | Optional | string | - | Additional class names |
height | Optional | number | 300 | Chart height in pixels |
options | Optional | object | - | Chart.js options - merged with defaults |
tooltip | Optional | ChartTooltipConfig | - | Custom HTML tooltip configuration. When provided, replaces the default Chart.js tooltip |
AverageDowntimeChart
Stacked bar chart of average downtime (curtailment vs operational issues). Wraps ChartContainer and BarChart; pass period labels and rate arrays via data
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
barWidth | Optional | number | 38 | Max bar thickness |
className | Optional | string | - | Extra class on the container |
data | Optional | AverageDowntimeChartData | - | Period labels and rate arrays (fractions 0–1) |
emptyMessage | Optional | string | - | Message when there are no period labels or rate series |
height | Optional | number | 280 | Chart height in pixels |
isLoading | Optional | boolean | false | Shows loading overlay |
showDataLabels | Optional | boolean | false | Show values above stacked bars |
title | Optional | string | "Monthly Average Downtime" | Chart title (unit renders on its own line below) |
unit | Optional | string | % | Unit subtitle under the title |
yTicksFormatter | Optional | (value: number) => string | - | Formats Y-axis ticks, tooltips, and bar data labels (values are 0–1 rates). Defaults to rate × 100 via formatNumber |
AvgAllInCostChart
Avg All-in Cost - revenue vs cost ($/MWh) bar chart over time.
Renders the OSS SiteEnergyVsCostChart. The revenue/cost time-series isn't carried by the cost-summary response, so consumers feed it through as a separate prop (the OSS app sources it from useAvgAllInPowerCostData)
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
dateRange | Required | FinancialDateRange | null | - | - |
data | Optional | readonly AvgAllInCostDataPoint[] | - | - |
isLoading | Optional | boolean | - | - |
BarChart
Presentational Chart.js bar chart. Data must be pre-aggregated; use grouped or stacked categories via datasets
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Required | any | - | Chart data - required, provided by parent. Use as any for mixed bar+line datasets |
className | Optional | string | - | Additional class for the wrapper div |
formatDataLabel | Optional | ((value: number) => string) | - | Format data label values (default: round to nearest integer) |
formatYLabel | Optional | ((value: number) => string) | - | Format Y-axis tick labels |
height | Optional | number | 300 | Chart height in pixels |
isHorizontal | Optional | boolean | false | Render bars horizontally (indexAxis: 'y') |
isStacked | Optional | boolean | false | Stack bars on top of each other |
legendAlign | Optional | "center" | "start" | "end" | "start" | Alignment of the legend labels within their position |
legendPosition | Optional | "left" | "right" | "top" | "bottom" | "top" | Position of the legend |
options | Optional | object | - | Chart.js options - merged with defaults |
showDataLabels | Optional | boolean | false | Show values above each bar |
showLegend | Optional | boolean | true | Show built-in Chart.js legend |
tooltip | Optional | ChartTooltipConfig | - | Custom HTML tooltip configuration. When provided, replaces the default Chart.js tooltip |
BitcoinPriceCard
Stat card showing the BTC reference price used by the reporting view with currency and timestamp
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
value | Required | number | - | - |
BitcoinProducedCard
Stat card summarising the bitcoin produced during the reporting window with delta to prior period
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
value | Required | number | - | - |
BitcoinProducedChart
Time-series chart of bitcoin produced per day across the selected reporting window
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
chartData | Required | BarChartDataResult | - | - |
hasAllZeros | Optional | boolean | - | - |
height | Optional | number | - | - |
isLoading | Optional | boolean | - | - |
BitcoinProductionCostCard
Stat card showing the average cost in USD to produce one bitcoin during the reporting window
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
value | Required | number | - | - |
ChartContainer
Standard chrome for charts: title, optional highlighted value, legend with toggle, range selector (radio cards), loading / empty states, and a footer for min/max/avg stats
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
children | Required | React.ReactNode | - | The chart element to render |
className | Optional | string | - | Additional class for the root element |
empty | Optional | boolean | - | Hides the chart and shows emptyMessage |
emptyMessage | Optional | string | "No data available" | Message shown when empty is true |
footer | Optional | React.ReactNode | - | Custom footer content rendered below the chart |
footerClassName | Optional | string | - | Additional class for the footer area |
header | Optional | React.ReactNode | - | Replaces the default title heading with a custom element |
headerAction | Optional | React.ReactNode | - | Optional action rendered on the right side of the header row (e.g. an expand/fullscreen toggle). Sits alongside the range selector when both are present. Purely additive - omit it and the header renders exactly as before |
highlightedValue | Optional | HighlightedValueProps | - | Large value/unit displayed alongside the legend |
legendData | Optional | LegendItem[] | - | Color-keyed legend items; each item can be toggled |
loading | Optional | boolean | - | Shows a centered <Loader> overlay |
minMaxAvg | Optional | Partial<{ min: string; max: string; avg: string; }> | - | Built-in footer showing Min / Avg / Max values |
onToggleDataset | Optional | ((index: number) => void) | - | Fired when a legend item is clicked |
rangeSelector | Optional | RangeSelectorProps | - | Radio-card time-range selector |
timeRange | Optional | string | - | Time range label shown in the footer |
title | Optional | string | - | Chart heading (renders as <h3> unless header is provided) |
titleExtra | Optional | React.ReactNode | - | Optional node rendered immediately after the title text (e.g. an info tooltip). Only shown when title is set and header is not. Additive - omit it and the title renders exactly as before |
ChartExpandAction
Expand / collapse toggle rendered in a dashboard chart card's header. Swaps between a maximize and a minimize glyph based on isExpanded
advanced
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
isExpanded | Required | boolean | - | Whether the parent chart is currently expanded to full width |
onToggle | Optional | VoidFunction | - | Toggles the expanded state |
ChartStatsFooter
ChartStatsFooter - Displays Min/Max/Avg values and optional stats grid below a chart
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
className | Optional | string | - | Custom class name |
minMaxAvg | Optional | Partial<{ min: string; max: string; avg: string; }> | - | Min/Max/Avg values row |
secondaryLabel | Optional | SecondaryLabel | - | Secondary label displayed below stats |
stats | Optional | ChartStatsFooterItem[] | - | Additional stats displayed in a columnar grid |
statsPerColumn | Optional | number | 1 | Number of stat items per column (default: 1) |
CostCharts
Convenience wrapper that renders the three cost-page charts in declaration order. Pages that need bespoke layouts (e.g. CostContent's 2x2 Mosaic) compose the individual chart components directly instead
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
btcPriceLog | Required | readonly BtcPriceTimeSeriesEntry[] | - | - |
costLog | Required | readonly CostTimeSeriesEntry[] | - | - |
dateRange | Required | FinancialDateRange | null | - | - |
totals | Required | CostSummaryMonetaryTotals | null | - | - |
avgAllInCostData | Optional | readonly AvgAllInCostDataPoint[] | - | - |
isLoading | Optional | boolean | - | - |
DetailLegend
DetailLegend - Enhanced chart legend with current values and percentage change indicators
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
items | Required | DetailLegendItem[] | - | Legend items to display |
className | Optional | string | - | Custom class name |
onToggle | Optional | ((label: string, index: number) => void) | - | Callback when a legend item is toggled |
DoughnutChart
DoughnutChart – Presentational Chart.js doughnut chart with custom HTML legend matching the MDK design
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Required | DoughnutChartDataset[] | - | Array of labelled slices |
borderWidth | Optional | number | 4 | Border width between segments (default: 4) |
className | Optional | string | - | Additional class for the root element |
cutout | Optional | string | "75%" | Doughnut cutout percentage (default: '75%') |
formatValue | Optional | ((value: number) => string) | - | Formats slice values in the built-in legend and default tooltip (default: raw number) |
height | Optional | number | 260 | Chart height in pixels |
legendPosition | Optional | "left" | "right" | "top" | "bottom" | "top" | Where to place the legend relative to the chart (default: 'top') |
options | Optional | object | - | Chart.js options – merged with defaults |
tooltip | Optional | ChartTooltipConfig | - | Custom HTML tooltip configuration. When provided, replaces the default doughnut tooltip (which shows label, value with unit, and percentage). Use valueFormatter to replicate the percentage display if needed |
unit | Optional | string | "" | Unit suffix appended to values in tooltips and legends |
Ebitda
Top-level EBITDA section of the reporting view — pulls together metric cards, charts, and tables
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
btcProducedChartInput | Required | ToBarChartDataInput | null | - | Data for the BTC produced chart |
currentBTCPrice | Required | number | - | Current Bitcoin price in USD |
datePicker | Required | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | - | Date picker element |
ebitdaChartInput | Required | ToBarChartDataInput | null | - | Data for the EBITDA bar chart |
hasBtcProducedAllZeros | Required | boolean | - | Whether all BTC produced values are zero |
hasDateSelection | Required | boolean | - | When false, show the "select a period" hint instead of empty data |
metrics | Required | EbitdaDisplayMetrics | null | - | Computed EBITDA metrics |
showEbitdaBarChart | Required | boolean | - | Show the EBITDA bar chart |
errors | Optional | string[] | [] | Error messages to display |
isLoading | Optional | boolean | false | Loading state |
setCostHref | Optional | string | - | Optional URL for the "Set Monthly Cost" control (hidden when omitted) |
EbitdaCharts
Chart panel inside the EBITDA section visualising revenue, cost, and EBITDA over time
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
btcDisplayData | Required | BarChartDataResult | - | - |
ebitdaChartData | Required | BarChartDataResult | - | - |
hasBtcProducedAllZeros | Required | boolean | - | - |
isLoading | Required | boolean | - | - |
showEbitdaBarChart | Required | boolean | - | - |
EbitdaHodlCard
Stat card projecting EBITDA assuming all produced bitcoin is held instead of sold
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
currentBTCPrice | Required | number | - | - |
value | Required | number | - | - |
EbitdaMetrics
Row of summary metric cards across the top of the EBITDA section (actual, hodl, selling, cost)
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
currentBTCPrice | Required | number | - | - |
metrics | Required | EbitdaDisplayMetrics | - | - |
EbitdaSellingCard
Stat card projecting EBITDA assuming all produced bitcoin is sold at the daily reference price
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
value | Required | number | - | - |
EnergyBalance
Full energy balance view with tabbed revenue and cost sections, charts, and metric cards
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
onCostDisplayModeChange | Required | (mode: DisplayMode) => void | - | Called when the user toggles USD / BTC on the cost tab |
onRevenueDisplayModeChange | Required | (mode: DisplayMode) => void | - | Called when the user toggles USD / BTC on the revenue tab |
onTabChange | Required | (tab: EnergyBalanceTab) => void | - | Called when the user switches between Revenue and Cost tabs |
viewModel | Required | EnergyBalanceViewModel | - | All display state: chart inputs, metrics, active tab, display modes, loading/error flags. Returned directly by useEnergyBalanceViewModel |
isDemoMode | Optional | boolean | false | Suppresses error banners in demo/mock environments |
setCostHref | Optional | string | - | Optional URL for the "Set Monthly Cost" control (hidden when omitted) |
timeframeControls | Optional | React.ReactNode | - | Slot for timeframe / date-range controls rendered by the host app |
EnergyBalanceCostCharts
Layout container for the energy cost tab charts: revenue-vs-cost bar chart and power line chart
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
barLabelFormatter | Required | (v: number) => string | - | - |
btcUnit | Required | string | null | - | - |
costChartData | Required | BarChartDataResult | - | - |
displayMode | Required | "BTC" | "USD" | - | - |
onDisplayModeChange | Required | (mode: DisplayMode) => void | - | - |
periodType | Required | "month" | "week" | "day" | - | - |
powerChartInput | Required | ThresholdLineChartInput | - | - |
showCostBarChart | Required | boolean | - | Show the revenue-vs-cost bar chart only for non-daily periods |
EnergyBalanceCostMetrics
Grid of stat cards summarising energy cost metrics for the selected period
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
metrics | Required | EnergyCostMetrics | - | - |
EnergyBalancePowerChart
Line chart visualising power consumption against threshold for the energy balance view
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
chartInput | Required | ThresholdLineChartInput | - | Series and optional threshold line for power vs availability |
periodType | Required | "month" | "week" | "day" | - | Controls x-axis date formatting (month uses MM-yy) |
fillHeight | Optional | boolean | false | Stretch the panel and chart to fill a mosaic cell (uses height 320 and mdk-energy-balance__panel--fill). Used on the revenue tab power column in EnergyBalanceRevenueCharts |
height | Optional | number | 280 | Chart height when fillHeight is false |
EnergyBalanceRevenueCharts
Mosaic layout of revenue, downtime, and power charts for the energy balance revenue tab
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
averageDowntimeData | Required | AverageDowntimeChartData | - | - |
barLabelFormatter | Required | (v: number) => string | - | - |
displayMode | Required | "BTC" | "USD" | - | - |
onDisplayModeChange | Required | (mode: DisplayMode) => void | - | - |
periodType | Required | "month" | "week" | "day" | - | - |
powerChartInput | Required | ThresholdLineChartInput | - | - |
revenueChartData | Required | BarChartDataResult | - | - |
revenueMetrics | Required | EnergyRevenueMetrics | - | - |
EnergyBalanceRevenueMetrics
Grid of stat cards summarising energy revenue metrics for the selected period
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
metrics | Required | EnergyRevenueMetrics | - | - |
EnergyCostChart
Bar chart comparing site revenue vs cost per MWh, with USD/BTC currency toggle
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
barLabelFormatter | Required | (v: number) => string | - | - |
btcUnit | Required | string | null | - | - |
chartData | Required | BarChartDataResult | - | - |
displayMode | Required | "BTC" | "USD" | - | - |
onDisplayModeChange | Required | (mode: DisplayMode) => void | - | - |
height | Optional | number | - | - |
EnergyMetricCard
Stat card for a single energy balance metric
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
name | Required | string | - | Metric label shown on the card |
unit | Required | string | - | Unit suffix shown next to the value |
value | Required | number | - | Metric value, formatted via formatNumber |
fallback | Optional | string | - | Text shown when value can't be formatted |
EnergyReportMinerTypeView
Energy report — power consumption grouped by miner model (latest day in range)
advanced
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
containers | Optional | Container[] | - | - |
groupedConsumption | Optional | MetricsConsumptionGroupedResponse | - | - |
isLoading | Optional | boolean | - | - |
onTimeFrameChange | Optional | ((start: Date, end: Date) => void) | - | - |
EnergyReportMinerUnitView
Energy report — power consumption grouped by mining unit / container
advanced
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
containers | Optional | Container[] | - | - |
groupedConsumption | Optional | MetricsConsumptionGroupedResponse | - | - |
isLoading | Optional | boolean | - | - |
onTimeFrameChange | Optional | ((start: Date, end: Date) => void) | - | - |
EnergyReportSiteView
Energy report site tab — power trend, power-mode table, and per–mining-unit activity cards
advanced
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
dateRange | Required | EnergyReportDateRange | - | - |
consumptionError | Optional | unknown | - | - |
consumptionFetching | Optional | boolean | - | - |
consumptionLoading | Optional | boolean | - | - |
consumptionLog | Optional | MetricsConsumptionLogEntry[] | - | - |
containers | Optional | EnergyReportContainer[] | - | - |
containersLoading | Optional | boolean | - | - |
nominalConfigLoading | Optional | boolean | - | - |
nominalPowerAvailabilityMw | Optional | number | null | - | - |
onDateRangeChange | Optional | ((range: EnergyReportDateRange) => void) | - | - |
onRefetchSnapshot | Optional | VoidFunction | - | - |
snapshotLoading | Optional | boolean | - | - |
tailLog | Optional | EnergyReportTailLogItem[][] | - | - |
tailLogLoading | Optional | boolean | - | - |
EnergyRevenueChart
Bar chart showing site energy revenue per MWh, with USD/BTC currency toggle
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
barLabelFormatter | Required | (v: number) => string | - | - |
chartData | Required | BarChartDataResult | - | - |
displayMode | Required | "BTC" | "USD" | - | - |
onDisplayModeChange | Required | (mode: DisplayMode) => void | - | - |
height | Optional | number | - | - |
GaugeChart
GaugeChart - Presentational gauge / speedometer chart.
Implementation note: the gauge is drawn by a pure-SVG internal implementation (see ./gauge-svg.tsx), so the component is bundler- and runtime-agnostic and carries no third-party runtime dependency. The gauge packages on NPM are published CommonJS-only with a module field pointing at the same CJS file, which crashes under ESM bundlers that add no __esModule ? .default : module interop shim (Webpack 4, raw esbuild, some SSR setups) with React's "Element type is invalid" error
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
percent | Required | number | - | Value between 0 and 1 (e.g. 0.75 = 75%). Values outside the range are clamped |
arcsLength | Optional | number[] | - | Custom arc-segment proportions (auto-normalised), overriding nrOfLevels. e.g. [0.7, 0.3] for a progress-style gauge whose first arc is the fill |
arcWidth | Optional | number | 0.2 | Arc thickness as a fraction of the gauge radius (0–1) |
className | Optional | string | - | Additional class for the root div |
colors | Optional | string[] | [COLOR.GREEN, COLOR.RED] | Arc colours in HEX format |
formatTextValue | Optional | ((percent: number) => string) | - | Format the center label from the clamped fraction (0–1) |
height | Optional | string | number | 200 | Chart height in pixels or any CSS length (e.g. '200px' or '50%') |
hideNeedle | Optional | boolean | false | Hide the needle + hub (e.g. for a progress-style gauge) |
hideText | Optional | boolean | false | Hide the percentage text rendered inside the gauge |
id | Optional | string | "mdk-gauge-chart" | Stable id used for the gauge's accessibility labels |
maxWidth | Optional | number | - | Maximum width in pixels |
needleColor | Optional | string | COLOR.STEEL_GRAY | Needle + hub colour |
nrOfLevels | Optional | number | 3 | Number of arc segments. Ignored when arcsLength is provided |
Hashrate
Top-level hashrate reporting section - composes the site / miner-type / mining-unit drilldowns into a tabbed shell. Each tab fetches independently because the three views use different groupBy axes; the composite stitches them via per-tab prop bags
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
defaultTab | Optional | "site-view" | "miner-type-view" | "mining-unit-view" | "site-view" | Tab selected on first render. Defaults to the Site View |
minerTypeView | Optional | HashrateMinerTypeViewProps | - | Props forwarded to the Miner Type View tab |
miningUnitView | Optional | HashrateMiningUnitViewProps | - | Props forwarded to the Mining Unit View tab |
siteView | Optional | HashrateSiteViewProps | - | Props forwarded to the Site View tab |
HashrateMinerTypeView
Hashrate drilldown grouped by miner model - bar chart of the latest hashrate per miner type, with an optional multi-select filter
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
dateRange | Optional | HashrateDateRange | - | Selected date range |
isLoading | Optional | boolean | false | Drives the chart spinner |
log | Optional | HashrateGroupedLog | [] | Hashrate log grouped by miner type (groupBy=miner) |
onDateRangeChange | Optional | ((range: HashrateDateRange) => void) | - | Fires when the user picks a new range |
onReset | Optional | VoidFunction | - | Optional reset handler |
HashrateMiningUnitView
Hashrate drilldown grouped by mining unit / container - bar chart of the latest hashrate per container with an optional multi-select filter. Drops BE-leaked rollup keys (group-N, maintenance) via the utils layer
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
dateRange | Optional | HashrateDateRange | - | Selected date range |
isLoading | Optional | boolean | false | Drives the chart spinner |
log | Optional | HashrateGroupedLog | [] | Hashrate log grouped by container / mining unit (groupBy=container) |
onDateRangeChange | Optional | ((range: HashrateDateRange) => void) | - | Fires when the user picks a new range |
onReset | Optional | VoidFunction | - | Optional reset handler |
HashrateSiteView
Site-level hashrate trend - aggregates hashrate across the whole site for the selected date range, with an optional miner-type filter that scopes the sum to a subset
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
dateRange | Optional | HashrateDateRange | - | Selected date range used by the host to drive the query |
isLoading | Optional | boolean | false | Loading state - drives the chart spinner |
log | Optional | HashrateGroupedLog | [] | Hashrate log grouped by miner type |
onDateRangeChange | Optional | ((range: HashrateDateRange) => void) | - | Fires when the user picks a new range from the DateRangePicker |
onReset | Optional | VoidFunction | - | Optional reset handler shown as a "Reset" button next to the date picker |
Heatmap
Heatmap — a generic grid of value-coloured cells on a low→high gradient.
Presentational and domain-agnostic: pass a row-major matrix of cells and an optional [min, max] range (auto-derived otherwise). Use renderCell to overlay domain content (socket borders, selection, tooltips) without forking the primitive — the grid still owns each cell's background colour. Pair with HeatmapLegend for a gradient scale
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Required | HeatmapCell[][] | - | Rows of cells (row-major). Rows may be ragged |
ariaLabel | Optional | string | "Heatmap" | Accessible label for the grid |
className | Optional | string | - | Additional class for the root element |
colors | Optional | readonly string[] | HEATMAP_GRADIENT | Gradient stops low→high. Defaults to the cold→hot HEATMAP_GRADIENT |
emptyColor | Optional | string | #000000 | Colour used for null cells |
max | Optional | number | auto | Range ceiling (maps to the last gradient stop); auto-derived from the finite values when omitted |
min | Optional | number | auto | Range floor (maps to the first gradient stop); auto-derived from the finite values when omitted |
renderCell | Optional | ((cell: HeatmapCell, context: HeatmapCellContext) => React.ReactNode) | - | Override the cell's inner content — e.g. to overlay socket borders, selection, or tooltips for a PDU grid. The primitive still owns the cell's background colour (passed via context.color) |
showValues | Optional | boolean | false | Render each cell's value/label as text |
HeatmapLegend
HeatmapLegend — a gradient bar with low/high scale labels, matching the gradient used by Heatmap
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
max | Required | string | number | - | Value (or pre-formatted label) at the high end of the scale |
min | Required | string | number | - | Value (or pre-formatted label) at the low end of the scale |
className | Optional | string | - | Additional class for the root element |
colors | Optional | readonly string[] | HEATMAP_GRADIENT | Gradient stops low→high |
label | Optional | string | - | Heading above the gradient bar (e.g. "Temperature") |
unit | Optional | string | - | Unit suffix appended to min/max |
LineChart
Customisable Chart.js line chart with built-in zoom, tooltip, and legend. Data is passed via props; the component does no fetching
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Required | LineChartData | - | Data of the chart |
backgroundColor | Optional | string | - | Background color of the chart |
beginAtZero | Optional | boolean | - | Starts the value axis at 0 |
chartRef | Optional | React.MutableRefObject<IChartApi | null> | - | Mutable ref to hold the LightWeightCharts reference |
customDateFormat | Optional | string | - | Custom date format |
customLabel | Optional | string | - | TODO: Doc |
disableAutoRange | Optional | boolean | - | Disable automatically determining range |
fadedBackground | Optional | boolean | - | Use a faded background |
fixedTimezone | Optional | string | - | Applies offset if provided, otherwise timestamps are assumed to already be in local time. Otherwise, use browser's current timezone offset for consistent time display |
height | Optional | number | 240 | Controls the height of the chart |
horizontalLineLabelVisible | Optional | boolean | - | Show horizontal line at mouse position |
priceFormatter | Optional | ((value: number) => string) | - | Callback to format ticks on y axis |
roundPrecision | Optional | number | - | The number of decimals to show |
shouldResetZoom | Optional | boolean | - | Wether to Reset Zoom |
showDateInTooltip | Optional | boolean | - | Show date line in tooltip |
showPointMarkers | Optional | boolean | - | Show a marker on the line |
skipMinWidth | Optional | boolean | - | Do not enforce a min width |
skipRound | Optional | boolean | - | Prevent rounding of values |
timeline | Optional | string | - | TODO: DOC |
uniformDistribution | Optional | boolean | - | Changes horizontal scale marks generation. With this flag equal to true, marks of the same weight are either all drawn or none are drawn at all |
unit | Optional | string | "" | The unit to display with values |
verticalLineLabelVisible | Optional | boolean | - | Show vertical line at mouse position |
yTicksFormatter | Optional | ((value: number) => string) | - | Callback to format ticks on y axis. If priceFormatter is given. It would be used instead |
LineChartCard
Composable line-chart card with title, timeline range selector, legend (basic or detailed), error boundary, and an optional min/max/avg footer.
Accepts either pre-shaped data or rawData + a dataAdapter callback so upstream domain components can keep their data wrangling local
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
chartProps | Optional | Partial<LightWeightLineChartProps> | - | Pass-through props to the core LineChart |
chartRef | Optional | React.MutableRefObject<IChartApi | null> | - | Ref to the lightweight-charts IChartApi |
className | Optional | string | - | Custom class name |
data | Optional | LineChartCardData | - | Pre-adapted chart data (use this OR rawData+dataAdapter) |
dataAdapter | Optional | (data: unknown) => LineChartCardData | - | Adapter to transform rawData into LineChartCardData |
defaultTimeline | Optional | string | first option | Default timeline when uncontrolled |
detailLegends | Optional | boolean | false | Show detail legends with current values |
headerAction | Optional | React.ReactNode | - | Optional action rendered on the right of the card header (e.g. an expand toggle). Passed straight through to ChartContainer. Additive - omit it and the card header is unchanged |
isLoading | Optional | boolean | false | Loading state |
minHeight | Optional | string | number | 350 | Minimum chart height |
onTimelineChange | Optional | (timeline: string) => void | - | Callback when timeline changes |
rawData | Optional | unknown | - | Raw data to be transformed by dataAdapter |
shouldResetZoom | Optional | boolean | true | Whether to reset zoom on timeline change (default: true) |
timeline | Optional | string | - | Controlled timeline value |
timelineOptions | Optional | TimelineOption[] | - | Timeline range selector options |
title | Optional | string | - | Chart title |
titleExtra | Optional | React.ReactNode | - | Optional node rendered next to the title (e.g. an info tooltip). Passed straight through to ChartContainer. Additive |
MinMaxAvg
Min / Max / Avg summary row with consistent MDK label and value styling
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
avg | Optional | string | - | Average value (hidden if empty) |
className | Optional | string | - | Additional root class |
max | Optional | string | - | Maximum value (hidden if empty) |
min | Optional | string | - | Minimum value (hidden if empty) |
MonthlyEbitdaChart
Bar chart comparing EBITDA across the most recent months for trend visualisation
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
chartData | Required | BarChartDataResult | - | - |
height | Optional | number | - | - |
OperationalHashrateChart
Hashrate trend card for the operational dashboard. Renders the site hashrate over time (TH/s) with an optional nominal reference line, plus an expand toggle. Purely presentational - pass pre-shaped data from useOperationsDashboard
advanced
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Optional | LineChartCardData | - | - |
isExpanded | Optional | boolean | - | - |
isLoading | Optional | boolean | - | - |
onToggleExpand | Optional | VoidFunction | - | - |
OperationalMinersStatusChart
Miners-status card for the operational dashboard. Renders a stacked daily breakdown of miner states (online / error / offline / sleep / maintenance) with an expand toggle. Purely presentational - pass pre-shaped data from useOperationsDashboard
advanced
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Optional | MinersStatusChartData | - | - |
isExpanded | Optional | boolean | - | - |
isLoading | Optional | boolean | - | - |
onToggleExpand | Optional | VoidFunction | - | - |
OperationalPowerConsumptionChart
Power-consumption trend card for the operational dashboard. Renders site power draw over time (MW) with an optional power-availability reference line, plus an expand toggle. Purely presentational - pass pre-shaped data from useOperationsDashboard
advanced
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Optional | LineChartCardData | - | - |
isExpanded | Optional | boolean | - | - |
isLoading | Optional | boolean | - | - |
onToggleExpand | Optional | VoidFunction | - | - |
OperationalSiteEfficiencyChart
Site-efficiency trend card for the operational dashboard. Renders measured site efficiency over time (W/TH/s) with an optional nominal reference line, an info tooltip, and an expand toggle. Purely presentational - pass pre-shaped data from useOperationsDashboard
advanced
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Optional | LineChartCardData | - | - |
isExpanded | Optional | boolean | - | - |
isLoading | Optional | boolean | - | - |
onToggleExpand | Optional | VoidFunction | - | - |
OperationsEnergyChart
Doughnut breakdown of Operations vs Energy cost (in USD totals).
Mirrors the OSS OperationsEnergyCostChart. Returns the empty-state placeholder when both totals are zero (the OSS chart hides both slices in that case)
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
totals | Required | CostSummaryMonetaryTotals | null | - | - |
isLoading | Optional | boolean | - | - |
OperationsEnergyCostChart
Doughnut breakdown of Operations vs Energy cost (USD per MWh). Wraps ChartContainer and DoughnutChart; pass operationalCostsUSD and energyCostsUSD via data
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
className | Optional | string | - | Extra class on the container |
data | Optional | Partial<{ energyCostsUSD: number; operationalCostsUSD: number; }> | - | operationalCostsUSD and energyCostsUSD |
emptyMessage | Optional | string | - | Message when both costs are zero or missing |
height | Optional | number | 200 | Doughnut height in pixels |
isLoading | Optional | boolean | false | Shows loading overlay on the chart area |
title | Optional | string | "Operations vs Energy Cost" | Chart title |
unit | Optional | string | $/MWh | Subtitle and tooltip unit label |
PowerModeTimelineChart
Timeline chart for power-mode state changes over time. Wraps TimelineChart with mining-specific data shaping
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Optional | PowerModeTimelineEntry[] | [] | Initial power-mode entries (each with start/end ts + mode) |
dataUpdates | Optional | PowerModeTimelineEntry[] | [] | Streaming updates appended to the initial data |
isLoading | Optional | boolean | false | Show a loading skeleton instead of the chart |
timezone | Optional | string | "UTC" | IANA timezone string for x-axis tick formatting |
title | Optional | string | CHART_TITLES.POWER_MODE_TIMELINE | Chart title |
ProductionCostChart
Production cost over time, overlaid with BTC price.
Mirrors the OSS ProductionCostPriceChart - both series rendered as bars on the same x-axis (bucket labels derived from dateRange.period)
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
btcPriceLog | Required | readonly BtcPriceTimeSeriesEntry[] | - | - |
costLog | Required | readonly CostTimeSeriesEntry[] | - | - |
dateRange | Required | FinancialDateRange | null | - | - |
isLoading | Optional | boolean | - | - |
RevenueChart
Stacked bar chart displaying monthly revenue per site. Automatically switches between BTC and Sats display based on value scale. Receives pre-fetched data as props — no internal data fetching
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
data | Optional | RevenueDataItem[] | [] | Raw API response, each entry is one time period with site IDs as dynamic keys |
isLoading | Optional | boolean | false | Shows a loading spinner while data is being fetched |
legendAlign | Optional | "center" | "start" | "end" | "start" | Chart legend alignment |
legendPosition | Optional | "left" | "right" | "top" | "bottom" | "bottom" | Chart legend position |
siteList | Optional | (string | SiteItem)[] | [] | List to resolve site IDs to display names |
ThresholdLineChart
Line chart with optional horizontal threshold lines. Wraps ChartContainer and LineChart; pass series and optional thresholds via data
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
className | Optional | string | - | Extra class on the container |
data | Optional | ThresholdLineChartData | - | series points plus optional thresholds lines |
emptyMessage | Optional | string | - | Message when data is missing or all zero |
height | Optional | number | 280 | Chart height in pixels (360 when isTall) |
isLegendVisible | Optional | boolean | true | Legend with click-to-hide series |
isTall | Optional | boolean | false | When true, uses a taller default height (360px) |
title | Optional | string | - | Chart title (unit appended when unit is set) |
unit | Optional | string | - | Shown in title and axis/tooltip formatting |
yTicksFormatter | Optional | (value: number) => string | - | Custom Y-axis tick labels |
TimelineChart
Discrete-event timeline chart (e.g. miner state over time) with a category legend. Supports streaming updates via newData
agent-ready
Props
| Prop | Status | Type / Options | Default | Description |
|---|---|---|---|---|
initialData | Required | TimelineChartData | - | Initial timeline data |
axisTitleText | Optional | AxisTitleText | { x: "Time", y: "" } | Axis title strings |
height | Optional | number | - | Chart pixel height |
isLoading | Optional | boolean | false | Show loader |
newData | Optional | TimelineChartData | - | Streaming updates appended to the initial data |
range | Optional | ChartRange | - | Visible time window |
skipUpdates | Optional | boolean | false | Ignore newData |
title | Optional | string | - | Chart title |