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

285
Views
¿Cómo crear un gráfico donde el eje vertical (eje Y) es una cadena?

El gráfico que quiero hacer es un gráfico de líneas con cadenas en el eje vertical y números en el eje horizontal usando Chart.js. Por ejemplo, el eje horizontal es el tiempo y el eje vertical es el color del sombrero. Ver la imagen de abajo

 var myChart = new Chart(ctx, { type: 'line', data: { labels: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],//Number of frames datasets: [{ label: 'The colour of the hat of the person in the frame', data: ["red","blue","red","blue","yeallow","red","blue","red","blue","yeallow",.....], borderColor: '#f88', }], } });

imagen gráfica

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Sí, debe configurar su escala y en categoría, también proporcionarle una matriz de etiquetas y luego, en su matriz de datos, puede mencionar esas etiquetas:

 const options = { type: 'line', data: { labels: [1, 2, 3, 4, 5, 6], datasets: [{ label: '# of Points', data: ["Blue", "Red", "Red", "Orange", "Green", "Orange"], borderColor: 'pink' }] }, options: { scales: { y: { type: 'category', labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"] }, } } } const ctx = document.getElementById('chartJSContainer').getContext('2d'); new Chart(ctx, options);
 <body> <canvas id="chartJSContainer" width="600" height="400"></canvas> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.0/chart.js"></script> </body>

about 4 years ago · Juan Pablo Isaza Report
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!