Code Monkey home page Code Monkey logo

Comments (4)

rehamwael avatar rehamwael commented on June 19, 2024 1

thank you for the help actually after integrate the api I create the html and center it inside the legand with taking datasets backgroundColor

    var htmlArea = "";
    var i = 0;
    for (var area in cancelledAreas) {
        
        htmlArea += '<p>'+ '<b>' + cancelledAreas[area]+ '</b>'+ ' ' +' '+'<span style="color:'+whereCanceledData.datasets[0].backgroundColor[i]+'">'+ area +'</span>'+'</p>'; 
        i++;
    }
    document.getElementById('js-legend').innerHTML = htmlArea;

Thanks

from chartjs-plugin-doughnutlabel.

JohnArcher avatar JohnArcher commented on June 19, 2024

This plugin does not work with pie charts. So, first you have to set type: 'doughnut'

Then add the following object to the plugins object:

doughnutlabel: {
    labels: [
        {
            text: '50% Dubai',
            font: {
                size: '14'
            },
            color: "#F38C83"
        },
        {
            text: '36% Abu Dhabi',
            font: {
                size: '14'
            },
            color: "#E173C2"
        },
        {
            text: '14% Fujairah',
            font: {
                size: '14'
            },
            color: "#A176E8"
        }
    ]
}

from chartjs-plugin-doughnutlabel.

ciprianciurea avatar ciprianciurea commented on June 19, 2024

Hi @rehamwael ,
This also doesn't currently allow for different text fonts on the same line of text, it just allows you to configure one font (size, color) for one line.
I'm thinking maybe to allow for an array of lines, each line consisting of an array of labels (each with its own font configuration). What do you think, would that help?

from chartjs-plugin-doughnutlabel.

JohnArcher avatar JohnArcher commented on June 19, 2024

@rehamwael Could you provide a jsfiddle how to exactly use this? I am not sure how you put the pieces together. Thanks!

from chartjs-plugin-doughnutlabel.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.