Skip to main content

Rolling Pin Legend

Overview

RollingPinLegend is a stand-alone component that can be used alongside your visualization to compactly label marginal values while also displaying the color scheme used.

Legend Contents

RollingPinLegend requires the rects property, an array of strings representing colors used in a legend.

leftLabelText and rightLabelText are optional, but it is recommended to use at least one of them.

Here is an example of a basic configuration:

component.tsx
function Component(props) {
const rects = [
`#11F`,
`#55F`,
`#99F`,
`#DDF`,
`#fff`,
`#FDD`,
`#F99`,
`#F55`,
`#F11`
]

return (
<VisRollingPinLegend
rects={rects}
leftLabelText="Democrat"
rightLabelText="Republican"
/>
)
}
Loading...

Label Configuration

Font Size

The labels' font size can be changed with a valid font-size CSS string provided to the labelMaxWidth property.

<VisRollingPinLegend rects={rects} labelFontSize="x-large"/>
Loading...

Custom Class

You can also add any further configuration for labels by providing labelClassName with your custom css class.

CSS Variables

Supported CSS variables and their default values
--vis-rolling-pin-legend-label-color: #6c778c;
--vis-rolling-pin-legend-label-max-width: 300px;
--vis-rolling-pin-legend-label-font-size: 12px;
--vis-rolling-pin-legend-spacing: 4px;
--vis-rolling-pin-legend-item-width: 8px;
--vis-dark-rolling-pin-legend-label-color: #eee;

Component Props

NameTypeDescription
* required property