Author: Dmitri Popov
Although OpenOffice.org doesn’t provide a dedicated sparkline feature, there are several ways to add sparkline graphics to your documents. For starters, you can manually construct sparklines using OpenOffice.org’s own charting tools.
In your Writer document, place the cursor somewhere in the text where you want the sparkline to appear, choose Insert -> Object -> Chart, and press Create without changing anything. Now select the inserted chart by double-clicking on it (you should see a thick gray border around the chart), then right-click on the chart and select Chart Data. Remove the excessive columns, add rows you need, and enter the desired values in the cells (Figure 1). Select the inserted chart by double-clicking on it, and use the Formatting toolbar to turn off Title, Legend, Axes Titles, and Axes Descriptions. Next, click to select the Y axis, then double-click on it to evoke the Y Axis properties window (this can be a bit tricky, so it may take a couple of attempts to get it right). Under the Line tab in the Line Properties section, set Style to Invisible. Now select the chart bars, right-click on them, select Object Properties, switch to the Area tab and select the desired color (stark solid colors like blue or black work best with sparklines).
Next you have to resize the created sparkline chart and place it in the text. To do this, click on the chart once (you should see green handles around it), right-click on it, and select Object. Specify the Width and Height values.
You can start with something like 3.5cm x 0.5cm and then tweak the values for better results. In the Anchor section, select the As character option, and set the Vertical position to Top/Base Line in the Position section (Figure 2). Press OK to save the settings and close the dialog window. Now place the sparkline chart in the text, and you are done. The final result should look like Figure 3.
This technique works fine if you need to create sparklines every now and then, but it involves too many steps to be practical for use with sparkline-intensive documents. In those cases, you would be better off using a tool that allows you to generate sparklines as images ready to be inserted into your document. There are, in fact, several sparkline generators suitable for the job. BitWorking Sparkline Generator is probably the most sophisticated tool for creating sparklines. It is available both as a Web application and a CGI script which you can deploy on your own server. The main advantage of BitWorking’s generator is the sheer number of available options that allow you to customize virtually any aspect of your sparkline, including type (line or bar), size, data limits, and colors. The generator creates a sparkline on the fly as you type the data or modify settings. Once you’re satisfied with the generated sparkline, download it (on Firefox, right-click on the generated image and choose Save Image As) and insert it into your document.
If you use DokuWiki, you can use the Sparkline plugin, which allows you to kill two birds with one stone: you can use it to generate sparklines for use with your wiki pages as well as your Writer documents. The provided instructions help you to install and configure the sparkline plugin, but if you don’t fancy doing this manually, I’ve created a packaged version of the plugin for your convenience. Download the archive, unzip it, and move the resulting sparkline folder into the lib/plugins directory of your DokuWiki installation. To add a sparkline to your wiki page, add:
replacing the value strings with actual data. You can then save the generated sparkline and insert it into your Writer document as described above.
Dmitri Popov is a freelance writer whose articles have appeared in Russian, British, German, and Danish computer magazines.