你好,我需要認真的幫助,因爲我試過所有的方式,沒有找到答案...所以我真的想顯示圖表,每月計數許多數據,例如1月2日數據,febuary 3數據等......請看看這個弟弟Lavachart顯示每月計數
public function lihatkeluhan(){
$halaman="tindaklayanan";
$keluhan_list=DB::table('keluhans')
->select(DB::raw('id,tanggal,produk,username,area,masalah,status'))->get();
$keluhan_group = keluhan::select(DB::raw('id,tanggal,produk,username,area,masalah,status'))
->get()->groupBy(function($date) {
return Carbon::parse($date->tanggal)->format('m'); // grouping by months
});
foreach ($keluhan_group as $group) {
$count[] = count($group);
}
$bulan = array("Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des");
$count = Count($keluhan_list);
$population = Lava::DataTable();
$population->addDateColumn("Month")
->addNumberColumn('Keluhan');
foreach($keluhan_group as $group){
$population->addRow(["jan",$count]);
}
Lava::LineChart('Population', $population, [
'title' => 'Tahun : 2017',
'titleTextStyle' => [
'color' => '#212F3C',
'fontSize' => 14
]
]);
$ keluhan_group按月 $計數結果用於組是每個月 數據的個數,但IDK的是如何在圖表中顯示...
順便說一句$人口 - > addDateColumn(「Month」)不起作用,它不顯示月份但是年份T_T
再次問候,謝謝哥們。我發現這個錯誤btw,無效的行屬性,數組鍵值(字符串)與值[v | f | p]我應該改變什麼? –
你在哪一行得到錯誤? –
@Merra坦克在DataTable.php行841 idk它在哪裏,我想它是在$人口 –