phpchartjs pandora_enterprise#9554

This commit is contained in:
daniel 2022-12-21 12:33:53 +01:00
parent 872b079b20
commit 1dee676d5b
8 changed files with 65 additions and 144 deletions

View File

@ -551,11 +551,11 @@
}, },
{ {
"name": "artica/phpchartjs", "name": "artica/phpchartjs",
"version": "v1.0.1", "version": "v1.0.2",
"dist": { "dist": {
"type": "path", "type": "path",
"url": "../../../phpchartjs", "url": "../../../phpchartjs",
"reference": "7ec8ed26f31671a6fc0c91c294b48dc9625d7827" "reference": "4957e7cd699e50cee8e0ba7304e1423aafb2cad2"
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",

View File

@ -2226,19 +2226,15 @@ function reporting_event_report_group(
$return['chart']['validated_vs_unvalidated'] = null; $return['chart']['validated_vs_unvalidated'] = null;
$options_charts = [ $options_charts = [
'width' => 500, 'width' => 500,
'height' => 150, 'height' => 150,
'viewport' => [ 'legend' => [
'width' => 500,
'height' => 0,
],
'legend' => [
'display' => true, 'display' => true,
'position' => 'right', 'position' => 'right',
'align' => 'center', 'align' => 'center',
], ],
'pdf' => $pdf, 'pdf' => $pdf,
'ttl' => $ttl, 'ttl' => $ttl,
]; ];
if ($pdf === true) { if ($pdf === true) {
@ -4372,19 +4368,15 @@ function reporting_event_report_agent(
$return['chart']['validated_vs_unvalidated'] = null; $return['chart']['validated_vs_unvalidated'] = null;
$options_charts = [ $options_charts = [
'width' => 500, 'width' => 500,
'height' => 150, 'height' => 150,
'radius' => null, 'radius' => null,
'viewport' => [ 'legend' => [
'width' => 500,
'height' => 0,
],
'legend' => [
'display' => true, 'display' => true,
'position' => 'right', 'position' => 'right',
'align' => 'center', 'align' => 'center',
], ],
'ttl' => $ttl, 'ttl' => $ttl,
]; ];
if ((int) $ttl === 2) { if ((int) $ttl === 2) {
@ -11070,19 +11062,15 @@ function reporting_get_module_detailed_event(
} }
$options_charts = [ $options_charts = [
'width' => 500, 'width' => 500,
'height' => 150, 'height' => 150,
'radius' => null, 'radius' => null,
'viewport' => [ 'legend' => [
'width' => 500,
'height' => 0,
],
'legend' => [
'display' => true, 'display' => true,
'position' => 'right', 'position' => 'right',
'align' => 'center', 'align' => 'center',
], ],
'ttl' => $ttl, 'ttl' => $ttl,
]; ];
if ((int) $ttl === 2) { if ((int) $ttl === 2) {

View File

@ -693,10 +693,10 @@ function get_build_setup_charts($type, $options, $data)
$legend->setAlign($legendAlign); $legend->setAlign($legendAlign);
// Defaults fonts legends. // Defaults fonts legends.
// $legend->labels()->getFonts()->setFamily((empty($config['fontpath']) === true) ? 'Lato' : $config['fontpath']); $legend->labels()->getFonts()->setFamily((empty($config['fontpath']) === true) ? 'Lato' : $config['fontpath']);
// $legend->labels()->getFonts()->setStyle('normal'); $legend->labels()->getFonts()->setStyle('normal');
// $legend->labels()->getFonts()->setWeight(600); $legend->labels()->getFonts()->setWeight(600);
// $legend->labels()->getFonts()->setSize(((int) $config['font_size'] + 2)); $legend->labels()->getFonts()->setSize(((int) $config['font_size'] + 2));
if (isset($options['legend']['fonts']) === true if (isset($options['legend']['fonts']) === true
&& empty($options['legend']['fonts']) === false && empty($options['legend']['fonts']) === false
&& is_array($options['legend']['fonts']) === true && is_array($options['legend']['fonts']) === true

View File

@ -9,7 +9,7 @@
"readme": "README.md", "readme": "README.md",
"homepage": "https://artica.es/", "homepage": "https://artica.es/",
"type": "package", "type": "package",
"version": "v1.0.1", "version": "v1.0.2",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"authors": [ "authors": [
{ {

View File

@ -4,7 +4,8 @@ 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\LabelsCollection; use Artica\PHPChartJS\Labels;
use Artica\PHPChartJS\Options\Legend\Labels as LegendLabels;
use JsonSerializable; use JsonSerializable;
use Laminas\Json\Expr; use Laminas\Json\Expr;
@ -43,7 +44,7 @@ class Legend implements ArraySerializableInterface, JsonSerializable
private $onHover; private $onHover;
/** /**
* @var LabelsCollection * @var Labels
*/ */
private $labels; private $labels;
@ -171,12 +172,12 @@ class Legend implements ArraySerializableInterface, JsonSerializable
/** /**
* @return LabelsCollection * @return Labels
*/ */
public function labels() public function labels()
{ {
if (is_null($this->labels)) { if (is_null($this->labels)) {
$this->labels = new LabelsCollection(); $this->labels = new LegendLabels();
} }
return $this->labels; return $this->labels;

View File

@ -4,6 +4,7 @@ namespace Artica\PHPChartJS\Options\Legend;
use Artica\PHPChartJS\ArraySerializableInterface; use Artica\PHPChartJS\ArraySerializableInterface;
use Artica\PHPChartJS\Delegate\ArraySerializable; use Artica\PHPChartJS\Delegate\ArraySerializable;
use Artica\PHPChartJS\Options\Fonts;
use JsonSerializable; use JsonSerializable;
use Laminas\Json\Expr; use Laminas\Json\Expr;
@ -17,32 +18,17 @@ class Labels implements ArraySerializableInterface, JsonSerializable
use ArraySerializable; use ArraySerializable;
/** /**
* @var int * @var integer
*/ */
private $boxWidth; private $boxWidth;
/** /**
* @var int * @var Fonts
*/ */
private $fontSize; private $font;
/** /**
* @var string * @var integer
*/
private $fontStyle;
/**
* @var string
*/
private $fontColor;
/**
* @var string
*/
private $fontFamily;
/**
* @var int
*/ */
private $padding; private $padding;
@ -52,20 +38,22 @@ class Labels implements ArraySerializableInterface, JsonSerializable
private $generateLabels; private $generateLabels;
/** /**
* @var bool * @var boolean
*/ */
private $usePointStyle; private $usePointStyle;
/** /**
* @return int * @return integer
*/ */
public function getBoxWidth() public function getBoxWidth()
{ {
return $this->boxWidth; return $this->boxWidth;
} }
/** /**
* @param int $boxWidth * @param integer $boxWidth
* *
* @return Labels * @return Labels
*/ */
@ -76,96 +64,33 @@ class Labels implements ArraySerializableInterface, JsonSerializable
return $this; return $this;
} }
/**
* @return mixed
*/
public function getFontSize()
{
return $this->fontSize;
}
/** /**
* @param int $fontSize * Return Font.
* *
* @return Labels * @return Font
*/ */
public function setFontSize($fontSize) public function getFonts()
{ {
$this->fontSize = intval($fontSize); if (isset($this->font) === false) {
$this->font = new Fonts();
}
return $this; return $this->font;
} }
/**
* @return string
*/
public function getFontStyle()
{
return $this->fontStyle;
}
/** /**
* @param string $fontStyle * @return integer
*
* @return Labels
*/
public function setFontStyle($fontStyle)
{
$this->fontStyle = strval($fontStyle);
return $this;
}
/**
* @return string
*/
public function getFontColor()
{
return $this->fontColor;
}
/**
* @param string $fontColor
*
* @return Labels
*/
public function setFontColor($fontColor)
{
$this->fontColor = strval($fontColor);
return $this;
}
/**
* @return string
*/
public function getFontFamily()
{
return $this->fontFamily;
}
/**
* @param string $fontFamily
*
* @return Labels
*/
public function setFontFamily($fontFamily)
{
$this->fontFamily = strval($fontFamily);
return $this;
}
/**
* @return int
*/ */
public function getPadding() public function getPadding()
{ {
return $this->padding; return $this->padding;
} }
/** /**
* @param int $padding * @param integer $padding
* *
* @return Labels * @return Labels
*/ */
@ -176,6 +101,7 @@ class Labels implements ArraySerializableInterface, JsonSerializable
return $this; return $this;
} }
/** /**
* @return Expr * @return Expr
*/ */
@ -184,6 +110,7 @@ class Labels implements ArraySerializableInterface, JsonSerializable
return $this->generateLabels; return $this->generateLabels;
} }
/** /**
* @param string $generateLabels * @param string $generateLabels
* *
@ -196,26 +123,29 @@ class Labels implements ArraySerializableInterface, JsonSerializable
return $this; return $this;
} }
/** /**
* @return bool * @return boolean
*/ */
public function isUsePointStyle() public function isUsePointStyle()
{ {
return $this->usePointStyle; return $this->usePointStyle;
} }
/** /**
* @param bool $usePointStyle * @param boolean $usePointStyle
* *
* @return Labels * @return Labels
*/ */
public function setUsePointStyle($usePointStyle) public function setUsePointStyle($usePointStyle)
{ {
$this->usePointStyle = ! ! $usePointStyle; $this->usePointStyle = !!$usePointStyle;
return $this; return $this;
} }
/** /**
* @return array * @return array
*/ */
@ -223,4 +153,6 @@ class Labels implements ArraySerializableInterface, JsonSerializable
{ {
return $this->getArrayCopy(); return $this->getArrayCopy();
} }
} }

View File

@ -569,12 +569,12 @@
}, },
{ {
"name": "artica/phpchartjs", "name": "artica/phpchartjs",
"version": "v1.0.1", "version": "v1.0.2",
"version_normalized": "1.0.1.0", "version_normalized": "1.0.2.0",
"dist": { "dist": {
"type": "path", "type": "path",
"url": "../../../phpchartjs", "url": "../../../phpchartjs",
"reference": "7ec8ed26f31671a6fc0c91c294b48dc9625d7827" "reference": "4957e7cd699e50cee8e0ba7304e1423aafb2cad2"
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",

View File

@ -3,7 +3,7 @@
'name' => 'pandorafms/console', 'name' => 'pandorafms/console',
'pretty_version' => 'dev-develop', 'pretty_version' => 'dev-develop',
'version' => 'dev-develop', 'version' => 'dev-develop',
'reference' => '2e48d517141e494775e9b22166f37eb589e06baa', 'reference' => '872b079b20910f3fa403f418df510e134db9f463',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -83,9 +83,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'artica/phpchartjs' => array( 'artica/phpchartjs' => array(
'pretty_version' => 'v1.0.1', 'pretty_version' => 'v1.0.2',
'version' => '1.0.1.0', 'version' => '1.0.2.0',
'reference' => '7ec8ed26f31671a6fc0c91c294b48dc9625d7827', 'reference' => '4957e7cd699e50cee8e0ba7304e1423aafb2cad2',
'type' => 'package', 'type' => 'package',
'install_path' => __DIR__ . '/../artica/phpchartjs', 'install_path' => __DIR__ . '/../artica/phpchartjs',
'aliases' => array(), 'aliases' => array(),
@ -193,7 +193,7 @@
'pandorafms/console' => array( 'pandorafms/console' => array(
'pretty_version' => 'dev-develop', 'pretty_version' => 'dev-develop',
'version' => 'dev-develop', 'version' => 'dev-develop',
'reference' => '2e48d517141e494775e9b22166f37eb589e06baa', 'reference' => '872b079b20910f3fa403f418df510e134db9f463',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),