Skip to content
OpenChart

Bar list

Show a ranked list of labelled values as compact rows with inline bars, grouped, limited and sized to fit a card or a dense layout.

A bar list is a ranked list where each row is a label, a thin proportional bar and its value. It has no axes, so it takes less room than a bar chart and fits cards and dashboards. It is its own spec type, type: "barlist", with label and value channels instead of x and y.

Use a bar chart instead when the reader needs an axis to read values against.

A basic bar list

Set type to "barlist" and map label and value. The list sorts descending by default. format on the value channel is a d3-format string, and color colors each row by a category.

Python has the largest share of the indexProgramming-language popularity index, % share, 2025PythonPython: 23.423.4JavaJava: 17.117.1JavaScriptJavaScript: 14.914.9C/C++C/C++: 11.211.2C#C#: 8.68.6GoGo: 5.85.8TypeScriptTypeScript: 5.35.3RustRust: 4.14.1PHPPHP: 3.73.7SwiftSwift: 2.62.6KotlinKotlin: 2.12.1RubyRuby: 1.21.2Python has the largest share of the indexProgramming-language popularity index, % share, 2025PythonPython: 23.423.4JavaJava: 17.117.1JavaScriptJavaScript: 14.914.9C/C++C/C++: 11.211.2C#C#: 8.68.6GoGo: 5.85.8TypeScriptTypeScript: 5.35.3RustRust: 4.14.1PHPPHP: 3.73.7SwiftSwift: 2.62.6KotlinKotlin: 2.12.1RubyRuby: 1.21.2
Programming language popularity. Source: TIOBE Index.
{
  "type": "barlist",
  "data": [
    {
      "language": "Python",
      "pct": 23.4,
      "category": "general"
    },
    {
      "language": "Java",
      "pct": 17.1,
      "category": "general"
    },
    {
      "language": "JavaScript",
      "pct": 14.9,
      "category": "web"
    },
    {
      "language": "C/C++",
      "pct": 11.2,
      "category": "systems"
    },
    {
      "language": "C#",
      "pct": 8.6,
      "category": "general"
    },
    {
      "language": "Go",
      "pct": 5.8,
      "category": "systems"
    },
    {
      "language": "TypeScript",
      "pct": 5.3,
      "category": "web"
    },
    {
      "language": "Rust",
      "pct": 4.1,
      "category": "systems"
    },
    {
      "language": "PHP",
      "pct": 3.7,
      "category": "web"
    },
    {
      "language": "Swift",
      "pct": 2.6,
      "category": "mobile"
    },
    {
      "language": "Kotlin",
      "pct": 2.1,
      "category": "mobile"
    },
    {
      "language": "Ruby",
      "pct": 1.2,
      "category": "web"
    }
  ],
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    },
    "color": {
      "field": "category",
      "type": "nominal"
    }
  },
  "chrome": {
    "title": "Python has the largest share of the index",
    "subtitle": "Programming-language popularity index, % share, 2025"
  }
}
import { BarList } from "@opendata-ai/openchart-react";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    },
    "color": {
      "field": "category",
      "type": "nominal"
    }
  },
  "chrome": {
    "title": "Python has the largest share of the index",
    "subtitle": "Programming-language popularity index, % share, 2025"
  }
};

export function Example() {
  return <BarList spec={spec} />;
}
<script setup lang="ts">
import { BarList } from "@opendata-ai/openchart-vue";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    },
    "color": {
      "field": "category",
      "type": "nominal"
    }
  },
  "chrome": {
    "title": "Python has the largest share of the index",
    "subtitle": "Programming-language popularity index, % share, 2025"
  }
};
</script>

<template>
  <BarList :spec="spec" />
</template>
<script lang="ts">
import { BarList } from "@opendata-ai/openchart-svelte";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    },
    "color": {
      "field": "category",
      "type": "nominal"
    }
  },
  "chrome": {
    "title": "Python has the largest share of the index",
    "subtitle": "Programming-language popularity index, % share, 2025"
  }
};
</script>

