Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b649aaef23 | ||
|
|
75f46fc1cf | ||
|
|
11272bd21b | ||
|
|
1e1075ba07 | ||
|
|
1bfa52ca83 | ||
|
|
3add4a148e | ||
|
|
27606ff1e9 | ||
|
|
230b706c63 | ||
|
|
8b0bb9c250 | ||
|
|
c61ca90905 |
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* @asantibanez
|
||||||
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal 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
14
.github/ISSUE_TEMPLATE/feature.md
vendored
Normal 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
18
.github/PULL_REQUEST_TEMPLATE
vendored
Normal 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
29
.github/workflows/phpunit.yml
vendored
Normal 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
1
.gitignore
vendored
@@ -6,3 +6,4 @@ vendor
|
|||||||
coverage
|
coverage
|
||||||
.DS_STORE
|
.DS_STORE
|
||||||
node_modules
|
node_modules
|
||||||
|
.phpunit.result.cache
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ for each type of chart.
|
|||||||
| singleColumn() | Sets chart to display a single column series |
|
| singleColumn() | Sets chart to display a single column series |
|
||||||
| stacked() | Sets chart to display column series stacked |
|
| 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 |
|
| 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 |
|
| onColumnClickEventName(string $eventName) | Event Name that will be fired when a column of the chart is clicked |
|
||||||
|
|
||||||
#### LivewirePieChart
|
#### LivewirePieChart
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.2|^7.3|^7.4",
|
"php": "^7.2|^7.3|^7.4|^8.0",
|
||||||
"illuminate/support": "^7.0|^8.0",
|
"illuminate/support": "^7.0|^8.0",
|
||||||
"livewire/livewire": "^2.3"
|
"livewire/livewire": "^2.3"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<logging>
|
<logging>
|
||||||
<log type="tap" target="build/report.tap"/>
|
<log type="tap" target="build/report.tap"/>
|
||||||
<log type="junit" target="build/report.junit.xml"/>
|
<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-text" target="build/coverage.txt"/>
|
||||||
<log type="coverage-clover" target="build/logs/clover.xml"/>
|
<log type="coverage-clover" target="build/logs/clover.xml"/>
|
||||||
</logging>
|
</logging>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -53,9 +53,7 @@ const areaChart = () => {
|
|||||||
|
|
||||||
colors: [component.get('areaChartModel.color') || '#2E93fA'],
|
colors: [component.get('areaChartModel.color') || '#2E93fA'],
|
||||||
|
|
||||||
stroke: {
|
stroke: component.get('areaChartModel.stroke') || {},
|
||||||
curve: 'straight'
|
|
||||||
},
|
|
||||||
|
|
||||||
title: {
|
title: {
|
||||||
text: title,
|
text: title,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace Asantibanez\LivewireCharts\Models;
|
|||||||
trait HasStroke
|
trait HasStroke
|
||||||
{
|
{
|
||||||
private $stroke;
|
private $stroke;
|
||||||
|
private $width;
|
||||||
|
|
||||||
public function initStroke()
|
public function initStroke()
|
||||||
{
|
{
|
||||||
@@ -17,6 +18,7 @@ trait HasStroke
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'curve' => 'straight',
|
'curve' => 'straight',
|
||||||
|
'width' => 4
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +36,13 @@ trait HasStroke
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setStrokeWidth($width)
|
||||||
|
{
|
||||||
|
data_set($this->stroke, 'width', $width);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
protected function strokeToArray()
|
protected function strokeToArray()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -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
25
tests/LivewireAreaChartTest.php
Executable 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
tests/LivewireColumnChartTest.php
Executable file
25
tests/LivewireColumnChartTest.php
Executable 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
25
tests/LivewireLineChartTest.php
Executable 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
25
tests/LivewirePieChartTest.php
Executable 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
25
tests/TestCase.php
Executable 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=');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user