You are here

function chart_graphs_get_graph in Charts and Graphs 6

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

Parameters

<ChartCanvas> $name:

Return value

<type>

3 calls to chart_graphs_get_graph()
charts_graphs_test in ./charts_graphs.module
For testing and Advanced Help examples.
charts_openflash_data in apis/charts_openflash/charts_openflash.module
_____charts_openflash_data in apis/amcharts/amcharts.module

File

./charts_graphs.module, line 102

Code

function chart_graphs_get_graph($name) {
  $apis = chart_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;
  }
}