Skip to content

Commit

Permalink
Merge branch 'release/0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocfe committed Dec 7, 2022
2 parents abc48d8 + 3ff4bff commit d17107a
Show file tree
Hide file tree
Showing 50 changed files with 2,356 additions and 87 deletions.
29 changes: 27 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Changelog
# Change Log

All notable changes to `filament-apex-charts` will be documented in this file.
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 0.1.1

### Added

- New commands with available chart samples.
- New chart examples.
- Documentation.

### Changed

- Documentation and chart examples.

### Fixed

- Show the message **No chart data available** when the chart option is empty.

## 0.1.0

### Added

- Initial commit.
51 changes: 46 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,34 @@ Start by creating a widget with the command:
php artisan make:filament-apex-charts BlogPostsChart
```

This command will create the BlogPostsChart.php file in app\Filament\Widgets:
### Available chart samples

You may choose:

- Area
- Bar
- Boxplot
- Bubble
- Candlestick
- Column
- Donut
- Heatmap
- Line
- Mixed-LineAndColumn
- Pie
- PolarArea
- Radar
- Radialbar
- RangeArea
- Scatter
- TimelineRangeBars
- Treemap

You may also create an **empty chart** by selecting the **Empty** option.

This command will create the **BlogPostsChart.php** file in _app\Filament\Widgets_. Ex:

```php

namespace App\Filament\Widgets;

use Leandrocfe\FilamentApexCharts\Widgets\ApexChartWidget;
Expand Down Expand Up @@ -61,22 +85,39 @@ class BlogPostsChart extends ApexChartWidget
return [
'chart' => [
'type' => 'bar',
'height' => 300,
],
'series' => [
[
'name' => 'Sales',
'data' => [90, 80, 70, 60, 50, 40, 40, 50, 60, 70, 80, 90],
'name' => 'BlogPostsChart',
'data' => [7, 4, 6, 10, 14, 7, 5, 9, 10, 15, 13, 18],
],
],
'xaxis' => [
'categories' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'yaxis' => [
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'colors' => ['#6366f1'],
];
}
}

