F
Filament16mo ago
Noor

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
Solution:
So merge the data into an array to provide that array as the charts data.
Jump to solution
8 Replies
Patrick Boivin
Patrick Boivin16mo ago
There is Filament\Widgets\PieChartWidget in filament 2.x, have you tried it?
Noor
NoorOP16mo ago
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
awcodes
awcodes16mo ago
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’.
Noor
NoorOP16mo ago
@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.
Solution
awcodes
awcodes16mo ago
So merge the data into an array to provide that array as the charts data.
awcodes
awcodes16mo ago
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.
Noor
NoorOP16mo ago
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
awcodes
awcodes16mo ago
I have no idea. You’d have to dig into chartjs to see how to apply that.
Want results from more Discord servers?
Add your server