primary(), $color->alpha('blue2', 0.5)]; $this->title('New Devices'); $this->subTitle('Last 30 days'); $this->chartLabels($this->labels); // 设置图表颜色 $this->chartColors($colors); } /** * 渲染模板 * * @return string */ public function render() { $this->fill(); return parent::render(); } /** * 写入数据. * * @return void */ public function fill() { $this->withContent(44.9, 28.6); // 图表数据 $this->withChart([44.9, 28.6]); } /** * 设置图表数据. * * @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) { $blue = Admin::color()->alpha('blue2', 0.5); $style = 'margin-bottom: 8px'; $labelWidth = 120; return $this->content( <<
{$this->labels[0]}
{$desktop}
{$this->labels[1]}
{$mobile}
HTML ); } }