Sankey chart

Info alert:Beta feature

This beta component is currently under review and is still open for further evolution. It is available for use in product. Beta components are considered for promotion on a quarterly basis. Please join in and give us your feedback or submit any questions on the PatternFly forum or via Slack. To learn more about the process, visit our about page or our Beta components page on GitHub.

Introduction

Note: PatternFly React charts live in its own package at @patternfly/react-charts!

The examples below are based on the Apache ECharts chart library, along with additional functionality, custom components, and theming for PatternFly. This provides a collection of React based components you can use to build PatternFly patterns with consistent markup, styling, and behavior.

Examples

Basic

Multi-color (unordered) with responsive container

Teal color with responsive container and toolbox

This demonstrates how to import ToolboxComponent for use with ECharts

Custom theme

This demonstrates how to create a color scale via a custom theme, which may be applied to multiple charts.

Skeleton

Props

Charts

This component is based on the Apache ECharts chart library. It provides additional functionality, custom components, and theming for PatternFly. This provides a collection of React based components you can use to build PatternFly patterns with consistent markup, styling, and behavior. See https://echarts.apache.org/en/api.html#echarts
*required
NameTypeDefaultDescription
classNamestringThe className prop specifies a class name that will be applied to outermost element
heightnumberSpecify height explicitly, in pixels
idstringThe id prop specifies an ID that will be applied to outermost element.
isLegendTooltipbooleanFlag indicating to use the legend tooltip (default). This may be overridden by the `option.tooltip` property.
isSvgRendererbooleanFlag indicating to use the SVG renderer (default). This may be overridden by the `opts.renderer` property.
nodeSelectorstringThis creates a Mutation Observer to watch the given DOM selector. When the pf-v6-theme-dark selector is added or removed, this component will be notified to update its computed theme styles. However, if the dark theme is not updated dynamically (e.g., via a toggle), there is no need to add this Mutation Observer. Note: Don't provide ".pf-v6-theme-dark" as the node selector as it won't exist in the page for light theme. The underlying querySelectorAll() function needs to find the element the dark theme selector will be added to. See https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors
optionChartsOptionPropsECharts uses this object to configure its properties; for example, series, title, and tooltip See https://echarts.apache.org/en/option.html
optsEChartsInitOptsOptional chart configuration See https://echarts.apache.org/en/api.html#echarts.init
themeanyThe theme prop specifies a theme to use for determining styles and layout properties for a component. Any styles or props defined in theme may be overwritten by props specified on the component instance. See https://echarts.apache.org/handbook/en/concepts/style/#theme
themeColorstringSpecifies the theme color. Valid values are 'blue', 'green', 'multi', etc. Note: Not compatible with theme prop
widthnumberSpecify width explicitly, in pixels

ChartsOptionProps

