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

查看生态总览
Skip to content

SankeyChart 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="sankey-chart": root · caption · legend · legend-item · legend-swatch · legend-label · viewport · plot · defs · gradient · gradient-stop · link · node · node-label · 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-sankey-chart>
Vue componentsXhSankeyChartCaption XhSankeyChartEmpty XhSankeyChartLegend XhSankeyChartPlot XhSankeyChartRoot XhSankeyChartTooltip XhSankeyChartViewport
ComposableuseSankeyChart
State machinesankeyChartMachine
Skin@xihan-ui/styles/sankey-chart.css

Events ​

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

EventPayload
hidden-series-changeChartHiddenSeriesChangeDetails
active-key-changeChartActiveKeyChangeDetails
datum-activeChartDatumDetails
datum-pressChartDatumDetails

Slots ​

Only slots with a payload are listed.

Vue componentSlotPayload
XhSankeyChartRootdefaultSankeyChartRootSlotProps
XhSankeyChartRootcaption—
XhSankeyChartRoottooltipSankeyChartTooltipSlotProps
XhSankeyChartRootempty—
XhSankeyChartTooltipdefaultSankeyChartTooltipSlotProps

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
XhSankeyChartRootnodesreadonly SankeyNodeDatum[]
XhSankeyChartRootlinksreadonly SankeyLinkDatum[]
XhSankeyChartRootorientationSankeyOrientation
XhSankeyChartRootnodeAlignSankeyNodeAlign
XhSankeyChartRootlinkColorSankeyLinkColor
XhSankeyChartRootnodeSortSankeyNodeSort
XhSankeyChartRootformatNumberFormatSpec | ((value: number) => string)
XhSankeyChartRoothiddenSeriesstring[]
XhSankeyChartRootdefaultHiddenSeriesstring[]
XhSankeyChartRootactiveKeyChartKey | null
XhSankeyChartRootpendingboolean
XhSankeyChartRootanimatedboolean
XhSankeyChartRootlocalestring
XhSankeyChartRoottranslationsPartial<SankeyChartTranslations>
XhSankeyChartRootonHiddenSeriesChangeSankeyChartProps['onHiddenSeriesChange']
XhSankeyChartRootonActiveKeyChangeSankeyChartProps['onActiveKeyChange']
XhSankeyChartRootonDatumActiveSankeyChartProps['onDatumActive']
XhSankeyChartRootonDatumPressSankeyChartProps['onDatumPress']
XhSankeyChartRootcaptionReactNode
XhSankeyChartRootrenderTooltip(props: SankeyChartTooltipSlotProps) => ReactNode
XhSankeyChartRootemptyReactNode
XhSankeyChartRootchildrenSlotChildren<SankeyChartRootSlotProps>
XhSankeyChartTooltipchildrenSlotChildren<SankeyChartTooltipSlotProps>

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

connect API ​

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

MemberType
modelSankeyModel
sceneScene
overlaySankeyOverlay
measuredboolean
emptyboolean
legendItemsreadonly SankeyLegendItem[]
gradientsreadonly SankeyGradient[]
activeChartDatumDetails | null
tooltipSankeyTooltipModel | null
summarystring
tableTableModel
emptyTextstring
tableCaptionstring
activeKeyChartKey | null
hiddenSeriesstring[]
toggleSeries(id: string) => void
setFocusedDatum(ref: { seriesId: string, index: number } | null) => void
markTag(mark: Mark) => SankeyMarkTag
getRootProps() => T['element']
getCaptionProps() => T['element']
getLegendProps() => T['element']
getLegendItemProps(item: SankeyLegendItem) => T['button']
getLegendSwatchProps(item: SankeyLegendItem) => T['element']
getLegendLabelProps(item: SankeyLegendItem) => T['element']
getViewportProps() => T['element']
getPlotProps() => T['element']
getDefsProps() => T['element']
getGradientProps(gradient: SankeyGradient) => T['element']
getGradientStopProps(gradient: SankeyGradient, at: 'from' | 'to') => T['element']
getMarkProps(mark: Mark) => T['element']
getTooltipProps() => T['element']
getTooltipHeaderProps() => T['element']
getTooltipRowProps(row: SankeyTooltipRow) => T['element']
getTooltipSwatchProps(row: SankeyTooltipRow) => T['element']
getTooltipValueProps(row: SankeyTooltipRow) => T['element']
getTooltipNameProps(row: SankeyTooltipRow) => 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+Tabsankey-chart.kbd.tab
ArrowDownsankey-chart.kbd.next
ArrowUpsankey-chart.kbd.prev
ArrowRightsankey-chart.kbd.downstream
ArrowLeftsankey-chart.kbd.upstream
Homesankey-chart.kbd.first
Endsankey-chart.kbd.last
Enter / Spacesankey-chart.kbd.press
Escapesankey-chart.kbd.dismiss
ArrowLeft / ArrowRight / Home / Endsankey-chart.kbd.legend-move
Enter / Spacesankey-chart.kbd.legend-toggle

