Charts.js update global variables

👍:0

You are defining a local variable doughnutData in myFunction(..) with “var doughnutData”. remove that “var” and make it global.

 doughnutData = [
        {
            value: ITEM1PERCENT.toFixed(2),
            color:"#F7464A",
            highlight: "#FF5A5E",
            label: "Red"
        },
        {
            value: ITEM2PERCENT.toFixed(2),
            color: "#46BFBD",
            highlight: "#5AD3D1",
            label: "Green"
        },
        {
            value: ITEM3PERCENT.toFixed(2),
            color: "#FDB45C",
            highlight: "#FFC870",
            label: "Yellow"
        }

    ];

Leave a comment