10 Commits

Author SHA1 Message Date
asantibanez
b649aaef23 Added CI setup and PR templates 2020-12-16 09:27:18 -05:00
asantibanez
75f46fc1cf Updated .gitignore 2020-12-16 09:27:01 -05:00
asantibanez
11272bd21b Added base tests for components 2020-12-16 09:26:37 -05:00
Andrés Santibáñez
1e1075ba07 Merge pull request #24 from AlexHupe/patch-2
Add method 'addSeriesColumn' to readme
2020-12-16 08:55:51 -05:00
Andrés Santibáñez
1bfa52ca83 Merge pull request #26 from mokhosh/patch-1
Add support for php 8.0
2020-12-16 08:55:01 -05:00
Mo Khosh
3add4a148e Add support for php 8.0
Modify composer.json to allow php 8.0
2020-12-16 11:47:43 +03:30
Alexander Hupe
27606ff1e9 Add method 'addSeriesColumn' to readme 2020-12-07 16:33:03 +01:00
Andrés Santibáñez
230b706c63 Merge pull request #11 from hamidafghan/ifix-stroke-width
Added stroke width customization
2020-11-30 12:59:20 -05:00
Andrés Santibáñez
8b0bb9c250 Added custom stroke for Area Chart 2020-11-30 12:58:19 -05:00
hamidafghan
c61ca90905 Add stroke width 2020-11-24 10:36:09 +04:30
18 changed files with 228 additions and 27 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1 @@
* @asantibanez

26
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. '...'
2. '...'
3. '...'
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.
**Solution Ideas**
Initial thoughts or details about how this could be fixed

14
.github/ISSUE_TEMPLATE/feature.md vendored Normal file
View File

@@ -0,0 +1,14 @@
---
name: Feature
about: New feature idea
---
### Summary
What's the new feature about? What should it do?
### Proposal
How should it work? API ideas?
### Additional Notes
Reference links or comments

18
.github/PULL_REQUEST_TEMPLATE vendored Normal file
View File

@@ -0,0 +1,18 @@
## Summary
[Provide a summary of the change.]
## Issue
[If exists, provide a link to the corresponding issue(s).]
## Type of Change
- [ ] :rocket: New Feature
- [ ] :bug: Bug Fix
- [ ] :hammer: Refactor
- [ ] :question: [Other]
## Screenshot/Video
[Provide a screenshot or video that describes the change if applicable]

29
.github/workflows/phpunit.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: PHPUnit
on: [push]
jobs:
phpunit:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Run
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, exif, imagick, bcmath
coverage: none
- name: Checkout code
uses: actions/checkout@v2
- name: Install Composer dependencies
run: composer install --ignore-platform-reqs
- name: Run tests
run: ./vendor/bin/phpunit

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ vendor
coverage
.DS_STORE
node_modules
.phpunit.result.cache

View File

@@ -188,6 +188,7 @@ for each type of chart.
| singleColumn() | Sets chart to display a single column series |
| stacked() | Sets chart to display column series stacked |
| addColumn(string $title, double $value, string $color, array $extras = []) | Adds a column to the chart with the specified color. `$extras` is forwarded on click event |
| addSeriesColumn(string $seriesName, string $title, double $value, array $extras = []) | Adds a column to a multicolumn chart. `$extras` is forwarded on click event |
| onColumnClickEventName(string $eventName) | Event Name that will be fired when a column of the chart is clicked |
#### LivewirePieChart

View File

@@ -16,7 +16,7 @@
}
],
"require": {
"php": "^7.2|^7.3|^7.4",
"php": "^7.2|^7.3|^7.4|^8.0",
"illuminate/support": "^7.0|^8.0",
"livewire/livewire": "^2.3"
},

View File

@@ -22,7 +22,7 @@
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>

File diff suppressed because one or more lines are too long

View File

