You are here

function FrxSVGGraph::renderChart in Forena Reports 8

1 call to FrxSVGGraph::renderChart()
FrxSVGGraph::render in src/FrxPlugin/Renderer/FrxSVGGraph.php
Render the graph.

File

src/FrxPlugin/Renderer/FrxSVGGraph.php, line 316
FrxSVGGraph php SVG Graph generator

Class

FrxSVGGraph
SVG Graphing Renderer

Namespace

Drupal\forena\FrxPlugin\Renderer

Code

function renderChart($type) {
  $type = strtolower($type);

  // Legacy sustitions for backcward compatibility.
  if ($type == 'piechart') {
    $type = 'piegraph';
  }
  if ($type == 'scatterplot') {
    $type = 'scattergraph';
  }
  if ($type == 'multiscatterplot') {
    $type = 'multiscattergraph';
  }

  // Newly defined types
  $graph_types = FrxSVGGraph::graphTypes();

  // Build map for array types.
  $lower_graphs_types = array_change_key_case($graph_types);
  $graph_classes = array_combine(array_keys($lower_graphs_types), array_keys($graph_types));
  if (isset($graph_classes[$type])) {
    $class = $graph_classes[$type];
    $output = $this
      ->renderGraph($class);
  }
  return $output;
}