Agentic BP DScode-first design system

LineChart

How values change over time as lines or filled areas, one per series, like revenue by month or invoices approved by day.

Master

Hover or use the arrow keys for the tooltip. Turn the title, area, stacked, points, values, grid, legend and animate on and off. Variants has a limit line, a dashed forecast and a today marker.

Revenue by periodLast 6 months, all accounts
Revenue by period
Revenue
Jan$3,400,000
Feb$3,600,000
Mar$4,200,000
Apr$4,400,000
May$4,600,000
Jun$4,900,000

Usage

Use LineChart for trends across ordered categories, usually time. It is one component: pass categories (the labels along the bottom) and series (one values array each). area fills under each line; stacked piles the areas on each other so the top edge is the total, like invoices by severity. showPoints marks each value with a dot and showValues writes it above. A limit or target goes in referenceLines, a dashed line across the chart with its label and value at the end. A forecast stays in the same series: projectedFrom names its first forecast category, and the line turns dashed from there. marker draws a thin line down the chart at one category, like Today. Hover or use the arrow keys for a tooltip with every series at that point. animate plays a subtle draw-in. Put the chart's title and report link in the Section or Card around it. ChartIntent: green | olive | cyan | orange | pink | gray | purple | yellow | red | mint (the kit category colors). title and subtitle write a heading over the chart; showHeader turns it off when the Card around it already says the same. The keys under the chart are the kit Legend; legendPosition moves them over it or beside it. See contracts/linechart.json for the full contract. A legend beside the chart drops under it when the chart's own box is narrower than 360px. A reference label keeps clear of the marker's line and label, other reference labels and the points near the end of a line: it moves to the other side of its line, or slides left, rather than drawing over them.

Do's

  • Trends over time: revenue by month, approvals by day, a burndown.
  • Part-to-whole over time with stacked areas.
  • A limit, target or budget across a trend, like API calls against the plan limit: referenceLines.
  • Actual values and a forecast in one line: projectedFrom on the series, with a marker at today.

Don'ts

  • Do not use it for categories without an order, like regions. Use BarChart.
  • Do not use it for one share of a total. Use PieChart.
  • Do not fake a limit or target with an extra series. It shows in the legend, the tooltip and the table as data. Use referenceLines.
  • Do not draw a forecast as a second series. Use projectedFrom, so actual and forecast stay one line with one name.
  • Do not use marker for ranges or several moments. It marks one category, like today.
  • Do not draw charts with loose SVG or a chart library. Use the kit charts.
  • Do not use raw hex; pick an intent.
  • Do not fake a changing limit with several flat reference lines. Give the one line its values per category.
<LineChart
  label="Revenue by period"
  title="Revenue by period"
  subtitle="Last 6 months, all accounts"
  categories={months}
  series={revenue}
  area
  showPoints
  showValues
  legendPosition="bottom"
  format="currency"
/>