Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Vega-Lite API Bar Chart

Public visualization

Viewing a saved revision (read-only)

ed0ede1d3311440d9a5753e297d652bf

Vega-Lite API Bar Chart

0 stars0🌍 Public
CCaroline Ghisolfi
Last edited Dec 18, 2022
Created on Dec 18, 2022

This bar chart visualizes the top five religions by country, with bars color-coded by religion and a tooltip displaying the religion name for each segment. The example demonstrates the Vega-Lite API for declarative chart construction, using `vl.markBar()` and `vl.encode()` to define marks and channels. It loads CSV data via `d3.csv` and renders with Vega-Lite, compiling to Vega for SVG output. The chart is customized through a config object that adjusts axis styling, font sizes, and colors, while the layout adapts to the window size.

AI-generated description

Bar chart example