remove first bucket
This commit is contained in:
parent
aedba1293a
commit
1c0a1a0182
@ -258,18 +258,19 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
// Data passed from the backend as JSON
|
||||
const distinctDeviceData = {{ distinct_device_data|tojson }};
|
||||
const timeframeData = {{ timeframe_data|tojson }};
|
||||
let distinctDeviceData = {{ distinct_device_data|tojson }};
|
||||
let timeframeData = {{ timeframe_data|tojson }};
|
||||
const userAgentData = {{ user_agent_data|tojson }};
|
||||
const folderData = {{ folder_data|tojson }};
|
||||
|
||||
// Remove the first (incomplete) bucket from the arrays
|
||||
distinctDeviceData = distinctDeviceData.slice(1);
|
||||
timeframeData = timeframeData.slice(1);
|
||||
|
||||
// shift the labels to local time zone
|
||||
const timeframe = "{{ timeframe }}"; // e.g., 'last24hours', '7days', '30days', or '365days'
|
||||
const shiftedLabels = timeframeData.map((item, index) => {
|
||||
if (timeframe === 'last24hours') {
|
||||
|
||||
// Hide the first bucket
|
||||
if (index === 0) return '';
|
||||
|
||||
// item.bucket is now in the format "YYYY-MM-DDTHH:00:00Z"
|
||||
const bucketDate = new Date(item.bucket);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user