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

293
Views
Cómo cambiar la familia de fuentes del título de la información sobre herramientas del gráfico de líneas de React en chart.js

Estoy usando "chart.js": "^3.7.1", junto con react-chartjs-2 en la aplicación web de reacción. Quiero cambiar la familia de fuentes de información sobre herramientas del gráfico. Aquí están las opciones que estoy usando en el gráfico. No puedo aplicar la familia de fuentes al gráfico de líneas. Quiero aplicar una fuente personalizada para el título en la información sobre herramientas. he usado accesorios mencionados en la documentación de chart js

 const options = { animation, plugins: { tooltip: { backgroundColor: "#fff", displayColors: false, borderColor: "#8b7a7a", borderWidth: 0.5, bodyColor: "#0000", titleColor: "#8b7a7a", // bodyFontColor: "#8b7a7a", padding: 10, footerSpacing: 0, boxHeight: 10, title: { font: { size: 50, family: "'Work Sans',sans-serif", }, }, callbacks: { title: function (t, d) { let datae = moment(t[0].label).format("MMM DD, YYYY"); const aa = t[0].dataset.label; const val = t[0].formattedValue; return `Date: ${datae.toString()}\n${aa}: ${val}`; }, }, }, legend: { display: false, }, }, elements: { line: { tension: 0, }, }, legend: { display: false, }, scales: { x: { grid: { display: false, }, }, y: { grid: { display: false, }, }, }, };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Como se puede leer aquí , debe configurar la fuente para el título de información sobre herramientas en la propiedad titleFont y no en la propiedad title.font :

 var options = { type: 'line', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], borderColor: 'orange' }, { label: '# of Points', data: [7, 11, 5, 8, 3, 7], borderColor: 'pink' } ] }, options: { plugins: { tooltip: { titleFont: { family: 'commic-sans-ms' } } } } } 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/3.7.1/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!