fix(web): show empty-state message when analytics charts have no data
Charts previously rendered as blank boxes when no context events existed in the selected range, which looked broken. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -126,8 +126,19 @@
|
|||||||
|
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
<script>
|
<script>
|
||||||
|
function showChartEmptyState(canvasId, message) {
|
||||||
|
var canvas = document.getElementById(canvasId);
|
||||||
|
var container = canvas.closest('.chart-container');
|
||||||
|
container.innerHTML = '<div class="search-empty">' + message + '</div>';
|
||||||
|
container.style.display = 'flex';
|
||||||
|
container.style.alignItems = 'center';
|
||||||
|
container.style.justifyContent = 'center';
|
||||||
|
}
|
||||||
|
|
||||||
// Timeline bar chart
|
// Timeline bar chart
|
||||||
if (timelineData.length > 0) {
|
if (timelineData.length === 0) {
|
||||||
|
showChartEmptyState('timeline-chart', 'No activity recorded in this time range.');
|
||||||
|
} else {
|
||||||
new Chart(document.getElementById('timeline-chart'), {
|
new Chart(document.getElementById('timeline-chart'), {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {
|
data: {
|
||||||
@@ -169,7 +180,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Category donut chart
|
// Category donut chart
|
||||||
if (categoryData.length > 0) {
|
if (categoryData.length === 0) {
|
||||||
|
showChartEmptyState('category-chart', 'No categorized activity in this time range.');
|
||||||
|
} else {
|
||||||
new Chart(document.getElementById('category-chart'), {
|
new Chart(document.getElementById('category-chart'), {
|
||||||
type: 'doughnut',
|
type: 'doughnut',
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
Reference in New Issue
Block a user