Skip to content

Chart Types

Dataface renders most charts through Vega-Lite, but authored chart YAML uses a typed Dataface surface. Choose one of the supported built-in chart types, use top-level Dataface fields such as x, y, color, theta, value, and href. Arbitrary Vega-Lite spec, mark, encoding, config, transform, params, and composition blocks are rejected on the authored surface.


Bar Chart

Best for: Comparing values across categories

source: examples_db
charts:
  bar_example:
    query:
      sql: |
        SELECT date, SUM(revenue) AS revenue FROM ecommerce_orders GROUP BY date ORDER BY date
    type: bar
    title: Daily Revenue
    x: date
    y: revenue
rows:
  - bar_example
1Jan'248152229010k20k30kDaily Revenue Data as of 16:49 UTC on 5 Aug 2026 made with dataface
Field Required Description
x Yes Category field
y Yes Value field
color No Group by color

Horizontal Bar Chart

Use style.orientation: horizontal for horizontal bars - great for long category labels or ranked lists. When sort: is omitted, horizontal bars rank by the value field descending so the largest bar appears at the top.

source: examples_db
charts:
  horizontal_bar_example:
    query:
      sql: |
        SELECT product, category, SUM(revenue) AS revenue, SUM(units_sold) AS units_sold FROM ecommerce_orders GROUP BY product, category ORDER BY revenue DESC
    type: bar
    title: Revenue by Product
    x: product
    y: revenue
    style:
      orientation: horizontal
rows:
  - horizontal_bar_example
05k10k15k20k25k30k35k40k45k50k55k60k65k70k75k80kWidget BGadget YWidget AGadget XWidget CTool ZTool AGadget ZRevenue by Product Data as of 16:49 UTC on 5 Aug 2026 made with dataface
Style field Value Description
style.orientation horizontal Swaps x/y axes for horizontal bars

Add sort: when a horizontal bar needs a different category order.


Line Graph

Best for: Trends over time

source: examples_db
charts:
  line_example:
    query:
      sql: |
        SELECT date, product, SUM(revenue) AS revenue, SUM(units_sold) AS units_sold FROM ecommerce_orders GROUP BY date, product ORDER BY date, product
    type: line
    title: Revenue Trend
    x: date
    y: revenue
    color: product
rows:
  - line_example
1 Jan20242 Jan3 Jan4 Jan5 Jan6 Jan7 Jan8 Jan9 Jan10 Jan11 Jan12 Jan13 Jan14 Jan15 Jan16 Jan17 Jan18 Jan19 Jan20 Jan21 Jan22 Jan23 Jan24 Jan25 Jan26 Jan27 Jan28 Jan29 Jan30 Jan05k10kRevenue TrendWidget ATool ZGadget XWidget CWidget BGadget ZGadget YTool A Data as of 16:49 UTC on 5 Aug 2026 made with dataface
Field Required Description
x Yes Time/category field
y Yes Value field
color No Series grouping

Area Chart

Best for: Stacked trends, showing composition over time

source: examples_db
charts:
  area_example:
    query:
      sql: |
        SELECT date, category, SUM(revenue) AS revenue, SUM(units_sold) AS units_sold FROM ecommerce_orders GROUP BY date, category ORDER BY date, category
    type: area
    title: Revenue by Category
    x: date
    y: revenue
    color: category
rows:
  - area_example
1 Jan20242 Jan3 Jan4 Jan5 Jan6 Jan7 Jan8 Jan9 Jan10 Jan11 Jan12 Jan13 Jan14 Jan15 Jan16 Jan17 Jan18 Jan19 Jan20 Jan21 Jan22 Jan23 Jan24 Jan25 Jan26 Jan27 Jan28 Jan29 Jan30 Jan05k10k15k20kRevenue by CategoryElectronicsAccessoriesTools Data as of 16:49 UTC on 5 Aug 2026 made with dataface
Field Required Description
x Yes Time/category field
y Yes Value field
color No Stack grouping

Scatter Plot

Best for: Relationships between two metrics

source: examples_db
charts:
  scatter_example:
    query:
      sql: |
        SELECT * FROM ecommerce_orders
    type: scatter
    title: Revenue vs Units
    x: units_sold
    y: revenue
    color: category
rows:
  - scatter_example
0102030405060708090100110120130140Units Sold02k4kRevenueAccessoriesElectronicsToolsCategoryRevenue vs Units Data as of 16:49 UTC on 5 Aug 2026 made with dataface
Field Required Description
x Yes First metric
y Yes Second metric
color No Category grouping
size No Bubble size

