You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
1.9 KiB
86 lines
1.9 KiB
<?php |
|
|
|
namespace App\Admin\Metrics\Examples\Follow; |
|
|
|
use Dcat\Admin\Admin; |
|
use Dcat\Admin\Widgets\ApexCharts\Chart; |
|
|
|
class AllCollegesFollowCharts extends Chart |
|
{ |
|
public function __construct($containerSelector = null, $options = []) |
|
{ |
|
parent::__construct($containerSelector, $options); |
|
|
|
$this->setUpOptions(); |
|
} |
|
|
|
/** |
|
* 初始化图表配置 |
|
*/ |
|
protected function setUpOptions() |
|
{ |
|
$color = Admin::color(); |
|
|
|
$colors = [$color->primary(), $color->primaryDarker()]; |
|
|
|
$this->options([ |
|
'colors' => ['#008ffbd9', '#feb019', '#00e396'], |
|
'chart' => [ |
|
'type' => 'bar', |
|
"height"=>'315px', //高度 |
|
], |
|
'plotOptions' => [ |
|
'bar' => [ |
|
'horizontal' => false, |
|
'columnWidth' => '80%', |
|
'borderRadius' => 5, |
|
'borderRadiusApplication' => 'end' |
|
] |
|
], |
|
'stroke' => [ |
|
'show' => false, |
|
'width' => 3 |
|
], |
|
'xaxis' => [ |
|
'type' => 'category', |
|
], |
|
'tooltip' => [ |
|
'x' => [ |
|
'formatter' => function ($val) { |
|
return $val; |
|
} |
|
] |
|
], |
|
]); |
|
} |
|
|
|
|
|
/** |
|
* 设置图表数据 |
|
* @param array $data |
|
* @return $this |
|
*/ |
|
public function withData(array $data) |
|
{ |
|
return $this->option('series', $data); |
|
} |
|
|
|
/** |
|
* 设置图表类别. |
|
* @param array $data |
|
* @return $this |
|
*/ |
|
public function withCategories(array $data) |
|
{ |
|
return $this->option('xaxis.categories', $data); |
|
} |
|
|
|
/** |
|
* 渲染图表 |
|
* @return string |
|
*/ |
|
public function render() |
|
{ |
|
return parent::render(); |
|
} |
|
}
|
|
|