/**
  * Generates a bar chart from the entered data and returns the HTML code to render the graph
  *
  * @param	$input	String	Input between the <pBar> and </pBar> tags or null is the tag is closed (<pBar />)
  * @param	$args	Array	Tag arguments, which are entered like HTML tag attributes; this is an associative 
  *							array indexed by attribute name
  * @param	$parser	Object	The parent parser; more advanced extensions use this to obtain the contextual Title, 
  *							parse wiki text, expand braces, register link relationships and dependencies etc.
  * @returns			String	HTML code to show the bar chart
  */
 public static function render($input, $args, $parser)
 {
     // Recursively parse the wikitext
     $parsedText = $parser->recursiveTagParse($input);
     // Create the chart
     $chart = new pChart4mwBars();
     return $chart->renderChart($parsedText, $args);
 }
Example #2
0
    $data = "";
}
// Create chart object
switch ($type) {
    case "bars":
        $pChart = new pChart4mwBars();
        break;
    case "lines":
        $pChart = new pChart4mwLines();
        break;
    case "radar":
        $pChart = new pChart4mwRadar();
        break;
    case "pie":
        $pChart = new pChart4mwPie();
        break;
    case "scatter":
        $pChart = new pChart4mwScatter();
        break;
    case "bubble":
        $pChart = new pChart4mwBubble();
        break;
    default:
        $pChart = new pChart4mwBars();
        break;
}
// Parse the data and get all arguments into an array
$data = str_replace("|", "\n", $data);
$args = $_REQUEST;
// Show the chart
$pChart->showChart($data, $args);