data={{
nodes: sankeyData.nodes,
links: sankeyData.links
}}
layout="horizontal"
align="justify"
sort="input"
margin={{
top: 16,
right: horizontalMargin,
bottom: 16,
left: horizontalMargin
}}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
colors={( node: any ) => flowColors[ node.nodeType as FlowNodeType ] || flowColors.other}
nodeThickness={14}
nodeSpacing={12}
nodeBorderRadius={2}
nodeBorderWidth={0}
nodeOpacity={1}
nodeHoverOpacity={1}
nodeHoverOthersOpacity={0.35}
linkOpacity={isDarkTheme ? 0.5 : 0.4}
linkHoverOpacity={isDarkTheme ? 0.85 : 0.75}
linkHoverOthersOpacity={0.12}
enableLinkGradient={true}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
label={( node: any ) =>
truncateMiddle(
node.displayLabel,
labelLength
)
}
labelPosition="outside"
labelPadding={10}
labelTextColor={labelColor}
labelComponent={FlowSankeyLabel}
valueFormat={( value: number ) => formatNumber( value, 0, false )}
nodeTooltip={NodeTooltip}
linkTooltip={LinkTooltip}
animate={false}
theme={{
labels: {
text: {
fontSize: 12,
fontWeight: 600,
fill: labelColor
}
}
}}
/>
{__( 'Where visitors came from', 'burst-statistics' )}
{sankeyData.sources.map( ( source ) => (
-
{source.label}, {getFlowTypeLabel( source.type )},{' '}
{formatNumber( source.sessions, 0, false )}{' '}
{__( 'sessions', 'burst-statistics' )},{' '}
{formatPercentage( source.percentage, 0 )}
) )}
{__( 'Where visitors went next', 'burst-statistics' )}
{sankeyData.destinations.map( ( destination ) => (
-
{destination.label},{' '}
{getFlowTypeLabel( destination.type )},{' '}
{formatNumber( destination.sessions, 0, false )}{' '}
{__( 'sessions', 'burst-statistics' )},{' '}
{formatPercentage( destination.percentage, 0 )}
) )}
);
};