chart
Hello everyone,
Is there some way to display in the dashboard, more than one graph in a single widget?
18 Replies
If you create a custom dashboard, you may be able to customize the Blade view and group your charts into a single Card component.
(still multiple widgets, but visually grouped)
thanks for your answer,
but where can I find some examples of use,
in the documentation it seems to me there is written only to create the file
Multiple lines on the graph? or multiple graphs?
what wrong with multiple widgets?
multiple graphs, because if I make multiple widgets, I should have the same header, as they are the result of the same set of input parameters, but displayed differently (for example average, monthly or weekly).
You could create a single chart and use filters?
I could, but I need to figure out how it works,
I can't find a working example
If you create a custom Dashboard page with a custom view, this is what I'm thinking about:
https://filamentphp.com/docs/2.x/admin/dashboard/getting-started#customizing-the-dashboard-page
where can i find an example of a graph with filter?
Filament
Charts - Dashboard - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
It's in the docs
https://filamentphp.com/docs/2.x/admin/dashboard/charts#available-chart-types
in this link I read that there is a special class to use a specific graph.
Is there a generic graph class where I can specify which graph I need?
or rather, is there any method I can use to specify the type of graph I need?
Filament
Charts - Dashboard - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
Yes there is
Filament\Widgets\ChartWidget
https://github.com/filamentphp/filament/blob/2.x/packages/admin/src/Widgets/ChartWidget.php
You can use the getType
method to specify the type of chart
For an example see: https://github.com/filamentphp/filament/blob/2.x/packages/admin/src/Widgets/BarChartWidget.phpthis example is great:
https://github.com/filamentphp/filament/blob/2.x/packages/admin/src/Widgets/BarChartWidget.php
but unfortunately in the mount I can't pass a type string parameter, because it is incompatible with the ChartWidget class mount declaration
GitHub
filament/packages/admin/src/Widgets/BarChartWidget.php at 2.x · fil...
Admin panel, form builder and table builder for Laravel. Built with the TALL stack. Designed for humans. - filament/packages/admin/src/Widgets/BarChartWidget.php at 2.x · filamentphp/filament
can I pass parameters to individual elements of this array?
:widgets="[
App\Filament\Widgets\ChartOne::class,
App\Filament\Widgets\ChartTwo::class,
App\Filament\Widgets\ChartThree::class,
]"in my case I would pass directly the data to display,
or even a simple string
Oh sorry, this is for all widgets. I don't think there's an easy way to do individual widgets.
Have a look at the template : vendor/filament/filament/resources/views/components/widgets.blade.php
Maybe this can give you an idea to handle the widgets individually.
and how passing variable from custom dashboard ?
this is a found solution, even if I don't really like it and that it could be done better
in laravel\config\filament.php dashboard changed laravel\Modules\MyModule\Filament\Pages\Dashboard.php laravel\Modules\MyModule\Filament\Widgets\ChartsWidget.php
where I pass the parameters I need, in this case the ids his blade component created and called laravel\Modules\MyModule\Http\Livewire\QuestionChart.php I repeat, it is a solution, but it could be done better
in laravel\config\filament.php dashboard changed laravel\Modules\MyModule\Filament\Pages\Dashboard.php laravel\Modules\MyModule\Filament\Widgets\ChartsWidget.php
where I pass the parameters I need, in this case the ids his blade component created and called laravel\Modules\MyModule\Http\Livewire\QuestionChart.php I repeat, it is a solution, but it could be done better
I managed to view some graphs inside the card (see photo).
this is the blade code
unfortunately each graph is giant and one above the other, in a single column.
how can I change the blade so that the graphs are displayed on one line?