Problem in making a chart with chart.js

I am having a problem in making a doughnut chart. The data and label are sent from page code to html iframe…Both the data and labels are returned json data from another api…

Here i have taken (res.length-30) to decrease the data, to clarify if this is a problem with background color.

Note: res.length contains 38 items.


$w.onReady( function () {

getchampionranks('pronil07').then(res => { 

    console.log(res); 

var data = ;

var labels = ;
for ( var i = 0; i <= res.length-30; i++) {

        data.push(res[i].Minutes.toString()); 

        labels.push(res[i].champion.toString()); 
    } 
    console.log(data); 
    console.log("Data length: " + data.length); 
    console.log(labels); 
    console.log("Label length: " + labels.length); 

    $w("#html1").postMessage(data); 

    $w("#html1").onMessage((event) => { 

if (event.data.type === ‘ready’) {

            $w("#html1").postMessage(data); 
        } 
    }); 
    $w("#html1").postMessage(labels); 

    $w("#html1").onMessage((event) => { 

if (event.labels.type === ‘ready’) {

            $w("#html1").postMessage(labels); 
        } 
    }); 


}); 

});


This is the html code…

Title

For some reason the chart is not generating…Anyone please HALLLP…

Hi,
I’m afraid that we cannot debug your entire code…
I recommend checking out our Messaging article to better understand how the iFrame component sends & gets information from the page code. I recommend using only one postMessage on the onReady function and another one on the input change event. Moreover, I recommend checking out our Charts example.

Good luck,
Tal.

i have managed to draw the graph based on the data, but i cant get the labels from page code to htrml component…


i am getting this…


I have seen the chart example…there the labels are fixed…here i have to pass both data array and labels array via post message to html component… I am stuck…

Can you help me solve this…if i provide you my site url…

@pritamsinha2304 Were you able to resolve this? I’m having a similar issue myself.

yes…

Would you mind sharing the solution you found?

the question u are seeing is a part of whole problem…i cant give that particular solution from that…coz its integrated within another code…if u want i can help u…but u have tell me the problem and the code of yours…

Hey, do you mind sharing your solution?
Thanks