You are here

function FrxSVGGraph::renderChart in Forena Reports 7.5

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

File

src/Renderer/FrxSVGGraph.php, line 413
FrxSVGGraph php SVG Graph generator

Class

FrxSVGGraph

Namespace

Drupal\forena\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;
}