```

Now, check out your widget in the **dashboard**.
Now, check out your new widget in the **dashboard**.

## Available options

Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
},
"autoload": {
"psr-4": {
"Leandrocfe\\FilamentApexCharts\\": "src",
"Leandrocfe\\FilamentApexCharts\\Database\\Factories\\": "database/factories"
"Leandrocfe\\FilamentApexCharts\\": "src"
}
},
"autoload-dev": {
Expand Down
22 changes: 22 additions & 0 deletions config/filament-apex-charts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,26 @@
// config for Leandrocfe/FilamentApexCharts
return [

//command options
'chart_options' => [
'Empty',
'Area',
'Bar',
'Boxplot',
'Bubble',
'Candlestick',
'Column',
'Donut',
'Heatmap',
'Line',
'Mixed-LineAndColumn',
'Pie',
'PolarArea',
'Radar',
'Radialbar',
'RangeArea',
'Scatter',
'TimelineRangeBars',
'Treemap',
],
];
16 changes: 15 additions & 1 deletion examples/Area/BasicAreaChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,25 @@ protected function getOptions(): array
'series' => [
[
'name' => 'BasicAreaChart',
'data' => [2, 4, 6, 10, 14, 7, 2, 9, 10, 15, 13, 18],
'data' => [7, 4, 6, 10, 14, 7, 5, 9, 10, 15, 13, 18],
],
],
'xaxis' => [
'categories' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'yaxis' => [
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'colors' => ['#6366f1'],
'stroke' => [
Expand Down
18 changes: 16 additions & 2 deletions examples/Bar/BasicBarChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,30 @@ protected function getOptions(): array
'series' => [
[
'name' => 'BasicBarChart',
'data' => [2, 4, 6, 10, 14],
'data' => [7, 10, 13, 15, 18],
],
],
'xaxis' => [
'categories' => ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'yaxis' => [
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'colors' => ['#6366f1'],
'plotOptions' => [
'bar' => [
'borderRadius' => 4,
'borderRadius' => 3,
'horizontal' => true,
],
],
Expand Down
74 changes: 74 additions & 0 deletions examples/Boxplot/BasicBloxPlotChart.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

namespace App\Filament\Widgets;

use Leandrocfe\FilamentApexCharts\Widgets\ApexChartWidget;

class BasicBloxPlotChart extends ApexChartWidget
{
/**
* Chart Id
*
* @var string
*/
protected static string $chartId = 'basicBloxPlotChart';

/**
* Widget Title
*
* @var string|null
*/
protected static ?string $heading = 'BasicBloxPlotChart';

/**
* Chart options (series, labels, types, size, animations...)
* https://apexcharts.com/docs/options
*
* @return array
*/
protected function getOptions(): array
{
return [
'chart' => [
'type' => 'boxPlot',
'height' => 300,
],
'series' => [
[
'type' => 'boxPlot',
'data' => [
['x' => 'Jan', 'y' => [54, 66, 69, 75, 88]],
['x' => 'Fev', 'y' => [43, 65, 69, 76, 81]],
['x' => 'Mar', 'y' => [31, 39, 45, 51, 59]],
['x' => 'Apr', 'y' => [39, 46, 55, 65, 71]],
['x' => 'May', 'y' => [29, 31, 35, 39, 44]],
],
],
],
'xaxis' => [
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'yaxis' => [
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'plotOptions' => [
'boxPlot' => [
'colors' => [
'upper' => '#6366f1',
'lower' => '#84cc16',
],
],
],
];
}
}
72 changes: 72 additions & 0 deletions examples/Bubble/BasicBubbleChart.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace App\Filament\Widgets;

use Leandrocfe\FilamentApexCharts\Widgets\ApexChartWidget;

class BasicBubbleChart extends ApexChartWidget
{
/**
* Chart Id
*
* @var string
*/
protected static string $chartId = 'basicBubbleChart';

/**
* Widget Title
*
* @var string|null
*/
protected static ?string $heading = 'BasicBubbleChart';

/**
* Chart options (series, labels, types, size, animations...)
* https://apexcharts.com/docs/options
*
* @return array
*/
protected function getOptions(): array
{
return [
'chart' => [
'type' => 'bubble',
'height' => 300,
],
'series' => [
['name' => 'Jan', 'data' => [[49, 12, 10], [24, 31, 10], [54, 20, 14], [52, 25, 67], [13, 69, 53], [55, 61, 55], [13, 70, 41], [45, 56, 61], [60, 21, 23], [48, 30, 69]]],
['name' => 'Feb', 'data' => [[70, 53, 16], [39, 33, 53], [14, 55, 51], [44, 28, 32], [26, 46, 33], [61, 56, 11], [11, 29, 29], [19, 64, 67], [26, 19, 28], [28, 69, 44]]],
['name' => 'Mar', 'data' => [[63, 62, 50], [12, 37, 12], [30, 35, 25], [29, 16, 35], [67, 34, 36], [67, 19, 23], [21, 44, 48], [14, 50, 60], [61, 63, 51], [19, 33, 22]]],
['name' => 'Apr', 'data' => [[22, 14, 29], [57, 12, 63], [65, 63, 61], [56, 27, 44], [61, 54, 41], [43, 69, 12], [65, 68, 42], [56, 33, 42], [46, 48, 12], [54, 56, 12]]],
['name' => 'May', 'data' => [[57, 68, 50], [22, 37, 32], [33, 46, 18], [51, 14, 39], [23, 63, 60], [65, 24, 38], [67, 33, 59], [19, 62, 24], [19, 55, 24], [12, 20, 32]]],
],
'xaxis' => [
'min' => 5,
'max' => 80,
'type' => 'category',
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'yaxis' => [
'min' => 5,
'max' => 80,
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'fill' => [
'opacity' => 0.7,
],
'dataLabels' => [
'enabled' => false,
],
];
}
}
Loading

0 comments on commit d17107a

Please sign in to comment.