Skip to content

ChartFrame

Stable

The box every chart sits in. It adds a title, a short written summary, a table view and clear messages when data is loading or missing.

Also known as chart container, chart card, chart wrapper

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

A chart with a summary and a table

How long orders take

Minutes per order, last 7 days

The slowest orders took 82 minutes on Friday. A typical order stayed between 26 and 30 minutes all week.

  • Typical order
  • Slowest orders

Source: order records.

The summary says what the chart shows. View as table swaps the chart for the same numbers in a table.

When to use it

The box every chart sits in. It puts the title, what is measured and a summary in words above the chart, so the point is clear before anyone reads the lines.

Made of: Title · Subtitle with what is measured and when · Table and download buttons · Summary in words · Key for the lines or bars · Chart or table · Source and note

Use it for

  • Any chart on a page, so it gets a title, a summary and a table view.
  • Showing clear messages while data loads, when there is none, or when loading fails.
  • A chart that may land in a narrow space: pass a small trend line as the fallback.

Not for

Do and avoid

Orders per day

Orders, Mon to Thu

Thursday was the busiest day, with 21 orders.

Do. A title, unit and one-line summary give the point first.

Orders per day

Orders, Mon to Thu

Avoid. No summary, so people who need words miss the point.

Do

  • Write the summary as a sentence that says what the data shows, with the key number.
  • Say what is measured and over what time in the subtitle.
  • Give every chart a table, so the table button is always there.
  • When there is nothing to show, say why and what to do next.
  • Pass onRetry, so the error message offers a Try again button.

Avoid

  • Don't skip the summary because the chart looks obvious. Some people need the words.
  • Don't hide numbers in a pop-up. Put them in the table.
  • Don't put filters inside the box. Keep them in one row above the charts they control.
  • Don't make the box shorter than the chart and its labels.

On a phone

  • The chart is drawn at the width of the frame, and below minWidth (280px unless you change it) it is replaced by your fallback, usually a Sparkline, with a note to use the table view.
  • Cards use 16px padding and the title wraps instead of being cut off.
  • The View as table button swaps in a DataTable that scrolls sideways inside the frame, so give the table a narrow column set for phones.

Seen in products

  • The UK Analysis Function charts checklist requires a text alternative as a data table, a description of the message, or both, in body text and not only in alt text. It also recommends a downloadable data file.
  • Highcharts' accessibility module offers a chart description and a data-table view.
  • Carbon's chart anatomy lists title, legend and graph frame as parts of a chart.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started