PHP code example of leandrocfe / filament-apex-charts
1. Go to this page and download the library: Download leandrocfe/filament-apex-charts library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
leandrocfe / filament-apex-charts example snippets
use Leandrocfe\FilamentApexCharts\FilamentApexChartsPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentApexChartsPlugin::make()
]);
}
protected function isCollapsible(): bool
{
return true;
}
protected static ?int $contentHeight = 300; //px
protected function getContentHeight(): ?int
{
return 300;
}
protected static ?string $footer = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.';
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Contracts\View\View;
protected function getFooter(): null|string|Htmlable|View
{
return view('custom-footer', ['text' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.']);
}
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Contracts\View\View;
protected function getFooter(): null|string|Htmlable|View
{
return new HtmlString('<p class="text-danger-500">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>');
}
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
use Filament\Widgets\ChartWidget\Concerns\HasFiltersSchema;
use Leandrocfe\FilamentApexCharts\Widgets\ApexChartWidget;
class BlogPostsChart extends ApexChartWidget
{
use HasFiltersSchema;
public function filtersSchema(Schema $schema): Schema
{
return $schema->components([
TextInput::make('title')
->default('Blog Posts Chart'),
DatePicker::make('date_start')
->default('2025-07-01'),
DatePicker::make('date_end')
->default('2025-07-31'),
]);
}
/**
* Use this method to update the chart options when the filter form is submitted.
*/
public function updatedInteractsWithSchemas(string $statePath): void
{
$this->updateOptions();
}
}