diff --git a/src/front/src/components/UI/aboutportal/line-chart.vue b/src/front/src/components/UI/aboutportal/line-chart.vue new file mode 100644 index 000000000..8b75b260f --- /dev/null +++ b/src/front/src/components/UI/aboutportal/line-chart.vue @@ -0,0 +1,144 @@ + + + + + \ No newline at end of file diff --git a/src/front/src/views/AboutPortalPage.vue b/src/front/src/views/AboutPortalPage.vue index 35e07a993..5900500c3 100644 --- a/src/front/src/views/AboutPortalPage.vue +++ b/src/front/src/views/AboutPortalPage.vue @@ -87,7 +87,9 @@ class="d-flex flex-column text-center" height="200px" > - + + + @@ -180,19 +182,20 @@ import { ref, computed } from 'vue' import {pagecounter, splitname, format1, format2} from '@/utils/universal_functions' import moment from 'moment' -import lineGraph from '@/components/graph/line-graph.vue' + import { axiosApiInstance } from '@/utils/axios-api' import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue' import DateSelect from '@/components/UI/date-select.vue' import TopUser from '@/components/UI/aboutportal/top-user.vue' +import LineChart from '@/components/UI/aboutportal/line-chart.vue' export default { components: { - lineGraph, Feedmodul, DateSelect, - TopUser + TopUser, + LineChart }, @@ -209,123 +212,13 @@ setup(){ const year = ref('') const modelrating = ref(false) - const arrlines = {} + + - const data = computed({ - get() { - arrlines.value = { - labels: [], - datasets: [ - { - label: 'Посещений всего', - backgroundColor: 'crimson', - borderColor: 'crimson', - borderWidth: 3, - cubicInterpolationMode: 'monotone', - data: [], - hidden: true - - }, - { - label: 'Уникальные посещения', - backgroundColor: 'teal', - borderColor: 'teal', - borderWidth: 3, - cubicInterpolationMode: 'monotone', - data: [] - } - ] - } - arrforline() - return arrlines.value - } - -}) - const options = { - - plugins: { - - datalabels: { - color: 'grey', - - align: 'top', - display: 'auto' - - - }, - legend: { - - labels: { - - color: 'grey', - - - } - }}, - scales: { - x: { - - grid: { - color: 'white', - - - } - - }, - - - y: { - ticks: { - stepSize: 10 - }, - offset: true, - grid: { - color: 'white', - - } - - - } - }, - responsive: true, - maintainAspectRatio: false - } - const arrforline=() => { - - let datas = - visiting.value.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(item.author.id)) - { - acc[item.visitdate]['unic'].push(item.author.id) - } - - - - - return acc - }, {}) - for (let key in datas) { - arrlines.value.datasets[0].data.push(datas[key].count) - arrlines.value.datasets[1].data.push(datas[key]['unic'].length) - arrlines.value.labels.push(format1(key)) - } - - - - - // arrlines.value.labels = Object.keys(datas) - - } @@ -345,7 +238,6 @@ setup(){ } const returnend = (dates) => { - console.log(dates,'dates'); endate.value = dates periodname() visition() @@ -501,8 +393,7 @@ setup(){ visiting, countgrupp, activuser, - data, - options, + feedback, countvising, crit,