Your IP : 216.73.216.240
<?php
/*
* @package Tech Fry Library
* @license https://www.gnu.org/licenses/gpl-3.0.en.html
*/
namespace TechFry\Library\View\Others;
defined('_JEXEC') or die;
// Reference: https://quickchart.io/documentation/graphviz-api/
class Graphviz
{
public $format; // Output format
public $type; // graph, digraph
public $statements;
public function __construct()
{
$this->type = 'digraph';
}
public function display()
{
$content = '';
foreach ($this->statements as $statement)
{
$content .= $statement . ';';
}
$url = 'https://quickchart.io/graphviz?graph=' . $this->type . '{' . $content . '}';
$output = '<img src="' . $url . '">';
return $output;
}
public function add_statement($statement)
{
$this->statements[] = $statement;
}
public static function get_output($content, $config = array())
{
// content
if (empty($content))
{
return;
}
$url = 'https://quickchart.io/graphviz?graph=digraph{' . $content . '}';
$output = '<img src="' . $url . '">';
return $output;
}
}