Vega-Lite API Template
This example demonstrates a bar chart of presidential election totals by candidate, with bars sorted in descending order and tooltips showing the total votes for each candidate. The visualization uses the Vega-Lite API to declaratively define the chart specification, while D3’s `csv` loader fetches the dataset from a Gist, and the UCI Auto MPG data source is referenced. The code registers Vega and Vega-Lite libraries, applies a custom configuration for axis and label styling, and renders the output as a full-screen, responsive SVG using the `vega-lite-api` `render()` method.
AI-generated descriptionA 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.