Skip to Content

Legends

The Legends component in REAVIZ provides a visual representation of the data series in a chart. Legends help users understand what each color or symbol in the chart represents.

Types supported by reaviz:

  • Discrete Legend: Displays individual entries for each data series. REAVIZ does not include legends by default to keep the library modular, but you can add discrete legends as needed.
  • Sequential Legend: Useful for categorical charts such as heatmaps, supporting both vertical and horizontal layouts.

Where to use:

  • Clarify Data Series: Ideal for providing clear labels and color codes for different data series in a chart.
  • Enhance Readability: Useful for improving the readability and interpretation of complex charts.
  • Categorical Data Representation: Great for representing categorical data in charts like heatmaps.

Examples

Descrete

Sequential

API

DiscreteLegendΒ 

NameTypeDefault
classNamestring

CSS Class name.

styleCSSProperties

CSS Styles.

orientation"horizontal" | "vertical"

Orientation of the legend.

'vertical'
entriesReactElement<DiscreteLegendEntryProps, FC<Partial<DiscreteLegendEntryProps>>>[]

Entry components to show in the legend.

DiscreteLegendEntryΒ 

NameTypeDefault
labelstring

Label for the entry.

colorstring

Color for the entry.

symbolReactElement<DiscreteLegendSymbolProps, FC<Partial<DiscreteLegendSymbolProps>>> | ReactNode

Symbol for the entry.

`<DiscreteLegendSymbol />`
styleCSSProperties

CSS Styles.

classNamestring

CSS Class names.

titlestring

HTML Title Attribute.

orientation"horizontal" | "vertical"

Orientation of the entry set internally by DiscreteLegend.

'horizontal'
onMouseEnter(event: MouseEvent<HTMLDivElement, MouseEvent>) => void

Mouse enter event.

onMouseLeave(event: MouseEvent<HTMLDivElement, MouseEvent>) => void

Mouse leave event.

onClick(event: MouseEvent<HTMLDivElement, MouseEvent>) => void

On click event.

DiscreteLegendSymbolΒ 

NameTypeDefault
colorstring

Color for the symbol set by the DiscreteLegendEntry.

classNamestring

CSS Class names.

SequentialLegendΒ 

NameTypeDefault
classNameany

CSS Class name.

gradientClassNamestring

CSS Class name for the gradient element.

styleany

CSS Styles.

orientation"horizontal" | "vertical"

Orientation of the legend.

'vertical'
dataChartDataShape[]

Data to use to render the scale.

colorSchemestring[]

Color scheme for the scale.

['rgba(28, 107, 86, 0.5)', '#2da283']
Last updated on