[extension] exocet/yii2-bootstrap-material-design


yii2-widget-chart

  1. Resources
  2. Installation
  3. Example Usage
  4. Ajax Example Usage
  5. License

Wrapper for CHARTIST.JS library
Resources

Installation The preferred way to install this extension is through composer
Either run
$ php composer.phar require --prefer-dist "exocet/yii2-chart-widget"

or add
{
"require": {
"exocet/yii2-chart-widget": "~1.0"
}
}

to the require section of your composer.json
Example Usage <?php
/* @var $this yii\web\View */

use exocet\yii2\chart\Chart;
use yii\web\JsExpression;

$this->title = 'my example';
$this->params['breadcrumbs'][] = $this->title;

?>
<?php
echo Chart::widget([
'type' => Chart::TYPE_LINE,
'disableCss' => true, //disable chartist css
'label' => true, //enable labels plugin
'labels' => [1, 2, 3, 4],
'series' => [[100, 120, 180, 200]],
'clientOptions' => [
'showLine' => false,
'axisX' => [
'labelInterpolationFnc' => new JsExpression('function(value, index) {
return index % 13 === 0 ? \'W\' + value : null;
}')
]
],
'responsiveOptions' => [
'screen and (min-width: 640px)' => [
'axisX' => [
'labelInterpolationFnc' => new JsExpression('function(value, index) {
return index % 4 === 0 ? \'W\' + value : null;
}')
]
]
]
]);
?>

Ajax Example Usage <?php
/* @var $this yii\web\View */

use exocet\yii2\chart\Chart;
use yii\web\JsExpression;
use yii\helpers\Url;

$this->title = 'my example';
$this->params['breadcrumbs'][] = $this->title;

?>
<?php
echo Chart::widget([
'type' => Chart::TYPE_LINE,
'ajax' => Url::to(['ajax-data']),
]);
?>

License yii2-chart-widget is released under MIT license. See bundled LICENSE for details