title('任务堆积'); $this->height(330); $this->chartHeight(320); } /** * 处理请求 * * @param Request $request * * @return mixed|void */ public function handle(Request $request) { $list = Base::getList('job', 'wait',20); $datas =[]; $xd = []; foreach ($list as $value){ array_unshift($datas, $value->number); array_unshift($xd, $value->pvar); } // 图表数据 $this->withChart($datas,$xd); } /** * 设置图表数据. * * @param array $data * * @return $this */ public function withChart(array $data, array $categories) { $this->chart([ 'chart' => [ 'type' => 'area', 'toolbar' => [ 'show' => false, ], ], 'series' => [ [ 'name' => $this->title, 'data' => $data, ], ], 'dataLabels' => [ 'enabled' => true ], 'xaxis' => [ 'type' => 'number', 'categories' => $categories, 'labels' => [ 'show' => true, ], 'axisBorder' => [ 'show' => true, ], ], 'tooltip' => [ 'x' => [ 'show' => true ] ], ]); } }