score: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"
        }

    ];

Related Query

More Query from same tag