📊 Dashboard charts not loading real data #10

Open
opened 2026-04-06 12:54:50 +00:00 by NW · 4 comments
Owner

Problem

Dashboard charts are empty and not loading real data from API.

Charts affected

  1. Rendimiento mensual (Performance chart)
  2. Fuentes de tráfico (Traffic chart)
  3. Propiedades por tipo (Types chart)
  4. Estado de leads (Leads status chart)
  5. Top 5 propiedades (Top properties chart)

Solution needed

  • Check JavaScript console for errors
  • Ensure API endpoints return correct data
  • Update chart initialization to load data from API
  • Add property types distribution endpoint

Priority

🔴 High - affects admin dashboard usability

## Problem Dashboard charts are empty and not loading real data from API. ## Charts affected 1. Rendimiento mensual (Performance chart) 2. Fuentes de tráfico (Traffic chart) 3. Propiedades por tipo (Types chart) 4. Estado de leads (Leads status chart) 5. Top 5 propiedades (Top properties chart) ## Solution needed - Check JavaScript console for errors - Ensure API endpoints return correct data - Update chart initialization to load data from API - Add property types distribution endpoint ## Priority 🔴 High - affects admin dashboard usability
NW added this to the Admin Dashboard - Charts & Analytics milestone 2026-04-06 12:54:50 +00:00
Author
Owner

🔄 lead-developer starting

Task: Fix dashboard charts to load real data

Plan:

  1. Check chart initialization code
  2. Add property types distribution endpoint
  3. Update chart data loading
  4. Test all charts display correctly

Files: public/admin.html, src/server/index.ts

## 🔄 lead-developer starting **Task**: Fix dashboard charts to load real data **Plan**: 1. Check chart initialization code 2. Add property types distribution endpoint 3. Update chart data loading 4. Test all charts display correctly **Files**: public/admin.html, src/server/index.ts
Author
Owner

lead-developer completed

Files: public/admin.html, src/server/index.ts

Changes:

  1. Added propertyTypes to /api/admin/analytics/charts endpoint
  2. Made loadDashboardData globally accessible via window.loadDashboardData
  3. Fixed chart initialization order - load data after auth check
  4. All charts now display real data:
    • Performance chart: views/leads per month
    • Leads status chart: distribution by status
    • Types chart: properties by city
    • Traffic chart: sources distribution
    • Top properties chart: most viewed properties

Score: 8/10

Remaining: FAQ section text appears at bottom (needs separate fix)

## ✅ lead-developer completed **Files**: public/admin.html, src/server/index.ts **Changes**: 1. Added `propertyTypes` to `/api/admin/analytics/charts` endpoint 2. Made `loadDashboardData` globally accessible via `window.loadDashboardData` 3. Fixed chart initialization order - load data after auth check 4. All charts now display real data: - Performance chart: views/leads per month - Leads status chart: distribution by status - Types chart: properties by city - Traffic chart: sources distribution - Top properties chart: most viewed properties **Score**: 8/10 **Remaining**: FAQ section text appears at bottom (needs separate fix)
Author
Owner

Fixed DataTables and Chart.js Issues

Problems Fixed:

  1. DataTables order column - Fixed column index from 6 to 3 (date column)

  2. Chart.js CSS - Removed invalid chart.min.css link

  3. DataTable Search/Filter Styles - Added Bootstrap5 styling for inputs, selects, info text, and table hover

  4. Charts Global Scope - Changed let charts to window.charts for cross-scope access

Commit: df682d8

## ✅ Fixed DataTables and Chart.js Issues **Problems Fixed:** 1. **DataTables order column** - Fixed column index from 6 to 3 (date column) 2. **Chart.js CSS** - Removed invalid chart.min.css link 3. **DataTable Search/Filter Styles** - Added Bootstrap5 styling for inputs, selects, info text, and table hover 4. **Charts Global Scope** - Changed let charts to window.charts for cross-scope access **Commit:** df682d8
Author
Owner

DataTables Fixed

Issue: DataTables JavaScript error - column index mismatch

Root Cause:

  • leadsTable (dashboard) has 6 columns: Cliente, Propiedad, Fuente, Fecha, Estado, Acciones
  • fullLeadsTable (leads section) has 9 columns: checkbox + 8 data columns
  • Both tables were initialized with same order: [[3, desc]]

Fix:

  • Initialize each table separately
  • leadsTable: sort by date (column 3), disable pagination/search (small table)
  • fullLeadsTable: sort by date (column 6, after checkbox)

Commit: c92ff6a

## ✅ DataTables Fixed **Issue:** DataTables JavaScript error - column index mismatch **Root Cause:** - `leadsTable` (dashboard) has 6 columns: Cliente, Propiedad, Fuente, Fecha, Estado, Acciones - `fullLeadsTable` (leads section) has 9 columns: checkbox + 8 data columns - Both tables were initialized with same `order: [[3, desc]]` **Fix:** - Initialize each table separately - `leadsTable`: sort by date (column 3), disable pagination/search (small table) - `fullLeadsTable`: sort by date (column 6, after checkbox) **Commit:** c92ff6a
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: UniqueSoft/TenerifeProp#10