<BarList {spec} />
import { createBarList } from "@opendata-ai/openchart-vanilla";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    },
    "color": {
      "field": "category",
      "type": "nominal"
    }
  },
  "chrome": {
    "title": "Python has the largest share of the index",
    "subtitle": "Programming-language popularity index, % share, 2025"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createBarList(container, spec);

Grouped rows

encoding.group adds a header for each group, in the order the groups first appear in the data. The rows inside each group are sorted, so the order across the whole list follows the group order, not the values.

Python, JavaScript, C/C++ and Swift lead their categoriesProgramming-language popularity index by category, % share, 2025generalwebsystemsmobilePythonPython: 23.423.4JavaJava: 17.117.1C#C#: 8.68.6JavaScriptJavaScript: 14.914.9TypeScriptTypeScript: 5.35.3PHPPHP: 3.73.7RubyRuby: 1.21.2C/C++C/C++: 11.211.2GoGo: 5.85.8RustRust: 4.14.1SwiftSwift: 2.62.6KotlinKotlin: 2.12.1Python, JavaScript, C/C++ and Swift lead their categoriesProgramming-language popularity index by category, % share, 2025generalwebsystemsmobilePythonPython: 23.423.4JavaJava: 17.117.1C#C#: 8.68.6JavaScriptJavaScript: 14.914.9TypeScriptTypeScript: 5.35.3PHPPHP: 3.73.7RubyRuby: 1.21.2C/C++C/C++: 11.211.2GoGo: 5.85.8RustRust: 4.14.1SwiftSwift: 2.62.6KotlinKotlin: 2.12.1
Languages grouped by category. Source: TIOBE Index.
{
  "type": "barlist",
  "data": [
    {
      "language": "Python",
      "pct": 23.4,
      "category": "general"
    },
    {
      "language": "Java",
      "pct": 17.1,
      "category": "general"
    },
    {
      "language": "JavaScript",
      "pct": 14.9,
      "category": "web"
    },
    {
      "language": "C/C++",
      "pct": 11.2,
      "category": "systems"
    },
    {
      "language": "C#",
      "pct": 8.6,
      "category": "general"
    },
    {
      "language": "Go",
      "pct": 5.8,
      "category": "systems"
    },
    {
      "language": "TypeScript",
      "pct": 5.3,
      "category": "web"
    },
    {
      "language": "Rust",
      "pct": 4.1,
      "category": "systems"
    },
    {
      "language": "PHP",
      "pct": 3.7,
      "category": "web"
    },
    {
      "language": "Swift",
      "pct": 2.6,
      "category": "mobile"
    },
    {
      "language": "Kotlin",
      "pct": 2.1,
      "category": "mobile"
    },
    {
      "language": "Ruby",
      "pct": 1.2,
      "category": "web"
    }
  ],
  "encoding": {
    "group": {
      "field": "category",
      "type": "nominal"
    },
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    }
  },
  "chrome": {
    "title": "Python, JavaScript, C/C++ and Swift lead their categories",
    "subtitle": "Programming-language popularity index by category, % share, 2025"
  }
}
import { BarList } from "@opendata-ai/openchart-react";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "group": {
      "field": "category",
      "type": "nominal"
    },
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    }
  },
  "chrome": {
    "title": "Python, JavaScript, C/C++ and Swift lead their categories",
    "subtitle": "Programming-language popularity index by category, % share, 2025"
  }
};

export function Example() {
  return <BarList spec={spec} />;
}
<script setup lang="ts">
import { BarList } from "@opendata-ai/openchart-vue";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "group": {
      "field": "category",
      "type": "nominal"
    },
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    }
  },
  "chrome": {
    "title": "Python, JavaScript, C/C++ and Swift lead their categories",
    "subtitle": "Programming-language popularity index by category, % share, 2025"
  }
};
</script>

<template>
  <BarList :spec="spec" />
</template>
<script lang="ts">
import { BarList } from "@opendata-ai/openchart-svelte";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "group": {
      "field": "category",
      "type": "nominal"
    },
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    }
  },
  "chrome": {
    "title": "Python, JavaScript, C/C++ and Swift lead their categories",
    "subtitle": "Programming-language popularity index by category, % share, 2025"
  }
};
</script>

