生态产品多个设计器现已发布候选版本

查看生态总览
Skip to content

HierarchyChart new ​

Charts component. This page is the API reference, generated from the source code. Usage guidance and live examples are on the Chinese page.

Anatomy ​

Parts in bold are required.

data-scope="hierarchy-chart": root · caption · path · path-item · legend · legend-scale · legend-scale-name · legend-scale-bar · legend-scale-value · viewport · plot · node · node-label · group-header · focus-ring · tooltip · tooltip-header · tooltip-row · tooltip-swatch · tooltip-value · tooltip-name · empty · summary · table-region · table

API reference ​

Descriptions of individual props, events and slots are written in Chinese and appear on the Chinese page.

Artifacts ​

LayerValue
Custom element<xh-hierarchy-chart>
Vue componentsXhHierarchyChartCaption XhHierarchyChartEmpty XhHierarchyChartLegend XhHierarchyChartPath XhHierarchyChartPlot XhHierarchyChartRoot XhHierarchyChartTooltip XhHierarchyChartViewport
ComposableuseHierarchyChart
State machinehierarchyChartMachine
Skin@xihan-ui/styles/hierarchy-chart.css

Events ​

Custom elements put the payload in detail; Vue emits an event of the same name.

EventPayload
root-key-changeHierarchyRootKeyChangeDetails
active-key-changeChartActiveKeyChangeDetails
datum-activeChartDatumDetails
datum-pressChartDatumDetails

Slots ​

Only slots with a payload are listed.

Vue componentSlotPayload
XhHierarchyChartRootdefaultHierarchyChartRootSlotProps
XhHierarchyChartRootcaption—
XhHierarchyChartRoottooltipHierarchyChartTooltipSlotProps
XhHierarchyChartRootempty—
XhHierarchyChartTooltipdefaultHierarchyChartTooltipSlotProps

React adapter props ​

Only the props each component declares itself: DOM attributes inherited from ComponentPropsWithRef are left out, and root props already listed in the Props table are not repeated. The Vue counterpart is the slot table above.

React componentPropTypeRequired
XhHierarchyChartRootdataChartRow | readonly ChartRow[]
XhHierarchyChartRootchildrenFieldstring
XhHierarchyChartRootidFieldstring
XhHierarchyChartRootparentFieldstring
XhHierarchyChartRootnameFieldstring
XhHierarchyChartRootvalueFieldstring
XhHierarchyChartRootlayoutHierarchyLayout
XhHierarchyChartRoottileHierarchyTile
XhHierarchyChartRootdepthnumber
XhHierarchyChartRootcolorByHierarchyColorBy
XhHierarchyChartRootpaletteChartPalette
XhHierarchyChartRootorientation'vertical' | 'horizontal'
XhHierarchyChartRootrootKeystring | null
XhHierarchyChartRootdefaultRootKeystring | null
XhHierarchyChartRootformatNumberFormatSpec | ((value: number) => string)
XhHierarchyChartRootactiveKeyChartKey | null
XhHierarchyChartRootpendingboolean
XhHierarchyChartRootanimatedboolean
XhHierarchyChartRootlocalestring
XhHierarchyChartRoottranslationsPartial<HierarchyChartTranslations>
XhHierarchyChartRootonRootKeyChangeHierarchyChartProps['onRootKeyChange']
XhHierarchyChartRootonActiveKeyChangeHierarchyChartProps['onActiveKeyChange']
XhHierarchyChartRootonDatumActiveHierarchyChartProps['onDatumActive']
XhHierarchyChartRootonDatumPressHierarchyChartProps['onDatumPress']
XhHierarchyChartRootcaptionReactNode
XhHierarchyChartRootrenderTooltip(props: HierarchyChartTooltipSlotProps) => ReactNode
XhHierarchyChartRootemptyReactNode
XhHierarchyChartRootchildrenSlotChildren<HierarchyChartRootSlotProps>
XhHierarchyChartTooltipchildrenSlotChildren<HierarchyChartTooltipSlotProps>

State ​

Public state is written to data-state.

PartValues
root'error' | undefined
tooltip'visible' | 'hidden'
empty'loading' | undefined

The following names are internal to the state machine.

States: idle

Events: ROOT.SET

connect API ​

getXxxProps() returns the host attributes of the matching part.

