Graflume · Alpha

Bar · Basic implementation · Common features

Compare categorical magnitudes with bars sharing a common baseline. Start with only the required data and family encoding. Expand the code to run the same example. Use the tabs to compare header, tooltip, theme, legend, highlight, callout, selection, view controls, and accessibility one feature at a time.

Chart family · Default families

Bar

Compare categorical magnitudes with bars sharing a common baseline.

Quick API
bar()
Browser snapshot
graflume
mark
bar
Presets
9

Basic implementation

The smallest runnable chart

Start with only the required data and family encoding. Expand the code to run the same example.

Basic example

Compare categorical magnitudes with bars sharing a common baseline.

StatusLoading

  • minimal-implementation
Graflume.horizontalBar() Canvas 2D
Control help

Zoom and pan inspect the rendered surface without changing data axes or values. When playback controls are available, they move through real steps in the order each unique value first appears in the source data.

Use Tab to reach a control and Enter or Space to activate it. With the chart focused, use plus and minus to zoom and arrow keys to pan.

Auto placement compares perimeter candidates and avoids the plot, legend, and other callouts when possible. Explicit placement is preserved with only necessary safety correction. Callout text wraps safely inside the bubble. Long unbroken tokens are visually shortened within the line budget, while the complete source text remains available to assistive technology.

Loading

Browser API · Portable schema

Browser API

Graflume.horizontalBar()

const data = [
  {
    "category": "Insights",
    "high": 91,
    "low": 81,
    "previous": 74,
    "target": 88,
    "value": 86,
    "width": 24
  },
  {
    "category": "Dashboards",
    "high": 84,
    "low": 72,
    "previous": 69,
    "target": 82,
    "value": 78,
    "width": 21
  },
  {
    "category": "Reports",
    "high": 76,
    "low": 63,
    "previous": 65,
    "target": 74,
    "value": 69,
    "width": 18
  },
  {
    "category": "Alerts",
    "high": 68,
    "low": 55,
    "previous": 48,
    "target": 66,
    "value": 61,
    "width": 15
  },
  {
    "category": "Models",
    "high": 56,
    "low": 42,
    "previous": 41,
    "target": 55,
    "value": 48,
    "width": 12
  },
  {
    "category": "Exports",
    "high": 45,
    "low": 31,
    "previous": 34,
    "target": 44,
    "value": 37,
    "width": 10
  }
];

const options = {
  "height": 620,
  "locale": "en",
  "mark": {
    "orientation": "horizontal"
  },
  "width": "container",
  "x": {
    "field": "value",
    "title": "Adoption (%)",
    "type": "quantitative"
  },
  "y": {
    "field": "category",
    "title": "Capability",
    "type": "ordinal"
  }
};

Graflume.horizontalBar('#chart', data, options);

Portable schema

ChartSpec 0.1 · options

{
  "height": 620,
  "locale": "en",
  "mark": {
    "orientation": "horizontal"
  },
  "width": "container",
  "x": {
    "field": "value",
    "title": "Adoption (%)",
    "type": "quantitative"
  },
  "y": {
    "field": "category",
    "title": "Capability",
    "type": "ordinal"
  }
}

Common features

Features shared by every chart

Use the tabs to compare header, tooltip, theme, legend, highlight, callout, selection, view controls, and accessibility one feature at a time. Hover over a data mark. On supported charts, move the pointer along the axis to see the nearest value. All exact values are available in the table below.

Header

Add a chart title and supporting description inside the visualization.

StatusLoading

  • header
Graflume.horizontalBar() Canvas 2D
Control help

Zoom and pan inspect the rendered surface without changing data axes or values. When playback controls are available, they move through real steps in the order each unique value first appears in the source data.

Use Tab to reach a control and Enter or Space to activate it. With the chart focused, use plus and minus to zoom and arrow keys to pan.

Auto placement compares perimeter candidates and avoids the plot, legend, and other callouts when possible. Explicit placement is preserved with only necessary safety correction. Callout text wraps safely inside the bubble. Long unbroken tokens are visually shortened within the line budget, while the complete source text remains available to assistive technology.

Loading

Browser API · Portable schema

Browser API

Graflume.horizontalBar()

const data = [
  {
    "category": "Insights",
    "high": 91,
    "low": 81,
    "previous": 74,
    "target": 88,
    "value": 86,
    "width": 24
  },
  {
    "category": "Dashboards",
    "high": 84,
    "low": 72,
    "previous": 69,
    "target": 82,
    "value": 78,
    "width": 21
  },
  {
    "category": "Reports",
    "high": 76,
    "low": 63,
    "previous": 65,
    "target": 74,
    "value": 69,
    "width": 18
  },
  {
    "category": "Alerts",
    "high": 68,
    "low": 55,
    "previous": 48,
    "target": 66,
    "value": 61,
    "width": 15
  },
  {
    "category": "Models",
    "high": 56,
    "low": 42,
    "previous": 41,
    "target": 55,
    "value": 48,
    "width": 12
  },
  {
    "category": "Exports",
    "high": 45,
    "low": 31,
    "previous": 34,
    "target": 44,
    "value": 37,
    "width": 10
  }
];

const options = {
  "height": 620,
  "locale": "en",
  "mark": {
    "orientation": "horizontal"
  },
  "title": {
    "subtitle": "Bar chart uses runnable data and options to demonstrate horizontal and vertical bars; automatic total and segment labels.",
    "text": "Bar"
  },
  "width": "container",
  "x": {
    "field": "value",
    "title": "Adoption (%)",
    "type": "quantitative"
  },
  "y": {
    "field": "category",
    "title": "Capability",
    "type": "ordinal"
  }
};

Graflume.horizontalBar('#chart', data, options);

Portable schema

ChartSpec 0.1 · options

{
  "height": 620,
  "locale": "en",
  "mark": {
    "orientation": "horizontal"
  },
  "title": {
    "subtitle": "Bar chart uses runnable data and options to demonstrate horizontal and vertical bars; automatic total and segment labels.",
    "text": "Bar"
  },
  "width": "container",
  "x": {
    "field": "value",
    "title": "Adoption (%)",
    "type": "quantitative"
  },
  "y": {
    "field": "category",
    "title": "Capability",
    "type": "ordinal"
  }
}