See https://echarts.apache.org/en/option.html
*required
NameTypeDefaultDescription
angleAxisAngleAxisOption | AngleAxisOption[]The angle axis in Polar Coordinate -- see https://echarts.apache.org/en/option.html#angleAxis
animationbooleanWhether to enable animation -- see https://echarts.apache.org/en/option.html#animation
animationDelaynumberDelay before updating the first animation -- see https://echarts.apache.org/en/option.html#animationDelay
animationDelayUpdatenumberDelay before updating animation -- see https://echarts.apache.org/en/option.html#animationDelayUpdate
animationDurationnumberDuration of the first animation -- see https://echarts.apache.org/en/option.html#animationDuration
animationDurationUpdatenumberTime for animation to complete -- see https://echarts.apache.org/en/option.html#animationDurationUpdate
animationEasingstringEasing method used for the first animation -- see https://echarts.apache.org/en/option.html#animationEasing
animationEasingUpdatestringEasing method used for animation -- see https://echarts.apache.org/en/option.html#animationEasingUpdate
animationThresholdnumberWhether to set graphic number threshold to animation -- see https://echarts.apache.org/en/option.html#animationThreshold
ariaAriaOptionThe W3C has developed the WAI-ARIA, the Accessible Rich Internet Applications Suite, which is dedicated to making web content and web applications accessible -- see https://echarts.apache.org/en/option.html#aria
axisPointerAxisPointerOption | AxisPointerOption[]This is the global configurations of axisPointer -- see https://echarts.apache.org/en/option.html#axisPointer
backgroundColorstringBackground color - see https://echarts.apache.org/en/option.html#backgroundColor
blendModestringSets the type of compositing operation to apply when drawing a new shape -- see https://echarts.apache.org/en/option.html#blendMode
brushBrushOption | BrushOption[]Brush is an area-selecting component -- see https://echarts.apache.org/en/option.html#brush
calendarCalendarOption | CalendarOption[]Calendar coordinates -- see https://echarts.apache.org/en/option.html#calendar
colorstring[]The color list of palette -- see https://echarts.apache.org/en/option.html#color
darkModeboolean | 'auto'ECharts will automatically detect it via backgroundColor by default and adjust the text color accordingly - see https://echarts.apache.org/en/option.html#darkMode
datasetDatasetOption | DatasetOption[]Dataset brings convenience in data management separated with styles and enables data reuse by different series -- see https://echarts.apache.org/en/option.html#dataset
dataZoomDataZoomComponentOption | DataZoomComponentOption[]Data zoom component is used for zooming a specific area -- see https://echarts.apache.org/en/option.html#dataZoom
geoGeoOption | GeoOption[]ECharts will automatically detect it via backgroundColor by default and adjust the text color accordingly -- see https://echarts.apache.org/en/option.html#darkMode Geographic coordinate system component -- see https://echarts.apache.org/en/option.html#geo
graphicGraphicComponentLooseOption | GraphicComponentLooseOption[]Graphic component enables creating graphic elements in ECharts -- see https://echarts.apache.org/en/option.html#graphic
gridGridOption | GridOption[]Drawing grid in rectangular coordinate -- see https://echarts.apache.org/en/option.html#grid
hoverLayerThresholdnumberWhen the number of element of the whole chart is larger than hoverLayerThreshold, a separate hover layer is used to render hovered elements -- see https://echarts.apache.org/en/option.html#hoverLayerThreshold
legendLegendComponentOption | LegendComponentOption[]Legend component -- see https://echarts.apache.org/en/option.html#legend
mediaObjectSee Responsive Mobile-End for details -- see https://echarts.apache.org/en/option.html#media
optionsEChartsOption[]Option array used in timeline -- see https://echarts.apache.org/en/option.html#options
parallelParallelCoordinateSystemOption | ParallelCoordinateSystemOption[]Parallel Coordinates is a common way of visualizing high-dimensional geometry and analyzing multivariate data -- see https://echarts.apache.org/en/option.html#parallel
parallelAxisObjectThis component is the coordinate axis for parallel coordinate -- see https://echarts.apache.org/en/option.html#parallelAxis
polarPolarOption | PolarOption[]Polar coordinate can be used in scatter and line chart -- see https://echarts.apache.org/en/option.html#polar
radarRadarOption | RadarOption[]Coordinate for radar charts -- see https://echarts.apache.org/en/option.html#radar
radiusAxisRadiusAxisOption | RadiusAxisOption[]Radial axis of polar coordinate -- see https://echarts.apache.org/en/option.html#radiusAxis
seriesObjectProperties for various chart types -- see https://echarts.apache.org/en/option.html#series
singleAxisSingleAxisOption | SingleAxisOption[]An axis with a single dimension -- see https://echarts.apache.org/en/option.html#singleAxis
stateAnimationObjectAnimation configurations of state switchment -- see https://echarts.apache.org/en/option.html#stateAnimation
timelineTimelineOption | ObjectTimeline component -- see https://echarts.apache.org/en/option.html#timeline
titleTitleOption | TitleOption[]Title component, including main title and subtitle -- see https://echarts.apache.org/en/option.html#title
toolboxToolboxComponentOption | ToolboxComponentOption[]A group of utility tools -- see https://echarts.apache.org/en/option.html#toolbox
tooltipTooltipOptionProps | TooltipOptionProps[]Tooltip component -- see https://echarts.apache.org/en/option.html#tooltip
useUTCbooleanWhether to use UTC in display -- see https://echarts.apache.org/en/option.html#useUTC
visualMapVisualMapComponentOption | VisualMapComponentOption[]Visual map is a type of component for visual encoding -- see https://echarts.apache.org/en/option.html#visualMap
xAxisXAXisOption | XAXisOption[]The x-axis in cartesian(rectangular) coordinate -- see https://echarts.apache.org/en/option.html#xAxis
yAxisYAXisOption | YAXisOption[]The y-axis in cartesian(rectangular) coordinate -- see https://echarts.apache.org/en/option.html#yAxis

