PHP Класс HighchartsWidget
To use this widget, you may insert the following code in a view:
$this->Widget('ext.highcharts.HighchartsWidget', array(
'options'=>array(
'title' => array('text' => 'Fruit Consumption'),
'xAxis' => array(
'categories' => array('Apples', 'Bananas', 'Oranges')
),
'yAxis' => array(
'title' => array('text' => 'Fruit eaten')
),
'series' => array(
array('name' => 'Jane', 'data' => array(1, 0, 4)),
array('name' => 'John', 'data' => array(5, 7, 3))
)
)
));
By configuring the {@link $options} property, you may specify the options
that need to be passed to the Highcharts JavaScript object. Please refer to
the demo gallery and documentation on the {@link http://www.highcharts.com/ Highcharts website} for possible options.
Alternatively, you can use a valid JSON string in place of an associative
array to specify options:
$this->Widget('ext.highcharts.HighchartsWidget', array(
'options'=>'{
"title": { "text": "Fruit Consumption" },
"xAxis": {
"categories": ["Apples", "Bananas", "Oranges"]
},
"yAxis": {
"title": { "text": "Fruit eaten" }
},
"series": [
{ "name": "Jane", "data": [1, 0, 4] },
{ "name": "John", "data": [5, 7,3] }
]
}'
));
Note: You must provide a valid JSON string (e.g. double quotes) when using
the second option. You can quickly validate your JSON string online using
{@link http://jsonlint.com/ JSONLint}.
Note: You do not need to specify the
chart->renderTo
option as
is shown in many of the examples on the Highcharts website. This value is
automatically populated with the id of the widget's container element. If you
wish to use a different container, feel free to specify a custom value.
Показать файл
Открыть проект
Примеры использования класса
Открытые свойства
Открытые методы
Метод |
Описание |
|
run ( ) |
Renders the widget. |
|
Защищенные методы
Метод |
Описание |
|
registerScripts ( $id, $embeddedScript ) |
Publishes and registers the necessary script files. |
|
Описание методов
registerScripts()
защищенный Метод
Publishes and registers the necessary script files.
Описание свойств
$htmlOptions публичное свойство
$options публичное свойство
$scripts публичное свойство