A small SVG chart library
The problem
Write plain-Python functions that turn data into SVG bar, line and scatter charts with nice ticks, axis labels, direct labels and accessible titles.
Requirements
- Linear scale and nice-tick functions shared by every chart
- Bar, line and scatter functions that return SVG text with axes and labels
- Bars that start at zero, lines that break at missing values, and labels that do not overlap
- A title and aria-label on every chart, and an accessible default palette
Technologies
- Python 3
- SVG
- Scale functions
- Accessible colour
Step by step
- Write and test the scale and tick functions with small examples.
- Build the bar chart, then reuse the scales for the line and scatter charts.
- Add axes, labels, gaps for missing values and label collision handling.
- Open the SVG output in a browser and check it against hand-drawn sketches.
Expected result
A reusable module that produces clean, honest SVG charts from lists of numbers.
How it is evaluated
- Every chart maps data to positions correctly
- Bars start at zero and gaps are shown
- Text has enough contrast and labels never overlap
- Functions are small, documented and tested
Ways to improve it
- Add small multiples with a shared scale
- Add a log-scale option
- Add tooltips with SVG title elements