Experimental project

This is a sandbox project, which contains experimental code for developer use only.

There are already some drupal modules available for generating sparklines, eg sparkline generator and filter and Views Sparkline.

As both modules are not available for drupal 7, I wanted to write my own sparklines module using the jQuery Sparklines plugin.

This module provides a new theme function. This function requires the data you want to represent as sparklines and some options.

Examples

//$page is a render array. The examples are snippets from a bigger array
$sparkline_data = array(7,3,5,9,12);
//default line spark lines in a span element
$page['line_sparklines'] = array(
		'#theme' => 'sparklines',	
		'#values' => $sparkline_data,
);
//example where type of spark lines are changed and the wrapping element is a div
$page['bar_sparklines'] = array(
		'#theme' => 'sparklines',	
		'#values' => $sparkline_data,
		'#type' => 'bar',
		'#prefix' => '<div>',
		'#suffix' => '</div>',
	);

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • Created by pieterjd on , updated