Charts¶
Can I add a chart type the language doesn't have?¶
Yes: type: custom draws a shape from your own SVG template. Many shapes also compose from the built-in ones, and text blocks can carry raw HTML on boards you host yourself. See Chart types and extensibility.
How do I change the chart type?¶
Change type: (bar, line, area, scatter, pie, donut, heatmap, histogram, table, kpi, map, and more). Each type has its own required fields. See Supported Built-In Types.
How do I plot several series on one chart?¶
Add color: naming the column that splits the series. See Multi-Series Line Graph.
How do I plot two measures on one chart?¶
Give y: a list: y: [revenue, units_sold]. Add color: as well when the result is already grouped by a dimension. See Multiple Measures by a Dimension.
How do I make a stacked bar chart?¶
Add color: and set style.stack: zero. Use normalize for 100% stacked and none for grouped side-by-side bars. See Axis, Scale, and Orientation.
How do I make bars horizontal?¶
Set style.orientation: horizontal. Left on auto, categorical x-axes already render horizontally. See Vertical Columns and Horizontal Bars.
How do I sort bars by value?¶
Add sort: with by: a column and order: desc. See Labels and Ranking.
How do I make the bars thinner?¶
Set style.marks.bar.band_width to a fraction of the band, such as 0.4. See Bar Width.
How do I show the value on each bar or point?¶
Set style.marks.bar.labels.visible: true (or marks.line, marks.point). See Value Labels.
How do I label the end of each line instead of using a legend?¶
Multi-series line charts do this by default (style.key.type: auto). To force it on a chart that took a legend instead, set style.key.type: direct. See Endpoint Labels.
How do I hide the legend?¶
Set style.key.visible: false. See Chart Styling.
How do I move the legend?¶
Set style.key.legend.position.edge to top, bottom, left or right; style.key.type: direct names the series on the chart instead of in a legend, and auto (the default) picks between the two per chart. align (start, center, end) places it along that edge, and overlay: true floats it over the plot instead of reserving a strip. See LegendStyle.
How do I limit how many legend entries show?¶
Set style.key.legend.symbol_limit, or pin an explicit list with style.key.legend.values. See Legend.
How do I rename the axis titles?¶
Set x_label: and y_label: on the chart. See Axis Labels, Formatting, and Styling.
How do I rename a column in the legend or tooltip?¶
Set field_labels: on the chart, mapping the column to its display text. See Field Labels.
How do I rotate or skip crowded axis labels?¶
Overlapping labels are skipped and tilted automatically. Force an angle with style.axis_x.labels.angle: -45, or turn the automatic handling off. See Axis Labels.
How do I hide axis labels or gridlines?¶
style.axis_y.labels.visible: false hides labels; style.axis.grid.visible: false hides gridlines. See Other label controls.
How do I set the axis minimum and maximum?¶
Set style.axis_y.scale.continuous.domain: [0, 100]. On a date axis, also set scale.continuous.type: temporal. See Extending the visible range.
How do I stop the y-axis from starting at zero?¶
Set style.axis_y.scale.continuous.zero: false on a line or scatter chart. A bar chart rejects it, because a bar's length is measured from zero, and an area chart warns, because its fill is too; use a line for a zoomed range. See Target and Reference Lines.
How do I use a log scale?¶
Set style.axis_y.scale.continuous.type: log. Values must be strictly positive, and bars do not support it. See Axis Scales.
How do I format numbers as currency or percent?¶
Name the format on the query with formats: (currency, currency_whole, percent, integer, and more) and every chart that shows the column uses it (see Column formats). A chart's own exception goes in its slot: style.axis_y.labels.format on a measure axis, or format: on a KPI or table column. Percent formats expect a 0 to 1 ratio. See Format names and aliases.
How do I change the default currency?¶
Set regional.currency to an ISO code. In charts/meta.yml it changes every board in the folder; in a board it overrides it:
regional: currency: EUR
currency, currency_whole, currency_full and every $ spec then print €, at the locale's placement. A board has one currency; to show a second one, define a style.formats alias with a prefix: or suffix:. See Regional settings.
How do I use European number separators?¶
Set regional.locale.number to a locale name, e.g. fr-FR for 1 234,5, or to a d3 locale definition. The locale's own currency comes with it unless regional.currency says otherwise. regional.locale.time does the same for month and weekday names (de-DE prints Mrz). See Regional settings.
How do I define a number format once and reuse it?¶
Add an alias under style.formats (for example revenue: "$,.0f") and use the alias name in any format: field. See Global Styling.
How do I change how dates show on the axis?¶
Set style.axis_x.time_unit for the grain and style.axis_x.labels.format for the label text. Date columns are detected automatically. See Time Axes.
Why does my line chart skip months with no data?¶
Missing calendar buckets are synthesized automatically; style.axis_x.fill decides whether the gap breaks the line ("null"), reads as zero, or is interpolated. See Gap handling.
How do I smooth a line?¶
Set style.marks.line.curve: monotone. Use step for a step line. See Smoothing and Step Lines.
How do I put bars and a line on the same chart?¶
Add a layers: list to the chart; each layer has its own type: and y:. See Layered Charts.
How do I add a second y-axis?¶
On a layer, set axis_y.position: right. The layer gets its own scale on the right. See Dual Y-Axis.
How do I add a trend line?¶
Compute it in SQL (most warehouses have REGR_SLOPE and REGR_INTERCEPT) and overlay it as a line layer with its own query:. See Trend Lines.
How do I add a target or goal line?¶
There is no field for an arbitrary threshold line yet. Zero baselines and 100% lines are drawn automatically when relevant; for a fixed target, emit the target as a column and overlay it as a line layer. See Target and Reference Lines.
How do I make a pie or donut chart?¶
type: pie (or donut) with theta: for the size column and color: for the slice column. total: puts a grand total in the center of a donut. See Sector Charts.
How do I repeat one chart per region (small multiples)?¶
Add multiples: with rows: or columns: naming the field to split on. See Small Multiples.
How do I make a heatmap?¶
type: heatmap with x:, y:, and color: for the value. See Heatmap.
How do I show a distribution?¶
type: histogram with x:; bins are computed for you. See Histogram.
How do I make a map?¶
type: map for filled regions, point_map for markers, bubble_map for sized markers. See Maps.
How do I show a single big number?¶
type: kpi with value: and label:. The query must return exactly one row. See KPI Charts.
How do I show a change versus last period on a KPI?¶
Compute the delta in the query and put it in the KPI's support: block with a format: like percent_delta, a glyph:, and a tone:. See KpiSupportConfig.
How do I add a note or warning card?¶
type: callout with message: and an optional style.tone of info, positive, negative, or warning. See Callout Charts.
How do I change chart colors?¶
Pick a palette with style.color.categorical.palette (for example vivid-10), or fix one color on the chart's mark (for a bar chart, style.marks.bar.color). See Chart Color Channels and Palettes.
How do I give one category the same color on every chart?¶
Pin it under style.charts.category_colors at the board root, so the value gets the same swatch everywhere. See One value, one color.
How do I color by value (a gradient)?¶
Set color: to a numeric column and add style.color.gradient with a palette and optional min/max. See Gradient scale.
How do I highlight values above a threshold?¶
On a table, add a style.conditional: block keyed by column, with rules like gte: 50000 that set background or font; a KPI takes the same style.conditional: block, with rules that set background, value.font, label.font, support.font or support.tone. See Conditional (threshold).
How do I customize the tooltip?¶
Tooltips show the hovered row's values automatically and follow the measure's format (the query's formats: or the chart's axis_y.labels.format). Their paint (background, font, value format) is set board-wide under style.charts.tooltip. To show more query columns on the card, list them under the chart's tooltip: (a name, or {column, label, format}); see Add columns to the tooltip. See also Hover Tooltips and TooltipStyle.
How do I make a chart clickable (drill down)?¶
Set link: to a URL template; {{ x }}, {{ y }}, and {{ color }} are replaced with the clicked value. A link to /other/board?region={{ x }} drills down to that board filtered to the clicked value; a link to ?region={{ x }} filters the board you are on. See Links and Drill-Downs for the overview and Drill-Down Links for the options.
How do I filter the whole board by clicking a chart (cross-filtering)?¶
Declare a variable, filter your queries on it, and give the chart a link: that starts with ?, for example link: "?region={{ x }}". Every chart whose query reads region updates on the click. See Filter a board by clicking a chart.
How do I open a drill-down in a modal or popup?¶
Use the object form of link: with open: modal or open: preview, or set links.open at the board root. See Open the detail without leaving.
How do I add a title, subtitle, or description to a chart?¶
title: and subtitle: render above the chart. notes: never renders; it is metadata for search and AI tools. See Field Reference.
How do I hide a chart's title?¶
Leave title: out. A chart with no title renders without one.
How do I set a chart's height?¶
Set height: 400 at the chart root, or style.aspect_ratio for a shape. min_height and max_height under style: clamp the automatic height. See Chart Sizing.
Why is my chart blank?¶
Usually the query returned no rows or a named column is missing. Run dct render board.yml --format json --allow-chart-errors to see what the chart received, and dct validate for schema errors. See Chart Not Displaying.
One chart shows an error but the others are fine. Is that expected?¶
Yes. A failing query or data-shape error renders as a red callout in that chart's tile while the rest of the board renders. See Error Handling.