yii2-developer / yii2-chartjs
ChartJs widget for Yii2.
This package's canonical repository appears to be gone and the package has been frozen as a result.
dev-master
2018-04-11 20:52 UTC
Requires
- php: >=7.1.0
- bower-asset/chartjs: ~2.6
- yiisoft/yii2: ~2.0.12
This package is not auto-updated.
Last update: 2022-01-28 08:50:53 UTC
README
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yii2-developer/yii2-chartjs "*"
or add
"yii2-developer/yii2-charjs": "*"
to the require section of your composer.json
file.
Use
use zima\chartjs\ChartJs;
<?= ChartJs::widget([
'type' => 'line',
'options' => [
'height' => 400,
'width' => 400
],
'data' => [
'labels' => ["January", "February", "March", "April", "May", "June", "July"],
'datasets' => [
[
'label' => "My First dataset",
'backgroundColor' => "rgba(179,181,198,0.2)",
'borderColor' => "rgba(179,181,198,1)",
'pointBackgroundColor' => "rgba(179,181,198,1)",
'pointBorderColor' => "#fff",
'pointHoverBackgroundColor' => "#fff",
'pointHoverBorderColor' => "rgba(179,181,198,1)",
'data' => [65, 59, 90, 81, 56, 55, 40]
],
[
'label' => "My Second dataset",
'backgroundColor' => "rgba(255,99,132,0.2)",
'borderColor' => "rgba(255,99,132,1)",
'pointBackgroundColor' => "rgba(255,99,132,1)",
'pointBorderColor' => "#fff",
'pointHoverBackgroundColor' => "#fff",
'pointHoverBorderColor' => "rgba(255,99,132,1)",
'data' => [28, 48, 40, 19, 96, 27, 100]
]
]
]
]);