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

159
Views
¿Hay alguna manera de cambiar la visualización de una fecha?

Estoy usando la biblioteca ChartJs en mi aplicación para mis gráficos. En este momento tengo un gráfico que muestra los 31 días del mes, pero debido a muchas fechas, las fechas se muestran así:

ingrese la descripción de la imagen aquí

pero en realidad los necesito así:

ingrese la descripción de la imagen aquí

¿Alguien tiene alguna idea de cambiar la forma en que se muestran, de modo que la fecha se muestre debajo del mes o al revés? Momentáneamente mi código se ve así:

 const ctx = document.getElementById('myChart').getContext('2d'); const myChart = new Chart(ctx, { type: 'bar', data: { labels: data.map(x => moment(x.date).format("MMM Do")), datasets: [{ data: data.map(x => x.premium), backgroundColor: '#ffec87', borderColor: "#ffec87", borderWidth: 2, borderStyle: 'dotted' }] }, options: { scales: { xAxis: { grid: { display: false } }, yAxis: { grid: { borderDash: [3, 5] } } } } });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar etiquetas multilínea para eso proporcionando las etiquetas en una matriz como esta:

 var options = { type: 'line', data: { labels: [ [ "Red", "second line" ], [ "Blue", "second line" ], [ "Yellow", "second line" ], [ "Green", "second line" ], [ "Purple", "second line" ], [ "Orange", "second line" ] ], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], borderWidth: 1 }, { label: '# of Points', data: [7, 11, 5, 8, 3, 7], borderWidth: 1 } ] }, options: { scales: { yAxes: [{ ticks: { reverse: false } }] } } } var 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/2.9.4/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!