feat(dashboard): #192 include treemap of treasure chests
This commit was merged in pull request #195.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Initialize the echarts instance based on the prepared dom
|
||||
|
||||
async function init() {
|
||||
const element = document.getElementById('graph')
|
||||
async function initMainChart() {
|
||||
const element = document.getElementById('main-chart')
|
||||
if (element === null) {
|
||||
return;
|
||||
}
|
||||
@@ -9,7 +9,7 @@ async function init() {
|
||||
var myChart = echarts.init(element);
|
||||
|
||||
try {
|
||||
const response = await fetch("/dashboard/dataset");
|
||||
const response = await fetch("/dashboard/main-chart");
|
||||
if (!response.ok) {
|
||||
throw new Error(`Response status: ${response.status}`);
|
||||
}
|
||||
@@ -24,15 +24,41 @@ async function init() {
|
||||
|
||||
const chart = myChart.setOption(option);
|
||||
window.addEventListener('resize', function() {
|
||||
myChart.resize();
|
||||
});
|
||||
myChart.resize();
|
||||
});
|
||||
|
||||
console.log("initialized charts");
|
||||
console.log("initialized main-chart");
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
|
||||
// Display the chart using the configuration items and data just specified.
|
||||
}
|
||||
|
||||
init();
|
||||
async function initTreasureChests() {
|
||||
const element = document.getElementById('treasure-chests')
|
||||
if (element === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var myChart = echarts.init(element);
|
||||
|
||||
try {
|
||||
const response = await fetch("/dashboard/treasure-chests");
|
||||
if (!response.ok) {
|
||||
throw new Error(`Response status: ${response.status}`);
|
||||
}
|
||||
|
||||
const option = await response.json();
|
||||
|
||||
const chart = myChart.setOption(option);
|
||||
window.addEventListener('resize', function() {
|
||||
myChart.resize();
|
||||
});
|
||||
|
||||
console.log("initialized treasure-chests");
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
initMainChart();
|
||||
initTreasureChests();
|
||||
|
||||
Reference in New Issue
Block a user