Commit b36b438c authored by Kevin Yumang's avatar Kevin Yumang

SERV-2286 - refactor chart title attribute

parent f07c170c
......@@ -3,6 +3,7 @@ namespace Ceetrox\Managers\ChartManager;
Class ChartDataManager {
private ?string $title;
private array $categories;
private Series $series;
private ?int $numberOfCharts;
......@@ -16,6 +17,7 @@ Class ChartDataManager {
public function __construct()
{
$this->title = null;
$this->categories = [];
$this->series = new Series();
$this->numberOfCharts = null;
......@@ -33,6 +35,11 @@ Class ChartDataManager {
return new SeriesData();
}
public function setTitle(string $value)
{
$this->title = $value;
}
public function setColors($color)
{
if(is_array($color)) {
......@@ -89,6 +96,7 @@ Class ChartDataManager {
$data = [];
if(!is_null($this->title)) $data['title'] = $this->title;
if(!is_null($this->numberOfCharts)) $data['charts'] = $this->numberOfCharts;
if(count($this->series) > 0) $data['series'] = $this->series->toArray();
if(count($this->categories) > 0) $data['categories'] = $this->categories;
......
......@@ -5,7 +5,6 @@ use Ceetrox\Managers\ChartManager\ChartDataManager;
Class BarChartData extends ChartDataManager {
private ?string $title;
private ?bool $isHorizontal;
private ?bool $showBarValues;
......@@ -13,7 +12,6 @@ Class BarChartData extends ChartDataManager {
{
parent::__construct();
$this->title = null;
$this->isHorizontal = null;
$this->showBarValues = null;
}
......@@ -23,11 +21,6 @@ Class BarChartData extends ChartDataManager {
return new self;
}
public function setTitle(string $value)
{
$this->title = $value;
}
public function setIsHorizontal(bool $value)
{
$this->isHorizontal = $value;
......@@ -50,7 +43,6 @@ Class BarChartData extends ChartDataManager {
$data = [];
if(!is_null($this->title)) $data['title'] = $this->title;
if(!is_null($this->isHorizontal)) $data['horizontal'] = $this->isHorizontal;
if(!is_null($this->showBarValues)) $data['barValues'] = $this->showBarValues;
......
......@@ -30,6 +30,7 @@
$chartDataManager->setIsStacked(false);
$chartDataManager->setShowPointValues(true);
$chartDataManager->setTitle(['A', 'B', 'C']);
$dataObject = $chartDataManager->toJson();
......
......@@ -5,7 +5,6 @@ use Ceetrox\Managers\ChartManager\ChartDataManager;
Class PieChartData extends ChartDataManager {
private ?string $title;
private ?string $subtitle;
private ?string $pieType;
private ?bool $hasLabel;
......@@ -15,7 +14,6 @@ Class PieChartData extends ChartDataManager {
{
parent::__construct();
$this->title = null;
$this->subtitle = null;
$this->pieType = null;
$this->hasLabel = null;
......@@ -27,11 +25,6 @@ Class PieChartData extends ChartDataManager {
return new self;
}
public function setTitle(string $value)
{
$this->title = $value;
}
public function setSubtitle(string $value)
{
$this->subtitle = $value;
......@@ -64,7 +57,6 @@ Class PieChartData extends ChartDataManager {
$data = [];
if(!is_null($this->title)) $data['title'] = $this->title;
if(!is_null($this->subtitle)) $data['subtitle'] = $this->subtitle;
if(!is_null($this->pieType)) $data['pieType'] = $this->pieType;
if(!is_null($this->hasLabel)) $data['label'] = $this->hasLabel;
......
......@@ -27,9 +27,6 @@
$chartDataManager->addSeries($sd);
$chartDataManager->setIsHorizontal(true);
$chartDataManager->setShowBarValues(true);
$dataObject = $chartDataManager->toJson();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment