mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-09 23:48:36 +01:00
fix projection UI on chart
This commit is contained in:
@@ -220,9 +220,14 @@ function transformResponse(input: { _id: string, count: number }[]) {
|
|||||||
const labels = input.map(e => DateService.getChartLabelFromISO(e._id, new Date().getTimezoneOffset(), selectedSlice.value));
|
const labels = input.map(e => DateService.getChartLabelFromISO(e._id, new Date().getTimezoneOffset(), selectedSlice.value));
|
||||||
if (input.length > 0) allDatesFull.value = input.map(e => e._id.toString());
|
if (input.length > 0) allDatesFull.value = input.map(e => e._id.toString());
|
||||||
|
|
||||||
const todayIndex = input.findIndex(e => new Date(e._id).getTime() > (Date.now() - new Date().getTimezoneOffset() * 1000 * 60));
|
const current = (Date.now());
|
||||||
|
//console.log(input.map(e => e._id));
|
||||||
|
//console.log(new Date(current));
|
||||||
|
|
||||||
return { data, labels, todayIndex }
|
const todayIndex = input.findIndex(e => new Date(e._id).getTime() >= current);
|
||||||
|
|
||||||
|
//console.log({ todayIndex })
|
||||||
|
return { data, labels, todayIndex: todayIndex + 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
function onResponseError(e: any) {
|
function onResponseError(e: any) {
|
||||||
@@ -281,7 +286,6 @@ function onDataReady() {
|
|||||||
chartData.value.datasets[1].backgroundColor = [createGradient('#4abde8')];
|
chartData.value.datasets[1].backgroundColor = [createGradient('#4abde8')];
|
||||||
chartData.value.datasets[2].backgroundColor = [createGradient('#fbbf24')];
|
chartData.value.datasets[2].backgroundColor = [createGradient('#fbbf24')];
|
||||||
|
|
||||||
|
|
||||||
(chartData.value.datasets[1] as any).borderSkipped = sessionsData.data.value.data.map((e, i) => {
|
(chartData.value.datasets[1] as any).borderSkipped = sessionsData.data.value.data.map((e, i) => {
|
||||||
const todayIndex = eventsData.data.value?.todayIndex || 0;
|
const todayIndex = eventsData.data.value?.todayIndex || 0;
|
||||||
if (i == todayIndex - 1) return true;
|
if (i == todayIndex - 1) return true;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ const avgSessionDuration = computed(() => {
|
|||||||
|
|
||||||
const todayIndex = computed(() => {
|
const todayIndex = computed(() => {
|
||||||
if (!visitsData.data.value) return -1;
|
if (!visitsData.data.value) return -1;
|
||||||
return visitsData.data.value.input.findIndex(e => new Date(e._id).getTime() > (Date.now() - new Date().getTimezoneOffset() * 1000 * 60));
|
return visitsData.data.value.input.findIndex(e => new Date(e._id).getTime() > (Date.now()));
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,18 +12,17 @@ export default defineEventHandler(async event => {
|
|||||||
const cacheKey = `timeline:visits:${pid}:${slice}:${from}:${to}:${domain}`;
|
const cacheKey = `timeline:visits:${pid}:${slice}:${from}:${to}:${domain}`;
|
||||||
const cacheExp = 20;
|
const cacheExp = 20;
|
||||||
|
|
||||||
// return await Redis.useCacheV2(cacheKey, cacheExp, async () => {
|
return await Redis.useCacheV2(cacheKey, cacheExp, async () => {
|
||||||
const timelineData = await executeAdvancedTimelineAggregation({
|
const timelineData = await executeAdvancedTimelineAggregation({
|
||||||
projectId: project_id,
|
projectId: project_id,
|
||||||
model: VisitModel,
|
model: VisitModel,
|
||||||
from, to, slice, timeOffset, domain,
|
from, to, slice, timeOffset, domain
|
||||||
debug: true
|
});
|
||||||
|
|
||||||
|
return timelineData;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return timelineData;
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user