График практически готов
This commit is contained in:
1 parent
f7631694ba
commit
cb48059255
1 file changed
+82
-84
@@ -43,8 +43,8 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
<v-col class="d-flex flex-column ">
|
<v-col class="d-flex flex-column ">
|
||||||
<v-row class="flex-grow-0">
|
<v-row class="flex-grow-0">
|
||||||
<v-col class="bg-blue">
|
<v-col >
|
||||||
<Line :data="data" :options="options" />
|
<line-graph :data="data" :options="options"/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row>
|
<v-row>
|
||||||
@@ -53,12 +53,8 @@
|
|||||||
<v-col
|
<v-col
|
||||||
lg=8
|
lg=8
|
||||||
>
|
>
|
||||||
<!-- <v-card class="text-center" title="Рейтинг посещаемости страниц портала">
|
|
||||||
<div v-for="(val, key) in countgrupp()" :key = key>
|
|
||||||
{{key}} : {{ val.now }} {{ val.week }} {{ val.year }}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</v-card> -->
|
|
||||||
<v-card class="pt-3 text-center" title="Рейтинг посещаемости страниц портала">
|
<v-card class="pt-3 text-center" title="Рейтинг посещаемости страниц портала">
|
||||||
<v-table class="pt-3 ma-0">
|
<v-table class="pt-3 ma-0">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -102,75 +98,84 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, reactive, computed } from 'vue'
|
||||||
import {getfromserver, pagecounter, splitname} from '@/utils/universal_functions'
|
import {getfromserver, pagecounter, splitname} from '@/utils/universal_functions'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import lineGraph from '@/components/graph/line-graph.vue'
|
import lineGraph from '@/components/graph/line-graph.vue'
|
||||||
|
import { axiosApiInstance } from '@/utils/axios-api'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// import {
|
|
||||||
// Chart as ChartJS,
|
|
||||||
// CategoryScale,
|
|
||||||
// LinearScale,
|
|
||||||
// PointElement,
|
|
||||||
// LineElement,
|
|
||||||
// Title,
|
|
||||||
// Tooltip,
|
|
||||||
// Legend
|
|
||||||
// } from 'chart.js'
|
|
||||||
// import { Line } from 'vue-chartjs'
|
|
||||||
// import * as chartConfig from './chartConfig.js'
|
|
||||||
|
|
||||||
// ChartJS.register(
|
|
||||||
// CategoryScale,
|
|
||||||
// LinearScale,
|
|
||||||
// PointElement,
|
|
||||||
// LineElement,
|
|
||||||
// Title,
|
|
||||||
// Tooltip,
|
|
||||||
// Legend
|
|
||||||
// )
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { lineGraph },
|
components: { lineGraph },
|
||||||
// components: {
|
|
||||||
// Line
|
|
||||||
// },
|
|
||||||
|
|
||||||
setup(){
|
setup(){
|
||||||
const data = {
|
const visiting = ref([])
|
||||||
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
||||||
datasets: [
|
const arrlines = {}
|
||||||
{
|
const data = computed({
|
||||||
label: 'Data One',
|
get() {
|
||||||
backgroundColor: '#f87979',
|
arrlines.value = {
|
||||||
data: [40, 39, 10, 40, 39, 80, 40]
|
labels: [],
|
||||||
}
|
datasets: [
|
||||||
]
|
{
|
||||||
}
|
label: 'Data One',
|
||||||
|
backgroundColor: '#f87979',
|
||||||
|
data: [40, 39, 10, 40, 39, 80]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Data One',
|
||||||
|
backgroundColor: '#f87979',
|
||||||
|
data: [1, 29, 10, 40, 39, 80]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
arrforline()
|
||||||
|
return arrlines.value
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
const options = {
|
const options = {
|
||||||
responsive: true,
|
responsive: true,
|
||||||
maintainAspectRatio: false
|
maintainAspectRatio: false
|
||||||
}
|
}
|
||||||
// const data = {
|
|
||||||
// labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
||||||
// datasets: [
|
|
||||||
// {
|
|
||||||
// label: 'Data One',
|
|
||||||
// backgroundColor: '#f87979',
|
|
||||||
// data: [40, 39, 10, 40, 39, 80, 40]
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const options = {
|
|
||||||
// responsive: true,
|
|
||||||
// maintainAspectRatio: false
|
|
||||||
// }
|
|
||||||
|
|
||||||
const visiting = ref([])
|
const arrforline=() => {
|
||||||
|
console.log(visiting.value, 'visiting.value');
|
||||||
|
|
||||||
|
let un = []
|
||||||
|
visiting.value.map(e => un.push(e.author.id) )
|
||||||
|
|
||||||
|
console.log(new Set(un), 'eeeeeeeeeeeee------------------')
|
||||||
|
let datas =
|
||||||
|
visiting.value.reduce((acc, item) => {
|
||||||
|
//
|
||||||
|
|
||||||
|
if (!acc[item.visitdate]) {
|
||||||
|
acc[item.visitdate] = {unic: 0, count: 0}
|
||||||
|
}
|
||||||
|
acc[item.visitdate]['count'] += item.count
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
console.log(datas, 'visiting.value');
|
||||||
|
// for (let x in visiting.value) {
|
||||||
|
|
||||||
|
// arrlines.value.labels.push(visiting.value[x].visitdate)
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const previousWeekStart = moment().subtract(1, 'weeks').startOf('week'); // начало предыдущей недели
|
const previousWeekStart = moment().subtract(1, 'weeks').startOf('week'); // начало предыдущей недели
|
||||||
const previousWeekEnd = moment().subtract(1, 'weeks').endOf('week'); // конец предыдущей недели
|
const previousWeekEnd = moment().subtract(1, 'weeks').endOf('week'); // конец предыдущей недели
|
||||||
|
|
||||||
@@ -182,7 +187,18 @@ setup(){
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
getfromserver(`api/watcher/counter/`, visiting)
|
const visition = () => {
|
||||||
|
axiosApiInstance.get(`api/watcher/counter/`).then(result => {
|
||||||
|
visiting.value = result.data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
console.log( visiting.value, '--------aaaaa-------');
|
||||||
|
})}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
pagecounter()
|
pagecounter()
|
||||||
|
|
||||||
const countvis = () => {
|
const countvis = () => {
|
||||||
@@ -242,8 +258,6 @@ setup(){
|
|||||||
|
|
||||||
const groupedData =
|
const groupedData =
|
||||||
visiting.value.reduce((acc, item) => {
|
visiting.value.reduce((acc, item) => {
|
||||||
console.log(Object.keys(acc).length, 'item------------');
|
|
||||||
|
|
||||||
|
|
||||||
if (Object.keys(acc).length <4) {
|
if (Object.keys(acc).length <4) {
|
||||||
|
|
||||||
@@ -274,38 +288,22 @@ setup(){
|
|||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// .reduce((acc, item) => ({
|
|
||||||
|
|
||||||
// ...acc, [item]: groupedData[item]
|
|
||||||
// }), {})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Object.values(groupedData).sort(function(a, b) {
|
|
||||||
// console.log(a, b);
|
|
||||||
// return parseFloat(a.splitname(item.author)) - parseFloat(b.splitname(item.author));
|
|
||||||
// });
|
|
||||||
// groupedData.sort(function(a, b) { console.log(a,b, 'groupedData')})
|
|
||||||
// groupedData.sort((a, b) => parseFloat(b.price) - parseFloat(a.price));
|
|
||||||
console.log(sorted, 'groupedDatsorteda');
|
console.log(sorted, 'groupedDatsorteda');
|
||||||
|
|
||||||
// const sortedValues = Object.values(groupedData).sort((a,b)=>b[1]-a[1])
|
|
||||||
// topUser.value = sortedValues.slice(0, 1)
|
|
||||||
// console.log(topUser.value, 'groupedData');
|
|
||||||
|
|
||||||
return sorted
|
return sorted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
visition()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
visiting,
|
visiting,
|
||||||
countvis,
|
countvis,
|
||||||
countgrupp,
|
countgrupp,
|
||||||
activuser,
|
activuser,
|
||||||
data,
|
data,
|
||||||
options
|
options
|
||||||
// chartConfig,
|
|
||||||
// data,
|
|
||||||
// options
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user