MemberType
modelHierarchyModel
sceneScene
overlayHierarchyOverlay
measuredboolean
emptyboolean
pathreadonly HierarchyPathItem[]
legendScalesreadonly HierarchyLegendScale[]
rootKeystring | null
activeChartDatumDetails | null
tooltipHierarchyTooltipModel | null
summarystring
tableTableModel
emptyTextstring
tableCaptionstring
activeKeyChartKey | null
drillTo(key: string | null) => void
drillUp() => void
setFocusedDatum(ref: { seriesId: string, index: number } | null) => void
markTag(mark: Mark) => HierarchyMarkTag
getRootProps() => T['element']
getCaptionProps() => T['element']
getPathProps() => T['element']
getPathItemProps(item: HierarchyPathItem) => T['button']
getLegendProps() => T['element']
getLegendScaleProps(scale: HierarchyLegendScale) => T['element']
getLegendScaleNameProps() => T['element']
getLegendScaleBarProps() => T['element']
getLegendScaleValueProps(edge: 'min' | 'max') => T['element']
getViewportProps() => T['element']
getPlotProps() => T['element']
getMarkProps(mark: Mark) => T['element']
getTooltipProps() => T['element']
getTooltipHeaderProps() => T['element']
getTooltipRowProps(row: HierarchyTooltipRow) => T['element']
getTooltipSwatchProps(row: HierarchyTooltipRow) => T['element']
getTooltipValueProps(row: HierarchyTooltipRow) => T['element']
getTooltipNameProps(row: HierarchyTooltipRow) => T['element']
getEmptyProps() => T['element']
getSummaryProps() => T['element']
getTableRegionProps() => T['element']
getTableProps() => T['element']

Accessibility ​

Keyboard ​

Specification: W3C APG. Each row is a stable behavior id that the conformance tests cover; the conditions and effects are described on the Chinese page.

KeysBehavior
Tab / Shift+Tabhierarchy-chart.kbd.tab
ArrowRighthierarchy-chart.kbd.next
ArrowLefthierarchy-chart.kbd.prev
ArrowDownhierarchy-chart.kbd.child
ArrowUphierarchy-chart.kbd.parent
Homehierarchy-chart.kbd.first
Endhierarchy-chart.kbd.last
Enterhierarchy-chart.kbd.drill
Spacehierarchy-chart.kbd.press
Backspacehierarchy-chart.kbd.up
Escapehierarchy-chart.kbd.dismiss

ARIA ​

These attributes are produced by connect.

PartAttributeValue
rootaria-busy'true' | undefined
patharia-labeltranslations.pathLabel
path-itemaria-current'location' | undefined
path-itemaria-disabled'true' | undefined
legendaria-hidden'true'
plotaria-describedbyid of the summary part
plotaria-roledescriptiontranslations.chartRoleDescription
plotrole'tree'
tooltiparia-hidden'true'
markaria-hidden'true'

Style reference ​

Skin ​

