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

202
Views
¿Cómo generar dinámicamente un gráfico de líneas de conjuntos de datos múltiples en GraphJS?

Los datos se generan así:

 $repResults[] = [ 'label' => (new \Carbon\Carbon($wbwResult->created_at))->isoFormat('DD-MM-YY'), 'data' => [ # datatype cast to int to prevent {!! xss !!} (int) $wbwResult->discipline_three, (int) $wbwResult->discipline_four, (int) $wbwResult->discipline_five, (int) $wbwResult->discipline_six, ] ];

Luego estoy tratando de generar los datos como un gráfico de líneas:

 <canvas id="myChart" width="400" height="400"></canvas> <script src='https://cdn.jsdelivr.net/npm/chart.js@3.6.0/dist/chart.min.js'></script> <script> const ctx = document.getElementById('myChart').getContext('2d'); const myChart = new Chart(ctx, { type: 'line', labels: ['A', 'B', 'C', 'D'], datasets: {!! json_encode($wbw['reps']) !!}, options: { responsive: true } }); </script>

El gráfico no muestra nada, ni recibo ningún error en mi consola. ¿Alguna idea de lo que estoy haciendo mal?

Los datos se ven así:

 [{"label":"28-11-21","data":[22,70,50,27]},{"label":"28-11-21","data":[7,7,7,7]}]
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!