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

124
Views
¿Cómo pasar una lista de diccionarios en etiquetas y datos de chartjs?

Estoy tratando de mostrar mis datos en el gráfico chart js, mi formato de datos es este:

 > {length: 3, objects: Array(3)} length: 3 objects: Array(3) 0: {counter: 1, date: '2022-06-01 00:00:00', income: '233.000', …} 1: {counter: 2, date: '2022-05-01 00:00:00', income: '1000.000', …} 2: {counter: 3, date: '2022-04-01 00:00:00', income: '89.000', …} length: 3 [[Prototype]]: Array(0) [[Prototype]]: Object

esto es lo que probé en mi js:

 function listChartMonOutcome(){ $.ajax({ type:'GET', url:'/listcharts/data/', success:function(data){ var totalMonthCanvas = $('#listChart').get(0).getContext('2d') var totalMonthData = { labels: [ data ], data:{ datasets:[{ data:[{ data }] }] } } var totalMonthOptions = { responsive : true, maintainAspectRatio : false, datasetFill : false, parsing: { xAxisKey: 'income', yAxisKey: 'date' } } var totalMonthChart = new Chart(totalMonthCanvas, { type: 'bar', data: totalMonthData, options: totalMonthOptions }) } }) } listChartMonOutcome() }
 <div class="card-body"> <div class="chart"> <canvas id="listChart" style="height:250px; min-height:250px"></canvas> </div> </div>

pero no muestra nada, en la consola también.

y también probé esto en los data :

 labels = [data.map(({datE}) => date) ] datasets: [ { data: [ data.map(({income}) => income) ], } ]

pero plantea este error:

TypeError no detectado: data.map no es una función

¿Hay alguna solución para este problema, por favor?

Gracias por ayudar

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!