PHP 클래스 miloschuman\highcharts\SeriesDataHelper

It includes a set of built-in formatters to handle common preprocessing tasks (like converting datetime strings to JavaScript timestamps) and provides an extensible column configuration, which allows you to add custom parser/formatter handlers. Basic usage: php use miloschuman\highcharts\Highstock; use miloschuman\highcharts\SeriesDataHelper; Highstock::widget([ 'options' => [ 'series' => [ [ 'type' => 'candlestick', 'name' => 'Stock', 'data' => new SeriesDataHelper($dataProvider, ['date:datetime', 'open', 'high', 'low', 'close']), ], [ 'type' => 'column', 'name' => 'Volume', 'data' => new SeriesDataHelper($dataProvider, ['date:datetime', 'volume:int']), ], ] ] ]);
상속: extends yii\base\Component, implements JsonSerializabl\JsonSerializable
파일 보기 프로젝트 열기: miloschuman/yii2-highcharts-widget 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$columns column configuration
$data the underlying data source

공개 메소드들

메소드 설명
__construct ( BaseDataProvider | array $data, array $columns, array $config = [] ) Constructor
jsonSerialize ( )
process ( ) : array Processes the source data and returns the result.
setColumns ( array $columns ) Sets the column configuration.
setData ( BaseDataProvider | array $data ) Sets the underlying data source.

보호된 메소드들

메소드 설명
getFormatters ( ) : callable[] Built-in formatters, which can be used in the [[$columns]] configuration.
normalizeColumns ( ) Prepares the [[$columns]] for use by SeriesDataHelper::process.

메소드 상세

__construct() 공개 메소드

Constructor
또한 보기: setColumns()
또한 보기: setData()
public __construct ( BaseDataProvider | array $data, array $columns, array $config = [] )
$data yii\data\BaseDataProvider | array the underlying data source
$columns array column configuration
$config array for future use

getFormatters() 보호된 메소드

Built-in formatters, which can be used in the [[$columns]] configuration.
protected getFormatters ( ) : callable[]
리턴 callable[]

jsonSerialize() 공개 메소드

public jsonSerialize ( )

normalizeColumns() 보호된 메소드

Prepares the [[$columns]] for use by SeriesDataHelper::process.
protected normalizeColumns ( )

process() 공개 메소드

Processes the source data and returns the result.
public process ( ) : array
리턴 array the processed data

setColumns() 공개 메소드

Each element can be either an array ['column', 'format'] or a shortcut string 'column:format'. Column can be a string representing the attribute, field, or key from the source data. It can even be an integer if the source data uses numeric keys. Format can be one of the built-in formatters ('datetime', 'float', 'int', 'raw', 'string', or 'timestamp') or a callable that is used to prepare each data value. If format is omitted, the raw value will be passed to the chart. Example showing different ways to specify a column: php [ ['date_measured', 'datetime'], 'open', 'high:float', ['low', 'float'], ['close', function($value) { return ceil($value); }] ]
public setColumns ( array $columns )
$columns array

setData() 공개 메소드

Sets the underlying data source.
public setData ( BaseDataProvider | array $data )
$data yii\data\BaseDataProvider | array the data source

프로퍼티 상세

$columns 보호되어 있는 프로퍼티

column configuration
protected $columns

$data 보호되어 있는 프로퍼티

the underlying data source
protected $data