You are here

function theme_d3_graphapi in d3.js 7

Displays the visualization for graphapi's selected library.

File

./d3.module, line 567
D3 module file for creating visualizations with d3.js.

Code

function theme_d3_graphapi($vars) {
  if (empty($vars['graph'])) {
    return '';
  }
  $default_library = variable_get('d3_graphapi_default_library', 'forcedirected');
  $library = empty($vars['config']['library']) ? $default_library : $vars['config']['library'];
  $graph = _d3_graphapi_format_graph_data($vars['graph']);
  $chart = array(
    'id' => $vars['config']['id'],
    'type' => $library,
    'links' => $graph['links'],
    'nodes' => $graph['nodes'],
    'config' => $vars['config'],
  );
  return d3_draw($chart);
}