diff --git a/resources/views/components/ib-apex-chart.blade.php b/resources/views/components/ib-apex-chart.blade.php index d142666..61e37d2 100644 --- a/resources/views/components/ib-apex-chart.blade.php +++ b/resources/views/components/ib-apex-chart.blade.php @@ -1,7 +1,7 @@ -@props(['data' => [], 'name' => 'apex-chart' ]) +@props(['seriesData' => [], 'name' => 'apex-chart' ]) @php - $data = array_merge([ + $seriesData = array_merge([ 'chart' => [ 'type' => "area", 'stacked' => true, @@ -40,6 +40,10 @@ 'axisTicks' => [ 'show' => false ], + 'labels' => [ + 'offsetX' => 15, + 'offsetY' => 0 + ], 'tooltip' => [ 'enabled' => false ] @@ -65,30 +69,37 @@ 'legend' => [ 'show' => false, ], - ], $data); - $data = json_encode($data) + ], $seriesData); + $seriesData = json_encode($seriesData) @endphp
-
+
diff --git a/resources/views/components/ib-toolbar.blade.php b/resources/views/components/ib-toolbar.blade.php index c8e4da1..575dc1c 100644 --- a/resources/views/components/ib-toolbar.blade.php +++ b/resources/views/components/ib-toolbar.blade.php @@ -1,6 +1,6 @@ @props(['title' => '']) -
merge(['class' => 'flex mb-6']) }} class=""> +
merge(['class' => 'flex items-center mb-6']) }} class="">

{{ $title }}

{{ $slot }} diff --git a/resources/views/livewire/dashboard.blade.php b/resources/views/livewire/dashboard.blade.php index 96f031d..1c4ecc7 100644 --- a/resources/views/livewire/dashboard.blade.php +++ b/resources/views/livewire/dashboard.blade.php @@ -30,96 +30,92 @@ new class extends Component { public ?Portfolio $portfolio; - public array $myChart = [ - 'type' => 'line', - 'data' => [ - 'labels' => ['Jan', 'Feb', 'Mar', 'Apr', 'May'], - 'datasets' => [ - [ - 'label' => '# of Votes', - 'data' => [2000, 2204, 3001, 2981, 2845], - 'tension' => 0.4, - 'pointStyle' => 'rect', - 'pointRadius' => 4, - 'pointHoverRadius' => 6 - ], - - ] - ], - 'options' => [ - 'scales' => [ - // 'y' => [ - // 'display' => false, - // ], - 'x' => [ - // 'type' => 'time', - 'time' => [ - // Luxon format string - // 'tooltipFormat' => 'DD' - ], - ], - ], - 'aspectRatio' => 0, - 'plugins' => [ - 'htmlLegend' => [ - // ID of the container to put the legend in - 'containerID' => 'chart-legend', - ], - 'legend' => [ - 'display' => false, - // 'position' => 'right' - ] - ] - ] - ]; + private function generateDateSeries($startDate, $endDate) { + $dateArray = []; + $currentDate = strtotime($startDate); + $endDate = strtotime($endDate); + + while ($currentDate <= $endDate) { + // Generate a random integer + $randomInt = rand(1000, 3000); + + // Format the current date to 'Y-m-d' + $formattedDate = date('Y-m-d', $currentDate); + + // Append the date and random integer to the array + $dateArray[] = [$formattedDate, $randomInt]; + + // Move to the next day + $currentDate = strtotime("+1 day", $currentDate); + } + + return $dateArray; + } + + public array $myChart; + + public function mount() { + + $this->myChart = [ + 'series' => [ + [ + 'name' => 'Total Views', + 'data' => $this->generateDateSeries('2024-01-01', '2024-08-01') + ], + [ + 'name' => 'Second Views', + 'data' => $this->generateDateSeries('2024-01-01', '2024-08-01') + ], + ], + + ]; + + } }; ?>
-
- + - -
- -
- -

Performance

-
- -
- - - - @foreach($options as $option) - - - - @endforeach - - +
+ +
+ +

Performance

+
+ + + + + @foreach($options as $option) + + + + @endforeach + + -
- -
- +
+ +
+ +
- -
- +
+
'line', - 'data' => [ - 'labels' => ['Jan', 'Feb', 'Mar', 'Apr', 'May'], - 'datasets' => [ + private function generateDateSeries($startDate, $endDate) { + $dateArray = []; + $currentDate = strtotime($startDate); + $endDate = strtotime($endDate); + + while ($currentDate <= $endDate) { + // Generate a random integer + $randomInt = rand(1000, 3000); + + // Format the current date to 'Y-m-d' + $formattedDate = date('Y-m-d', $currentDate); + + // Append the date and random integer to the array + $dateArray[] = [$formattedDate, $randomInt]; + + // Move to the next day + $currentDate = strtotime("+1 day", $currentDate); + } + + return $dateArray; + } + + public array $myChart; + + public function mount() { + + $this->myChart = [ + 'series' => [ [ - 'label' => '# of Votes', - 'data' => [2000, 2204, 3001, 2981, 2845], - 'tension' => 0.4, - 'pointStyle' => 'rect', - 'pointRadius' => 4, - 'pointHoverRadius' => 6 - ], - - ] - ], - ]; + 'name' => 'Total Views', + 'data' => $this->generateDateSeries('2024-01-01', '2024-08-01') + ], + [ + 'name' => 'Second Views', + 'data' => $this->generateDateSeries('2024-01-01', '2024-08-01') + ], + ], + + ]; + + } }; ?>
@@ -62,6 +86,10 @@ new class extends Component { + @if($portfolio->wishlist) + + @endif + -
+ - - - - -
- -
- -

Performance

-
- -
- - - - - @foreach($options as $option) - - - - @endforeach - - +
+ +
+ +

Performance

+
- - {{--
+ + + @foreach($options as $option) + + - > --}} - - {{--
--}} + @endforeach + + + +
+ +
+ +
- + -
-