@@ -8,29 +8,29 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class JavaScript extends Renderer |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * Renders the necessary JavaScript for the chart to function in the frontend. |
|
| 13 | - * |
|
| 14 | - * @param int|null $flags |
|
| 15 | - * |
|
| 16 | - * @return string |
|
| 17 | - */ |
|
| 18 | - public function render($flags = null) |
|
| 19 | - { |
|
| 20 | - $script = []; |
|
| 11 | + /** |
|
| 12 | + * Renders the necessary JavaScript for the chart to function in the frontend. |
|
| 13 | + * |
|
| 14 | + * @param int|null $flags |
|
| 15 | + * |
|
| 16 | + * @return string |
|
| 17 | + */ |
|
| 18 | + public function render($flags = null) |
|
| 19 | + { |
|
| 20 | + $script = []; |
|
| 21 | 21 | |
| 22 | - // First, setup the canvas context |
|
| 23 | - $script[] = "var ctx = document.getElementById( \"{$this->chart->getId()}\" ).getContext( \"2d\" );"; |
|
| 22 | + // First, setup the canvas context |
|
| 23 | + $script[] = "var ctx = document.getElementById( \"{$this->chart->getId()}\" ).getContext( \"2d\" );"; |
|
| 24 | 24 | |
| 25 | - // Now, setup the chart instance |
|
| 26 | - $jsonRenderer = new Json($this->chart); |
|
| 27 | - $json = $jsonRenderer->render($flags); |
|
| 28 | - $script[] = "var chart = new Chart( ctx, {$json} );"; |
|
| 25 | + // Now, setup the chart instance |
|
| 26 | + $jsonRenderer = new Json($this->chart); |
|
| 27 | + $json = $jsonRenderer->render($flags); |
|
| 28 | + $script[] = "var chart = new Chart( ctx, {$json} );"; |
|
| 29 | 29 | |
| 30 | - // Return the script |
|
| 31 | - return "\nwindow.onload=(function(oldLoad){return function(){\n" |
|
| 32 | - . "if( oldLoad ) oldLoad();\n" |
|
| 33 | - . implode("\n", $script) . "\n" |
|
| 34 | - . "}})(window.onload);\n"; |
|
| 35 | - } |
|
| 30 | + // Return the script |
|
| 31 | + return "\nwindow.onload=(function(oldLoad){return function(){\n" |
|
| 32 | + . "if( oldLoad ) oldLoad();\n" |
|
| 33 | + . implode("\n", $script) . "\n" |
|
| 34 | + . "}})(window.onload);\n"; |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -9,19 +9,19 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | interface RendererInterface |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * RendererInterface constructor. Expects an instance of a chart. |
|
| 14 | - * |
|
| 15 | - * @param Chart $chart |
|
| 16 | - */ |
|
| 17 | - public function __construct(Chart $chart); |
|
| 12 | + /** |
|
| 13 | + * RendererInterface constructor. Expects an instance of a chart. |
|
| 14 | + * |
|
| 15 | + * @param Chart $chart |
|
| 16 | + */ |
|
| 17 | + public function __construct(Chart $chart); |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Render the chart with the current strategy, returning a string. |
|
| 21 | - * |
|
| 22 | - * @param int|null $flags |
|
| 23 | - * |
|
| 24 | - * @return string |
|
| 25 | - */ |
|
| 26 | - public function render($flags = null); |
|
| 19 | + /** |
|
| 20 | + * Render the chart with the current strategy, returning a string. |
|
| 21 | + * |
|
| 22 | + * @param int|null $flags |
|
| 23 | + * |
|
| 24 | + * @return string |
|
| 25 | + */ |
|
| 26 | + public function render($flags = null); |
|
| 27 | 27 | } |
@@ -8,30 +8,30 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Factory |
| 10 | 10 | { |
| 11 | - const BAR = 'bar'; |
|
| 12 | - const BUBBLE = 'bubble'; |
|
| 13 | - const DOUGHNUT = 'doughnut'; |
|
| 14 | - const HORIZONTAL_BAR = 'horizontalBar'; |
|
| 15 | - const LINE = 'line'; |
|
| 16 | - const PIE = 'pie'; |
|
| 17 | - const POLAR_AREA = 'polarArea'; |
|
| 18 | - const RADAR = 'radar'; |
|
| 19 | - const SCATTER = 'scatter'; |
|
| 11 | + const BAR = 'bar'; |
|
| 12 | + const BUBBLE = 'bubble'; |
|
| 13 | + const DOUGHNUT = 'doughnut'; |
|
| 14 | + const HORIZONTAL_BAR = 'horizontalBar'; |
|
| 15 | + const LINE = 'line'; |
|
| 16 | + const PIE = 'pie'; |
|
| 17 | + const POLAR_AREA = 'polarArea'; |
|
| 18 | + const RADAR = 'radar'; |
|
| 19 | + const SCATTER = 'scatter'; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @param $type |
|
| 23 | - * |
|
| 24 | - * @return Chart |
|
| 25 | - */ |
|
| 26 | - public function create($type) |
|
| 27 | - { |
|
| 28 | - $className = ucfirst($type); |
|
| 29 | - $namespace = "\\Halfpastfour\\PHPChartJS\\Chart"; |
|
| 30 | - $path = "{$namespace}\\{$className}"; |
|
| 31 | - if (! class_exists($path)) { |
|
| 32 | - throw new \InvalidArgumentException("Invalid chart type. {$path} does not exist."); |
|
| 33 | - } |
|
| 21 | + /** |
|
| 22 | + * @param $type |
|
| 23 | + * |
|
| 24 | + * @return Chart |
|
| 25 | + */ |
|
| 26 | + public function create($type) |
|
| 27 | + { |
|
| 28 | + $className = ucfirst($type); |
|
| 29 | + $namespace = "\\Halfpastfour\\PHPChartJS\\Chart"; |
|
| 30 | + $path = "{$namespace}\\{$className}"; |
|
| 31 | + if (! class_exists($path)) { |
|
| 32 | + throw new \InvalidArgumentException("Invalid chart type. {$path} does not exist."); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - return new $path; |
|
| 36 | - } |
|
| 35 | + return new $path; |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -8,212 +8,212 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class GlobalConfig |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * @var GlobalConfig |
|
| 13 | - */ |
|
| 14 | - private static $instance; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * @var string |
|
| 18 | - */ |
|
| 19 | - private $defaultFontColor; |
|
| 20 | - |
|
| 21 | - /** |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - private $defaultFontFamily; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * @var int |
|
| 28 | - */ |
|
| 29 | - private $defaultFontSize; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @var string |
|
| 33 | - */ |
|
| 34 | - private $defaultFontStyle; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @var LayoutConfig |
|
| 38 | - */ |
|
| 39 | - private $layout; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * @var TooltipsConfig |
|
| 43 | - */ |
|
| 44 | - private $tooltips; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * @var HoverConfig |
|
| 48 | - */ |
|
| 49 | - private $hover; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * @var AnimationConfig |
|
| 53 | - */ |
|
| 54 | - private $animation; |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * @var ElementsConfig |
|
| 58 | - */ |
|
| 59 | - private $elements; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * GlobalConfig constructor. |
|
| 63 | - */ |
|
| 64 | - private function __construct() |
|
| 65 | - { |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @return $this |
|
| 70 | - */ |
|
| 71 | - public static function getInstance() |
|
| 72 | - { |
|
| 73 | - if (is_null(self::$instance)) { |
|
| 74 | - self::$instance = new self; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - return self::$instance; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * @return string |
|
| 82 | - */ |
|
| 83 | - public function getDefaultFontColor() |
|
| 84 | - { |
|
| 85 | - return $this->defaultFontColor; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @param string $defaultFontColor |
|
| 90 | - * |
|
| 91 | - * @return $this |
|
| 92 | - */ |
|
| 93 | - public function setDefaultFontColor($defaultFontColor) |
|
| 94 | - { |
|
| 95 | - $this->defaultFontColor = strval($defaultFontColor); |
|
| 96 | - |
|
| 97 | - return $this; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - public function getDefaultFontFamily() |
|
| 104 | - { |
|
| 105 | - return $this->defaultFontFamily; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * @param string $defaultFontFamily |
|
| 110 | - * |
|
| 111 | - * @return $this |
|
| 112 | - */ |
|
| 113 | - public function setDefaultFontFamily($defaultFontFamily) |
|
| 114 | - { |
|
| 115 | - $this->defaultFontFamily = strval($defaultFontFamily); |
|
| 116 | - |
|
| 117 | - return $this; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * @return int |
|
| 122 | - */ |
|
| 123 | - public function getDefaultFontSize() |
|
| 124 | - { |
|
| 125 | - return $this->defaultFontSize; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * @param int $defaultFontSize |
|
| 130 | - * |
|
| 131 | - * @return $this |
|
| 132 | - */ |
|
| 133 | - public function setDefaultFontSize($defaultFontSize) |
|
| 134 | - { |
|
| 135 | - $this->defaultFontSize = intval($defaultFontSize); |
|
| 136 | - |
|
| 137 | - return $this; |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * @return string |
|
| 142 | - */ |
|
| 143 | - public function getDefaultFontStyle() |
|
| 144 | - { |
|
| 145 | - return $this->defaultFontStyle; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * @param string $defaultFontStyle |
|
| 150 | - * |
|
| 151 | - * @return $this |
|
| 152 | - */ |
|
| 153 | - public function setDefaultFontStyle($defaultFontStyle) |
|
| 154 | - { |
|
| 155 | - $this->defaultFontStyle = $defaultFontStyle; |
|
| 156 | - |
|
| 157 | - return $this; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * @return LayoutConfig |
|
| 162 | - */ |
|
| 163 | - public function layout() |
|
| 164 | - { |
|
| 165 | - if (is_null($this->layout)) { |
|
| 166 | - $this->layout = new LayoutConfig(); |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - return $this->layout; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - /** |
|
| 173 | - * @return TooltipsConfig |
|
| 174 | - */ |
|
| 175 | - public function tooltips() |
|
| 176 | - { |
|
| 177 | - if (is_null($this->tooltips)) { |
|
| 178 | - $this->tooltips = new TooltipsConfig(); |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - return $this->tooltips; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * @return HoverConfig |
|
| 186 | - */ |
|
| 187 | - public function hover() |
|
| 188 | - { |
|
| 189 | - if (is_null($this->hover)) { |
|
| 190 | - $this->hover = new HoverConfig(); |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - return $this->hover; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * @return AnimationConfig |
|
| 198 | - */ |
|
| 199 | - public function animation() |
|
| 200 | - { |
|
| 201 | - if (is_null($this->animation)) { |
|
| 202 | - $this->animation = new AnimationConfig(); |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - return $this->animation; |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * @return ElementsConfig |
|
| 210 | - */ |
|
| 211 | - public function elements() |
|
| 212 | - { |
|
| 213 | - if (is_null($this->elements)) { |
|
| 214 | - $this->elements = new ElementsConfig(); |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - return $this->elements; |
|
| 218 | - } |
|
| 11 | + /** |
|
| 12 | + * @var GlobalConfig |
|
| 13 | + */ |
|
| 14 | + private static $instance; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * @var string |
|
| 18 | + */ |
|
| 19 | + private $defaultFontColor; |
|
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + private $defaultFontFamily; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @var int |
|
| 28 | + */ |
|
| 29 | + private $defaultFontSize; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @var string |
|
| 33 | + */ |
|
| 34 | + private $defaultFontStyle; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @var LayoutConfig |
|
| 38 | + */ |
|
| 39 | + private $layout; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * @var TooltipsConfig |
|
| 43 | + */ |
|
| 44 | + private $tooltips; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * @var HoverConfig |
|
| 48 | + */ |
|
| 49 | + private $hover; |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * @var AnimationConfig |
|
| 53 | + */ |
|
| 54 | + private $animation; |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * @var ElementsConfig |
|
| 58 | + */ |
|
| 59 | + private $elements; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * GlobalConfig constructor. |
|
| 63 | + */ |
|
| 64 | + private function __construct() |
|
| 65 | + { |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @return $this |
|
| 70 | + */ |
|
| 71 | + public static function getInstance() |
|
| 72 | + { |
|
| 73 | + if (is_null(self::$instance)) { |
|
| 74 | + self::$instance = new self; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + return self::$instance; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * @return string |
|
| 82 | + */ |
|
| 83 | + public function getDefaultFontColor() |
|
| 84 | + { |
|
| 85 | + return $this->defaultFontColor; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @param string $defaultFontColor |
|
| 90 | + * |
|
| 91 | + * @return $this |
|
| 92 | + */ |
|
| 93 | + public function setDefaultFontColor($defaultFontColor) |
|
| 94 | + { |
|
| 95 | + $this->defaultFontColor = strval($defaultFontColor); |
|
| 96 | + |
|
| 97 | + return $this; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + public function getDefaultFontFamily() |
|
| 104 | + { |
|
| 105 | + return $this->defaultFontFamily; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * @param string $defaultFontFamily |
|
| 110 | + * |
|
| 111 | + * @return $this |
|
| 112 | + */ |
|
| 113 | + public function setDefaultFontFamily($defaultFontFamily) |
|
| 114 | + { |
|
| 115 | + $this->defaultFontFamily = strval($defaultFontFamily); |
|
| 116 | + |
|
| 117 | + return $this; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * @return int |
|
| 122 | + */ |
|
| 123 | + public function getDefaultFontSize() |
|
| 124 | + { |
|
| 125 | + return $this->defaultFontSize; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * @param int $defaultFontSize |
|
| 130 | + * |
|
| 131 | + * @return $this |
|
| 132 | + */ |
|
| 133 | + public function setDefaultFontSize($defaultFontSize) |
|
| 134 | + { |
|
| 135 | + $this->defaultFontSize = intval($defaultFontSize); |
|
| 136 | + |
|
| 137 | + return $this; |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * @return string |
|
| 142 | + */ |
|
| 143 | + public function getDefaultFontStyle() |
|
| 144 | + { |
|
| 145 | + return $this->defaultFontStyle; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * @param string $defaultFontStyle |
|
| 150 | + * |
|
| 151 | + * @return $this |
|
| 152 | + */ |
|
| 153 | + public function setDefaultFontStyle($defaultFontStyle) |
|
| 154 | + { |
|
| 155 | + $this->defaultFontStyle = $defaultFontStyle; |
|
| 156 | + |
|
| 157 | + return $this; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * @return LayoutConfig |
|
| 162 | + */ |
|
| 163 | + public function layout() |
|
| 164 | + { |
|
| 165 | + if (is_null($this->layout)) { |
|
| 166 | + $this->layout = new LayoutConfig(); |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + return $this->layout; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + /** |
|
| 173 | + * @return TooltipsConfig |
|
| 174 | + */ |
|
| 175 | + public function tooltips() |
|
| 176 | + { |
|
| 177 | + if (is_null($this->tooltips)) { |
|
| 178 | + $this->tooltips = new TooltipsConfig(); |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + return $this->tooltips; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * @return HoverConfig |
|
| 186 | + */ |
|
| 187 | + public function hover() |
|
| 188 | + { |
|
| 189 | + if (is_null($this->hover)) { |
|
| 190 | + $this->hover = new HoverConfig(); |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + return $this->hover; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * @return AnimationConfig |
|
| 198 | + */ |
|
| 199 | + public function animation() |
|
| 200 | + { |
|
| 201 | + if (is_null($this->animation)) { |
|
| 202 | + $this->animation = new AnimationConfig(); |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + return $this->animation; |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * @return ElementsConfig |
|
| 210 | + */ |
|
| 211 | + public function elements() |
|
| 212 | + { |
|
| 213 | + if (is_null($this->elements)) { |
|
| 214 | + $this->elements = new ElementsConfig(); |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + return $this->elements; |
|
| 218 | + } |
|
| 219 | 219 | } |
@@ -10,37 +10,37 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | interface ChartInterface |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * @return Options |
|
| 15 | - */ |
|
| 16 | - public function options(); |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * @return DataSet |
|
| 20 | - */ |
|
| 21 | - public function createDataSet(); |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * @param DataSet $dataSet |
|
| 25 | - * |
|
| 26 | - * @return $this |
|
| 27 | - */ |
|
| 28 | - public function addDataSet(DataSet $dataSet); |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @param $offset |
|
| 32 | - * |
|
| 33 | - * @return DataSet |
|
| 34 | - */ |
|
| 35 | - public function getDataSet($offset); |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @return CollectionInterface |
|
| 39 | - */ |
|
| 40 | - public function dataSets(); |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @return string |
|
| 44 | - */ |
|
| 45 | - public function render(); |
|
| 13 | + /** |
|
| 14 | + * @return Options |
|
| 15 | + */ |
|
| 16 | + public function options(); |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * @return DataSet |
|
| 20 | + */ |
|
| 21 | + public function createDataSet(); |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @param DataSet $dataSet |
|
| 25 | + * |
|
| 26 | + * @return $this |
|
| 27 | + */ |
|
| 28 | + public function addDataSet(DataSet $dataSet); |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @param $offset |
|
| 32 | + * |
|
| 33 | + * @return DataSet |
|
| 34 | + */ |
|
| 35 | + public function getDataSet($offset); |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @return CollectionInterface |
|
| 39 | + */ |
|
| 40 | + public function dataSets(); |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @return string |
|
| 44 | + */ |
|
| 45 | + public function render(); |
|
| 46 | 46 | } |
@@ -11,90 +11,90 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class PieOptions extends Options |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * @var int |
|
| 16 | - */ |
|
| 17 | - protected $cutoutPercentage; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * @var float |
|
| 21 | - */ |
|
| 22 | - protected $rotation; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @var float |
|
| 26 | - */ |
|
| 27 | - protected $circumference; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @return Animation |
|
| 31 | - */ |
|
| 32 | - public function getAnimation() |
|
| 33 | - { |
|
| 34 | - if (is_null($this->animation)) { |
|
| 35 | - $this->animation = new PieAnimation(); |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - return $this->animation; |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * @return int |
|
| 43 | - */ |
|
| 44 | - public function getCutoutPercentage() |
|
| 45 | - { |
|
| 46 | - return $this->cutoutPercentage; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * @param int $cutoutPercentage |
|
| 51 | - * |
|
| 52 | - * @return $this |
|
| 53 | - */ |
|
| 54 | - public function setCutoutPercentage($cutoutPercentage) |
|
| 55 | - { |
|
| 56 | - $this->cutoutPercentage = $cutoutPercentage; |
|
| 57 | - |
|
| 58 | - return $this; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * @return float |
|
| 63 | - */ |
|
| 64 | - public function getRotation() |
|
| 65 | - { |
|
| 66 | - return $this->rotation; |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @param float $rotation |
|
| 71 | - * |
|
| 72 | - * @return $this |
|
| 73 | - */ |
|
| 74 | - public function setRotation($rotation) |
|
| 75 | - { |
|
| 76 | - $this->rotation = $rotation; |
|
| 77 | - |
|
| 78 | - return $this; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * @return float |
|
| 83 | - */ |
|
| 84 | - public function getCircumference() |
|
| 85 | - { |
|
| 86 | - return $this->circumference; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * @param float $circumference |
|
| 91 | - * |
|
| 92 | - * @return $this |
|
| 93 | - */ |
|
| 94 | - public function setCircumference($circumference) |
|
| 95 | - { |
|
| 96 | - $this->circumference = $circumference; |
|
| 97 | - |
|
| 98 | - return $this; |
|
| 99 | - } |
|
| 14 | + /** |
|
| 15 | + * @var int |
|
| 16 | + */ |
|
| 17 | + protected $cutoutPercentage; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * @var float |
|
| 21 | + */ |
|
| 22 | + protected $rotation; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @var float |
|
| 26 | + */ |
|
| 27 | + protected $circumference; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @return Animation |
|
| 31 | + */ |
|
| 32 | + public function getAnimation() |
|
| 33 | + { |
|
| 34 | + if (is_null($this->animation)) { |
|
| 35 | + $this->animation = new PieAnimation(); |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + return $this->animation; |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * @return int |
|
| 43 | + */ |
|
| 44 | + public function getCutoutPercentage() |
|
| 45 | + { |
|
| 46 | + return $this->cutoutPercentage; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * @param int $cutoutPercentage |
|
| 51 | + * |
|
| 52 | + * @return $this |
|
| 53 | + */ |
|
| 54 | + public function setCutoutPercentage($cutoutPercentage) |
|
| 55 | + { |
|
| 56 | + $this->cutoutPercentage = $cutoutPercentage; |
|
| 57 | + |
|
| 58 | + return $this; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * @return float |
|
| 63 | + */ |
|
| 64 | + public function getRotation() |
|
| 65 | + { |
|
| 66 | + return $this->rotation; |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @param float $rotation |
|
| 71 | + * |
|
| 72 | + * @return $this |
|
| 73 | + */ |
|
| 74 | + public function setRotation($rotation) |
|
| 75 | + { |
|
| 76 | + $this->rotation = $rotation; |
|
| 77 | + |
|
| 78 | + return $this; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * @return float |
|
| 83 | + */ |
|
| 84 | + public function getCircumference() |
|
| 85 | + { |
|
| 86 | + return $this->circumference; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @param float $circumference |
|
| 91 | + * |
|
| 92 | + * @return $this |
|
| 93 | + */ |
|
| 94 | + public function setCircumference($circumference) |
|
| 95 | + { |
|
| 96 | + $this->circumference = $circumference; |
|
| 97 | + |
|
| 98 | + return $this; |
|
| 99 | + } |
|
| 100 | 100 | } |
@@ -8,15 +8,15 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | interface ChartOwnedInterface |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * @param ChartInterface $chart |
|
| 13 | - * |
|
| 14 | - * @return $this |
|
| 15 | - */ |
|
| 16 | - public function setOwner(ChartInterface $chart); |
|
| 11 | + /** |
|
| 12 | + * @param ChartInterface $chart |
|
| 13 | + * |
|
| 14 | + * @return $this |
|
| 15 | + */ |
|
| 16 | + public function setOwner(ChartInterface $chart); |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @return ChartInterface |
|
| 20 | - */ |
|
| 21 | - public function owner(); |
|
| 18 | + /** |
|
| 19 | + * @return ChartInterface |
|
| 20 | + */ |
|
| 21 | + public function owner(); |
|
| 22 | 22 | } |
@@ -15,16 +15,16 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Bubble extends Chart |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * The internal type of chart. |
|
| 20 | - */ |
|
| 21 | - const TYPE = 'bubble'; |
|
| 18 | + /** |
|
| 19 | + * The internal type of chart. |
|
| 20 | + */ |
|
| 21 | + const TYPE = 'bubble'; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * The list of models that should be used for this chart type. |
|
| 25 | - */ |
|
| 26 | - const MODEL = [ |
|
| 27 | - 'dataset' => BubbleDataSet::class, |
|
| 28 | - 'options' => BubbleOptions::class, |
|
| 29 | - ]; |
|
| 23 | + /** |
|
| 24 | + * The list of models that should be used for this chart type. |
|
| 25 | + */ |
|
| 26 | + const MODEL = [ |
|
| 27 | + 'dataset' => BubbleDataSet::class, |
|
| 28 | + 'options' => BubbleOptions::class, |
|
| 29 | + ]; |
|
| 30 | 30 | } |
@@ -16,16 +16,16 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Radar extends Chart implements ChartInterface |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * The internal type of chart. |
|
| 21 | - */ |
|
| 22 | - const TYPE = 'radar'; |
|
| 19 | + /** |
|
| 20 | + * The internal type of chart. |
|
| 21 | + */ |
|
| 22 | + const TYPE = 'radar'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * The list of models that should be used for this chart type. |
|
| 26 | - */ |
|
| 27 | - const MODEL = [ |
|
| 28 | - 'dataset' => RadarDataSet::class, |
|
| 29 | - 'options' => RadarOptions::class, |
|
| 30 | - ]; |
|
| 24 | + /** |
|
| 25 | + * The list of models that should be used for this chart type. |
|
| 26 | + */ |
|
| 27 | + const MODEL = [ |
|
| 28 | + 'dataset' => RadarDataSet::class, |
|
| 29 | + 'options' => RadarOptions::class, |
|
| 30 | + ]; |
|
| 31 | 31 | } |