Пофиг
This commit is contained in:
1 parent
f734f7c397
commit
9b224698a5
2 files changed
+154
-119
No files matched your search
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<line-graph :data="data" :options="options"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import lineGraph from '@/components/graph/line-graph.vue'
|
||||
import {computed } from 'vue'
|
||||
import {format1} from '@/utils/universal_functions'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
lineGraph,
|
||||
},
|
||||
|
||||
props: {
|
||||
visiting: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
|
||||
setup(props, {emit}) {
|
||||
|
||||
const arrlines = {}
|
||||
const customLabel = ['c1', 'c2']
|
||||
|
||||
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',
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
// label: []
|
||||
label: function(tooltipItem, data) {
|
||||
// let label = []
|
||||
return customLabel.value[tooltipItem.index]
|
||||
}
|
||||
}}
|
||||
},
|
||||
|
||||
scales: {
|
||||
x: {
|
||||
grid: {
|
||||
color: 'white',
|
||||
}
|
||||
},
|
||||
y: {
|
||||
ticks: {
|
||||
stepSize: 10
|
||||
},
|
||||
offset: true,
|
||||
grid: {
|
||||
color: 'white',
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
responsive: true,
|
||||
maintainAspectRatio: false
|
||||
|
||||
}
|
||||
|
||||
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(item.author.id))
|
||||
{
|
||||
acc[item.visitdate]['unic'].push(item.author.id)
|
||||
|
||||
}
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
Object.entries(datas).forEach(e => {
|
||||
const [key, value] = e
|
||||
console.log(key, value)
|
||||
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))
|
||||
// customLabel.value.push('datas[key].count')
|
||||
});
|
||||
|
||||
// for (let [val, key] in datas) {
|
||||
// console.log(val, key, 'kkkkkkkkkkkk');
|
||||
// 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))
|
||||
|
||||
// }
|
||||
}
|
||||
return {
|
||||
data,
|
||||
options,
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -87,7 +87,9 @@
|
||||
class="d-flex flex-column text-center"
|
||||
height="200px"
|
||||
>
|
||||
<line-graph :data="data" :options="options"/>
|
||||
<line-chart :visiting="visiting"/>
|
||||
|
||||
<!-- <line-graph :data="data" :options="options"/> -->
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user