Components

TimeDistribution

Data visualization component combining donut chart and legend

Overview

TimeDistribution is a high-level data visualization component that combines a DonutChart + legend. With generic types, it can visualize any data structure.

  • Generic — Freely define data shape with the <T> type parameter
  • Compound — Combines donut chart + legend + title into one
  • Interactive — Legend items and chart segments are clickable
  • Empty State — Automatically displays empty state when there is no data

Basic Usage

This Week's Time Distribution

Design (33%)

Development (50%)

Meetings (17%)

Custom Legend

Focus work71.4%
Meetings28.6%

Props

PropTypeDefaultRequiredDescription
itemsT[]-YesItems to show
getValue(item: T) => number-YesTime of each item
getFillColor(item: T) => string-YesSlice color of each item
getLabel(item: T, context: TimeDistributionLegendContext) => ReactNode-YesLegend text. context has index, value and percentage
titleReactNode-NoHeading above the chart
getStrokeColor(item: T) => string | undefined-NoSlice stroke color
getKey(item: T, index: number) => string-NoReact key for each item
onItemClick(item: T, index: number) => void-NoMakes legend items and slices clickable
isItemClickable(item: T, index: number) => boolean-NoLimits which items are clickable
emptyMessageReactNode'No data available'NoShown when items is empty
chartSizenumber'180'NoChart size in px
chartPropsOmit<DonutChartProps, 'segments' | 'size' | 'onSegmentClick'>-NoPassed to the donut chart
legendMaxWidthnumber'240'NoLegend width limit in px
legendDotSizenumber'12'NoLegend color dot size in px
renderLegendItem(params: TimeDistributionRenderItemParams<T>) => ReactNode-NoReplaces the default legend item
classNamestring-NoExtra class

getLabel context

export type TimeDistributionLegendContext = {
  index: number
  value: number
  percentage: number
}

Specification

base

상태요소속성값
enabledtitletypography$text.bodyStrong
enabledtitlecolor$color.text.default.default
enabledpanelbackgroundColor$color.background.default.default
enabledpanelborderRadius$size.radius.200
enabledpanelpaddingX$size.space.400
enabledpanelpaddingY$size.space.800
enabledpanelgap$size.space.600
enabledlegendLabeltypography$text.caption
enabledlegendLabelcolor$color.text.default.secondary
enabledlegendDotborderRadius$size.radius.full

Guidelines

  • Items with value ≤ 0 are excluded from the chart but shown as 0% in the legend
  • If you only need a simple donut chart, use DonutChart directly
  • Use renderLegendItem to fully customize the legend