primary(), $color->alpha('blue2', 0.5),Admin::color()->yellow()]; $this->title('入驻比例');; $this->chartLabels($this->labels); // 设置图表颜色 $this->chartColors($colors); } /** * 渲染模板 * * @return string */ public function render() { $this->fill(); return parent::render(); } /** * 写入数据. * * @return void */ public function fill() { $agent = Agent::query()->count(); $supplier = Supplier::query()->count(); $guide = Guide::query()->count(); $this->withContent($agent, $supplier, $guide); // 图表数据 $this->withChart([$agent, $supplier, $guide]); } /** * 设置图表数据. * * @param array $data * * @return $this */ public function withChart(array $data) { return $this->chart([ 'series' => $data ]); } /** * 设置卡片头部内容. * * @param mixed $desktop * @param mixed $mobile * * @return $this */ protected function withContent($desktop, $mobile, $unkonw) { $blue = Admin::color()->alpha('blue2', 0.5); $yellow = Admin::color()->yellow(); $style = 'margin-bottom: 8px'; $labelWidth = 120; return $this->content( <<