You are here

function charts_graphs_get_graph in Charts and Graphs 6.2

Same name and namespace in other branches
  1. 7.2 charts_graphs.module \charts_graphs_get_graph()
  2. 7 charts_graphs.module \charts_graphs_get_graph()

Factory method that allows instantiating of a charting implementation class by implementation name.

Parameters

<ChartsGraphsCanvas> $name:

Return value

<type>

2 calls to charts_graphs_get_graph()
charts_graphs_open_flash_data in apis/charts_graphs_open_flash/charts_graphs_open_flash.module
Adds chart data as JSON.
charts_graphs_test in ./charts_graphs.module
For testing and Advanced Help examples.

File

./charts_graphs.module, line 195

Code

function charts_graphs_get_graph($name) {
  $apis = charts_graphs_apis();
  $api = $apis[$name];
  if (!empty($api) && is_object($api)) {
    require_once $api->path;
    $canvas = new $api->clazz($api->modulename);
    return $canvas;
  }
  else {
    return FALSE;
  }
}