Tablechart

for Reveal.js: Branding

Default

If no variables are set, a chart uses the text colour of the slide. Slices and lines get lighter one by one.

Nothing set
thousands of apples
Picked 74.5
Windfalls 28.2
Bruised -16.1
Peelings -13.3
Pressed 73.3

Where to set it

Set the variables on .reveal for the whole deck. To change one slide or one chart, set them on a class. In this demo, every slide uses its own class.

.reveal {
    --tablechart-bar-color: #e4572e;
}
.reveal .highlight {
    --tablechart-bar-color: #f2b134;
}

Your colour

One variable sets the colour of all bars.

One colour
thousands
Spring 58
Summer 72
Autumn 70
.onecolour {
    --tablechart-bar-color: #e4572e;
}

Waterfall colours

Set the colours for rising steps, falling steps and totals. The value colour variables set the colour of the number inside each bar.

Three colours
thousands of apples
Picked 74.5
Windfalls 28.2
Pressed 102.7
.warm {
    --tablechart-up-color: #b4552d;
    --tablechart-down-color: #d69a52;
    --tablechart-total-color: #cfc4b4;
    --tablechart-up-value-color: #ffffff;
    --tablechart-down-value-color: #3a2312;
    --tablechart-total-value-color: #3a2312;
}

A palette

Set --tablechart-color-1, -2 and on. Slices use them in order. If a colour is not set, that slice uses the default.

Four colours
thousands of apples
Picked 74.5
Juiced 38.2
Eaten fresh 18.1
Sold whole 12.4
Composted 5.8
.fruity {
    --tablechart-color-1: #b4552d;
    --tablechart-color-2: #d69a52;
    --tablechart-color-3: #7fa87f;
    --tablechart-color-4: #cfc4b4;
}

The same palette for lines

If a line chart has several lines, the lines use the palette too.

Apples per tree
Year North South East
2016 41 30 22
2019 58 39 35
2022 77 52 41
2025 105 61 70
.fruity {
    --tablechart-color-1: #b4552d;
    --tablechart-color-2: #d69a52;
    --tablechart-color-3: #7fa87f;
}

Legend

A legend is as wide as its items. These variables set its background, border, padding and corners.

Apples per tree
Year North South East
2016 41 30 22
2019 58 39 35
2022 77 52 41
2025 105 61 70
.boxed {
    --tablechart-legend-surface: rgba(255, 255, 255, 0.06);
    --tablechart-legend-border: 1px solid rgba(255, 255, 255, 0.3);
    --tablechart-legend-padding: 0.3em 0.8em;
    --tablechart-legend-radius: 0.4em;
}

Background

Lighter slices and lines are a mix of their colour and the background colour: that of the slide, or else that of the deck. If a chart has --tablechart-surface, that colour is its background.

On the slide
slices mixed with the colour of the slide
Picked 68.7
Juiced 38.2
Eaten fresh 18.1
Sold whole 12.4
With --tablechart-surface: white
a white background, and slices mixed with white
Picked 68.7
Juiced 38.2
Eaten fresh 18.1
Sold whole 12.4
<figure data-chart="donut" style="--tablechart-surface: white">

Text

Charts use the font of the deck. These variables set the sizes.

Bigger numbers
thousands
Spring 58
Summer 72
Autumn 70
.sizes {
    --tablechart-font-size: 0.5em;
    --tablechart-value-size: 1.6em;
    --tablechart-name-size: 0.75em;
}

Baseline and connectors

Heavier connectors
thousands of apples
Picked 74.5
Windfalls 28.2
Pressed 102.7
.dotty {
    --tablechart-connector-width: 2.5px;
    --tablechart-connector-dash: 0 6;
    --tablechart-connector-opacity: 1;
    --tablechart-baseline-width: 2px;
    --tablechart-baseline-opacity: 1;
}
/* A dash of 0 with round ends is a dot. */
.dotty .tablechart-connector {
    stroke-linecap: round;
}

The badge

Rounded corners
thousands of litres
Last season 251.5
This season 279.6
+11%
.pill {
    --tablechart-badge-radius: 0.4em;
    --tablechart-badge-padding: 0.4em 0.8em;
}

Animation speed

Slower
thousands of apples
Picked 74.5
Windfalls 28.2
Bruised -16.1
Peelings -13.3
Late pick 4.9
Pressed 78.3
.slow {
    --tablechart-animation-element-duration: 0.9s;
}

That’s it!

For all variables, see the Tablechart documentation.