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

281
Views
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
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!