Skip to content

Chart

Color tokens and container styling for data visualizations. Chart-library agnostic — works with Chart.js, ECharts, D3, inline SVG, or any charting tool.

When to use

  • Dashboards and data-driven interfaces
  • Reports, analytics, and monitoring views
  • Any context where data needs visual representation

Philosophy

Grundtone provides theming and layout for charts, not a charting engine. Use your preferred chart library and apply Grundtone tokens for visual consistency.


Color tokens

Five semantic chart colors, optimized for contrast in both light and dark mode:

TokenUsage
--chart-1Primary series
--chart-2Secondary series
--chart-3Tertiary series
--chart-4Quaternary series
--chart-5Quinary series

Use as fill, stroke, or background-color:

html
<rect fill="var(--chart-1)" />
<div style="background: var(--chart-2)"></div>

CSS classes

Container

ClassDescription
.chartRoot container — ensures SVG/canvas fills width
.chart__headerTitle + description block
.chart__titleChart title — semibold, sm
.chart__descriptionSubtitle — xs, tertiary
.chart__footerBelow-chart annotation

Legend

ClassDescription
.chart__legendFlex container for legend items
.chart__legend-itemSingle legend entry
.chart__legend-dotColor dot indicator

Tooltip

ClassDescription
.chart__tooltipStyled tooltip container
.chart__tooltip-labelTooltip header
.chart__tooltip-itemSingle data row
.chart__tooltip-indicatorDot + label
.chart__tooltip-dotColor dot
.chart__tooltip-valueValue — semibold, tabular-nums

Example: inline SVG bar chart

html
<div class="chart">
  <div class="chart__header">
    <p class="chart__title">Monthly revenue</p>
    <p class="chart__description">Jan – Jun 2026</p>
  </div>

  <svg viewBox="0 0 300 100">
    <rect x="10" y="20" width="30" height="80" fill="var(--chart-1)" rx="4" />
    <rect x="50" y="40" width="30" height="60" fill="var(--chart-1)" rx="4" />
    <!-- ... more bars -->
  </svg>

  <div class="chart__legend">
    <span class="chart__legend-item">
      <span class="chart__legend-dot" style="background: var(--chart-1)"></span>
      Revenue
    </span>
  </div>
</div>

Integration guides

Chart.js

js
import { Chart } from 'chart.js';

// Read Grundtone tokens from computed styles
const styles = getComputedStyle(document.documentElement);
const chart1 = styles.getPropertyValue('--chart-1').trim();
const chart2 = styles.getPropertyValue('--chart-2').trim();

new Chart(ctx, {
  data: {
    datasets: [
      { backgroundColor: chart1, ... },
      { backgroundColor: chart2, ... },
    ]
  }
});

Vue (GTChartContainer)

See Vue Chart documentation for the GTChartContainer, GTChartTooltip, and GTChartLegend components.


Accessibility

  • Use role="img" and aria-label on the chart container
  • Provide a text summary or data table alongside the chart for screen readers
  • Ensure chart colors have sufficient contrast (WCAG AA for large text)
  • Consider colorblind-safe palettes for categorical data — supplement color with patterns or labels