From 0503cd6cf703180c42540296062c531d79ae41e9 Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:00:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/UI/aboutportal/line-chart.vue | 52 ++++++------ src/front/src/components/UI/date-select.vue | 4 +- src/front/src/views/AboutPortalPage.vue | 81 ++++++++++++------- 3 files changed, 80 insertions(+), 57 deletions(-) diff --git a/src/front/src/components/UI/aboutportal/line-chart.vue b/src/front/src/components/UI/aboutportal/line-chart.vue index b1933bb13..f51359b7e 100644 --- a/src/front/src/components/UI/aboutportal/line-chart.vue +++ b/src/front/src/components/UI/aboutportal/line-chart.vue @@ -1,9 +1,6 @@ @@ -18,9 +15,9 @@ export default { }, props: { - visiting: { - type: Array, - default: () => [] + dataLineChart: { + type: Object, + default: () => {} } }, @@ -34,7 +31,7 @@ export default { labels: [], datasets: [ { - label: 'Посещений всего', + label: 'Открыто страниц', backgroundColor: 'crimson', borderColor: 'crimson', borderWidth: 3, @@ -45,7 +42,7 @@ export default { }, { - label: 'Уникальные посещения', + label: 'Активные пользователи', backgroundColor: 'teal', borderColor: 'teal', borderWidth: 3, @@ -112,26 +109,26 @@ export default { } const arrforline=() => { - let datas = - props.visiting.reduce((acc, item) => { - if (!acc[item.visitdate]) { - acc[item.visitdate] = {unic: [], count: 0} - } - acc[item.visitdate]['count'] += item.count - if (!acc[item.visitdate]['unic'].includes(splitname(item.author))) - { - acc[item.visitdate]['unic'].push(splitname(item.author)) + // let datas = + // props.visiting.reduce((acc, item) => { + // if (!acc[item.visitdate]) { + // acc[item.visitdate] = {unic: [], count: 0} + // } + // acc[item.visitdate]['count'] += item.count + // if (!acc[item.visitdate]['unic'].includes(splitname(item.author))) + // { + // acc[item.visitdate]['unic'].push(splitname(item.author)) - } - return acc - }, {}) + // } + // return acc + // }, {}) - Object.entries(datas).forEach(e => { + Object.entries(props.dataLineChart).forEach(e => { const [key, value] = e - arrlines.value.datasets[0].data.push(datas[key].count) - arrlines.value.datasets[1].data.push(datas[key]['unic'].length) + arrlines.value.datasets[0].data.push(value.count) + arrlines.value.datasets[1].data.push(value.unic.length) arrlines.value.labels.push(format1(key)) - arrlines.value.datasets[1].customlabel.push(datas[key].unic) + arrlines.value.datasets[1].customlabel.push(props.dataLineChart[key].unic) }) } @@ -145,4 +142,7 @@ export default { \ No newline at end of file diff --git a/src/front/src/components/UI/date-select.vue b/src/front/src/components/UI/date-select.vue index 98541c4e2..e21e42ff4 100644 --- a/src/front/src/components/UI/date-select.vue +++ b/src/front/src/components/UI/date-select.vue @@ -46,12 +46,12 @@