本文整理汇总了PHP中Khill\Lavacharts\Utils::arrayIsMulti方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::arrayIsMulti方法的具体用法?PHP Utils::arrayIsMulti怎么用?PHP Utils::arrayIsMulti使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Khill\Lavacharts\Utils
的用法示例。
在下文中一共展示了Utils::arrayIsMulti方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trendlines
/**
* Defines how the chart trendlines will be displayed.
*
* @param array $trendlineConfigArray
* @return \Khill\Lavacharts\Charts\Chart
* @throws \Khill\Lavacharts\Traits\InvalidConfigValue
*/
public function trendlines($trendlineConfigArray)
{
if (Utils::arrayIsMulti($trendlineConfigArray) === false) {
throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'array', 'With arrays of Trendline options.');
}
$trendlines = [];
foreach ($trendlineConfigArray as $index => $trendlineConfig) {
$trendlines[(string) $index] = new Trendline($trendlineConfig);
}
return $this->setOption(__FUNCTION__, $trendlines);
}
示例2: hAxes
/**
* Specifies properties for individual horizontal axes, if the chart has multiple horizontal axes.
* Each child object is a hAxis object, and can contain all the properties supported by hAxis.
* These property values override any global settings for the same property.
* To specify a chart with multiple horizontal axes, first define a new axis using series.targetAxisIndex,
* then configure the axis using hAxes.
*
* @param array $hAxisConfigArray Array of HorizontalAxis configuration arrays
* @return \Khill\Lavacharts\Charts\Chart
* @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
*/
public function hAxes($hAxisConfigArray)
{
if (Utils::arrayIsMulti($hAxisConfigArray) === false) {
throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'array', 'With arrays of HorizontalAxis options.');
}
$hAxes = [];
foreach ($hAxisConfigArray as $hAxisConfig) {
$hAxes[] = new HorizontalAxis($hAxisConfig);
}
return $this->setOption(__FUNCTION__, $hAxes);
}
示例3: series
/**
* An array of objects, each describing the format of the corresponding series
* in the chart.
* To use default values for a series, specify an null in the array.
* If a series or a value is not specified, the global value will be used.
*
* @param array $seriesConfigArray Array of Series options.
* @return \Khill\Lavacharts\Charts\Chart
* @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
*/
public function series($seriesConfigArray)
{
if (Utils::arrayIsMulti($seriesConfigArray) === false) {
throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'array', 'With arrays of Series options.');
}
$series = [];
foreach ($seriesConfigArray as $seriesConfig) {
$series[] = new Series($seriesConfig);
}
return $this->setOption(__FUNCTION__, $series);
}
示例4: slices
/**
* An array of slice objects, each describing the format of the
* corresponding slice in the pie.
*
* To use default values for a slice, specify a null. If a slice or a value is not specified,
* the global value will be used.
*
* The values of the array keys will correspond to each numbered piece
* of the pie, starting from 0. You can skip slices by assigning the
* keys of the array as (int)s.
*
*
* @param array $slices Array of slice objects
* @return \Khill\Lavacharts\Charts\PieChart
* @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
*/
public function slices($slices)
{
if (Utils::arrayIsMulti($slices) === false) {
throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'array', 'as (int) => (Slice)');
}
$pie = [];
foreach ($slices as $index => $slice) {
$pie[$index] = $slice;
}
return $this->setOption(__FUNCTION__, $pie);
}
示例5: addRows
/**
* Adds multiple rows to the DataTable.
*
* @see addRow()
* @param array Multi-dimensional array of rows.
*
* @return DataTable
*/
public function addRows($arrayOfRows)
{
if (Utils::arrayIsMulti($arrayOfRows)) {
foreach ($arrayOfRows as $row) {
$this->addRow($row);
}
} else {
throw new InvalidConfigValue(__FUNCTION__, 'array of arrays');
}
return $this;
}
示例6: bindings
/**
* Binds controls to the dashobard.
*
* Takes an array of with key value pairs of $controlType=>$controlLabels,
* where $controlLabels is an array of the control labels for each type of control.
*
* ex.
* $controls = ['NumberRangeFilter|StocksOfficialFilter' => ['GoogleTable|StocksTable', 'LineChart|Stocks'] ];
* alternatively accepted when only one control for a control type:
* $bindings = ['NumberRangeFilter|StocksOfficialFilter' => 'GoogleTable|StocksTable' ];
*
* @param array $controls
* @throws InvalidConfigProperty
* @throws InvalidConfigValue
* @return null
*/
public function bindings($bindings)
{
if (Utils::arrayIsMulti($bindings)) {
foreach ($bindings as $control => $charts) {
//or $chart=>controls
if (is_array($charts) && count($charts) > 0) {
foreach ($charts as $chartKey => $chart) {
$chartLabel = is_int($chartKey) ? $chart : $chartKey;
if ($this->checkBindingOrdering($control)) {
$this->makeBinding($control, $chartLabel);
} else {
//Flipped ordering of [fliter=>chart(s)] to [chart=>filter(s)]
$this->makeBinding($chartLabel, $control);
}
}
} else {
if (is_string($charts) && count($charts) > 0) {
if ($this->checkBindingOrdering($control)) {
$this->makeBinding($control, $charts);
} else {
$this->makeBinding($chartLabel, $control);
}
} else {
throw $this->invalidConfigValue(__FUNCTION__, 'array | string');
}
}
}
} else {
throw $this->invalidConfigValue(__FUNCTION__, 'array');
}
}
示例7: testArrayIsMultiWithNonArray
/**
* @dataProvider nonArrayProvider
*/
public function testArrayIsMultiWithNonArray($notArray)
{
$this->assertFalse(Utils::arrayIsMulti($notArray));
}