Demos

The bio clock with its default domains and severity scale.

Usage

Use the bio clock to sum up a person's results on one dial. It has three hands:

  • Domain hand — The dashed hand on the outer arc. It points at the domain with the highest value.
  • Severity hand — The solid hand on the inner arc, with a bubble showing the score as given, such as 1.1.
  • Age hand — The thick hand on the lower scale, from 0 to 100. The badge shows yearsValue and the biological age, such as +4 Years (51).

Hover or focus a domain on the outer arc to see a tooltip with its full name and value.

Import it from @workspace/ui/predict/bio-clock.

Defaults

  • Domains — Seven segments: IFR, VAF, MHF, BMF, PNF, CMF, and RFF, each with a full name for its tooltip. PNF has the highest value, so the domain hand points at it.
  • Severity — A 0 to 5 scale in five steps, coloured --status-normal, --status-mild, --status-moderate, --status-severe, and --status-extreme. The score is 1.1.
  • Age — bioAge is 60, and the badge shows +7 YEARS (60). Always pass yearsValue with real data, or the badge shows the placeholder.

Notes

  • The clock is a fixed square, 450 pixels by default. Set size to change it. On narrow screens, pick a size that fits or pass a number from your own layout.
  • currentValue replaces severity.current, so you can keep one scale and change only the score.
  • The age hand stops at 0 and 100. The severity hand does not, so keep currentValue inside the scale.
  • When two domains share the highest value, the hand points at the first.
  • Colours are any CSS colour. Use the --color-status-* variables to follow the theme.
  • The bubble and badge show numbers as you pass them. Round them first, such as Math.round(age * 10) / 10.
  • Each domain can be reached with Tab, which opens its tooltip.

Examples

Custom values

Pass bioAge, yearsValue, and currentValue to show a person's own result.

Custom domains

Pass domains to set each segment's label, full name, colour, and value. HRT has the highest value, so the domain hand points at it.

Custom severity scale

Pass severity to change the inner arc. This one runs from 0 to 10 in three steps, with a score of 6.5.

Sizes

size takes sm (320), default (450), lg (600), xl (720), or any number of pixels. This shows 240 and sm.

Props

Unlisted props pass through to the wrapping div, which also takes a ref.

BioClock

PropTypeDefaultDescription
bioAgenumber60Biological age, placed on the 0 to 100 scale.
yearsValuestring+7 YEARSThe gap from real age, such as +4 Years. Shown in the badge.
yearsDiffstring—Same as yearsValue. yearsValue wins when both are set.
currentValuenumber1.1The severity score. Replaces severity.current.
severitySeverityScale0 to 5, five stepsThe scale on the inner arc.
domainsDomainSegment[]seven domainsThe segments on the outer arc.
segmentsSegment[]—Older form of domains. A missing value becomes 10, 20, 30, and so on. Ignored when domains is set.
size"sm", "default", "lg", "xl", or numberdefaultWidth and height in pixels. The named sizes are 320, 450, 600, and 720.
classNamestring—Classes merged onto the wrapper.

DomainSegment

FieldTypeDescription
labelstringShort name shown outside the arc, such as HRT.
fullNamestringFull name shown in the tooltip, such as Heart health.
colorstringSegment colour.
valuenumberShown in the tooltip. The domain hand points at the highest.

Segment has label, color, and an optional value. Its tooltip shows the label as the name.

SeverityScale

FieldTypeDescription
rangesSeverityRange[]Steps from low to high. The arc runs from the first min to the last max.
currentnumberThe score. Overridden by currentValue.

SeverityRange

FieldTypeDescription
minnumberStart of the step.
maxnumberEnd of the step.
colorstringColour at the middle of the step. The arc blends between steps.

ClockGaugeProps is the type of the props.