/** * Draw Legend, if required by the user on the desired position * * This is a special method for pie charts. The legend for pie charts uses a * different datastructure. We can use the special drawPieLegend method of * the pChart class, but we cannot retrieve the size of that legend for * positioning. For that reason, the structure is changed */ public function drawLegend() { $args = $this->chartArgs; // Backup the original datadescription structure $original = $this->pDataDescription; $this->pDataDescription = $this->pieLegendDataDescription; // Draw the legend parent::drawLegend(); // Put the original datadescription back into place $this->pDataDescription = $original; }
/** * Returns the default properties for radar graphs * * @returns Array Associative array with default properties. */ public function getDefaultArgs() { $args = parent::getDefaultArgs(); // Set radar-specific default arguments $args["filled"] = false; $args["striped"] = false; $args["stripecolor"] = array(200, 200, 200); $args["opacity"] = 50; // Check whether the user has set defaults in the LocalSettings.php file $name = "wgPChart4mw" . ucfirst($this->type) . "Defaults"; if (array_key_exists($name, $GLOBALS)) { $args = $this->parseArgs($GLOBALS[$name], $args); } return $args; }
/** * Renders the chart as a parser function * * @param String Class name to render the chart * @param 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. * @return String HTML output with the chart */ public static function renderParserFunction() { // If no className and parser is given, return false if (func_num_args() < 2) { return false; } $className = func_get_arg(0); $parser = func_get_arg(1); // Walk through all other parameters $data = ''; $args = array(); for ($i = 2; $i < func_num_args(); $i++) { list($key, $value) = pChart4mw::parseParserFunctionArguments(func_get_arg($i)); if ($key == 'data') { $data = $value; } else { $args[$key] = $value; } } // Call the base method and return the HTML code. The parameters noparse and isHTML are set // because otherwise the returned code is not handled as HTML code. See http://www.mediawiki.org/wiki/Manual:Parser_functions return array(call_user_func(array($className, 'render'), $data, $args, $parser), 'noparse' => true, 'isHTML' => true); }