具有多个用户数据的图表js

我在图表上工作,但是只输出一个用户的数据

    $data = collect([]); // Could also be an array

        for ($months_backwards = 2; $months_backwards >= 0; $months_backwards--) {
            // Could also be an array_push if using an array rather than a collection.
            $actMonth = Carbon::now();
            $data->push(Slaughter::whereDate('dateOfDisplacement',$actMonth->subMonth($months_backwards))->count());
        }

        $chart1 = new AnimalChart;
        $chart1->labels(['2 months ago','Last Month','Current Month']);
        $chart1->dataset('Animal Slaughtered','line',$data)
            ->color($borderColors)
            ->backgroundcolor($fillColors);
 return view('admin.index',compact(['users','chart','chart1','chart2']));
    }

这是输出所有被宰杀的动物,但仅输出给第一个农场,而不是全部。换句话说,它仅输出动物farm_id为1(并非全部)的屠宰详细信息

muma96132 回答:具有多个用户数据的图表js

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3157961.html

大家都在问