ARIA ​

These attributes are produced by connect.

PartAttributeValue
rootaria-busy'true' | undefined
legendaria-labeltranslations.legendLabel
legendrole'toolbar'
legend-itemaria-pressed'false' | 'true'
legend-swatcharia-hidden'true'
plotaria-describedbyid of the summary part
plotaria-roledescriptiontranslations.chartRoleDescription
plotrole'graphics-document'
tooltiparia-hidden'true'
markaria-hidden'true'

Style reference ​

Skin ​

@xihan-ui/styles/sankey-chart.css is written against [data-scope="sankey-chart"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-sankey-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-state'error' | undefined
rootdata-xh-chart-part'root'
captiondata-xh-chart-part'caption'
legenddata-xh-chart-part'legend'
legend-itemdata-pressed'' (present only while the condition holds)
legend-itemdata-valueitem.id
legend-itemdata-xh-action-control''
legend-itemdata-xh-action-profile'text'
legend-itemdata-xh-action-size'xs'
legend-itemdata-xh-action-variant'ghost'
legend-itemdata-xh-chart-part'legend-item'
legend-itemdata-xh-chart-patternString(item.slot)
legend-itemdata-xh-chart-slotString(item.slot)
legend-swatchdata-xh-chart-part'legend-swatch'
viewportdata-xh-chart-part'viewport'
plotdata-xh-chart-part'plot'
gradient-stopdata-xh-chart-slotString(at === 'from' ? gradient.from : gradient.to)
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-rowdata-xh-chart-patternundefined | String(row.slot)
tooltip-rowdata-xh-chart-slotundefined | String(row.slot)
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-xh-chart-partmark.part | undefined

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-sankey-chart-empty-gapemptygapstate=loading--xh-space-2
--xh-sankey-chart-gaprootgapdefault--xh-space-3
--xh-sankey-chart-heightviewportblock-sizedefault--xh-chart-height
--xh-sankey-chart-legend-gaplegendgapdefault--xh-space-1
--xh-sankey-chart-legend-swatch-radiuslegend-swatchborder-radiusdefault--xh-shape-inset
--xh-sankey-chart-link-alphalinkfill-opacitydefault--xh-chart-link-alpha
--xh-sankey-chart-link-colorlinkfilldefault--xh-chart-categorical-other
--xh-sankey-chart-node-radiusroot--xh-_chart-metric-radiusdefault--xh-shape-inset
--xh-sankey-chart-node-widthroot--xh-_chart-metric-bar-maxdefault--xh-space-3
--xh-sankey-chart-series-colorgradient-stop
legend-swatch
link
node
pattern-line
tooltip-swatch
background
border
fill
stop-color
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
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-sankey-chart-tooltip-gaptooltipgapdefault--xh-space-1
--xh-sankey-chart-tooltip-pxtooltippadding-inlinedefault--xh-surface-pad-sm
--xh-sankey-chart-tooltip-pytooltippadding-blockdefault--xh-surface-pad-sm
--xh-sankey-chart-tooltip-radiustooltipborder-radiusdefault--xh-shape-overlay
--xh-sankey-chart-tooltip-row-gaptooltip-rowgapdefault--xh-space-2
--xh-sankey-chart-tooltip-shadowtooltipbox-shadowdefault--xh-material-frosted-shadow
--xh-sankey-chart-tooltip-swatch-radiustooltip-swatchborder-radiusdefault--xh-shape-inset

Released under The MIT License