Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
node express chart js problema de análisis/representación de datos

Datos de Excel

 Date Percentage 04-03-22 (H) 80 05-03-22 (H) 55 06-03-22 (H) 20 07-03-22 (H) 49 08-03-22 (H) 61 09-03-22 (H) 73 TODAY (P) 23 11-03-22 (P) 64

Código del controlador

 datavCenterSpacePredictionModelData = XLSX.utils.sheet_to_json(workbook.Sheets[sheet_name_list[3]]);

Pasando este objeto para ver

 await res.render('dashboard', { vCenterSpace:datavCenterSpacePredictionModelData})

En mi opinión, no puedo analizar/recorrer en bucle estos datos para que puedan pasarse al objeto chartjs. El objeto del gráfico necesita etiquetas y datos

 const zschart = new Chart(document.getElementById("chartjs-0"), { "type": "line", "data": { "labels": ["04-03-22 (H)","05-03-22 (H)","06-03-22 (H)","07-03-22 (H)","08-03-22 (H)","09-03-22 (H)","TODAY (P)","11-03-22 (P)","12-03-22 (P)","13-03-22 (P)","14-03-22 (P)","15-03-22 (P)"], "datasets": [{ "label": "Usage in %", "data": [80,55,20,49,61,73,23,64,60,91,70,95], "fill": false, "borderColor": "rgb(75, 192, 192)", "lineTension": 0.1 }] }, "options": {} });

cuando intento obtener este valor, me devuelve el objeto. Estoy comprobando el tipo de objeto que me devuelve una cadena

 var vCenterSpace = ('<%=vCenterSpace%>') //value of node js object into JS alert(typeof(vCenterSpace ))

Quiero pasar dinámicamente estos valores como se muestra a continuación. Estos son valores codificados

 "labels": ["04-03-22 (H)","05-03-22 (H)","06-03-22 (H)","07-03-22 (H)", "data": [80,55,20,49,61,73,23,64,60,91,70,95],

Todo se está arruinando, no puedo entender cómo esto resuelve esto.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!