本文整理汇总了PHP中Khill\Lavacharts\Utils::arrayToPipedString方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::arrayToPipedString方法的具体用法?PHP Utils::arrayToPipedString怎么用?PHP Utils::arrayToPipedString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Khill\Lavacharts\Utils
的用法示例。
在下文中一共展示了Utils::arrayToPipedString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOption
/**
* Overriding getOption function to pull config options from calendar array.
* (Thanks google)
*
* @param string $o Which option to fetch
* @throws InvalidConfigValue
* @return mixed
*/
public function getOption($o)
{
if (is_string($o) && array_key_exists($o, $this->options['calendar'])) {
return $this->options['calendar'][$o];
} else {
if (is_string($o) && array_key_exists($o, $this->options)) {
return $this->options[$o];
} else {
$calendarOptions = $this->options['calendar'];
$nonCalendarOptions = array_diff($this->options, $calendarOptions);
$options = array_merge($calendarOptions, $nonCalendarOptions);
throw $this->invalidConfigValue(__FUNCTION__, 'string', 'must be one of ' . Utils::arrayToPipedString(array_keys($options)));
}
}
}
示例2: 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;
}
示例3: animationEasing
/**
* Animation 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 $easing
*
* @return Chart
*/
public function animationEasing($easing = 'linear')
{
$values = array('linear', 'in', 'out', 'inAndOut');
if (in_array($easing, $values)) {
$this->easing = $easing;
} else {
$this->error('Invalid animationEasing value, must be (string) ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例4: curveType
/**
* Controls the curve of the lines when the line width is not zero.
*
* Can be one of the following:
* 'none' - Straight lines without curve.
* 'function' - The angles of the line will be smoothed.
*
* @param string $curveType
* @throws InvalidConfigValue
* @return LineChart
*/
public function curveType($curveType)
{
$values = array('none', 'function');
if (is_string($curveType) && in_array($curveType, $values)) {
$this->addOption(array('curveType' => $curveType));
} else {
throw $this->invalidConfigValue(__FUNCTION__, 'string', 'with a value of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例5: 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 ColumnChart
*/
public function axisTitlesPosition($position)
{
$values = array('in', 'out', 'none');
if (is_string($position) && in_array($position, $values)) {
$this->addOption(array('axisTitlesPosition' => $position));
} else {
throw $this->invalidConfigValue(__FUNCTION__, 'string', 'with a value of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例6: matchType
/**
* The method of filtering the string:
*
* exact - The pattern matches the string exactly.
* prefix - The pattern is found at the beginning of the string.
* any - The pattern is found anywhere in the string.
*
* @param string $position
* @throws InvalidConfigValue
* @return StringFilter
*/
public function matchType($type)
{
$values = array('exact', 'prefix', 'any');
if (is_string($type) && in_array($type, $values)) {
$this->addOption(array(__FUNCTION__ => $type));
} else {
throw $this->invalidConfigValue(__FUNCTION__, 'string', 'with a value of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例7: isStacked
/**
* If set to true, stacks the elements for all series at each domain value.
*
* Note: In Column, Area, and SteppedArea charts, Google Charts reverses the order
* of legend items to better correspond with the stacking of the series elements
* (E.g. series 0 will be the bottom-most legend item). This does not apply to Bar Charts.
*
* The isStacked option also supports 100% stacking, where the stacks
* of elements at each domain value are rescaled to add up to 100%.
*
* The options for isStacked are:
*
* false — elements will not stack. This is the default option.
* true — stacks elements for all series at each domain value.
* 'percent' — stacks elements for all series at each domain value
* and rescales them such that they add up to 100%, with each element's
* value calculated as a percentage of 100%.
* 'relative' — stacks elements for all series at each domain value
* and rescales them such that they add up to 1, with each element's
* value calculated as a fraction of 1.
* 'absolute' — functions the same as isStacked: true.
*
* For 100% stacking, the calculated value for each element will appear
* in the tooltip after its actual value.
*
* The target axis will default to tick values based on the relative
* 0-1 scale as fractions of 1 for 'relative', and 0-100% for 'percent'
* (Note: when using the 'percent' option, the axis/tick values are
* displayed as percentages, however the actual values are the relative
* 0-1 scale values. This is because the percentage axis ticks are the
* result of applying a format of "#.##%" to the relative 0-1 scale values.
* When using isStacked: 'percent', be sure to specify any ticks/gridlines
* using the relative 0-1 scale values). You can customize the gridlines/tick
* values and formatting using the appropriate hAxis/vAxis options.
*
* 100% stacking only supports data values of type number, and must have a baseline of zero.
*
* @param bool|string $isStacked
* @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
* @return \Khill\Lavacharts\Charts\Chart
*/
public function isStacked($isStacked)
{
$values = ['relative', 'absolute'];
if (is_bool($isStacked) === true) {
return $this->setBoolOption(__FUNCTION__, $isStacked);
} elseif (is_string($isStacked) === true) {
return $this->setStringInArrayOption(__FUNCTION__, $isStacked, $values);
} else {
throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'bool|string', 'Whose value is one of ' . Utils::arrayToPipedString($values));
}
}
示例8: __construct
/**
* Builds the ConfigOptions object.
*
* Passing an array of key value pairs will set the configuration for each
* child object created from this parent object.
*
* @param mixed $child Child ConfigOption object.
* @param array $config Array of options.
* @throws InvalidConfigValue
* @throws InvalidConfigProperty
* @return mixed
*/
public function __construct($child, $config)
{
$class = new \ReflectionClass($child);
$this->options = array_map(function ($prop) {
return $prop->name;
}, $class->getProperties(\ReflectionProperty::IS_PUBLIC));
if (is_array($config)) {
foreach ($config as $option => $value) {
if (in_array($option, $this->options)) {
$this->{$option}($value);
} else {
throw new InvalidConfigProperty($child::TYPE, __FUNCTION__, $option, $this->options);
}
}
} else {
throw new InvalidConfigValue(__FUNCTION__, 'array', 'with valid keys as ' . Utils::arrayToPipedString($this->options));
}
}
示例9: orientation
/**
* The slider orientation. Either 'horizontal' or 'vertical'.
*
* @access public
* @param string $orientation
* @return Ui
*/
public function orientation($orientation)
{
$values = array('horizontal', 'vertical');
if (is_string($orientation) && in_array($orientation, $values)) {
$this->orientation = $orientation;
} else {
throw new InvalidConfigValue(__FUNCTION__, 'string', 'with a value of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例10: 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);
}
示例11: type
/**
* The default line type for any series not specified in the series property.
* Available values are:
* 'line', 'area', 'bars', 'candlesticks' and 'steppedArea'
*
* @param string $type
* @throws InvalidConfigValue
* @return Series
*/
public function type($type)
{
$values = array('line', 'area', 'bars', 'candlesticks', 'steppedArea');
if (in_array($type, $values)) {
$this->type = $type;
} else {
throw new InvalidConfigValue(__FUNCTION__, 'string', 'with a value of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例12: 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;
}
示例13: viewWindowMode
/**
* Specifies how to scale the axis to render the values within
* the chart area. The following string values are supported:
*
* 'pretty' - Scale the values so that the maximum and minimum
* data values are rendered a bit inside the left and right of the chart area.
* 'maximized' - Scale the values so that the maximum and minimum
* data values touch the left and right of the chart area.
* 'explicit' - Specify the left and right scale values of the chart area.
* Data values outside these values will be cropped. You must specify an
* axis.viewWindow array describing the maximum and minimum values to show.
*
* This option is only supported for a continuous axis.
*
* @param string $viewMode
* @throws InvalidConfigValue
* @return Axis
*/
public function viewWindowMode($viewMode)
{
$values = array('pretty', 'maximized', 'explicit');
if (Utils::nonEmptyString($viewMode) && in_array($viewMode, $values)) {
$this->viewWindowMode = $viewMode;
} else {
throw $this->invalidConfigValue(__FUNCTION__, 'string', 'with a value of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例14: alignment
/**
* Sets the alignment of the legend.
*
* Can be one of the following:
* 'start' - Aligned to the start of the area allocated for the legend.
* 'center' - Centered in the area allocated for the legend.
* 'end' - Aligned to the end of the area allocated for the legend.
*
* Start, center, and end are relative to the style -- vertical or horizontal -- of the legend.
* For example, in a 'right' legend, 'start' and 'end' are at the top and bottom, respectively;
* for a 'top' legend, 'start' and 'end' would be at the left and right of the area, respectively.
*
* The default value depends on the legend's position. For 'bottom' legends,
* the default is 'center'; other legends default to 'start'.
*
* @param string $alignment Alignment of the legend.
* @return Legend
*/
public function alignment($alignment)
{
$values = array('start', 'center', 'end');
if (is_string($alignment) && in_array($alignment, $values)) {
$this->alignment = $alignment;
} else {
throw new InvalidConfigValue(__FUNCTION__, 'string', 'with a value of ' . Utils::arrayToPipedString($values));
}
return $this;
}
示例15: trigger
/**
* Sets The user interaction that causes the tooltip to be displayed.
*
* 'focus' - The tooltip will be displayed when the user hovers over an element.
* 'none' - The tooltip will not be displayed.
*
* @param string $trigger Type of trigger.
* @throws InvalidConfigValue
* @return Tooltip
*/
public function trigger($trigger)
{
$values = array('focus', 'none');
if (in_array($trigger, $values)) {
$this->trigger = $trigger;
} else {
throw new InvalidConfigValue(__FUNCTION__, 'string', 'with a value of ' . Utils::arrayToPipedString($values));
}
return $this;
}