<BarList {spec} />
import { createBarList } from "@opendata-ai/openchart-vanilla";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "group": {
      "field": "category",
      "type": "nominal"
    },
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    }
  },
  "chrome": {
    "title": "Python, JavaScript, C/C++ and Swift lead their categories",
    "subtitle": "Programming-language popularity index by category, % share, 2025"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createBarList(container, spec);

A compact list

maxItems limits how many rows show, barHeight sets the bar thickness in pixels and cornerRadius rounds its ends. This one shows six rows with 8px bars and a one-line title, a form that suits a dashboard tile.

Top six languagesPythonPython: 23.423.4JavaJava: 17.117.1JavaScriptJavaScript: 14.914.9C/C++C/C++: 11.211.2C#C#: 8.68.6GoGo: 5.85.8Top six languagesPythonPython: 23.423.4JavaJava: 17.117.1JavaScriptJavaScript: 14.914.9C/C++C/C++: 11.211.2C#C#: 8.68.6GoGo: 5.85.8
A compact top-six list. Source: TIOBE Index.
{
  "type": "barlist",
  "data": [
    {
      "language": "Python",
      "pct": 23.4,
      "category": "general"
    },
    {
      "language": "Java",
      "pct": 17.1,
      "category": "general"
    },
    {
      "language": "JavaScript",
      "pct": 14.9,
      "category": "web"
    },
    {
      "language": "C/C++",
      "pct": 11.2,
      "category": "systems"
    },
    {
      "language": "C#",
      "pct": 8.6,
      "category": "general"
    },
    {
      "language": "Go",
      "pct": 5.8,
      "category": "systems"
    },
    {
      "language": "TypeScript",
      "pct": 5.3,
      "category": "web"
    },
    {
      "language": "Rust",
      "pct": 4.1,
      "category": "systems"
    },
    {
      "language": "PHP",
      "pct": 3.7,
      "category": "web"
    },
    {
      "language": "Swift",
      "pct": 2.6,
      "category": "mobile"
    },
    {
      "language": "Kotlin",
      "pct": 2.1,
      "category": "mobile"
    },
    {
      "language": "Ruby",
      "pct": 1.2,
      "category": "web"
    }
  ],
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    }
  },
  "maxItems": 6,
  "barHeight": 8,
  "cornerRadius": 2,
  "chrome": {
    "title": "Top six languages"
  }
}
import { BarList } from "@opendata-ai/openchart-react";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    }
  },
  "maxItems": 6,
  "barHeight": 8,
  "cornerRadius": 2,
  "chrome": {
    "title": "Top six languages"
  }
};

export function Example() {
  return <BarList spec={spec} />;
}
<script setup lang="ts">
import { BarList } from "@opendata-ai/openchart-vue";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    }
  },
  "maxItems": 6,
  "barHeight": 8,
  "cornerRadius": 2,
  "chrome": {
    "title": "Top six languages"
  }
};
</script>

<template>
  <BarList :spec="spec" />
</template>
<script lang="ts">
import { BarList } from "@opendata-ai/openchart-svelte";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    }
  },
  "maxItems": 6,
  "barHeight": 8,
  "cornerRadius": 2,
  "chrome": {
    "title": "Top six languages"
  }
};
</script>

