array( 'arguments' => array('element' => array(), 'data' => array(), 'options' => array()), ), ); } /** * Main flot graphing function * * @param $element * An associative array to define a placeholder element. If an 'id' is * omitted one will be generated, If no 'style' is specified and width and * height style will be added. In short you can just pass an empty array and * everything will still work. This argument is essentially optional and has * been kept as the first argument to remain consistant with flots own api. * @param $data * The data series for the graph. Optional. See flot's API.txt for more * details. This module defines the flotData class which can be used or * extended to make generating data objects simpler. * @param $options * Options to pass to flot. Optional. See flot's API.txt for more details. * @param $direct * NOT IMPLEMENTED! * Boolean, whether data should be passed directly to an invocation of * $.plot(). Defaults to true. Setting this to false allows usage of * custom scripts to post data to the graph. * * @return * The placeholder element */ function theme_flot_graph($element, $data = array(), $options = array(), $direct = true) { static $n; if (!isset($element['id'])) { $n++; $element['id'] = 'flot-auto-identfier-'. $n; } if (!isset($element['style'])) { $element['style'] = "width:100%;height:200px"; } flot_add_js(); if (count($data)) { if ($direct) { $data = 'if (Drupal.jsEnabled) { $(document).ready(function() { Drupal.flot.'.str_replace('-', '_', $element['id']).' = $.plot($("#'.$element['id'].'"), '. drupal_to_js($data). ', '. drupal_to_js($options) .'); }); }'; drupal_add_js($data, 'inline'); } else { // TODO Add the data series, options, and element information to the Drupal object or DOM } } return '