public function FrxSVGGraph::validSeries in Forena Reports 8
Same name in this branch
- 8 src/FrxPlugin/Template/FrxSVGGraph.php \Drupal\forena\Template\FrxSVGGraph::validSeries()
- 8 src/FrxPlugin/Renderer/FrxSVGGraph.php \Drupal\forena\FrxPlugin\Renderer\FrxSVGGraph::validSeries()
Checks wheter we have a valid series.
Return value
bool TRUE indicates the series if valid.
1 call to FrxSVGGraph::validSeries()
- FrxSVGGraph::render in src/
FrxPlugin/ Renderer/ FrxSVGGraph.php - Render the graph.
File
- src/
FrxPlugin/ Renderer/ FrxSVGGraph.php, line 343 - FrxSVGGraph php SVG Graph generator
Class
- FrxSVGGraph
- SVG Graphing Renderer
Namespace
Drupal\forena\FrxPlugin\RendererCode
public function validSeries() {
$valid = TRUE;
$removed = array();
if (isset($this->graphOptions['structure']['value'])) {
foreach ($this->graphOptions['structure']['value'] as $k => $series) {
if (!isset($this->counts[$series])) {
// remove empty series.
unset($this->graphOptions['structure']['value'][$k]);
$removed[] = $k;
}
}
if ($removed) {
$this->graphOptions['structure']['value'] = array_values($this->graphOptions['structure']['value']);
foreach ($this->graphOptions as $option => $data) {
if (is_array($data)) {
$modified = FALSE;
foreach ($removed as $k) {
if (isset($data[$k])) {
unset($this->graphOptions[$option][$k]);
$modified = TRUE;
}
}
if ($modified) {
$this->graphOptions[$option] = array_values($this->graphOptions[$option]);
}
}
}
if (!$this->graphOptions['structure']['value']) {
$valid = FALSE;
}
}
}
return $valid;
}