public function parseGlobalOptions(stdClass $a_options) { $a_options->grid = new stdClass(); $a_options->grid->hoverable = false; $a_options->grid->clickable = false; $a_options->grid->ticks = $this->getYAxisMax(); $a_options->grid->tickColor = ilChart::renderColor("#000", "0.1"); $a_options->grid->mode = "spider"; }
public function parseGlobalOptions(stdClass $a_options, ilChart $a_chart) { $spider = new stdClass(); $spider->active = true; $spider->highlight = new stdClass(); $spider->highlight->mode = "line"; $spider->legs = new stdClass(); $spider->legs->fillStyle = ilChart::renderColor("#000", "0.7"); switch (count($a_chart->getLegLabels())) { case 4: case 6: $spider->legs->legStartAngle = 10; break; default: $spider->legs->legStartAngle = 0; break; } $spider->legs->data = array(); $max_str_len = 0; foreach ($a_chart->getLegLabels() as $l) { $l = ilUtil::shortenText($l, 80, true); $label = new stdClass(); $label->label = $l; $spider->legs->data[] = $label; $max_str_len = max($max_str_len, strlen($l)); } // depending on caption length if ($max_str_len > 60) { $font_size = 10; } else { if ($max_str_len > 30) { $font_size = 12; } else { $font_size = 15; } } $spider->legs->font = $font_size . "px Arial"; $spider->spiderSize = 0.7; $spider->lineWidth = 1; $spider->pointSize = 0; $spider->connection = new StdClass(); $spider->connection->width = 2; $spider->legMin = 1.0E-7; $spider->legMax = $a_chart->getYAxisMax(); $a_options->series->spider = $spider; }
/** * Convert (global) properties to flot config * * @param object $a_options */ public function parseOptions(stdClass $a_options) { $a_options->show = true; $a_options->noColumns = $this->getColumns(); $a_options->position = $this->getPosition(); $margin = $this->getMargin(); $a_options->margin = array($margin["x"], $margin["y"]); $a_options->backgroundColor = ilChart::renderColor($this->getBackground()); $a_options->backgroundOpacity = str_replace(",", ".", $this->getOpacity()); $a_options->labelBoxBorderColor = ilChart::renderColor($this->getLabelBorder()); $container = $this->getContainer(); if ($container) { $a_options->container = '#' . $container; } }
/** * Convert data to flot config * * @param array $a_data * @return object */ public function parseData(array &$a_data) { $series = new stdClass(); $series->label = str_replace("\"", "\\\"", $this->getLabel()); $series->data = array(); foreach ($this->getData() as $point) { $series->data[] = array($point[0], $point[1]); } $options = array("show" => $this->isHidden() ? false : true); $fill = $this->getFill(); if ($fill["fill"]) { $options["fill"] = $fill["fill"]; if ($fill["color"]) { $options["fillColor"] = ilChart::renderColor($fill["color"], $fill["fill"]); } } $this->parseDataOptions($options); $series->{$this->getTypeString()} = $options; $a_data[] = $series; }
public function parseGlobalOptions(stdClass $a_options, ilChart $a_chart) { $a_options->series->pie = new stdClass(); $a_options->series->pie->show = true; // fill vs. stroke - trying to normalize data attributes $fill = $this->getFill(); $width = $this->getLineWidth(); if ($fill["fill"] || $width) { $a_options->series->pie->stroke = new stdClass(); if ($width) { $a_options->series->pie->stroke->width = $width; } if ($fill["color"]) { $a_options->series->pie->stroke->color = ilChart::renderColor($fill["color"], $fill["fill"]); } } $radius = $this->getLabelRadius(); if ($radius) { $a_options->series->pie->label = new stdClass(); $a_options->series->pie->label->background = new stdClass(); $a_options->series->pie->radius = 1; $a_options->series->pie->label->radius = $radius; $a_options->series->pie->label->show = true; $a_options->series->pie->label->background->color = "#444"; $a_options->series->pie->label->background->opacity = 0.8; } }