You are here

function theme_flot_graph in Flot 7

Same name and namespace in other branches
  1. 6 flot.module \theme_flot_graph()

Main flot graphing function

Parameters

$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.

$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.

$options: Options to pass to flot. Optional. See flot's API.txt for more details.

$loader: Allows alterative loading of flot data. If 'FALSE' data will passed directly to an invocation of $.plot(). Otherwise the contents of $loader should be js.

Return value

The placeholder element

2 theme calls to theme_flot_graph()
flot-views-style.tpl.php in flot_views/views/flot-views-style.tpl.php
flot-views-summary-style.tpl.php Template to display a flot summary view.
flot_example_page in flot_example/flot_example.module

File

./flot.module, line 234

Code

function theme_flot_graph($variables) {
  $element = $variables['element'];
  $output = array(
    'graph' => array(
      '#type' => 'container',
      '#attributes' => $element['graph'],
    ),
    'zoom' => array(
      '#type' => 'container',
      '#attributes' => $element['zoom'],
    ),
    'legend' => array(
      '#type' => 'container',
      '#attributes' => $element['legend'],
    ),
  );
  return drupal_render($output);
}