jqh 5 years ago
parent
commit
88291e1fa5

+ 1 - 1
src/Console/stubs/metrics/NewDevices.stub

@@ -96,4 +96,4 @@ class NewDevices extends DonutChartCard
 HTML
         );
     }
-}
+}

+ 25 - 2
src/Console/stubs/metrics/NewUsers.stub

@@ -39,15 +39,38 @@ class NewUsers extends LineChartCard
      */
     public function handle(Request $request)
     {
+        $generator = function ($len, $min = 10, $max = 300) {
+            for ($i = 0; $i <= $len; $i++) {
+                yield mt_rand($min, $max);
+            }
+        };
+
         switch ($request->get('option')) {
             case '365':
+                // 卡片内容
+                $this->withContent(mt_rand(1000, 5000).'k');
+                // 图表数据
+                $this->withChart(collect($generator(30))->toArray());
+                // 直线
+                break;
             case '30':
+                // 卡片内容
+                $this->withContent(mt_rand(400, 1000).'k');
+                // 图表数据
+                $this->withChart(collect($generator(30))->toArray());
+                // 直线
+                break;
             case '28':
+                // 卡片内容
+                $this->withContent(mt_rand(400, 1000).'k');
+                // 图表数据
+                $this->withChart(collect($generator(28))->toArray());
+                // 直线
+                break;
             case '7':
             default:
                 // 卡片内容
                 $this->withContent('89.2k');
-
                 // 图表数据
                 $this->withChart([28, 40, 36, 52, 38, 60, 55,]);
         }
@@ -90,4 +113,4 @@ class NewUsers extends LineChartCard
 HTML
         );
     }
-}
+}

+ 4 - 8
src/Console/stubs/metrics/Sessions.stub

@@ -8,13 +8,6 @@ use Illuminate\Http\Request;
 
 class Sessions extends BarChartCard
 {
-    /**
-     * 卡片内容宽度.
-     *
-     * @var array
-     */
-    protected $contentWidth = [5, 7];
-
     /**
      * @var array
      */
@@ -36,6 +29,9 @@ class Sessions extends BarChartCard
 
         $dark35 = $color->dark35();
 
+        // 卡片内容宽度
+        $this->contentWidth(5, 7);
+        // 标题
         $this->title('Avg Sessions');
         // 设置下拉选项
         $this->dropdown($this->dropdownItems);
@@ -105,7 +101,7 @@ class Sessions extends BarChartCard
             $this->dropdownItems[request()->option] ?? 'last 7 days'
         );
 
-        $minHeight = '188px';
+        $minHeight = '183px';
 
         return $this->content(
             <<<HTML

+ 1 - 3
src/Console/stubs/metrics/Tickets.stub

@@ -16,7 +16,7 @@ class Tickets extends RadialBarChartCard
 
         $this->title('Tickets');
         $this->height(400);
-        $this->chartHeight(275);
+        $this->chartHeight(300);
         $this->chartLabels('Completed Tickets');
         $this->dropdown([
             '7' => 'Last 7 Days',
@@ -43,10 +43,8 @@ class Tickets extends RadialBarChartCard
             default:
                 // 卡片内容
                 $this->withContent(162);
-
                 // 卡片底部
                 $this->withFooter(29, 63, '1d');
-
                 // 图表数据
                 $this->withChart(83);
         }