Pie Charts

Best for: Part-to-whole relationships, proportions

source: examples_db
queries:
  sales_by_category:
    sql: |
      SELECT category, SUM(revenue) AS revenue, SUM(units_sold) AS units_sold FROM ecommerce_orders GROUP BY category ORDER BY revenue DESC
charts:
  pie_example:
    query: sales_by_category
    type: pie
    title: Revenue by Category
    theta: revenue
    color: category
  donut_example:
    query: sales_by_category
    type: donut
    title: Units by Category
    theta: units_sold
    color: category
cols:
  - pie_example
  - donut_example
45% Electronics197,19934% Accessories152,50421% Tools93,320Revenue by Category14.8kTotal Units Sold48% Electronics7,15133% Accessories4,90119% Tools2,797Units by Category Data as of 16:49 UTC on 5 Aug 2026 made with dataface
Field Required Description
theta Yes Numeric value field (angle encoding)
color No Category field
style.inner_radius No Inner radius ratio (hole/outer disk, 0–1). Use type: donut as a shorthand (sets 0.6 by default).

KPI Display

Best for: Single metric highlights, key numbers

source: examples_db
queries:
  sales_summary:
    sql: |
      SELECT SUM(revenue) AS revenue, SUM(units_sold) AS units_sold, COUNT(DISTINCT category) AS category_count FROM ecommerce_orders
charts:
  revenue_kpi:
    query: sales_summary
    type: kpi
    label: Total Revenue
    value: revenue
  units_kpi:
    query: sales_summary
    type: kpi
    label: Units Sold
    value: units_sold
cols:
  - revenue_kpi
  - units_kpi
440k Total Revenue 15k Units Sold Data as of 16:49 UTC on 5 Aug 2026 made with dataface
Field Required Description
value Yes Column reference (string column name) for the headline number or text
label No Text rendered above the headline value (KPI uses label: instead of title:)
support No Trailing line with the same shape: { value, label, format, glyph, tone }
format No Number format. Defaults to compact narrative notation (1.50mn); override notation: analytic for the dense register
style.glyph.character No Glyph character (e.g. , ) rendered ahead of the value
style.tone No Semantic color — positive / negative / warning

KPI charts require a query that returns exactly 1 row (e.g. SELECT SUM(revenue) as revenue). For status-style KPIs displaying a fixed string, use an inline values query with rows::

query:
  rows:
    - status: "On track"
value: status

Table

Best for: Detailed data view, exact values

source: examples_db
charts:
  table_example:
    query:
      sql: |
        SELECT * FROM ecommerce_orders
    type: table
    title: Sales Data
rows:
  - table_example
Sales DataDateRegionProductCategoryRevenueUnits Sold26 Jan 2024EastWidget AElectronics1.5K5014 Jan 2024EastGadget YAccessories3K10013 Jan 2024NorthWidget BElectronics1.46K5210 Jan 2024EastWidget CElectronics1.25K5023 Jan 2024EastWidget AElectronics2.16K7229 Jan 2024EastWidget AElectronics3.6K12029 Jan 2024EastGadget YAccessories1.89K6319 Jan 2024SouthWidget BElectronics1.4K5016 Jan 2024EastGadget XAccessories2.24K665 Jan 2024SouthWidget BElectronics6162213 Jan 2024NorthGadget YAccessories2.01K675 Jan 2024EastWidget CElectronics3.2K12825 Jan 2024NorthWidget AElectronics1.26K4220 Jan 2024WestWidget AElectronics1.05K3530 Jan 2024EastGadget XAccessories2.07K6126 Jan 2024SouthWidget AElectronics1.53K519 Jan 2024WestGadget XAccessories1.22K3626 Jan 2024WestTool ZTools1.79K5623 Jan 2024WestWidget BElectronics5321911 Jan 2024SouthWidget CElectronics3.05K122 1 2 12 Data as of 16:49 UTC on 5 Aug 2026 made with dataface

Tables automatically format numbers, convert snake_case headers to Title Case, and show a "more rows" indicator when data is truncated.


  • Line Graphs - Detailed line-graph surface and Vega-Lite mapping
  • Sector Charts - Detailed pie and donut surface and Vega-Lite mapping
  • Maps - Choropleth, point, and bubble maps for geographic data
  • More Chart Types - Heatmaps, histograms, and all Vega-Lite marks
  • Charts Overview - Field reference and styling
  • Interactions - Hover tooltips and link: click-through links