Skip to main content
100%

Vega-Lite API Template for bar chart

✓ Published1🌍 Public
RRuanzhenglin
Last edited Apr 15, 2021
Created on Apr 15, 2021

This example renders a bar chart of country populations using the Vega-Lite API, with data loaded from a CSV via D3’s `csv` function. The chart shows population counts per country, sorted descending, using `vl.markBar()` and encoding fields for country and population. The code integrates Vega-Lite with D3 v6, configures axis styling and tooltips via Vega Tooltip, and resizes the visualization to fit the window. The data originates from the UCI Auto MPG dataset, though the actual values shown come from a population-by-country gist.

AI-generated description

A visualization constructed using the vega-lite-api.

The data shown here comes from the UCI Machine Learning Repository: Auto MPG Data Set, via Gist: Scatter Plot with Menus.

MIT Licensed

Similar vizzes