You are here

function theme_radioactivity_history in Radioactivity 7.2

Theme callback

2 theme calls to theme_radioactivity_history()
radioactivity_field_formatter_view in ./radioactivity.field.inc
Implements hook_field_formatter_view()
radioactivity_field_widget_form in ./radioactivity.field.inc
Implement hook_field_widget().

File

./radioactivity.module, line 59
Radioactivity core functionality

Code

function theme_radioactivity_history($vars) {
  drupal_add_js(drupal_get_path('module', 'radioactivity') . '/js/jquery.sparkline.min.js');
  drupal_add_js(drupal_get_path('module', 'radioactivity') . '/js/radioactivity-history.js');
  drupal_add_css(drupal_get_path('module', 'radioactivity') . '/css/radioactivity.css');
  $data = array(
    'values' => array(),
    'tooltips' => array(),
    'cutoff' => $vars['cutoff'],
    'tooltipFormat' => '<span style="color:{{color}}">&#9679;</span> {{value}} | {{offset:tooltips}}',
  );
  foreach ($vars['dataset'] as $time => $value) {
    $data['values'][] = round($value, 2);
    $data['tooltips'][] = format_date($time, 'short');
  }
  return '<div class="radioactivity-history">' . drupal_json_encode($data) . '</div>';
}