Spaces:
Runtime error
Runtime error
File size: 1,223 Bytes
3eed4de |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
let chartsLoaded = { sentiment: false, wordcloud: false };
let chartInterval = setInterval(checkCharts, 2000);
function checkCharts() {
fetch('/sentiment_chart')
.then(response => {
if (response.ok) {
document.getElementById('sentimentChart').src = '/sentiment_chart';
document.getElementById('sentimentChart').style.display = 'block';
document.getElementById('sentimentChartMessage').style.display = 'none';
chartsLoaded.sentiment = true;
stopIfChartsLoaded();
}
});
fetch('/wordcloud_chart')
.then(response => {
if (response.ok) {
document.getElementById('wordcloudChart').src = '/wordcloud_chart';
document.getElementById('wordcloudChart').style.display = 'block';
document.getElementById('wordcloudChartMessage').style.display = 'none';
chartsLoaded.wordcloud = true;
stopIfChartsLoaded();
}
});
}
function stopIfChartsLoaded() {
if (chartsLoaded.sentiment && chartsLoaded.wordcloud) {
clearInterval(chartInterval);
}
}
|