slavkovrn / yii2-googlechart
Yii2 Google Chart
Installs: 43
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0
This package is auto-updated.
Last update: 2024-10-26 03:50:47 UTC
README
http://yii2.kadastrcard.ru/googlechart
The extension uses Google library https://www.gstatic.com/charts/loader.js and makes chart from php array of structure defined.
Installation
Install with composer:
composer require slavkovrn/yii2-googlechart
or add
"slavkovrn/yii2-googlechart": "*"
to the require section of your composer.json
file.
Set link to extension in your view:
use slavkovrn\googlechart\GoogleChartWidget; $data = [ 'SIN' => [ number_format(0,5) => sin(0), number_format(Pi()/4,5) => sin(Pi()/4), number_format(Pi()/2,5) => sin(Pi()/2), number_format(Pi()/2+Pi()/4,5) => sin(Pi()/2+Pi()/4), number_format(Pi(),5) => sin(Pi()), number_format(Pi()+Pi()/4,5) => sin(Pi()+Pi()/4), number_format(Pi()+Pi()/2,5) => sin(Pi()+Pi()/2), number_format(Pi()+Pi()/2+Pi()/4,5) => sin(Pi()+Pi()/2+Pi()/4), number_format(2*Pi(),5) => sin(2*Pi()), ], 'COS' => [ number_format(0,5) => cos(0), number_format(Pi()/4,5) => cos(Pi()/4), number_format(Pi()/2,5) => cos(Pi()/2), number_format(Pi()/2+Pi()/4,5) => cos(Pi()/2+Pi()/4), number_format(Pi(),5) => cos(Pi()), number_format(Pi()+Pi()/4,5) => cos(Pi()+Pi()/4), number_format(Pi()+Pi()/2,5) => cos(Pi()+Pi()/2), number_format(Pi()+Pi()/2+Pi()/4,5) => cos(Pi()+Pi()/2+Pi()/4), number_format(2*Pi(),5) => cos(2*Pi()), ], ]; echo GoogleChartWidget::widget([ 'id' =>'google-chart', 'title' => 'Google Chart', 'style' => 'width:100%', 'data' => $data, ]);