| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace UCore\DcatAdmin\Metrics\Examples;
- use Dcat\Admin\Widgets\Metrics\RadialBar;
- use Illuminate\Support\Str;
- /**
- * 显示多个数值
- * 一行
- */
- class NumberS2 extends RadialBar
- {
- protected $contentWidth = [12, 0];
- protected $chartPullRight =true;
- protected $decimal_places = 2;
- /**
- * 初始化卡片内容
- */
- protected function init()
- {
- $this->id('metric-card-'.Str::random(8));
- $this->class('card');
- $this->height(130);
- $this->dropdown([
- '1' => '最近 1 天',
- '7' => '最近 7 天',
- '30' => '最近 30 天',
- '90' => '最近 90 天',
- ]);
- }
- /**
- * 卡片内容.
- *
- * @param string $new
- * @param string $open
- * @param string $response
- *
- * @return $this
- */
- public function withContent($dataList )
- {
- $string = '';
- foreach ($dataList as $key => $value) {
- $value = number_format(floatval( $value), $this->decimal_places);
- $string .= <<<HTML
- <div class="text-center">
- <p>$key</p>
- <span class="font-md-5">{$value}</span>
- </div>
- HTML;
- }
- return $this->content(
- <<<HTML
- <div class="d-flex justify-content-between p-1" style="padding-top: 15px !important;">
- $string
- </div>
- HTML
- );
- }
- }
|