Skip to main content

Sparkline Charts

According to wikipedia, a sparkline is a very small line chart, typically drawn without axes or coordinates. Sparklines are best suitable to display them in data tables as they are small enough to fit within a table row and they provide trend of some metric for each item displayed in the table for relative comparision.

SQL Frames provides the ability to create sparkline charts. It ensures that the x-axis and y-axis ranges are normalized across all the rows (and columns for pivot tables) so that the relative comparison is accurate.

Sparklines in datatables

Sparklines can be created using the array fields of DataFrames. The elements of the array fields are themselves either arrays or objects each containing a time component and a value component. If the element is an array, these components are referred using the index in the array. If the element is an object, the components are referred using their name as shown below.

Sparklines are displayed using the cell renderers which are created using fmt.sparkline API.


Multiple sparklines

It is possible to display multiple sparklines in each row.


Sparklines in pivot tables

It is also possible to display sparklines in the pivot tables.