Skip to content

Multi-line chart ​

Multi-series line chart for comparing several time series or trends.

line-multi plots two or more series on shared axes so readers can see divergence, convergence, and ranking shifts over an ordered domain. See Properties for every key it accepts.

When to use ​

  • Comparing trends across 2–4 series on the same scale
  • Showing divergence or convergence between groups over time
  • Highlighting one key series against grey "context" lines

When NOT to use ​

  • More than 5–6 series — the chart becomes a spaghetti tangle
  • Series with very different scales (avoid dual axes; consider small multiples instead)
  • Composition over time, where readers need to see how parts add up (use area-stacked)

Example ​

bpc
chart line-multi {
  title = "Germany stagnated while the US and China bounced back"
  description = "Annual percentage change in real GDP"
  source = "IMF World Economic Outlook"
  sourceUrl = "https://imf.org"
  colorPalette = "SolLeWitt"
  legend = false
  tooltips = true

  data {
    series = "United States","China","Germany"
    "2018" = 2.9,6.7,1.0
    "2019" = 2.3,6.0,1.1
    "2020" = -2.8,2.2,-3.7
    "2021" = 5.9,8.4,3.2
    "2022" = 2.1,3.0,1.8
    "2023" = 2.5,5.2,-0.1
    "2024" = 2.8,5.0,-0.2
  }
}

Properties ​

Every property line-multi accepts, beside the frame and layout keys every chart shares. Anything absent from this table is rejected by validateChart and ignored by the renderer.

PropertyTypeDefault
colorscolors(unset)
colorPaletteselect, see PalettesBlueprint
autoContrastbooleanfalse
allowDarkModebooleantrue
interpolationselect: linear, monotoneX, step, stepBefore, stepAfter, basis, cardinal, catmullRommonotoneX
edgePaddingbooleanfalse
sortModeselect: none, total, within-groupsnone
legendbooleanfalse
legendAnchorselect: start, middle, endstart
legendPositionselect: top, bottom, left, righttop
directLabellingselect: "", auto, outside, insideauto
showVerticalAxisbooleanfalse
verticalAxisDirectionselect: left, rightleft
showVerticalTicksbooleanfalse
verticalLabelPositionselect: auto, inside, outside, offauto
verticalGridStyleselect: solid, dashed, dotted, nonedashed
verticalNumberFormatnumberFormat(unset)
verticalScaleTypeselect: linear, loglinear
verticalRangeMintext(unset)
verticalRangeMaxtext(unset)
showHorizontalAxisbooleantrue
showHorizontalTicksbooleanfalse
horizontalLabelPositionselect: auto, inside, outside, offauto
horizontalLabelRotationselect: auto, horizontal, verticalhorizontal
horizontalGridStyleselect: solid, dashed, dotted, nonenone
horizontalNumberFormatnumberFormat(unset)
horizontalRangeMintext(unset)
horizontalRangeMaxtext(unset)
valueLabelsbooleanfalse
tooltipsbooleanfalse
crosshairbooleantrue
crosshairDirectionselect: both, vertical, horizontalvertical
crosshairStyleselect: solid, dashed, dotteddashed
crosshairColortext#999
lineSymbolsbooleantrue
lineSymbolShapeselect: circle, square, diamond, triangle, triangleDown, cross, starcircle
lineSymbolShowOnselect: firstLast, first, last, allfirstLast
lineSymbolStyleselect: filled, hollowfilled
lineSymbolSizetext3.5
lineSymbolOpacitytext1

Common pitfalls ​

  • Five or more lines crossing each other defeats the chart — either highlight one and grey the rest, or split into small multiples
  • Two y-axes with different scales imply a correlation that may not exist
  • Inconsistent colour assignment between charts in the same story confuses readers
  • line — when you only need a single series
  • area-stacked — when the running total across series matters
  • bar-grouped — when the x-axis is categorical, not continuous

See also ​

Released under the MIT License. Built static-first — your data never leaves the page.