Sparklines for WordPress
WordPress Plugin to enable inline charts powered by the Spark font by After the flood.
by Nils Persson · github.com/nilspersson/sparklines-for-wordpress · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/nilspersson/sparklines-for-wordpress/archive/refs/heads/master.zipSparklines is a WordPress Plugin to enable inline charts powered by the Spark font by After the Flood.
Installation
Download the ZIP using the green button on this page and go to Plugins > Add New > Upload Plugin in your WordPress admin panel. Upload the ZIP file and you're good to go!
The plugin will soon be available in the official plugin repository. Hopefully. :)
Using the shortcode
The plugin provides you with a [spark] shortcode that takes some input and
generates the appropriate HTML and enqueues the stylesheet.
The basic shortcode format is (with default vaules):
[spark start="123" data="10,20,30,40,50,60,70,80,90,100" end="789" type="bar-medium"]
Available attributes
| Name | Default | Description |
|---|---|---|
start |
123 | The starting point. Will be displayed before the chart. |
data |
10,20,30,40,50,60,70,80,90,100 | Data points to be rendered inside the graph. Anything that isn't a number will be filtered out (strings, spaces etc.). |
end |
789 | The ending point. Will be displayed after the chart. |
type |
bar-medium | Type of chart to be used. See available fonts below. |
Types of charts
The sparkline charts can be displayed in any of the following types:
- Medium Bar (
bar-medium):
- Narrow Bar (
bar-narrow):
- Thin Bar (
bar-thin):
- Medium Dot (
dot-medium):
- Small Dot (
dot-small):
- Medium Line (
line-medium):
Only supports values 0-9.
The font
AtF Spark is a font that allows for the combination of text and visual data to show an idea and evidence in one headline. This builds on the principle of Sparklines defined by Edward Tufte and makes them easier to use. Sparklines are currently available as plugins or javascript elements. By installing the Spark font you can use them immediately without the need for custom code.
The font is maintained by After the flood. Read more about AtF Spark here.