You are here

function theme_feedapi_stat_sparkline in FeedAPI 6

Helper for creating a sparkline graph.

1 theme call to theme_feedapi_stat_sparkline()
theme_feedapi_stat in feedapi_stat/feedapi_stat.module
Theme stats. Accepts result of feedapi_stat_get().

File

feedapi_stat/feedapi_stat.module, line 102
Visualize standard FeedAPI statistics logs.

Code

function theme_feedapi_stat_sparkline($data, $width = 70, $height = 15) {
  if (empty($data)) {
    return '';
  }
  $elements = sparkline_elements();
  $element = $elements['sparkline_bar'];
  $element['#width'] = $width;
  $element['#height'] = $height;
  $element['#bar_width'] = 1;
  $element['#bar_gap'] = 0;
  $element['#negative_color'] = 'grey';
  $element['#positive_color'] = 'grey';
  $element['#data'] = $data;
  $element['#max'] = max($data) + max($data) * 0.2;
  $element['#style'] = 'bar';
  return theme('sparkline', $element);
}