Skip to content
This repository has been archived by the owner on Feb 27, 2022. It is now read-only.

Commit

Permalink
Add marker styling options array for bar charts
Browse files Browse the repository at this point in the history
  • Loading branch information
jtraulle committed Jun 25, 2017
1 parent b317075 commit 59cc6a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

\.idea/
11 changes: 8 additions & 3 deletions src/Utility/Trace.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class Trace
* @var string Line type ("markers", "lines" or "markers+line")
*/
private $mode;
/**
* @var string Styling options for marker
*/
private $marker;

/**
* Trace constructor.
Expand All @@ -48,13 +52,14 @@ class Trace
* @param string|null $name Name of the series
* @param string|null $mode Line type ("markers", "lines" or "markers+line")
*/
public function __construct(array $x, array $y, string $type, string $name = null, string $mode = null)
public function __construct(array $x, array $y, string $type, string $name = null, string $mode = null, array $marker = null)
{
$this->x = $x;
$this->y = $y;
$this->type = $type;
$this->name = $name;
$this->mode = $mode;
$this->marker = $marker;
}

/**
Expand All @@ -68,7 +73,7 @@ public function toArray()
$this->checkXequalsY();
switch ($this->type) {
case 'bar':
$trace = ['x' => $this->x, 'y' => $this->y, 'type' => $this->type, 'name' => $this->name];
$trace = ['x' => $this->x, 'y' => $this->y, 'type' => $this->type, 'name' => $this->name, 'marker' => $this->marker];
break;
case 'scatter':
$this->checkModeValue();
Expand Down Expand Up @@ -110,4 +115,4 @@ private function checkModeValue()
throw new \Exception('Invalid trace mode : can be either "markers", "lines" or "markers+line" ; got "' . $this->mode . '"');
}
}
}
}
3 changes: 2 additions & 1 deletion src/View/Helper/DrawChartHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ public function makeMultiTraceChart(
$serie[1],
$type,
isset($serie[2]) ? $serie[2] : null,
isset($serie[3]) ? $serie[3] : null
isset($serie[3]) ? $serie[3] : null,
isset($serie[4]) ? $serie[4] : null
)
);
}
Expand Down

0 comments on commit 59cc6a2

Please sign in to comment.