BarsWithLine

<k.BarsWithLine> draws one column as bars and another as a line. Use it for a volume and a rate that belong together: orders as bars, the return rate as a line. The two axes share their zero. When the two are not a count and its rate, separate draws the line in its own plot under the bars.

Example

monthly.sql:

-- Orders and return rate per month
select '2026-01' as month, 410 as orders, 4.2 as return_rate
union all select '2026-02', 455, 3.8
union all select '2026-03', 430, 5.1
union all select '2026-04', 498, 4.6

In report.tsx:

import monthly from "./monthly.sql?raw"

type Row = { month: string; orders: number; return_rate: number }

// in defineReport({ … })
queries: { monthly: query<Row>(monthly) },
blocks: (k) => [
  <k.BarsWithLine
    key="orders"
    series="monthly"
    x="month"
    xFormat="month"
    bar="orders"
    line="return_rate"
    labels={{ orders: "Orders", return_rate: "Return rate" }}
    title="Orders and returns"
    info={{ what: "Orders per month, and the share returned.", sql: ["monthly"] }}
  />,
],

Props

Also key, description, span (default 1) and info: see Props every block takes.

NameTypeRequiredDefaultMeaning
seriesquery nameyesThe query the rows come from
xcolumnyesThe column along the x axis
barcolumnyesThe column drawn as bars
linecolumnyesThe column drawn as a line
titletextyesThe heading
labels{column: label}nothe column namesThe legend's words for bar and line
xFormatmonth, period or weeknoas writtenHow x prints, as on line
metricmetric namenoA named metric's format
tooltip{column: label} or {column: {label, format, decimals}}noExtra rows in the hover
heightheight classnoh-64The chart's height; h-72 for about 25 categories
dashedtrue/falsenofalseThe line is dashed: a projection beside measured bars
lineAxisright or leftnorightleft draws the line on the bars' axis, in the bars' unit
lineFormatpercent or numbernopercentThe line is a rate, or a plain number
legendtrue/falsenotruefalse hides the legend
yDomain[min, max]nofrom zeroThe bars' axis range
lineDomain[min, max]nofrom zeroThe line's axis range
splitcolumnnoSmall multiples: one panel per value, on shared scales
separatetrue/falsenofalseThe line in its own plot under the bars, each captioned by its label
barLabelstrue/falsenofalsePrints each bar's value
lineLabelstrue/falsenofalsePrints each point's value

Checks

A series that is not one of the report's queries, or a column it names that the query's rows do not have, fails the typecheck, as does a missing required prop or a value of the wrong type.