diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 24dc535ba3..38b3e3e51a 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -984,19 +984,31 @@ function get_build_setup_charts($type, $options, $data) ) { $scales = $chart->options()->getScales(); - // Defaults scalesFont X. - $scalesXFonts = $scales->getX()->ticks()->getFonts(); - $scalesXFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']); - $scalesXFonts->setStyle('normal'); - $scalesXFonts->setWeight(600); - $scalesXFonts->setSize(((int) $config['font_size'] + 2)); + if ($options['scales']['x'] !== false) { + // Defaults scalesFont X. + $scalesXFonts = $scales->getX()->ticks()->getFonts(); + $scalesXFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']); + $scalesXFonts->setStyle('normal'); + $scalesXFonts->setWeight(600); + $scalesXFonts->setSize(((int) $config['font_size'] + 2)); + } - // Defaults scalesFont Y. - $scalesYFonts = $scales->getY()->ticks()->getFonts(); - $scalesYFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']); - $scalesYFonts->setStyle('normal'); - $scalesYFonts->setWeight(600); - $scalesYFonts->setSize(((int) $config['font_size'] + 2)); + if ($options['scales']['y'] !== false) { + // Defaults scalesFont Y. + $scalesYFonts = $scales->getY()->ticks()->getFonts(); + $scalesYFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']); + $scalesYFonts->setStyle('normal'); + $scalesYFonts->setWeight(600); + $scalesYFonts->setSize(((int) $config['font_size'] + 2)); + } + + if ($options['scales']['r'] !== false) { + // Defaults scalesFont R. + $scalesRFonts = $scales->getR()->pointLabels()->getFonts(); + $scalesRFonts->setStyle('normal'); + $scalesRFonts->setWeight(600); + $scalesRFonts->setSize(((int) $config['font_size'] + 2)); + } if (isset($options['scales']['x']) === true && empty($options['scales']['x']) === false @@ -1087,6 +1099,34 @@ function get_build_setup_charts($type, $options, $data) } } } + + if (isset($options['scales']['r']) === true + && empty($options['scales']['r']) === false + && is_array($options['scales']['r']) === true + ) { + if (isset($options['scales']['r']['pointLabels']) === true + && empty($options['scales']['r']['pointLabels']) === false + && is_array($options['scales']['r']['pointLabels']) === true + ) { + if (isset($options['scales']['r']['pointLabels']['fonts']) === true + && empty($options['scales']['r']['pointLabels']['fonts']) === false + && is_array($options['scales']['r']['pointLabels']['fonts']) === true + ) { + $scaleRpointLabelsFonts = $scales->getR()->pointLabels()->getFonts(); + if (isset($options['scales']['r']['pointLabels']['fonts']['size']) === true) { + $scaleRpointLabelsFonts->setSize($options['scales']['r']['pointLabels']['fonts']['size']); + } + + if (isset($options['scales']['r']['pointLabels']['fonts']['style']) === true) { + $scaleRpointLabelsFonts->setStyle($options['scales']['r']['pointLabels']['fonts']['style']); + } + + if (isset($options['scales']['r']['pointLabels']['fonts']['weight']) === true) { + $scaleRpointLabelsFonts->setWeight($options['scales']['r']['pointLabels']['fonts']['weight']); + } + } + } + } } // Color. @@ -1145,11 +1185,8 @@ function get_build_setup_charts($type, $options, $data) break; case 'RADAR': - $chart->labels()->exchangeArray($options['labels']); - foreach ($data as $key => $dataset) { $dataSet1 = $chart->createDataSet(); - $dataSet1->setLabel($dataset['label']); $dataSet1->setBackgroundColor($dataset['backgroundColor']); $dataSet1->setBorderColor($dataset['borderColor']); $dataSet1->setPointBackgroundColor($dataset['pointBackgroundColor']); diff --git a/pandora_console/vendor/artica/phpchartjs/src/Options/Scale.php b/pandora_console/vendor/artica/phpchartjs/src/Options/Scale.php index da79f68a01..d34eec4826 100644 --- a/pandora_console/vendor/artica/phpchartjs/src/Options/Scale.php +++ b/pandora_console/vendor/artica/phpchartjs/src/Options/Scale.php @@ -5,6 +5,7 @@ namespace Artica\PHPChartJS\Options; use Artica\PHPChartJS\ArraySerializableInterface; use Artica\PHPChartJS\Delegate\ArraySerializable; use Artica\PHPChartJS\Options\Scales\GridLines; +use Artica\PHPChartJS\Options\Scales\PointLabels; use Artica\PHPChartJS\Options\Scales\ScaleLabel; use Artica\PHPChartJS\Options\Scales\Ticks; use JsonSerializable; @@ -138,6 +139,11 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable */ protected $ticks; + /** + * @var PointLabels + */ + protected $pointLabels; + /** * @return string */ @@ -619,6 +625,31 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable return $this->ticks; } + + /** + * + * @return PointLabels + */ + public function getPointLabels() + { + return $this->pointLabels; + } + + /** + * + * @param PointLabels $pointLabels + * + * @return self + */ + public function pointLabels() + { + if (is_null($this->pointLabels)) { + $this->pointLabels = new PointLabels(); + } + + return $this->pointLabels; + } + /** * @return array */ diff --git a/pandora_console/vendor/artica/phpchartjs/src/Options/Scales.php b/pandora_console/vendor/artica/phpchartjs/src/Options/Scales.php index 167b43e111..9b1073e704 100644 --- a/pandora_console/vendor/artica/phpchartjs/src/Options/Scales.php +++ b/pandora_console/vendor/artica/phpchartjs/src/Options/Scales.php @@ -8,6 +8,8 @@ use Artica\PHPChartJS\Options\Scales\XAxis; use Artica\PHPChartJS\Options\Scales\XAxisCollection; use Artica\PHPChartJS\Options\Scales\YAxis; use Artica\PHPChartJS\Options\Scales\YAxisCollection; +use Artica\PHPChartJS\Options\Scales\RAxis; +use Artica\PHPChartJS\Options\Scales\RAxisCollection; use JsonSerializable; /** @@ -28,6 +30,11 @@ class Scales implements ArraySerializableInterface, JsonSerializable */ private $y; + /** + * @var RAxisCollection + */ + private $r; + /** * @return XAxis */ @@ -44,6 +51,14 @@ class Scales implements ArraySerializableInterface, JsonSerializable return new YAxis(); } + /** + * @return RAxis + */ + public function createR() + { + return new RAxis(); + } + /** * @return XAxis */ @@ -68,6 +83,18 @@ class Scales implements ArraySerializableInterface, JsonSerializable return $this->y; } + /** + * @return RAxis + */ + public function getR() + { + if (is_null($this->r)) { + $this->r = new RAxis(); + } + + return $this->r; + } + /** * @return array */ diff --git a/pandora_console/vendor/artica/phpchartjs/src/Options/Scales/PointLabels.php b/pandora_console/vendor/artica/phpchartjs/src/Options/Scales/PointLabels.php new file mode 100644 index 0000000000..b439c8a0b3 --- /dev/null +++ b/pandora_console/vendor/artica/phpchartjs/src/Options/Scales/PointLabels.php @@ -0,0 +1,263 @@ +backdropColor; + } + + /** + * Set the value of backdropColor + * + * @param string $backdropColor + * + * @return self + */ + public function setBackdropColor(string $backdropColor) + { + $this->backdropColor = $backdropColor; + + return $this; + } + + /** + * Get the value of backdropPadding + * + * @return int + */ + public function getBackdropPadding() + { + return $this->backdropPadding; + } + + /** + * Set the value of backdropPadding + * + * @param int $backdropPadding + * + * @return self + */ + public function setBackdropPadding(int $backdropPadding) + { + $this->backdropPadding = $backdropPadding; + + return $this; + } + + /** + * Get the value of borderRadius + * + * @return int + */ + public function getBorderRadius() + { + return $this->borderRadius; + } + + /** + * Set the value of borderRadius + * + * @param int $borderRadius + * + * @return self + */ + public function setBorderRadius(int $borderRadius) + { + $this->borderRadius = $borderRadius; + + return $this; + } + + /** + * Get the value of display + * + * @return string + */ + public function getDisplay() + { + return $this->display; + } + + /** + * Set the value of display + * + * @param string $display + * + * @return self + */ + public function setDisplay(string $display) + { + $this->display = $display; + + return $this; + } + + /** + * Get the value of color + * + * @return string + */ + public function getColor() + { + return $this->color; + } + + /** + * Set the value of color + * + * @param string $color + * + * @return self + */ + public function setColor(string $color) + { + $this->color = $color; + + return $this; + } + + /** + * Get the value of font + * + * @return string + */ + public function getFonts() + { + if (isset($this->font) === false) { + $this->font = new Fonts(); + } + + return $this->font; + } + + /** + * Set the value of font + * + * @param string $font + * + * @return self + */ + public function setFonts(string $font) + { + $this->font = $font; + + return $this; + } + + /** + * Get the value of padding + * + * @return int + */ + public function getPadding() + { + return $this->padding; + } + + /** + * Set the value of padding + * + * @param int $padding + * + * @return self + */ + public function setPadding(int $padding) + { + $this->padding = $padding; + + return $this; + } + + /** + * Get the value of centerPointLabels + * + * @return bool + */ + public function getCenterPointLabels() + { + return $this->centerPointLabels; + } + + /** + * Set the value of centerPointLabels + * + * @param bool $centerPointLabels + * + * @return self + */ + public function setCenterPointLabels(bool $centerPointLabels) + { + $this->centerPointLabels = $centerPointLabels; + + return $this; + } + + /** + * @return array + */ + public function jsonSerialize() + { + return $this->getArrayCopy(); + } + +} diff --git a/pandora_console/vendor/artica/phpchartjs/src/Options/Scales/RAxis.php b/pandora_console/vendor/artica/phpchartjs/src/Options/Scales/RAxis.php new file mode 100644 index 0000000000..fd2ce9082a --- /dev/null +++ b/pandora_console/vendor/artica/phpchartjs/src/Options/Scales/RAxis.php @@ -0,0 +1,14 @@ +data as $row) { + /** @var RAxis $row */ + $rows[] = $row->getArrayCopy(); + } + + return $rows; + } + + /** + * @return array + */ + public function jsonSerialize() + { + return $this->getArrayCopy(); + } +}