Hello again and thanks for any previous assistance.
I am trying to insert data from DB collection into a chart following a tutorial found here: https://www.wix.com/corvid/example/create-a-custom-chart
The issue is that I want the chart to show filtered results from dataset connected to the DB. I have read about the getTotalCount() before but I am unable to achieve the trick.
After all what I am trying to achieve is for the code of the chart to manage to read the number of rows containing the .value included in a dropdown menu and return a number which can then be inserted by code into the chart. Ultimately the chart shall show the number of rows filtered by the dataset in the collection (and if possible show this by month).
So do you guys think that there is a way to do so by code replacing the code below with what is obtained by filtering the dataset collection?:
let year = 2020;
let tradenumber = { 2020: [21, 2.4, 7.6, 5.4, 9.9, 7.8], 2019: [6.7, 2.2, 11.2, 5.5, 10.1, 7.9] };
Full code here:
let year = 2020;
let tradenumber = {
2020: [21, 2.4, 7.6, 5.4, 9.9, 7.8],
2019: [6.7, 2.2, 11.2, 5.5, 10.1, 7.9]
};
$w.onReady(() =>{
$w("#html1").postMessage(tradenumber[year]);
$w("#html1").onMessage((event)=>{
if(event.data.type === 'ready'){
$w("#html1").postMessage(tradenumber[year]);
}
if(event.data.type === 'click'){
$w("#clickedMessage").text = `The number of trades to ${event.data.label} in ${year} is ${event.data.value} million.`;
$w("#clickedMessage").show();
}
});
});
export function year_onChange(event) {
year = $w('#year').value;
$w("#html1").postMessage(tradenumber[year]);
}
Thank you so much for any insights