Skip to main content
100%

Stacked Bar Chart with Color Legend

✓ Published4🌍 Public
PPichayut Liamthong
Last edited Sep 23, 2020
Created on Sep 15, 2020
Forked from Hello VizHub

This stacked bar chart displays the number of tourists visiting Thailand per year, aggregated by region, with each bar segment colored according to its regional origin. Built with the vega-lite-api on top of Vega-Lite and Vega, it loads data from a remote CSV file using d3.csv and renders an interactive SVG with a color legend via the `vl.color().fieldN('region')` encoding. The visualization uses a custom config to adjust axis and label styling, a tooltip handler for hover details, and `autosize` fitting to maintain proper dimensions.

AI-generated description

A visualization constructed using the vega-lite-api.

The visualization comes from Data.World : Thai Tourism Data Set. It's designed to emphasize the number of "tourists coming to Thailand" each year, aggregating by the regions. Each stacked bar represented the total number of tourists.

MIT Licensed

Similar vizzes