Data Visualization
Chart a CSV file in your browser: bar, line, scatter and share charts drawn as plain SVG, with no charting library.
Upload a CSV file, or use one of the samples, and chart it four ways. The charts are drawn as plain SVG. There is no charting library: the parser, the axis arithmetic and the layout are written out.
What it does
- Reads your file in the browser. Nothing is uploaded. Comma, semicolon and tab delimiters are detected, and each column is typed as a number or as text.
- Four charts. Bars for comparing amounts, lines for change along a sequence, a scatter plot for two measures against each other, and ranked bars for each row's share of a total.
- You choose the columns. Which column labels the rows, which columns are plotted, and which two a scatter plot compares.
- Values on demand. Point at the chart, or focus it and use the arrow keys, to read the values for one row. The full data is also in a table under the chart.
Parsing
The parser is a small state machine, not a call to split. That lets it handle what real exports contain:
- quoted fields with the delimiter inside them, such as
"Sydney, NSW" - doubled quotes inside a quoted field
- line breaks inside a quoted field
- Windows line endings and a byte-order mark
A column is numeric only if every cell with a value in it is a number. An empty cell in a numeric column is kept as missing, not turned into zero: a line chart breaks at it instead of dipping to the axis. A row with the wrong number of columns stops the import with a message naming the row.
Axes
Tick values are chosen to be round: 1, 2 or 5 times a power of ten. The same function handles a range that crosses zero, a range entirely below one, and a column where every value is the same.
Bars are measured from zero, so a negative value hangs below the baseline. Lines scale to their own range.
Long files
Up to 20,000 rows are read. A line chart cannot draw more points than it has pixels, so each series is thinned to roughly one low and one high point per pixel column. Keeping both extremes means a single spike in a long series is still drawn.
A bar chart shows as many rows as there is room for and says how many it left out. A scatter plot samples evenly past 3,000 points.
Why "share" is not a pie
A pie chart makes close values hard to compare, and it needs a different colour for every slice. Ranked bars with the percentage written beside each one answer the same question and stay readable with ten rows. Rows past the tenth are folded into "Other".
Colour
The series colours come from a palette checked for separation under the common forms of colour blindness, against both the light and the dark background. Up to six series are shown at once; past that, colours stop being distinguishable. Text is never set in a series colour: a swatch beside the name carries the identity.
Limitations
- No zooming or panning.
- Dates are treated as text labels, not placed on a time scale.
- One table at a time.
SVG · CSV parsing · Scales · Accessibility