This commit is contained in:
1 parent
42da3849f5
commit
e66b623353
1 file changed
+7
-2
@@ -28,7 +28,6 @@
|
||||
totalBytes += day.sum.bytes;
|
||||
});
|
||||
hitRate = totalRequests > 0 ? (totalCached / totalRequests) * 100 : 0;
|
||||
renderChart(data);
|
||||
}
|
||||
loading = false;
|
||||
})
|
||||
@@ -39,11 +38,17 @@
|
||||
});
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (chartCanvas && analyticsData && analyticsData.length > 0) {
|
||||
renderChart(analyticsData);
|
||||
}
|
||||
});
|
||||
|
||||
async function renderChart(data: any[]) {
|
||||
if (!chartCanvas) return;
|
||||
|
||||
const ChartJS = await import('chart.js/auto');
|
||||
const Chart = ChartJS.default;
|
||||
const Chart = ChartJS.default || ChartJS;
|
||||
|
||||
const labels = data.map((d: any) => d.dimensions.date);
|
||||
const requests = data.map((d: any) => d.sum.requests);
|
||||
|
||||
Reference in new issue
Block a user