Mini area
A mini area is a small filled trend with no axes. The band is the chart. It sits where a sparkline would sit, when the filled shape should read at a glance.
When to use it
Use a mini area for one short series inline: signups over six weeks, holds across a week, a spark of volume under a label. The reader is not measuring a point off a grid. They are seeing the shape of the band.
A sparkline is the same small frame as a stroke only. Use it when the line is enough. A mini area always fills. That fill is not a switch on this type.
A line with mark.area is a full chart. It has axes, room for a second series, and a legend when there is more than one line. There is no type: "area". A filled line is still type: "line". Area is the page for that note.
Several series that add up to one shape are a stacked area. A mini area is one series, with no axes.
Mini area, sparkline, and a filled line
All three can show a measure over an ordered x. The frame is what changes.
type: "mini-area" fills one series and hides the axes. A number array is enough. The default height is 40px when size is omitted.
type: "sparkline" draws the stroke and leaves the area off. mark.area can turn that fill on, and the chart is still a sparkline.
type: "line" with mark.area keeps the axes. Use it when the scale is part of the reading.
{
"type": "line",
"mark": { "area": true }
}Data
A plain number array is the usual data. The field name is value. X is the index. Signups is six numbers. Holds this week is seven. Neither needs encoding.
Row objects work the same way they do on a sparkline. Point encoding.y at the number. A missing number leaves a gap, unless mark.connectNulls is true. A second series is a stacked area or a line, not a second band in this chart.
a11y.alt is required. One sentence, 10 to 500 characters, with the point of the chart.
A spec that renders
This is the smallest mini area. version, type, data, and a11y.alt are required. The fill is on, so mark can be omitted. The curve is monotone. The band fades toward the baseline. There are no axes and no legend. Omit size and the strip is 40px tall. The docs preview uses a short card. A size in the spec wins over that card. Holds this week sets 640 by 200, so the rail uses that size.
{
"version": "1",
"type": "mini-area",
"data": [
4,
6,
5,
8,
7,
11
],
"a11y": {
"alt": "The mini area trends upward and ends at its highest point."
}
}Install core and the adapter for your framework. The menu in the sidebar picks the snippet. spec is the JSON above.
npm install @chartkitdev/core
npm install @chartkitdev/react
import { Chart } from "@chartkitdev/react";
export function Panel() {
return <Chart spec={spec} />;
}npm install @chartkitdev/core
npm install @chartkitdev/vanilla
import { mount } from "@chartkitdev/vanilla";
const chart = mount(document.querySelector("#chart"), spec);
chart.update(spec);npm install @chartkitdev/core
npm install @chartkitdev/vue
<script setup>
import { Chart } from "@chartkitdev/vue";
</script>
<template>
<Chart :spec="spec" />
</template>npm install @chartkitdev/core
npm install @chartkitdev/svelte
<script>
import { Chart } from "@chartkitdev/svelte";
</script>
<Chart {spec} />npm install @chartkitdev/core
npm install @chartkitdev/astro
---
import { Chart } from "@chartkitdev/astro";
---
<Chart spec={spec} />npm install @chartkitdev/core
npm install @chartkitdev/solid
import { Chart } from "@chartkitdev/solid";
export function Panel() {
return <Chart spec={spec} />;
}npm install @chartkitdev/core
npm install @chartkitdev/qwik
import { component$ } from "@builder.io/qwik";
import { Chart } from "@chartkitdev/qwik";
export const Panel = component$(() => {
return <Chart spec={spec} />;
});npm install @chartkitdev/core
npm install @chartkitdev/angular
import { Component } from "@angular/core";
import { Chart } from "@chartkitdev/angular";
@Component({
standalone: true,
imports: [Chart],
template: `<ck-chart [spec]="spec" />`,
})
export class Panel {
spec = spec;
}npm install @chartkitdev/core
npm install @chartkitdev/element
import "@chartkitdev/element";
const chart = document.querySelector("chart-kit");
chart.spec = spec;Each option below is a key on the spec. The demo changes that key and updates the chart and the snippet together.
Examples
The rail switches between two mini areas. Signups is the trailing six weeks, with the default fade. Holds this week turns the fade off, names the tooltip field, and sets a size.
Curve
mark.curve is how the top edge joins the points. monotone is the default. It stays inside the data. linear draws straight segments. step holds the value and then jumps. The fill follows that edge.
{
"mark": { "curve": "step" }
}step-before and step-after place the jump on the other side of the point. Set those in the playground.
Gradient
mark.gradient fades the band toward the baseline. Omit it, or set true, and the fade is on. false keeps a solid band. Holds this week sets false. The fill itself stays. This control does not turn the chart into a sparkline.
{
"mark": { "gradient": false }
}Turning the fade off and on again puts the example's value back. An example that omitted mark.gradient gets the key removed, so the default fade stays on.
Tooltip
tooltip is on when the key is omitted. Hovering a point shows the value. tooltip: false turns the card off. tooltip: true turns it on.
{
"tooltip": false
}{
"tooltip": true
}tooltip.fields chooses the rows in the card. Holds this week names the value Holds. On a number array the field is value. Change the fields in the playground. Turning the card off and on again puts that object back.
The rest of the spec
mark.fillOpacity is the strength of the band, from 0 to 1. mark.strokeWidth is the top edge. mark.sampling downsamples a long series. mark.connectNulls draws through gaps. None of those are needed for a first mini area. A legend is not drawn. mark.points does not apply. Theme presets live on the playground, with the full option list.
A title is drawn as text and sits on a short strip, so these examples leave it off.