mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
#11326 added new property in chartjs
This commit is contained in:
parent
247bcc1cf5
commit
e88a33d984
@ -984,19 +984,31 @@ function get_build_setup_charts($type, $options, $data)
|
|||||||
) {
|
) {
|
||||||
$scales = $chart->options()->getScales();
|
$scales = $chart->options()->getScales();
|
||||||
|
|
||||||
// Defaults scalesFont X.
|
if ($options['scales']['x'] !== false) {
|
||||||
$scalesXFonts = $scales->getX()->ticks()->getFonts();
|
// Defaults scalesFont X.
|
||||||
$scalesXFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
|
$scalesXFonts = $scales->getX()->ticks()->getFonts();
|
||||||
$scalesXFonts->setStyle('normal');
|
$scalesXFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
|
||||||
$scalesXFonts->setWeight(600);
|
$scalesXFonts->setStyle('normal');
|
||||||
$scalesXFonts->setSize(((int) $config['font_size'] + 2));
|
$scalesXFonts->setWeight(600);
|
||||||
|
$scalesXFonts->setSize(((int) $config['font_size'] + 2));
|
||||||
|
}
|
||||||
|
|
||||||
// Defaults scalesFont Y.
|
if ($options['scales']['y'] !== false) {
|
||||||
$scalesYFonts = $scales->getY()->ticks()->getFonts();
|
// Defaults scalesFont Y.
|
||||||
$scalesYFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
|
$scalesYFonts = $scales->getY()->ticks()->getFonts();
|
||||||
$scalesYFonts->setStyle('normal');
|
$scalesYFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
|
||||||
$scalesYFonts->setWeight(600);
|
$scalesYFonts->setStyle('normal');
|
||||||
$scalesYFonts->setSize(((int) $config['font_size'] + 2));
|
$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
|
if (isset($options['scales']['x']) === true
|
||||||
&& empty($options['scales']['x']) === false
|
&& 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.
|
// Color.
|
||||||
@ -1145,11 +1185,8 @@ function get_build_setup_charts($type, $options, $data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'RADAR':
|
case 'RADAR':
|
||||||
$chart->labels()->exchangeArray($options['labels']);
|
|
||||||
|
|
||||||
foreach ($data as $key => $dataset) {
|
foreach ($data as $key => $dataset) {
|
||||||
$dataSet1 = $chart->createDataSet();
|
$dataSet1 = $chart->createDataSet();
|
||||||
$dataSet1->setLabel($dataset['label']);
|
|
||||||
$dataSet1->setBackgroundColor($dataset['backgroundColor']);
|
$dataSet1->setBackgroundColor($dataset['backgroundColor']);
|
||||||
$dataSet1->setBorderColor($dataset['borderColor']);
|
$dataSet1->setBorderColor($dataset['borderColor']);
|
||||||
$dataSet1->setPointBackgroundColor($dataset['pointBackgroundColor']);
|
$dataSet1->setPointBackgroundColor($dataset['pointBackgroundColor']);
|
||||||
|
@ -5,6 +5,7 @@ namespace Artica\PHPChartJS\Options;
|
|||||||
use Artica\PHPChartJS\ArraySerializableInterface;
|
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||||
use Artica\PHPChartJS\Delegate\ArraySerializable;
|
use Artica\PHPChartJS\Delegate\ArraySerializable;
|
||||||
use Artica\PHPChartJS\Options\Scales\GridLines;
|
use Artica\PHPChartJS\Options\Scales\GridLines;
|
||||||
|
use Artica\PHPChartJS\Options\Scales\PointLabels;
|
||||||
use Artica\PHPChartJS\Options\Scales\ScaleLabel;
|
use Artica\PHPChartJS\Options\Scales\ScaleLabel;
|
||||||
use Artica\PHPChartJS\Options\Scales\Ticks;
|
use Artica\PHPChartJS\Options\Scales\Ticks;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
@ -138,6 +139,11 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable
|
|||||||
*/
|
*/
|
||||||
protected $ticks;
|
protected $ticks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PointLabels
|
||||||
|
*/
|
||||||
|
protected $pointLabels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -619,6 +625,31 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable
|
|||||||
return $this->ticks;
|
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
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -8,6 +8,8 @@ use Artica\PHPChartJS\Options\Scales\XAxis;
|
|||||||
use Artica\PHPChartJS\Options\Scales\XAxisCollection;
|
use Artica\PHPChartJS\Options\Scales\XAxisCollection;
|
||||||
use Artica\PHPChartJS\Options\Scales\YAxis;
|
use Artica\PHPChartJS\Options\Scales\YAxis;
|
||||||
use Artica\PHPChartJS\Options\Scales\YAxisCollection;
|
use Artica\PHPChartJS\Options\Scales\YAxisCollection;
|
||||||
|
use Artica\PHPChartJS\Options\Scales\RAxis;
|
||||||
|
use Artica\PHPChartJS\Options\Scales\RAxisCollection;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,6 +30,11 @@ class Scales implements ArraySerializableInterface, JsonSerializable
|
|||||||
*/
|
*/
|
||||||
private $y;
|
private $y;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var RAxisCollection
|
||||||
|
*/
|
||||||
|
private $r;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return XAxis
|
* @return XAxis
|
||||||
*/
|
*/
|
||||||
@ -44,6 +51,14 @@ class Scales implements ArraySerializableInterface, JsonSerializable
|
|||||||
return new YAxis();
|
return new YAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return RAxis
|
||||||
|
*/
|
||||||
|
public function createR()
|
||||||
|
{
|
||||||
|
return new RAxis();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return XAxis
|
* @return XAxis
|
||||||
*/
|
*/
|
||||||
@ -68,6 +83,18 @@ class Scales implements ArraySerializableInterface, JsonSerializable
|
|||||||
return $this->y;
|
return $this->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return RAxis
|
||||||
|
*/
|
||||||
|
public function getR()
|
||||||
|
{
|
||||||
|
if (is_null($this->r)) {
|
||||||
|
$this->r = new RAxis();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->r;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
263
pandora_console/vendor/artica/phpchartjs/src/Options/Scales/PointLabels.php
vendored
Normal file
263
pandora_console/vendor/artica/phpchartjs/src/Options/Scales/PointLabels.php
vendored
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Artica\PHPChartJS\Options\Scales;
|
||||||
|
|
||||||
|
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||||
|
use Artica\PHPChartJS\Delegate\ArraySerializable;
|
||||||
|
use JsonSerializable;
|
||||||
|
use Artica\PHPChartJS\Options\Fonts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Pointlabels
|
||||||
|
*
|
||||||
|
* @package Artica\PHPChartJS\Options\Scales
|
||||||
|
*/
|
||||||
|
class Pointlabels implements ArraySerializableInterface, JsonSerializable
|
||||||
|
{
|
||||||
|
use ArraySerializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $backdropColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $backdropPadding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $borderRadius;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $display;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Fonts
|
||||||
|
*/
|
||||||
|
private $font;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $padding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $centerPointLabels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value of backdropColor
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getBackdropColor()
|
||||||
|
{
|
||||||
|
return $this->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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
14
pandora_console/vendor/artica/phpchartjs/src/Options/Scales/RAxis.php
vendored
Normal file
14
pandora_console/vendor/artica/phpchartjs/src/Options/Scales/RAxis.php
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Artica\PHPChartJS\Options\Scales;
|
||||||
|
|
||||||
|
use Artica\PHPChartJS\Options\Scale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RAxis
|
||||||
|
*
|
||||||
|
* @package Artica\PHPChartJS\Options\Scales
|
||||||
|
*/
|
||||||
|
class RAxis extends Scale
|
||||||
|
{
|
||||||
|
}
|
37
pandora_console/vendor/artica/phpchartjs/src/Options/Scales/RAxisCollection.php
vendored
Normal file
37
pandora_console/vendor/artica/phpchartjs/src/Options/Scales/RAxisCollection.php
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Artica\PHPChartJS\Options\Scales;
|
||||||
|
|
||||||
|
use Halfpastfour\Collection\Collection\ArrayAccess;
|
||||||
|
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||||
|
use JsonSerializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RAxisCollection
|
||||||
|
*
|
||||||
|
* @package Artica\PHPChartJS\Collection
|
||||||
|
*/
|
||||||
|
class RAxisCollection extends ArrayAccess implements ArraySerializableInterface, JsonSerializable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getArrayCopy()
|
||||||
|
{
|
||||||
|
$rows = [];
|
||||||
|
foreach ($this->data as $row) {
|
||||||
|
/** @var RAxis $row */
|
||||||
|
$rows[] = $row->getArrayCopy();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function jsonSerialize()
|
||||||
|
{
|
||||||
|
return $this->getArrayCopy();
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user