@@ -53,9 +53,7 @@ const areaChart = () => {
colors: [component.get('areaChartModel.color') || '#2E93fA'],
stroke: {
curve: 'straight'
},
stroke: component.get('areaChartModel.stroke') || {},
title: {
text: title,

View File

@@ -7,6 +7,7 @@ namespace Asantibanez\LivewireCharts\Models;
trait HasStroke
{
private $stroke;
private $width;
public function initStroke()
{
@@ -17,6 +18,7 @@ trait HasStroke
{
return [
'curve' => 'straight',
'width' => 4
];
}
@@ -34,6 +36,13 @@ trait HasStroke
return $this;
}
public function setStrokeWidth($width)
{
data_set($this->stroke, 'width', $width);
return $this;
}
protected function strokeToArray()
{
return [

View File

@@ -1,21 +0,0 @@
<?php
namespace Asantibanez\LivewireCharts\Tests;
use Orchestra\Testbench\TestCase;
use Asantibanez\LivewireCharts\LivewireChartsServiceProvider;
class ExampleTest extends TestCase
{
protected function getPackageProviders($app)
{
return [LivewireChartsServiceProvider::class];
}
/** @test */
public function true_is_true()
{
$this->assertTrue(true);
}
}

25
tests/LivewireAreaChartTest.php Executable file
View File

@@ -0,0 +1,25 @@
<?php
namespace Asantibanez\LivewireCharts\Tests;
use Asantibanez\LivewireCharts\Charts\LivewireAreaChart;
use Livewire\Livewire;
use Livewire\Testing\TestableLivewire;
class LivewireAreaChartTest extends TestCase
{
private function buildComponent() : TestableLivewire
{
return Livewire::test(LivewireAreaChart::class);
}
/** @test */
public function can_build_component()
{
//Act
$component = $this->buildComponent();
//Assert
$this->assertNotNull($component);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Asantibanez\LivewireCharts\Tests;
use Asantibanez\LivewireCharts\Charts\LivewireColumnChart;
use Livewire\Livewire;
use Livewire\Testing\TestableLivewire;
class LivewireColumnChartTest extends TestCase
{
private function buildComponent() : TestableLivewire
{
return Livewire::test(LivewireColumnChart::class);
}
/** @test */
public function can_build_component()
{
//Act
$component = $this->buildComponent();
//Assert
$this->assertNotNull($component);
}
}

25
tests/LivewireLineChartTest.php Executable file
View File

@@ -0,0 +1,25 @@
<?php
namespace Asantibanez\LivewireCharts\Tests;
use Asantibanez\LivewireCharts\Charts\LivewireLineChart;
use Livewire\Livewire;
use Livewire\Testing\TestableLivewire;
class LivewireLineChartTest extends TestCase
{
private function buildComponent() : TestableLivewire
{
return Livewire::test(LivewireLineChart::class);
}
/** @test */
public function can_build_component()
{
//Act
$component = $this->buildComponent();
//Assert
$this->assertNotNull($component);
}
}

25
tests/LivewirePieChartTest.php Executable file
View File

@@ -0,0 +1,25 @@
<?php
namespace Asantibanez\LivewireCharts\Tests;
use Asantibanez\LivewireCharts\Charts\LivewirePieChart;
use Livewire\Livewire;
use Livewire\Testing\TestableLivewire;
class LivewirePieChartTest extends TestCase
{
private function buildComponent() : TestableLivewire
{
return Livewire::test(LivewirePieChart::class);
}
/** @test */
public function can_build_component()
{
//Act
$component = $this->buildComponent();
//Assert
$this->assertNotNull($component);
}
}

25
tests/TestCase.php Executable file
View File

@@ -0,0 +1,25 @@
<?php
namespace Asantibanez\LivewireCharts\Tests;
use Asantibanez\LivewireCharts\LivewireChartsServiceProvider;
use Livewire\LivewireServiceProvider;
use Orchestra\Testbench\TestCase as BaseTestCase;
class TestCase extends BaseTestCase
{
protected function getPackageProviders($app)
{
return [
LivewireServiceProvider::class,
LivewireChartsServiceProvider::class
];
}
protected function getEnvironmentSetUp($app)
{
$app['config']->set('app.key', 'base64:Hupx3yAySikrM2/edkZQNQHslgDWYfiBfCuSThJ5SK8=');
}
}