[KongchangAI]
· 2 min read· 1,229 words

Datasette-charts-pie Plugin Released: New Options for Pie and Sunburst Charts

Datasette-charts-pie Plugin Released: New Options for Pie and Sunburst Charts

Author builds a pie chart plugin for Datasette to test the plugin system's ability to extend chart types.

Simon Willison released the datasette-charts-pie 0.1a0 plugin, adding pie, donut, sunburst, and rose charts to Datasette. Although he personally dislikes pie and donut charts and thus excluded them from datasette-charts, he implemented them himself to validate the flexibility of Datasette's plugin system for adding new chart types. The plugin includes Datasette Lite live demos where users can configure and share charts via URL parameters. The article also discusses when pie charts are appropriate and their limitations, and notes that the plugin is a practical sample for learning Datasette plugin development. The current version is an early alpha, suitable for trying out and providing feedback.

Simon Willison has released datasette-charts-pie 0.1a0, a plugin that adds four new chart types to the Datasette data exploration tool: pie charts, donut charts, sunburst charts, and rose charts. Interestingly, the author himself dislikes pie and donut charts—which is exactly why they were excluded from datasette-charts in the first place. But to test the plugin system's ability to add new chart types, he implemented these charts himself. This release not only enriches Datasette's visualization options but also demonstrates the flexibility of its plugin architecture.

rss source: datasette-charts-pie 0.1a0

Why Did the Author Build This Plugin Despite Hating Pie Charts?

According to the author's release notes, he "doesn't like pie and donut charts," which is why he deliberately omitted them when developing datasette-charts. Criticism of pie charts in the visualization field has a long history: the human eye is far less precise at judging angles than at judging lengths, and pie charts can easily cause misinterpretation when comparing multiple categories. However, Datasette's plugin system allows third parties to extend chart types, and the author needed a real-world case to verify whether this mechanism was flexible enough. Thus datasette-charts-pie was born—it serves both as a feature addition and as an architectural stress test.

This approach of "building a feature to validate the architecture" is not uncommon in open source projects, and it often exposes the real usability of the underlying design.

The controversy surrounding pie charts in data visualization stems from the characteristics of human visual perception. Research shows that the human eye judges linear lengths far more accurately than angles or areas, so bar charts are usually more accurate when comparing values. Pie charts encode values as sector angles; when there are many categories or values are close, the angular differences between adjacent sectors are hard to distinguish with the naked eye, easily leading to misinterpretation. In addition, pie charts lack a common baseline, making cross-category comparison inconvenient. For these reasons, many visualization guidelines recommend prioritizing bar charts or dot plots. However, pie charts have an intuitive advantage when showing "part-to-whole" relationships, especially when there are no more than five categories and the differences are significant, so they remain widely used. The author's aversion to pie charts reflects a common stance in the professional visualization community, but the needs of plugin development prompted him to re-examine this tool.

Four Chart Types and Live Demos

The plugin offers four visualization forms, each targeting different data relationships:

  • Pie: Classic proportion display, with support for limiting the number of categories and grouping the remainder as "Other."
  • Donut: Leaves a central area on top of the pie chart, which can display a total value.
  • Sunburst: Supports two-level categorization (e.g., author and repository), showing proportions within a hierarchical structure.
  • Rose: Also known as the Nightingale rose chart, it encodes values by radius rather than angle, making it suitable for periodic data.

The author provides four live demos in Datasette Lite, using datasets such as PyPI package licenses, download statistics, and release records. These demos configure charts directly via URL parameters, so users can experience them in the browser without installing anything.

The sunburst chart is a ring-shaped chart for displaying hierarchical data, using concentric rings to represent different levels, with the inner ring as the parent category and the outer ring as its subcategories. The angle of each sector corresponds to its value proportion, and colors are usually used to distinguish different branches. Sunburst charts are suitable for exploring data with a hierarchical structure, such as authors and repositories, or countries and cities, and can intuitively present the composition at each level. The rose chart, also known as the Nightingale rose chart, was invented by Florence Nightingale to show causes of battlefield casualties. It encodes values as the radius of sectors rather than the angle, with all sectors having equal angles, making it more suitable for showing periodic or inter-category differences, but radius encoding is likewise less precise than length encoding. These two chart types expand the application scenarios of the pie chart family, but they also inherit the perceptual limitations of angle or area encoding.

How Does the Plugin Extend Datasette's Charting Capabilities?

datasette-charts itself is a chart rendering plugin for Datasette, and datasette-charts-pie serves as its supplement, registering new chart types through the plugin mechanism. As can be seen from the demo links, chart configuration is passed through JSON-like URL parameters, including the type, encoding mappings (fields corresponding to x/y axes), and options (such as whether labels show percentages, whether to merge small categories, etc.). This design makes charts entirely data-driven, and configurations can be shared and reproduced.

For developers, this plugin is a practical sample for learning Datasette plugin development: it has a small codebase but fully covers chart type registration, option parsing, and the rendering flow.

Datasette is an open source tool for exploring and publishing data, developed by Simon Willison and based on Python and SQLite. It allows users to browse databases through a web interface, execute SQL queries, and share results as JSON or HTML. One of Datasette's core designs is its plugin system, through which developers can extend functionality by registering hooks, such as adding new output formats, customizing pages, or integrating visualization components. The datasette-charts plugin uses this mechanism to render charts, and datasette-charts-pie further registers new chart types. This plugin architecture allows features to be layered modularly while keeping the core lightweight. Datasette Lite is the WebAssembly version of Datasette, running entirely in the browser without a server, making it easy to share interactive data demos.

When Should You Use (or Not Use) Pie Charts?

Although the author added pie charts, the visualization community's controversy over them has not disappeared. Pie charts are suitable for showing part-to-whole relationships, especially when there are few categories (e.g., no more than five) and the differences are obvious; once categories increase or values are close, readability drops sharply. Donut charts retain proportional expression while allowing the central area to carry additional information, which counts as an improvement. Sunburst and rose charts are suited to hierarchical data and periodic data respectively, expanding the use cases of the pie chart family.

If you are using Datasette to explore data, this plugin provides a way to quickly generate the above charts; but if you have reservations about pie charts themselves, the author's attitude may resonate—the existence of a tool does not mean it must be used, and understanding its limitations is what matters.

The plugin is currently at version 0.1a0, an early alpha release suitable for trying out and providing feedback.

One-line Summary

The author developed a pie chart plugin for Datasette to test the plugin system's ability to extend chart types.

Paragraph Summary

Simon Willison released the datasette-charts-pie 0.1a0 plugin, adding four new chart types to Datasette: pie, donut, sunburst, and rose charts. Although the author personally dislikes pie and donut charts and therefore did not include them in datasette-charts, he implemented these charts himself to verify the flexibility of Datasette's plugin system for adding new chart types. The plugin provides live demos in Datasette Lite, and users can configure and share charts via URL parameters. The article also discusses the applicable scenarios and limitations of pie charts and notes that the plugin is a practical sample for learning Datasette plugin development. The current version is an early alpha, suitable for trying out and providing feedback.

#Datasette#datasette-charts-pie#pie chart#sunburst chart#plugin architecture#data visualization
Share:

Related articles