Skip to content

Commit aa756c9

Browse files
committed
fix: chart view
1 parent ef148fb commit aa756c9

2 files changed

Lines changed: 42 additions & 21 deletions

File tree

resources/views/components/stats/chart.blade.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,17 @@
2929
position: 'top',
3030
labels: {
3131
usePointStyle: true,
32+
pointStyle: 'line',
3233
padding: 20,
3334
font: {
34-
size: 12
35+
size: 14,
36+
weight: 'bold'
37+
},
38+
generateLabels: function(chart) {
39+
return Chart.defaults.plugins.legend.labels.generateLabels(chart).map(function(label) {
40+
label.lineWidth = 4;
41+
return label;
42+
});
3543
}
3644
}
3745
}
@@ -47,7 +55,9 @@
4755
font: {
4856
size: 11
4957
},
50-
color: '#6b7280'
58+
color: '#6b7280',
59+
precision: 0,
60+
stepSize: 1
5161
}
5262
},
5363
x: {
@@ -69,10 +79,19 @@
6979
elements: {
7080
point: {
7181
radius: 4,
72-
hoverRadius: 6
82+
hoverRadius: 6,
83+
pointStyle: 'circle'
7384
},
7485
line: {
75-
tension: 0.1
86+
tension: 0.3
87+
}
88+
},
89+
datasets: {
90+
line: {
91+
pointStyle: 'circle',
92+
pointRadius: 4,
93+
pointHoverRadius: 6,
94+
borderWidth: 3
7695
}
7796
}
7897
}

src/Services/DashboardAnalyticsService.php

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,34 +70,36 @@ protected function getChartData(): array
7070
$query = $this->getBaseQuery($dateRange);
7171
$chartData = $this->analyticsService->getChartData($query, $dateRange);
7272

73-
// Add dashboard-specific styling
73+
// Add dashboard-specific styling with high contrast colors
7474
$chartData['datasets'] = collect($chartData['datasets'])->map(function (array $dataset): array {
7575
if ($dataset['label'] === 'Views') {
7676
return array_merge($dataset, [
77-
'backgroundColor' => 'rgba(255, 99, 132, 0.1)',
78-
'borderColor' => 'rgba(255, 99, 132, 1)',
79-
'borderWidth' => 3,
77+
'backgroundColor' => 'rgba(220, 38, 127, 0.1)', // Bright pink background
78+
'borderColor' => 'rgba(220, 38, 127, 1)', // Bright pink border
79+
'borderWidth' => 4,
8080
'fill' => false,
81-
'tension' => 0.2,
82-
'pointBackgroundColor' => 'rgba(255, 99, 132, 1)',
81+
'tension' => 0.3,
82+
'pointBackgroundColor' => 'rgba(220, 38, 127, 1)',
8383
'pointBorderColor' => '#fff',
84-
'pointBorderWidth' => 2,
85-
'pointRadius' => 5,
86-
'pointHoverRadius' => 7,
84+
'pointBorderWidth' => 3,
85+
'pointRadius' => 6,
86+
'pointHoverRadius' => 8,
87+
'borderDash' => [], // Solid line
8788
]);
8889
}
8990
if ($dataset['label'] === 'Visitors') {
9091
return array_merge($dataset, [
91-
'backgroundColor' => 'rgba(54, 162, 235, 0.1)',
92-
'borderColor' => 'rgba(54, 162, 235, 1)',
93-
'borderWidth' => 3,
92+
'backgroundColor' => 'rgba(34, 197, 94, 0.1)', // Bright green background
93+
'borderColor' => 'rgba(34, 197, 94, 1)', // Bright green border
94+
'borderWidth' => 4,
9495
'fill' => false,
95-
'tension' => 0.2,
96-
'pointBackgroundColor' => 'rgba(54, 162, 235, 1)',
96+
'tension' => 0.3,
97+
'pointBackgroundColor' => 'rgba(34, 197, 94, 1)',
9798
'pointBorderColor' => '#fff',
98-
'pointBorderWidth' => 2,
99-
'pointRadius' => 5,
100-
'pointHoverRadius' => 7,
99+
'pointBorderWidth' => 3,
100+
'pointRadius' => 6,
101+
'pointHoverRadius' => 8,
102+
'borderDash' => [10, 5], // Dashed line to differentiate
101103
]);
102104
}
103105

0 commit comments

Comments
 (0)