Hello all,
I am trying to get help with pulling data that I imported via a csv file into a data set.
I am making a dashboard that shows the different data as a chart. I can get it to work with a fixed data array already, below is the code i have working right now and the rough site can be viewed at https://cis620group2.wixsite.com/mysite-1
let view = 0;
let fview = 0;
let flights = {
1 : [6.3, 2.4, 7.6, 5.4, 9.9, 7.8],
2: [6.7, 2.2, 11.2, 5.5, 10.1, 7.9],
3: [7.2, 3.1, 8.2, 5.6, 9.2, 10.2],
4: [7.4, 3.9, 8.8, 6.1, 8.7, 9.8]
};
let family = {
1 : [6.3, 2.4, 7.6, 5.4, 9.9, 7.8],
2: [6.7, 2.2, 11.2, 5.5, 10.1, 7.9],
3: [7.2, 3.1, 8.2, 5.6, 9.2, 10.2],
4: [7.4, 3.9, 8.8, 6.1, 8.7, 9.8]
};
let family3 = {
1 : [6.3, 2.4, 7.6, 5.4, 9.9, 7.8],
2: [6.7, 2.2, 11.2, 5.5, 10.1, 7.9],
3: [7.2, 3.1, 8.2, 5.6, 9.2, 10.2],
4: [7.4, 3.9, 8.8, 6.1, 8.7, 9.8]
};
let family4 = {
1 : [6.3, 2.4, 7.6, 5.4, 9.9, 7.8],
2: [6.7, 2.2, 11.2, 5.5, 10.1, 7.9],
3: [7.2, 3.1, 8.2, 5.6, 9.2, 10.2],
4: [7.4, 3.9, 8.8, 6.1, 8.7, 9.8]
};
let family5 = {
1 : [6.3, 2.4, 7.6, 5.4, 9.9, 7.8],
2: [6.7, 2.2, 11.2, 5.5, 10.1, 7.9],
3: [7.2, 3.1, 8.2, 5.6, 9.2, 10.2],
4: [7.4, 3.9, 8.8, 6.1, 8.7, 9.8]
};
let family6 = {
1 : [6.3, 2.4, 7.6, 5.4, 9.9, 7.8],
2: [6.7, 2.2, 11.2, 5.5, 10.1, 7.9],
3: [7.2, 3.1, 8.2, 5.6, 9.2, 10.2],
4: [7.4, 3.9, 8.8, 6.1, 8.7, 9.8]
};
$w.onReady(() =>{
$w("#html1").postMessage(flights[view]);
$w("#html2").postMessage(family[fview]);
$w("#html3").postMessage(family3[fview]);
$w("#html4").postMessage(family4[fview]);
$w("#html5").postMessage(family5[fview]);
$w("#html6").postMessage(family6[fview]);
$w("#html1").onMessage((event)=>{
if(event.data.type === 'ready'){
$w("#html1").postMessage(flights[view]);
}
if(event.data.type === 'click'){
$w("#text1").text = `The number of ${event.data.label} is ${event.data.value} .`;
$w("#text1").show();
}
});
$w("#html2").onMessage((event)=>{
if(event.data.type === 'ready'){
$w("#html2").postMessage(family[view]);
}
if(event.data.type === 'click'){
$w("#text2").text = `The number of ${event.data.label} is ${event.data.value} .`;
$w("#text2").show();
}
});
$w("#html3").onMessage((event)=>{
if(event.data.type === 'ready'){
$w("#html3").postMessage(family3[view]);
}
if(event.data.type === 'click'){
$w("#text2").text = `The number of ${event.data.label} is ${event.data.value} .`;
$w("#text2").show();
}
});
$w("#html4").onMessage((event)=>{
if(event.data.type === 'ready'){
$w("#html4").postMessage(family4[view]);
}
if(event.data.type === 'click'){
$w("#text2").text = `The number of ${event.data.label} is ${event.data.value} .`;
$w("#text2").show();
}
});
$w("#html5").onMessage((event)=>{
if(event.data.type === 'ready'){
$w("#html5").postMessage(family5[view]);
}
if(event.data.type === 'click'){
$w("#text2").text = `The number of ${event.data.label} is ${event.data.value} .`;
$w("#text2").show();
}
});
$w("#html6").onMessage((event)=>{
if(event.data.type === 'ready'){
$w("#html6").postMessage(family6[view]);
}
if(event.data.type === 'click'){
$w("#text2").text = `The number of ${event.data.label} is ${event.data.value} .`;
$w("#text2").show();
}
});
});
export function view_onchange(event) {
view = $w('#view').value;
$w("#html1").postMessage(flights[view]);
$w("#html2").postMessage(family[view]);
$w("#html3").postMessage(family3[view]);
$w("#html4").postMessage(family4[view]);
$w("#html5").postMessage(family5[view]);
$w("#html6").postMessage(family6[view]);
}