Skip to content

Commit

Permalink
feat:changes for version 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ArielMejiaDev committed Jul 27, 2021
1 parent 821f9a9 commit e0ad611
Show file tree
Hide file tree
Showing 46 changed files with 1,432 additions and 221 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: run-tests

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [7.4, 8.0]
laravel: [8.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 8.*
testbench: ^6.6

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
34 changes: 32 additions & 2 deletions .idea/larapex-charts.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

[![Total Downloads](https://poser.pugx.org/arielmejiadev/larapex-charts/downloads)](https://packagist.org/packages/arielmejiadev/larapex-charts)

![GitHub Actions](https://github.com/arielmejiadev/larapex-charts/actions/workflows/main.yml/badge.svg)

[![Latest Unstable Version](https://poser.pugx.org/arielmejiadev/larapex-charts/v/unstable)](https://packagist.org/packages/arielmejiadev/larapex-charts)

[![License](https://poser.pugx.org/arielmejiadev/larapex-charts/license)](https://packagist.org/packages/arielmejiadev/larapex-charts)
Expand Down Expand Up @@ -109,3 +111,10 @@ Hey 👋 thanks for considering making a donation, with these donations I can co
<a href="https://www.buymeacoffee.com/arielmejiadev">
<img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=arielmejiadev&button_colour=FF5F5F&font_colour=ffffff&font_family=Cookie&outline_colour=000000&coffee_colour=FFDD00">
</a>

## To do for version 4

- [ ] Add blade directive `@apexchartscdn`
- [ ] Add blade directive `@script($chart)`
- [ ] Add a command to generate a blade component with the boilerplate directives just to include it on any blade file.
- [ ] Add a command to generate a vue component with all the boilerplate to just pass a `chart` prop and include the component on any vue component.
25 changes: 20 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
{
"name": "arielmejiadev/larapex-charts",
"description": "Package to provide easy api to build apex charts on Laravel",
"keywords": [
"arielmejiadev",
"larapex",
"charts",
"apexcharts"
],
"homepage": "https://larapex-charts.netlify.app/",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "ArielMejiaDev",
"email": "arielmejiadev@gmail.com"
}
],
"require": {
"ext-json": "*"
"php": "^7.4|^8.0",
"illuminate/support": "^8.0",
"ext-json": "*"
},
"require-dev": {
"orchestra/testbench": "^6.0",
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
"ArielMejiaDev\\LarapexCharts\\": "src/"
"ArielMejiaDev\\LarapexCharts\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"ArielMejiaDev\\LarapexCharts\\Tests\\": "tests/"
"ArielMejiaDev\\LarapexCharts\\Tests\\": "tests"
}
},
"require-dev": {
"orchestra/testbench": "^4.4"
"scripts": {
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
},
"extra": {
"laravel": {
Expand Down
21 changes: 17 additions & 4 deletions config/larapex-charts.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
<?php
<?php

return [

/*
|--------------------------------------------------------------------------
| Font Options
|--------------------------------------------------------------------------
|
| Here you may specify font family and font color.
|
*/

'font_family' => 'Nunito',

'font_color' => '#373d3f',

/*
|--------------------------------------------------------------------------
| Default Colors for datasets
|--------------------------------------------------------------------------
|
| Here you may specify which hexadecimal colors below you wish
| to use as your default colors pallete.
| to use as your default colors palette in that order.
|
*/

'colors' => [
'#008FFB', '#00E396', '#feb019', '#ff455f', '#775dd0', '#80effe',
'#0077B5', '#ff6384', '#c9cbcf', '#0057ff', '00a9f4', '#2ccdc9', '#5e72e4'
'#0077B5', '#ff6384', '#c9cbcf', '#0057ff', '#00a9f4', '#2ccdc9', '#5e72e4'
]
];
];
23 changes: 21 additions & 2 deletions src/LarapexChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class LarapexChart
protected $type = 'donut';
protected $labels;
protected $fontFamily;
protected $foreColor;
protected $dataset;
protected $height = 500;
protected $width;
Expand Down Expand Up @@ -53,6 +54,8 @@ public function __construct()
$this->toolbar = json_encode(['show' => false]);
$this->zoom = json_encode(['enabled' => true]);
$this->dataLabels = json_encode(['enabled' => false]);
$this->fontFamily = json_encode(config('larapex-charts.font_family'));
$this->foreColor = config('larapex-charts.font_color');
return $this;
}

Expand Down Expand Up @@ -130,6 +133,12 @@ public function setFontFamily($fontFamily) :LarapexChart
return $this;
}

public function setFontColor($fontColor) :LarapexChart
{
$this->foreColor = $fontColor;
return $this;
}

public function setDataset($dataset): LarapexChart
{
$this->dataset = json_encode($dataset);
Expand Down Expand Up @@ -335,6 +344,14 @@ public function fontFamily()
return $this->fontFamily;
}

/**
* @return string
*/
public function foreColor()
{
return $this->foreColor;
}

/**
* @return mixed
*/
Expand Down Expand Up @@ -449,9 +466,10 @@ public function toJson()
'type' => $this->type(),
'height' => $this->height(),
'width' => $this->width(),
'fontFamily' => $this->fontFamily(),
'toolbar' => json_decode($this->toolbar()),
'zoom' => json_decode($this->zoom()),
'fontFamily' => json_decode($this->fontFamily()),
'foreColor' => $this->foreColor(),
],
'plotOptions' => [
'bar' => json_decode($this->horizontal()),
Expand Down Expand Up @@ -493,8 +511,9 @@ public function toVue() :array
'chart' => [
'height' => $this->height(),
'toolbar' => json_decode($this->toolbar()),
'fontFamily' => $this->fontFamily(),
'zoom' => json_decode($this->zoom()),
'fontFamily' => json_decode($this->fontFamily()),
'foreColor' => $this->foreColor(),
],
'plotOptions' => [
'bar' => json_decode($this->horizontal()),
Expand Down

0 comments on commit e0ad611

Please sign in to comment.