当前位置: 首页>>代码示例>>PHP>>正文


PHP Utils::isIntOrPercent方法代码示例

本文整理汇总了PHP中Khill\Lavacharts\Utils::isIntOrPercent方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::isIntOrPercent方法的具体用法?PHP Utils::isIntOrPercent怎么用?PHP Utils::isIntOrPercent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Khill\Lavacharts\Utils的用法示例。


在下文中一共展示了Utils::isIntOrPercent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: barGroupWidth

 /**
  * The width of a group of bars, specified in either of these formats:
  * - Pixels (e.g. 50).
  * - Percentage of the available width for each group (e.g. '20%'),
  *   where '100%' means that groups have no space between them.
  *
  * @param  int|string $barGroupWidth
  * @return \Khill\Lavacharts\Charts\Chart
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function barGroupWidth($barGroupWidth)
 {
     if (Utils::isIntOrPercent($barGroupWidth) === false) {
         throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'int|string', 'String only if representing a percent. "50%"');
     }
     return $this->setOption(__FUNCTION__, ['groupWidth' => $barGroupWidth]);
 }
开发者ID:tahertechs,项目名称:lavacharts,代码行数:17,代码来源:BarGroupWidthTrait.php

示例2: barGroupWidth

 /**
  * The width of a group of bars, specified in either of these formats:
  * - Pixels (e.g. 50).
  * - Percentage of the available width for each group (e.g. '20%'),
  *   where '100%' means that groups have no space between them.
  *
  * @param  mixed       $barGroupWidth
  * @return BarChart
  */
 public function barGroupWidth($barGroupWidth)
 {
     if (Utils::isIntOrPercent($barGroupWidth)) {
         $this->addOption(array('bar' => array('groupWidth' => $barGroupWidth)));
     } else {
         throw $this->invalidConfigValue(__FUNCTION__, 'string | int', 'must be a valid int or percent [ 50 | 65% ]');
     }
     return $this;
 }
开发者ID:antoniotajuelo,项目名称:lavacharts,代码行数:18,代码来源:BarChart.php

示例3: height

 /**
  * Sets the height of the chart in the container.
  *
  * @param  int                $height Amount in pixels
  * @throws InvalidConfigValue
  * @return ChartArea
  */
 public function height($height)
 {
     if (Utils::isIntOrPercent($height)) {
         $this->height = $height;
     } else {
         throw new InvalidConfigValue(__FUNCTION__, 'int | string', 'representing pixels or a percent.');
     }
     return $this;
 }
开发者ID:alvarobfdev,项目名称:applog,代码行数:16,代码来源:ChartArea.php

示例4: testIntOrPercentWithBadParams

 /**
  * @dataProvider badParamsProvider
  */
 public function testIntOrPercentWithBadParams($value)
 {
     $this->assertFalse(Utils::isIntOrPercent($value));
 }
开发者ID:alvarobfdev,项目名称:applog,代码行数:7,代码来源:UtilsIsIntOrPercentTest.php

示例5: setIntOrPercentOption

 /**
  * Sets the value of an integer option.
  *
  * @param  string $option Option to set.
  * @param  int    $value Value of the option.
  * @return \Khill\Lavacharts\JsonConfig
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  * @throws \Khill\Lavacharts\Exceptions\InvalidOption
  */
 protected function setIntOrPercentOption($option, $value)
 {
     if (Utils::isIntOrPercent($value) === false) {
         throw new InvalidConfigValue(static::TYPE . '->' . $option, 'int|string', 'String only if representing a percent. "50%"');
     }
     $this->options->set($option, $value);
     return $this;
 }
开发者ID:tahertechs,项目名称:lavacharts,代码行数:17,代码来源:JsonConfig.php


注:本文中的Khill\Lavacharts\Utils::isIntOrPercent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。