TooltipOptionProps

See https://echarts.apache.org/en/option.html#tooltip
*required
NameTypeDefaultDescription
alwaysShowContentbooleanWhether to show tooltip content all the time -- see https://echarts.apache.org/en/option.html#tooltip.alwaysShowContent
appendTostring | HTMLElement | FunctionWhich DOM element to append the tooltip to -- see https://echarts.apache.org/en/option.html#tooltip.appendTo
axisPointerObjectConfiguration item for axisPointer -- see https://echarts.apache.org/en/option.html#tooltip.axisPointer
backgroundColorstringThe background color of tooltip's floating layer -- see https://echarts.apache.org/en/option.html#tooltip.backgroundColor
borderColorstringThe border color of tooltip's floating layer -- see https://echarts.apache.org/en/option.html#tooltip.borderColor
borderWidthnumberThe border width of tooltip's floating layer -- see https://echarts.apache.org/en/option.html#tooltip.borderWidth
classNamestringSpecify the classes for the tooltip root DOM -- see https://echarts.apache.org/en/option.html#tooltip.className
confinebooleanWhether confine tooltip content in the view rect of chart instance -- see https://echarts.apache.org/en/option.html#tooltip.confine
destinationLabelstringThe destination label shown in the tooltip -- for Sankey only
enterablebooleanWhether mouse is allowed to enter the floating layer of tooltip -- see https://echarts.apache.org/en/option.html#tooltip.enterable
extraCssTextstringExtra CSS style for floating layer -- see https://echarts.apache.org/en/option.html#tooltip.extraCssText
formatterstring | FunctionThe content formatter of tooltip's floating layer -- see https://echarts.apache.org/en/option.html#tooltip.formatter
hideDelaynumberDelay time for hiding tooltip -- see https://echarts.apache.org/en/option.html#tooltip.hideDelay
orderstringTooltip order for multiple series -- see https://echarts.apache.org/en/option.html#tooltip.order
paddingnumberThe floating layer of tooltip space around content -- see https://echarts.apache.org/en/option.html#tooltip.padding
positionstring[]The position of the tooltip's floating layer -- see https://echarts.apache.org/en/option.html#tooltip.position
renderModestringRender mode for tooltip -- see https://echarts.apache.org/en/option.html#tooltip.renderMode
showbooleanWhether to show the tooltip component -- see https://echarts.apache.org/en/option.html#tooltip.show
showContentbooleanWhether to show the tooltip floating layer -- see https://echarts.apache.org/en/option.html#tooltip.showContent
showDelaynumberDelay time for showing tooltip -- see https://echarts.apache.org/en/option.html#tooltip.showDelay
sourceLabelstringThe source label shown in the tooltip -- for Sankey only
textStyleObjectThe text style of tooltip's floating layer -- see https://echarts.apache.org/en/option.html#tooltip.textStyle
transitionDurationnumberThe transition duration of tooltip's animation, in seconds -- see https://echarts.apache.org/en/option.html#tooltip.transitionDuration
triggerstringType of triggering -- see https://echarts.apache.org/en/option.html#tooltip.trigger
triggerOn'mousemove' | 'click' | 'mousemove|click' | 'none'Conditions to trigger tooltip -- see https://echarts.apache.org/en/option.html#tooltip.triggerOn
valueFormatterstringCallback function for formatting the value section in tooltip -- see https://echarts.apache.org/en/option.html#tooltip.valueFormatter