-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor improvements and PHP7.3 support
- Loading branch information
Showing
11 changed files
with
250 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
* PHP: v7.0.0 | ||
* Laravel: v5.5.0 | ||
|
||
|
||
### Description: | ||
|
||
|
||
### Steps To Reproduce: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
/vendor/ | ||
.idea | ||
/vendor | ||
/.idea | ||
composer.phar | ||
.DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
install: composer install | ||
language: php | ||
|
||
php: | ||
- '7.1' | ||
- '7.2' | ||
- nightly | ||
- '7.3' | ||
|
||
install: travis_retry composer install --no-interaction --prefer-dist --no-suggest | ||
|
||
script: vendor/bin/phpunit --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Examples | ||
|
||
## Table of Contents | ||
- [Std Chart](#std-chart) | ||
- [Helper class](#helper-class) | ||
- [Begin At Zero](#begin-at-zero) | ||
- [Mixed Chart Type](#mixed-chart-type) | ||
|
||
|
||
#### Std Chart | ||
```php | ||
$chart = app(Bbsnly\ChartJs\Chart::class); | ||
|
||
$chart->type = 'bar'; | ||
|
||
$data = new Data; | ||
|
||
$datasets = [ | ||
(new Dataset)->data([10, 20, 30, 40])->label('Bar Dataset'), | ||
(new Dataset)->data([50, 50, 50, 50])->label('Line Dataset'), | ||
]; | ||
|
||
$data->datasets($datasets)->labels(['January', 'February', 'March', 'April']); | ||
|
||
$chart->data($data); | ||
``` | ||
|
||
|
||
#### Helper class | ||
```php | ||
$chart = new Bbsnly\ChartJs\BarChart; | ||
|
||
$data = new Data; | ||
|
||
$datasets = [ | ||
(new Dataset)->data([10, 20, 30, 40])->label('Bar Dataset'), | ||
(new Dataset)->data([50, 50, 50, 50])->label('Line Dataset'), | ||
]; | ||
|
||
$data->datasets($datasets)->labels(['January', 'February', 'March', 'April']); | ||
|
||
$chart->data($data); | ||
``` | ||
|
||
|
||
#### Begin At Zero | ||
```php | ||
$chart = app(Bbsnly\ChartJs\Chart::class); | ||
|
||
$chart->type = 'bar'; | ||
|
||
$data = new Data; | ||
|
||
$datasets = [ | ||
(new Dataset)->data([10, 20, 30, 40])->label('Bar Dataset'), | ||
(new Dataset)->data([50, 50, 50, 50])->label('Line Dataset'), | ||
]; | ||
|
||
$data->datasets($datasets)->labels(['January', 'February', 'March', 'April']); | ||
|
||
$chart->data($data); | ||
|
||
$chart->beginAtZero(); | ||
``` | ||
|
||
|
||
#### Mixed Chart Type | ||
```php | ||
$chart = new app(Bbsnly\ChartJs\Chart::class); | ||
|
||
$chart->type = 'bar'; | ||
|
||
$data = new Data; | ||
|
||
$datasets = [ | ||
(new Dataset)->data([10, 20, 30, 40])->label('Bar Dataset'), | ||
(new Dataset)->data([50, 50, 50, 50])->label('Line Dataset')->type('line'), | ||
]; | ||
|
||
$data->datasets($datasets)->labels(['January', 'February', 'March', 'April']); | ||
|
||
$chart->data($data); | ||
|
||
$chart->get(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Extend | ||
To configure your chart you can use the `Config` class directly or helpers | ||
like `Dataset` or `Options`. | ||
|
||
You can extend it and add a helper you need (ex. `Scales`). | ||
|
||
You should implement the `ConfigInterface` when creating a new config helper. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# ChartJS-PHP | ||
|
||
<p align="center"> | ||
<a href="https://packagist.org/packages/bbsnly/chartjs-php"><img src="https://poser.pugx.org/bbsnly/chartjs-php/d/total.svg" alt="Total Downloads"></a> | ||
<a href="https://packagist.org/packages/bbsnly/chartjs-php"><img src="https://poser.pugx.org/bbsnly/chartjs-php/v/stable.svg" alt="Latest Stable Version"></a> | ||
<a href="https://travis-ci.org/bbsnly/chartjs-php"><img src="https://travis-ci.org/bbsnly/chartjs-php.svg?branch=master" alt="License"></a> | ||
<a href="https://packagist.org/packages/bbsnly/chartjs-php"><img src="https://poser.pugx.org/bbsnly/chartjs-php/license.svg" alt="License"></a> | ||
</p> | ||
|
||
This package helps you to generate [ChartJS](http://www.chartjs.org/ "ChartJS") element directly in PHP. | ||
|
||
|
||
## Table of Contents | ||
- [Install](#install) | ||
- [Requirements](#requirements) | ||
- [Charts](#charts) | ||
- [Usage](usage.md) | ||
- [Examples](examples.md) | ||
- [Extend](extend.md) | ||
- [Contributing](#contributing) | ||
- [License](#license) | ||
|
||
|
||
## Install | ||
Require this package with composer. | ||
```shell | ||
composer require bbsnly/chartjs-php | ||
``` | ||
|
||
|
||
## Requirements | ||
* `php >= 7.1` | ||
* `ChartJS >= 2.0` | ||
|
||
|
||
## Charts | ||
* [Line](http://www.chartjs.org/docs/latest/charts/line.html) | ||
* [Bar](http://www.chartjs.org/docs/latest/charts/bar.html) | ||
* [Radar](http://www.chartjs.org/docs/latest/charts/radar.html) | ||
* [Doughnut](http://www.chartjs.org/docs/latest/charts/doughnut.html) | ||
* [Pie](http://www.chartjs.org/docs/latest/charts/doughnut.html) | ||
* [Polar Area](http://www.chartjs.org/docs/latest/charts/polar.html) | ||
* [Bubble](http://www.chartjs.org/docs/latest/charts/bubble.html) | ||
* [Scatter](http://www.chartjs.org/docs/latest/charts/scatter.html) | ||
* [Mixed](http://www.chartjs.org/docs/latest/charts/mixed.html) | ||
|
||
Also it is possible to use the package with [New Charts](http://www.chartjs.org/docs/latest/developers/charts.html) | ||
using the `Chart` class | ||
|
||
|
||
## Contributing | ||
Thank you for considering contributing to the ChartJS PHP! | ||
|
||
|
||
## License | ||
The ChartJS PHP is open-sourced software licensed under the | ||
[MIT license](http://opensource.org/licenses/MIT). |
Oops, something went wrong.