Skip to content
Snippets Groups Projects
Commit e616a229 authored by laboratory.mike's avatar laboratory.mike Committed by Daniel Cothran
Browse files

Issue #2999560 by laboratory.mike: How to create a true scatter chart?

parent c8a889df
No related branches found
No related tags found
No related merge requests found
...@@ -142,22 +142,18 @@ class C3 extends AbstractChart { ...@@ -142,22 +142,18 @@ class C3 extends AbstractChart {
// C3 does not use bar, so column must be used. // C3 does not use bar, so column must be used.
if ($options['type'] == 'bar') { if ($options['type'] == 'bar') {
$chartAxis->setRotated(TRUE); $chartAxis->setRotated(TRUE);
array_unshift($categories, 'x');
array_push($c3Data, $categories);
$chartData->setColumns($c3Data);
} }
elseif ($options['type'] == 'column') { elseif ($options['type'] == 'column') {
$chartData->setType('bar'); $chartData->setType('bar');
$chartAxis->setRotated(FALSE); $chartAxis->setRotated(FALSE);
array_unshift($categories, 'x');
array_push($c3Data, $categories);
$chartData->setColumns($c3Data);
} }
else { if ($options['type'] == 'scatter') {
array_unshift($categories, 'x'); $chartAxis->setX(['tick' => ['fit' => FALSE]]);
array_push($c3Data, $categories);
$chartData->setColumns($c3Data);
} }
array_unshift($categories, 'x');
array_push($c3Data, $categories);
$chartData->setColumns($c3Data);
$c3->setAxis($chartAxis); $c3->setAxis($chartAxis);
} }
......
...@@ -31,6 +31,26 @@ class ChartAxis implements \JsonSerializable { ...@@ -31,6 +31,26 @@ class ChartAxis implements \JsonSerializable {
$this->rotated = $rotated; $this->rotated = $rotated;
} }
/**
* Get X.
*
* @return mixed $x
* Data for X Axis.
*/
public function getX() {
return $this->x;
}
/**
* Set X.
*
* @param mixed $x
* Data for X Axis.
*/
public function setX($x) {
$this->x = $x;
}
/** /**
* Json Serialize. * Json Serialize.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment