Esempio n. 1
0
 /**
  * Sets the transparency of assigned object points
  *
  * 1.0 being completely opaque and 0.0 fully transparent.
  *
  * @param  float $opacity
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  * @return \Khill\Lavacharts\Charts\Chart
  */
 public function opacity($opacity)
 {
     if (Utils::between(0.0, $opacity, 1.0) === false) {
         throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'float', 'between 0.0 - 1.0');
     }
     return $this->setOption(__FUNCTION__, $opacity);
 }
Esempio n. 2
0
 /**
  * If between 0 and 1, displays a donut chart.
  *
  * The hole with have a radius equal to $pieHole times the radius of the chart.
  *
  *
  * @param  integer|float $pieHole Size of the pie hole.
  * @return \Khill\Lavacharts\Charts\DonutChart
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function pieHole($pieHole)
 {
     if (Utils::between(0.0, $pieHole, 1.0) === false) {
         throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'float', 'while, 0 < pieHole < 1 ');
     }
     return $this->setOption(__FUNCTION__, $pieHole);
 }
Esempio n. 3
0
 /**
  * How far to separate the slice from the rest of the pie.
  * from 0.0 (not at all) to 1.0 (the pie's radius).
  *
  * @param  float $offset
  * @return \Khill\Lavacharts\Configs\Slice
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function offset($offset)
 {
     if (Utils::between(0.0, $offset, 1.0) === false) {
         throw new InvalidConfigValue(__FUNCTION__, 'float', 'where 0.0 < $offset < 1.0');
     }
     return $this->setOption(__FUNCTION__, $offset);
 }
Esempio n. 4
0
 /**
  * Sets the opacity of the stroke.
  *
  * @param  float $strokeOpacity
  * @return \Khill\Lavacharts\Configs\Stroke
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function strokeOpacity($strokeOpacity)
 {
     if (Utils::between(0.0, $strokeOpacity, 1.0, true) === false) {
         throw new InvalidConfigValue(__FUNCTION__, 'float', 'between 0.0 and 1.0');
     }
     return $this->setOption(__FUNCTION__, $strokeOpacity);
 }
Esempio n. 5
0
 /**
  * The default opacity of the colored area under an area chart series, where
  * 0.0 is fully transparent and 1.0 is fully opaque. To specify opacity for
  * an individual series, set the areaOpacity value in the series property.
  *
  * @param  float              $o
  * @throws InvalidConfigValue
  * @return ComboChart
  */
 public function areaOpacity($o)
 {
     if (Utils::between(0.0, $o, 1.0)) {
         return $this->addOption(array(__FUNCTION__ => $o));
     } else {
         throw $this->invalidConfigValue(__FUNCTION__, 'float', 'between 0.0 - 1.0');
     }
 }
Esempio n. 6
0
 /**
  * The default opacity of the colored area under an area chart series, where
  * 0.0 is fully transparent and 1.0 is fully opaque. To specify opacity for
  * an individual series, set the areaOpacity value in the series property.
  *
  * @param  float              $opacity
  * @throws InvalidConfigValue
  * @return AreaChart
  */
 public function areaOpacity($opacity)
 {
     if (Utils::between(0.0, $opacity, 1.0, true)) {
         $this->addOption(array('areaOpacity' => $opacity));
     } else {
         throw $this->invalidConfigValue(__FUNCTION__, 'float', 'where 0 < opacity < 1');
     }
     return $this;
 }
Esempio n. 7
0
 /**
  * Sets the opacity of the stroke.
  *
  * @param  float             $strokeOpacity
  * @throws InvalidConfigValue
  * @return Stroke
  */
 public function strokeOpacity($so)
 {
     if (Utils::between(0.0, $so, 1.0, true)) {
         $this->strokeOpacity = (double) $so;
     } else {
         throw new InvalidConfigValue(__FUNCTION__, 'float');
     }
     return $this;
 }
Esempio n. 8
0
 /**
  * If between 0 and 1, displays a donut chart. The hole with have a radius
  * equal to $pieHole times the radius of the chart.
  *
  * @param int|float $pieHole
  *
  * @return DonutChart
  */
 public function pieHole($pieHole)
 {
     if (Utils::between(0.0, $pieHole, 1.0)) {
         $this->addOption(array('pieHole' => $pieHole));
     } else {
         throw $this->invalidConfigValue(__FUNCTION__, 'float', 'while, 0 < pieHole < 1 ');
     }
     return $this;
 }
Esempio n. 9
0
 /**
  * How far to separate the slice from the rest of the pie.
  * from 0.0 (not at all) to 1.0 (the pie's radius).
  *
  * @param  float              $offset
  * @throws InvalidConfigValue
  * @return Slice
  */
 public function offset($offset)
 {
     if (Utils::between(0.0, $offset, 1.0)) {
         $this->offset = $offset;
     } else {
         throw new InvalidConfigValue(__FUNCTION__, 'float', 'where 0.0 < $offset < 0.1');
     }
     return $this;
 }
Esempio n. 10
0
 /**
  * Supplemental function to add columns from an array.
  *
  * @param  array                   $colDefArray
  * @throws InvalidColumnDefinition
  * @return DataTable
  */
 private function addColumnFromArray($colDefArray)
 {
     if (Utils::arrayValuesCheck($colDefArray, 'string') && Utils::between(1, count($colDefArray), 4, true)) {
         call_user_func_array(array($this, 'addColumnFromStrings'), $colDefArray);
     } else {
         throw new InvalidColumnDefinition($colDefArray);
     }
     return $this;
 }
Esempio n. 11
0
 /**
  * The opacity of the markers, where 0.0 is fully transparent and 1.0
  * is fully opaque.
  *
  * @param  float $markerOpacity
  * @return \Khill\Lavacharts\Charts\GeoChart
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function markerOpacity($markerOpacity)
 {
     if (Utils::between(0, $markerOpacity, 1) === false) {
         throw new InvalidConfigValue(__FUNCTION__, 'float', 'between 0.0 - 1.0');
     }
     return $this->setOption(__FUNCTION__, $markerOpacity);
 }
Esempio n. 12
0
 /**
  * Sets the angle of the axis text, if it's drawn slanted.
  * Ignored if "slantedText" is false, or is in auto mode, and the chart decided to
  * draw the text horizontally. This option is only supported for a discrete axis.
  *
  * @param  int $angle Angle of labels
  * @return \Khill\Lavacharts\Configs\HorizontalAxis
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function slantedTextAngle($angle)
 {
     if (is_int($angle) === false || Utils::between(1, $angle, 90) == false) {
         throw new InvalidConfigValue(self::TYPE . '->' . __FUNCTION__, 'int', 'between 1 - 90');
     }
     return $this->setOption(__FUNCTION__, $angle);
 }
 /**
  * @dataProvider badParamsProvider
  */
 public function testBetweenWithBadParams($lower, $test, $upper, $includeLimits = TRUE)
 {
     $this->assertFalse(Utils::between($lower, $test, $upper, $includeLimits));
 }
Esempio n. 14
0
 /**
  * The opacity of the markers, where 0.0 is fully transparent and 1.0
  * is fully opaque.
  *
  * @param  float|int          $mo
  * @throws InvalidConfigValue
  * @return GeoChart
  */
 public function markerOpacity($mo)
 {
     if ($mo === 0 || $mo === 1) {
         $this->addOption(array(__FUNCTION__ => $mo));
     } elseif (is_float($mo) && Utils::between(0.0, $mo, 1.0, true)) {
         $this->addOption(array(__FUNCTION__ => $mo));
     } else {
         throw $this->invalidConfigValue(__FUNCTION__, 'float|int', 'between 0 - 1');
     }
     return $this;
 }
Esempio n. 15
0
 /**
  * Sets the angle of the axis text, if it's drawn slanted. Ignored if
  * axis.slantedText is false, or is in auto mode, and the chart decided to
  * draw the text horizontally.
  *
  * This option is only supported for a discrete axis.
  *
  * @param int Angle of labels
  *
  * @return HorizontalAxis
  */
 public function slantedTextAngle($angle)
 {
     if (is_int($angle) && Utils::between(1, $angle, 90)) {
         $this->slantedTextAngle = $angle;
     } else {
         throw $this->invalidConfigValue(__FUNCTION__, 'int', 'between 1 - 90');
     }
     return $this;
 }