Ram Kumar
Ram Kumar

Reputation: 275

how to add FAHRENHEIT symbol in chart js donut chart

I want to add FAHRENHEIT symbol to the chart js donut chart, currently, my half donut chart looks like this:

enter image description here

I want to add FAHRENHEIT symbol after '50', how can I do that?

here is my code:

var chartColors = {
    hf_data : '#fba66c',
    themecolor:  '#62c799'
};

var hf_data = 12;
var myChart = new Chart('hf_data ', {
    type: 'doughnut',
    data: {
      labels: ['hf_data '],
      datasets: [{
        label: 'Temperature',
        data: [hf_data , hf_data +25],
        backgroundColor: [chartColors.hf_data , chartColors.themecolor],
        borderColor: [chartColors.hf_data , chartColors.themecolor],
        borderWidth: 1
      }]
    },
    options: {
        responsive:true,
        circumference: Math.PI,
        rotation:Math.PI,
        cutoutPercentage:60,
            title: {
            display: true,
            text: '50' ,
            position: 'bottom',
            verticalAlign: 'middle',
            align: 'center',
            y: 20,
        },
        legend: {
            position: 'top'
        },
        tooltips: {
            enabled: false
        },
        animation: {
            animateScale: true,
            animateRotate: true
        },
    }
});

Upvotes: 2

Views: 447

Answers (1)

Rkv88  -  Kanyan
Rkv88 - Kanyan

Reputation: 1332

did you try adding to the symbol directly °F

 text: '50°F' 

if doesn't work use Unicode hex number

Upvotes: 2

Related Questions