@xihan-ui/styles/hierarchy-chart.css is written against [data-scope="hierarchy-chart"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-hierarchy-chart in place of data-scope (same specificity) and sits in the xihan.components layer. Put overrides in xihan.overrides; the part selectors work as usual.

Data attributes ​

Produced by connect; valueless attributes are omitted while their condition does not hold.

PartAttributeValue
rootdata-loading'' (present only while the condition holds)
rootdata-paletteprops.palette | undefined
rootdata-state'error' | undefined
rootdata-xh-chart-part'root'
captiondata-xh-chart-part'caption'
path-itemdata-current'' (present only while the condition holds)
path-itemdata-pressed'' (present only while the condition holds)
path-itemdata-xh-collection-context'nav'
path-itemdata-xh-collection-item''
path-itemdata-xh-collection-size'sm'
path-itemdata-xh-collection-terminal'' (present only while the condition holds)
legenddata-xh-chart-part'legend'
legend-scaledata-levelscale.level
legend-scale-valuedata-edgeedge
viewportdata-xh-chart-part'viewport'
plotdata-xh-chart-part'plot'
tooltipdata-placement'top' | 'bottom'-'right' | 'left' | undefined
tooltipdata-state'visible' | 'hidden'
tooltipdata-xh-chart-part'tooltip'
tooltip-headerdata-xh-chart-part'tooltip-header'
tooltip-rowdata-xh-chart-part'tooltip-row'
tooltip-swatchdata-xh-chart-part'tooltip-swatch'
tooltip-valuedata-xh-chart-part'tooltip-value'
tooltip-namedata-xh-chart-part'tooltip-name'
emptydata-loading'' (present only while the condition holds)
emptydata-state'loading' | undefined
emptydata-xh-chart-part'empty'
emptydata-xh-loading-ring''
markdata-dimmed'' (present only while the condition holds)
markdata-levelString(Math.min(geometry.level, 4)) | undefined
markdata-xh-chart-partmark.part | undefined

CSS variables ​

The public override slots, generated from what the standalone skin actually consumes.

VariablePartCSS propertyStateDefault from
--xh-hierarchy-chart-empty-gapemptygapstate=loading--xh-space-2
--xh-hierarchy-chart-gaprootgapdefault--xh-space-3
--xh-hierarchy-chart-heightviewportblock-sizedefault--xh-chart-height
--xh-hierarchy-chart-icon-sizeroot--xh-icon-sizedefault--xh-glyph-size-sm
--xh-hierarchy-chart-legend-gaplegendgapdefault--xh-space-4
--xh-hierarchy-chart-legend-scale-bar-radiuslegend-scale-barborder-radiusdefault--xh-shape-inset
--xh-hierarchy-chart-legend-scale-gaplegend-scalegapdefault--xh-space-2
--xh-hierarchy-chart-legend-scale-widthlegend-scale-barinline-sizedefault--xh-chart-legend-scale-width
--xh-hierarchy-chart-node-gaproot--xh-_chart-metric-gapdefault--xh-chart-gap
--xh-hierarchy-chart-node-radiusroot--xh-_chart-metric-radiusdefault--xh-shape-inset
--xh-hierarchy-chart-path-column-gappathcolumn-gapdefault--xh-icon-size
--xh-hierarchy-chart-path-fgpath-itemcolordefault
xh-collection-context=nav
--xh-fg-muted
--xh-hierarchy-chart-path-font-sizepath
path-item
font-sizedefault--xh-control-font-sm
--xh-hierarchy-chart-path-item-bg-hoverpath-itembackground-colordisabled
error
hover
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
xh-collection-context=nav
--xh-bg-subtle
--xh-hierarchy-chart-path-item-bg-pressedpath-itembackground-colordisabled
error
is(:active, [data-pressed])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
pressed
xh-collection-context=nav
--xh-bg-subtle-hover
--xh-hierarchy-chart-path-item-fg-currentpath-itemcolorcurrent
xh-collection-context=nav
xh-collection-terminal
--xh-fg-default
--xh-hierarchy-chart-path-item-fg-hoverpath-itemcolordisabled
error
hover
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
xh-collection-context=nav
--xh-fg-default
--xh-hierarchy-chart-path-item-font-weight-currentpath-itemfont-weightcurrent
xh-collection-context=nav
xh-collection-terminal
--xh-font-weight-medium
--xh-hierarchy-chart-path-item-pxpath-itempadding-inlinedefault--xh-space-1
--xh-hierarchy-chart-path-item-radiuspath-itemborder-radiusdefault--xh-shape-control
--xh-hierarchy-chart-path-row-gappathrow-gapdefault--xh-space-1
--xh-hierarchy-chart-path-separator-fgpath-itembackground-colordefault--xh-fg-subtle
--xh-hierarchy-chart-series-colorlegend-swatch
node
pattern-line
tooltip-swatch
background
border
fill
stroke
@media (forced-colors: active)
@media print
mark=line
where([data-xh-chart-patterns])
xh-chart-pattern
xh-chart-pattern=1
xh-chart-pattern=2
xh-chart-pattern=3
xh-chart-pattern=4
xh-chart-pattern=5
xh-chart-pattern=6
xh-chart-pattern=7
xh-chart-pattern=8
xh-chart-patterns
xh-chart-slot=1
xh-chart-slot=2
xh-chart-slot=3
xh-chart-slot=4
xh-chart-slot=5
xh-chart-slot=6
xh-chart-slot=7
xh-chart-slot=8
--xh-chart-categorical-1
--xh-chart-categorical-2
--xh-chart-categorical-3
--xh-chart-categorical-4
--xh-chart-categorical-5
--xh-chart-categorical-6
--xh-chart-categorical-7
--xh-chart-categorical-8
--xh-hierarchy-chart-tooltip-gaptooltipgapdefault--xh-space-1
--xh-hierarchy-chart-tooltip-pxtooltippadding-inlinedefault--xh-surface-pad-sm
--xh-hierarchy-chart-tooltip-pytooltippadding-blockdefault--xh-surface-pad-sm
--xh-hierarchy-chart-tooltip-radiustooltipborder-radiusdefault--xh-shape-overlay
--xh-hierarchy-chart-tooltip-row-gaptooltip-rowgapdefault--xh-space-2
--xh-hierarchy-chart-tooltip-shadowtooltipbox-shadowdefault--xh-material-frosted-shadow
--xh-hierarchy-chart-tooltip-swatch-radiustooltip-swatchborder-radiusdefault--xh-shape-inset

Released under The MIT License