<BarList {spec} />
import { createBarList } from "@opendata-ai/openchart-vanilla";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative",
      "format": ".1f"
    }
  },
  "maxItems": 6,
  "barHeight": 8,
  "cornerRadius": 2,
  "chrome": {
    "title": "Top six languages"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createBarList(container, spec);

Reference line and label format

annotations takes vertical refline entries in value units. labels formats the printed value with format, prefix and suffix; here it adds a percent sign. The reference line marks the rows that pass a threshold.

Four languages hold more than a tenth of the index eachProgramming-language popularity index, % share, 2025PythonPython: 23.4%23.4%JavaJava: 17.1%17.1%JavaScriptJavaScript: 14.9%14.9%C/C++C/C++: 11.2%11.2%C#C#: 8.6%8.6%GoGo: 5.8%5.8%TypeScriptTypeScript: 5.3%5.3%RustRust: 4.1%4.1%PHPPHP: 3.7%3.7%SwiftSwift: 2.6%2.6%KotlinKotlin: 2.1%2.1%RubyRuby: 1.2%1.2%10% shareFour languages hold more than a tenth of the index eachProgramming-language popularity index, % share, 2025PythonPython: 23.4%23.4%JavaJava: 17.1%17.1%JavaScriptJavaScript: 14.9%14.9%C/C++C/C++: 11.2%11.2%C#C#: 8.6%8.6%GoGo: 5.8%5.8%TypeScriptTypeScript: 5.3%5.3%RustRust: 4.1%4.1%PHPPHP: 3.7%3.7%SwiftSwift: 2.6%2.6%KotlinKotlin: 2.1%2.1%RubyRuby: 1.2%1.2%10% share
A reference line and percent labels. Source: TIOBE Index.
{
  "type": "barlist",
  "data": [
    {
      "language": "Python",
      "pct": 23.4,
      "category": "general"
    },
    {
      "language": "Java",
      "pct": 17.1,
      "category": "general"
    },
    {
      "language": "JavaScript",
      "pct": 14.9,
      "category": "web"
    },
    {
      "language": "C/C++",
      "pct": 11.2,
      "category": "systems"
    },
    {
      "language": "C#",
      "pct": 8.6,
      "category": "general"
    },
    {
      "language": "Go",
      "pct": 5.8,
      "category": "systems"
    },
    {
      "language": "TypeScript",
      "pct": 5.3,
      "category": "web"
    },
    {
      "language": "Rust",
      "pct": 4.1,
      "category": "systems"
    },
    {
      "language": "PHP",
      "pct": 3.7,
      "category": "web"
    },
    {
      "language": "Swift",
      "pct": 2.6,
      "category": "mobile"
    },
    {
      "language": "Kotlin",
      "pct": 2.1,
      "category": "mobile"
    },
    {
      "language": "Ruby",
      "pct": 1.2,
      "category": "web"
    }
  ],
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative"
    }
  },
  "labels": {
    "format": ".1f",
    "suffix": "%"
  },
  "annotations": [
    {
      "type": "refline",
      "x": 10,
      "label": "10% share",
      "style": "dashed"
    }
  ],
  "chrome": {
    "title": "Four languages hold more than a tenth of the index each",
    "subtitle": "Programming-language popularity index, % share, 2025"
  }
}
import { BarList } from "@opendata-ai/openchart-react";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative"
    }
  },
  "labels": {
    "format": ".1f",
    "suffix": "%"
  },
  "annotations": [
    {
      "type": "refline",
      "x": 10,
      "label": "10% share",
      "style": "dashed"
    }
  ],
  "chrome": {
    "title": "Four languages hold more than a tenth of the index each",
    "subtitle": "Programming-language popularity index, % share, 2025"
  }
};

export function Example() {
  return <BarList spec={spec} />;
}
<script setup lang="ts">
import { BarList } from "@opendata-ai/openchart-vue";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative"
    }
  },
  "labels": {
    "format": ".1f",
    "suffix": "%"
  },
  "annotations": [
    {
      "type": "refline",
      "x": 10,
      "label": "10% share",
      "style": "dashed"
    }
  ],
  "chrome": {
    "title": "Four languages hold more than a tenth of the index each",
    "subtitle": "Programming-language popularity index, % share, 2025"
  }
};
</script>

<template>
  <BarList :spec="spec" />
</template>
<script lang="ts">
import { BarList } from "@opendata-ai/openchart-svelte";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative"
    }
  },
  "labels": {
    "format": ".1f",
    "suffix": "%"
  },
  "annotations": [
    {
      "type": "refline",
      "x": 10,
      "label": "10% share",
      "style": "dashed"
    }
  ],
  "chrome": {
    "title": "Four languages hold more than a tenth of the index each",
    "subtitle": "Programming-language popularity index, % share, 2025"
  }
};
</script>

<BarList {spec} />
import { createBarList } from "@opendata-ai/openchart-vanilla";
import type { BarListSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: BarListSpec = {
  data,
  "type": "barlist",
  "encoding": {
    "label": {
      "field": "language",
      "type": "nominal"
    },
    "value": {
      "field": "pct",
      "type": "quantitative"
    }
  },
  "labels": {
    "format": ".1f",
    "suffix": "%"
  },
  "annotations": [
    {
      "type": "refline",
      "x": 10,
      "label": "10% share",
      "style": "dashed"
    }
  ],
  "chrome": {
    "title": "Four languages hold more than a tenth of the index each",
    "subtitle": "Programming-language popularity index, % share, 2025"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createBarList(container, spec);

Fields that matter

Field What it does
type: "barlist" Selects the bar list spec.
encoding.label The row name. Required, type: "nominal".
encoding.value The number that sets bar length. Required, type: "quantitative", with format for the printed value.
encoding.color Colors rows by a category field.
encoding.group Starts a new header for each distinct value.
sort "descending" by default, "ascending", or null to keep the input order.
maxItems The most rows to show. The default is 20.
barHeight, cornerRadius Bar thickness in pixels, and corner rounding in pixels or "pill".
annotations, labels Value reference lines, and format, prefix and suffix for the printed value.