Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

295
Vistas
How can I move text around on a pie chart in ChartJS?

Wondering how I can move the text more to the left and create a new line between the labels. As you can see the "label" and "percentage" are on top of each other.

I'm using ChartJS v2.8.0 and ChartJS Plugin Labels 1.1.0

Current Look: Current

Desired Look: Desired effect


Current code:

var chart = new Chart(ctx, {
            type: 'pie',
            data: {
                labels: ['T-Shirts', 'Sweaters'],
                datasets: [{
                    backgroundColor: [$('#chart-color-1').val(), $('#chart-color-2').val()],
                    data: [$('#attire_1_percent').val(), $('#attire_2_percent').val()],
                    borderWidth: 0

                }]
            },
            options: {
                maintainAspectRatio: false,
                legend: {
                    display: false
                },
                plugins: {
                    labels: [{
                            render: "label",
                            fontColor: '#fff',
                        },
                        {
                            render: 'percentage',
                            fontColor: '#fff',
                        }
                    ],
                },
                tooltips: {
                    callbacks: {
                        label: function(tooltipItem, data) {
                            return data.labels[tooltipItem.index] + ": " + data.datasets[0].data[tooltipItem.index] + "%"
                        }
                    },
                },
            }
        });
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda