本文整理汇总了PHP中Khill\Lavacharts\Utils::nonEmptyStringInArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::nonEmptyStringInArray方法的具体用法?PHP Utils::nonEmptyStringInArray怎么用?PHP Utils::nonEmptyStringInArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Khill\Lavacharts\Utils
的用法示例。
在下文中一共展示了Utils::nonEmptyStringInArray方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setStringInArrayOption
/**
* Sets the value of a string option from an array of choices.
*
* @param string $option Option to set.
* @param string $value Value of the option.
* @param array $validValues Array of valid values
* @return \Khill\Lavacharts\JsonConfig
* @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
* @throws \Khill\Lavacharts\Exceptions\InvalidOption
*/
protected function setStringInArrayOption($option, $value, $validValues = [])
{
if (Utils::nonEmptyStringInArray($value, $validValues) === false) {
throw new InvalidConfigValue(static::TYPE . '->' . $option, 'string', 'Whose value is one of ' . Utils::arrayToPipedString($validValues));
}
$this->options->set($option, $value);
return $this;
}
示例2: axisTitlesPosition
/**
* Where to place the axis titles, compared to the chart area. Supported values:
* in - Draw the axis titles inside the the chart area.
* out - Draw the axis titles outside the chart area.
* none - Omit the axis titles.
*
* @param string $position
* @return BarChart
*/
public function axisTitlesPosition($position)
{
$values = array('in', 'out', 'none');
if (Utils::nonEmptyStringInArray($position, $values)) {
$this->addOption(array('axisTitlesPosition' => $position));
} else {
throw $this->invalidConfigValue(__FUNCTION__, 'string', 'with a value of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例3: formatType
/**
* Sets a quick formatting option for the date.
*
* The following string values are supported,
* reformatting the date February 28, 2008 as shown:
*
* 'short' - Short format: e.g., "2/28/08"
* 'medium' - Medium format: e.g., "Feb 28, 2008"
* 'long' - Long format: e.g., "February 28, 2008"
*
* You cannot specify both formatType and pattern.
*
* @param string $ft
* @throws InvalidConfigValue
* @return DateFormat
*/
public function formatType($ft)
{
$values = array('short', 'medium', 'long');
if (Utils::nonEmptyStringInArray($ft, $values)) {
$this->formatType = $ft;
} else {
throw new InvalidConfigValue(__FUNCTION__, 'string');
}
return $this;
}
示例4: create
/**
* Creates a new column object.
*
* @access public
* @since 3.0.0
* @param string $type Type of column to create.
* @param string $label A label for the column.
* @param \Khill\Lavacharts\DataTables\Formats\Format $format Column formatter for the data.
* @param string $role A role for the column to play.
* @return \Khill\Lavacharts\DataTables\Columns\Column
* @throws \Khill\Lavacharts\Exceptions\InvalidColumnRole
* @throws \Khill\Lavacharts\Exceptions\InvalidColumnType
*/
public static function create($type, $label = '', Format $format = null, $role = '')
{
if (Utils::nonEmptyStringInArray($type, self::$TYPES) === false) {
throw new InvalidColumnType($type, self::$TYPES);
}
$columnArgs = [$type];
if (Utils::nonEmptyString($label) === true) {
$columnArgs[] = $label;
} else {
$columnArgs[] = '';
}
if ($format !== null) {
$columnArgs[] = $format;
} else {
$columnArgs[] = null;
}
if (is_string($role) === false || $role != '' && in_array($role, self::$ROLES, true) === false) {
throw new InvalidColumnRole($role, self::$ROLES);
}
$columnArgs[] = $role;
$column = new \ReflectionClass('\\Khill\\Lavacharts\\DataTables\\Columns\\Column');
return $column->newInstanceArgs($columnArgs);
}
示例5: focusTarget
/**
* The type of the entity that receives focus on mouse hover.
*
* Also affects which entity is selected by mouse click, and which data table
* element is associated with events. Can be one of the following:
* 'datum' - Focus on a single data point. Correlates to a cell in the data table.
* 'category' - Focus on a grouping of all data points along the major axis.
* Correlates to a row in the data table.
*
* In focusTarget 'category' the tooltip displays all the category values.
* This may be useful for comparing values of different series.
*
* @since v2.4.1
* @param string $ft
* @return AreaChart
*/
public function focusTarget($ft)
{
$values = array('datum', 'category');
if (Utils::nonEmptyStringInArray($ft, $values)) {
$this->addOption(array(__FUNCTION__ => $ft));
} else {
throw $this->invalidConfigValue(__FUNCTION__, 'string', 'must be one of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例6: pagingButtons
/**
* Sets a specified option for the paging buttons. The options are as follows:
* both - enable prev and next buttons
* prev - only prev button is enabled
* next - only next button is enabled
* auto - the buttons are enabled according to the current page. On the first page only next
* is shown. On the last page only prev is shown. Otherwise both are enabled.
* number - the number of paging buttons to show. This explicit number will override computed number from pageSize.
*
* @access public
* @param string|int $paging
* @return \Khill\Lavacharts\Charts\TableChart
* @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
*/
public function pagingButtons($paging)
{
$values = ['both', 'prev', 'next', 'auto'];
if (Utils::nonEmptyStringInArray($paging, $values) === false || is_int($paging) === false) {
throw new InvalidConfigValue(__FUNCTION__, 'string|int', 'must be int or one of ' . Utils::arrayToPipedString($values));
}
return $this->setOption(__FUNCTION__, $paging);
}
示例7: theme
/**
* A theme is a set of predefined option values that work together to achieve a specific chart
* behavior or visual effect. Currently only one theme is available:
* 'maximized' - Maximizes the area of the chart, and draws the legend and all of the
* labels inside the chart area. Sets the following options:
*
* chartArea: {width: '100%', height: '100%'},
* legend: {position: 'in'},
* titlePosition: 'in', axisTitlesPosition: 'in',
* hAxis: {textPosition: 'in'}, vAxis: {textPosition: 'in'}
*
* @param string $t
* @return BarChart
*/
public function theme($t)
{
$values = array('maximized');
if (Utils::nonEmptyStringInArray($t, $values)) {
$this->addOption(array(__FUNCTION__ => $t));
} else {
throw $this->invalidConfigValue(__FUNCTION__, 'string', 'must be one of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例8: checkBindingOrdering
/**
* Gets the current chart bindings.
*
* @return array
*/
private function checkBindingOrdering($firstLabel, $isControlFirst = true)
{
//$ordering=0 => [fliter=>table(s)]
//$ordering=1 => [chart=>filter(s)]
$firstLabel = explode('|', $firstLabel)[0];
$isChart = Utils::nonEmptyStringInArray($firstLabel, Lavacharts::$chartClasses);
$isControl = Utils::nonEmptyStringInArray($firstLabel, Lavacharts::$controlClasses);
if ($isControl) {
return $isControlFirst == $isControl;
} else {
if ($isChart) {
return !$isControlFirst == $isControl;
}
}
return false;
}
示例9: easing
/**
* The easing function applied to the animation.
*
* The following options are available:
* 'linear' - Constant speed.
* 'in' - Ease in - Start slow and speed up.
* 'out' - Ease out - Start fast and slow down.
* 'inAndOut' - Ease in and out - Start slow, speed up, then slow down.
*
* @param string $e
* @return Animation
*/
public function easing($e)
{
$values = array('linear', 'in', 'out', 'inAndOut');
if (Utils::nonEmptyStringInArray($e, $values)) {
$this->easing = $e;
} else {
throw new InvalidConfigValue(__FUNCTION__, 'string', 'with a value of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例10: getColumnsByType
/**
* Returns the columns whos type match the given value.
*
* @access public
* @since 3.0.0
* @param string $type
* @return array
* @throws \Khill\Lavacharts\Exceptions\InvalidColumnType
*/
public function getColumnsByType($type)
{
if (Utils::nonEmptyStringInArray($type, ColumnFactory::$TYPES) === false) {
throw new InvalidColumnType($type, ColumnFactory::$TYPES);
}
$indices = [];
foreach ($this->cols as $index => $column) {
if ($type === $column->getType()) {
$indices[$index] = $column;
}
}
return $indices;
}