Stats and Charts
Hay Is there any way to use stats in pie chart .... I've aleady seen a plugin static widget charts but I don't wanna use plugin is there any other way to get counts from database in pie chart??ty
8 Replies
There is
Filament\Widgets\PieChartWidget
in filament 2.x, have you tried it?Yes I know pie chart widget but how can I use stats in chart that’s what I’m asking about .. by using getCards or what ? Idk @Patrick Boivin
Wouldn’t the counts from the db just be the data for the pie chart? Not following what you’re asking when you say ‘stats’.
@awcodes
Prospect::all()->count()
Prospect::whereDate('created_at', today())->count()) I mean how can i use this in pie chart because syntax for charts are sorted by filters and tren value in doc.
Prospect::whereDate('created_at', today())->count()) I mean how can i use this in pie chart because syntax for charts are sorted by filters and tren value in doc.
Solution
So merge the data into an array to provide that array as the charts data.
You don’t have to use trend. But you certainly can. You just need to manipulate the data before passing it to the dataset array.
done with that Thanks @awcodes but how can I display Percentage on it .. I'm using $interestedPercentage = ($prospectsInterested / $prospectsCount ) * 100; and returning it in dataset but I can't see the percentage (eg.80%) with symbol
I have no idea. You’d have to dig into chartjs to see how to apply that.