Добавить данные к графику
This commit is contained in:
1 parent
5119833fb7
commit
56a5f17857
4 files changed
+70
-29
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<v-card class="h-100">
|
<v-card class="h-100">
|
||||||
<line-graph :data="data" :options="options"/>
|
<line-graph :data="data" :options="options"/>
|
||||||
</v-card>
|
</v-card>
|
||||||
@@ -18,6 +19,10 @@ export default {
|
|||||||
dataLineChart: {
|
dataLineChart: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
|
},
|
||||||
|
dataChart: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -52,16 +57,16 @@ export default {
|
|||||||
tooltips: true
|
tooltips: true
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
// {
|
{
|
||||||
// label: 'CRR',
|
label: 'CRR',
|
||||||
// backgroundColor: 'blue',
|
backgroundColor: 'blue',
|
||||||
// borderColor: 'blue',
|
borderColor: 'blue',
|
||||||
// borderWidth: 3,
|
borderWidth: 3,
|
||||||
// cubicInterpolationMode: 'monotone',
|
cubicInterpolationMode: 'monotone',
|
||||||
// data: [],
|
data: [],
|
||||||
// customlabel: [],
|
customlabel: [],
|
||||||
// tooltips: true
|
tooltips: true
|
||||||
// }
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
arrforline()
|
arrforline()
|
||||||
@@ -135,7 +140,7 @@ export default {
|
|||||||
// }, {})
|
// }, {})
|
||||||
|
|
||||||
Object.entries(props.dataLineChart).forEach(e => {
|
Object.entries(props.dataLineChart).forEach(e => {
|
||||||
console.log(e,' e');
|
// console.log(e,' e');
|
||||||
const [key, value] = e
|
const [key, value] = e
|
||||||
arrlines.value.datasets[0].data.push(value.count)
|
arrlines.value.datasets[0].data.push(value.count)
|
||||||
arrlines.value.datasets[1].data.push(value.unic.length)
|
arrlines.value.datasets[1].data.push(value.unic.length)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
<v-col>
|
<v-col>
|
||||||
|
|
||||||
<line-chart :dataLineChart="dataLineChart"/>
|
<line-chart :dataLineChart="dataLineChart" :dataChart="dataChart"/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<feedmodul
|
<feedmodul
|
||||||
:feedback="feedback"
|
:feedback="feedback"
|
||||||
/>
|
/>
|
||||||
|
<my-helper :pretext = dataChart />
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -102,6 +102,7 @@ setup(){
|
|||||||
const dataActivusers = ref([])
|
const dataActivusers = ref([])
|
||||||
const dataAttendance = ref({})
|
const dataAttendance = ref({})
|
||||||
const dataIndicators = ref({})
|
const dataIndicators = ref({})
|
||||||
|
const dataChart = ref({})
|
||||||
|
|
||||||
const unicuser = ref([])
|
const unicuser = ref([])
|
||||||
|
|
||||||
@@ -118,8 +119,7 @@ setup(){
|
|||||||
visiting.value = result.data.result
|
visiting.value = result.data.result
|
||||||
feedback.value = result.data.feedback
|
feedback.value = result.data.feedback
|
||||||
dataIndicators.value = result.data.indicators
|
dataIndicators.value = result.data.indicators
|
||||||
console.log(for_formulas.value, 'feedback');
|
dataChart.value = result.data.chart,
|
||||||
|
|
||||||
|
|
||||||
visitionreduce()
|
visitionreduce()
|
||||||
funActiveUser()
|
funActiveUser()
|
||||||
@@ -306,10 +306,13 @@ setup(){
|
|||||||
const visitionreduce = () => {
|
const visitionreduce = () => {
|
||||||
|
|
||||||
let lineCharts = {}
|
let lineCharts = {}
|
||||||
|
|
||||||
unicuser.value = []
|
unicuser.value = []
|
||||||
|
|
||||||
|
|
||||||
pages_count.value.data= data_collection(visiting.value, lineCharts)
|
pages_count.value.data= data_collection(visiting.value, lineCharts)
|
||||||
|
|
||||||
|
|
||||||
dataLineChart.value = lineCharts
|
dataLineChart.value = lineCharts
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -344,6 +347,7 @@ setup(){
|
|||||||
for_formulas,
|
for_formulas,
|
||||||
dataAttendance,
|
dataAttendance,
|
||||||
dataIndicators,
|
dataIndicators,
|
||||||
|
dataChart,
|
||||||
feedback
|
feedback
|
||||||
// countgrupp,
|
// countgrupp,
|
||||||
// activuser,
|
// activuser,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<v-window-item value="document" class="h-100">
|
<v-window-item value="document" class="h-100">
|
||||||
<v-row no-gutters class="gap h-100 ">
|
<v-row no-gutters class="gap h-100 ">
|
||||||
<v-col lg="6">
|
<v-col lg="6">
|
||||||
<!-- <my-helper :pretext = safetyData /> -->
|
<!---->
|
||||||
<v-card class="h-100 flex-column d-flex gap">
|
<v-card class="h-100 flex-column d-flex gap">
|
||||||
<v-row class="ma-0 my-3 overflow-auto h-0 pb-1">
|
<v-row class="ma-0 my-3 overflow-auto h-0 pb-1">
|
||||||
<v-card v-for="item in safetyData" :key="item.id" class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100">
|
<v-card v-for="item in safetyData" :key="item.id" class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100">
|
||||||
|
|||||||
+45
-13
@@ -23,6 +23,7 @@ class Counter(ListAPIView):
|
|||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
|
||||||
data_start = datetime.strptime(request.GET.get("start"), "%Y-%m-%d").date()
|
data_start = datetime.strptime(request.GET.get("start"), "%Y-%m-%d").date()
|
||||||
|
data_end = datetime.strptime(request.GET.get("end"), "%Y-%m-%d").date()
|
||||||
beetween = datetime.strptime(request.GET.get("end"), "%Y-%m-%d").date() - (data_start + timedelta(days=1))
|
beetween = datetime.strptime(request.GET.get("end"), "%Y-%m-%d").date() - (data_start + timedelta(days=1))
|
||||||
crrdate = data_start - timedelta(days=1)
|
crrdate = data_start - timedelta(days=1)
|
||||||
|
|
||||||
@@ -35,23 +36,51 @@ class Counter(ListAPIView):
|
|||||||
# Посещаемость портала
|
# Посещаемость портала
|
||||||
res = CountVisitor.objects.filter(Q(visitdate__lte = request.GET.get("end")) | Q(visitdate=date.today()))
|
res = CountVisitor.objects.filter(Q(visitdate__lte = request.GET.get("end")) | Q(visitdate=date.today()))
|
||||||
visiting = res.filter(visitdate__gte=request.GET.get("start"))
|
visiting = res.filter(visitdate__gte=request.GET.get("start"))
|
||||||
|
formulas = data_start
|
||||||
|
indicators={}
|
||||||
|
print(formulas.strftime("%Y-%m-%d"),'--------------')
|
||||||
|
while (formulas <= data_end):
|
||||||
|
indicators[formulas.strftime("%Y-%m-%d")] = {'crr': 0, 'br': 0, 'ppv': 0}
|
||||||
|
|
||||||
|
# CRR
|
||||||
|
all_end = res.filter(visitdate__lte = formulas).distinct()
|
||||||
|
# Количество на начало периода
|
||||||
|
crr_start = all_end.values('user', 'visitdate').filter(visitdate__lte = crrdate).count()
|
||||||
|
# Количество клиентов на конец периода
|
||||||
|
crr_end = all_end.values('user', 'visitdate').count()
|
||||||
|
# Количество за выбранный период
|
||||||
|
crr_per = crr_end - crr_start
|
||||||
|
indicators[formulas.strftime("%Y-%m-%d")]['crr'] = ((crr_end - crr_per)/crr_start)*100
|
||||||
|
|
||||||
|
# BR Количество сессий, в которых посетитель посмотрел не более 1 страницы
|
||||||
|
br = res.filter(visitdate__range=[request.GET.get("start"), formulas]).values_list('user', 'visitdate').order_by('user', 'visitdate').annotate(count_pages=Count('pages')).filter(count_pages=1).count()
|
||||||
|
# PPV
|
||||||
|
ppv = res.filter(visitdate__range=[request.GET.get("start"), formulas]).count()
|
||||||
|
if crr_per > 0:
|
||||||
|
indicators[formulas.strftime("%Y-%m-%d")]['br'] = round((br/crr_per)*100, 2)
|
||||||
|
indicators[formulas.strftime("%Y-%m-%d")]['ppv'] = round(ppv/crr_per, 2)
|
||||||
|
# print(br, crr_per, request.GET.get("start"), formulas, '1')
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
formulas += timedelta(days=1)
|
||||||
|
print(indicators, '88888888888888888')
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# CRR
|
|
||||||
all_end = res.filter(visitdate__lte = request.GET.get("end")).distinct()
|
|
||||||
# Количество на начало периода
|
|
||||||
crr_start = all_end.values('user', 'visitdate').filter(visitdate__lte = crrdate).count()
|
|
||||||
# Количество клиентов на конец периода
|
|
||||||
crr_end = all_end.values('user', 'visitdate').count()
|
|
||||||
# Количество за выбранный период
|
|
||||||
crr_per = crr_end - crr_start
|
|
||||||
|
|
||||||
|
|
||||||
# BR Количество сессий, в которых посетитель посмотрел не более 1 страницы
|
|
||||||
br = res.filter(visitdate__range=[request.GET.get("start"), request.GET.get("end")]).values_list('user', 'visitdate').order_by('user', 'visitdate').annotate(count_pages=Count('pages')).filter(count_pages=1).count()
|
|
||||||
print(br,'11111111111111111')
|
|
||||||
# PPV
|
|
||||||
ppv = res.filter(visitdate__range=[request.GET.get("start"), request.GET.get("end")]).count()
|
|
||||||
|
|
||||||
# Обратная связь
|
# Обратная связь
|
||||||
feed = UserComment.objects.all()
|
feed = UserComment.objects.all()
|
||||||
@@ -62,9 +91,11 @@ class Counter(ListAPIView):
|
|||||||
# print(feed.values_list('user', 'comment').annotate(count_comment=Count('comment')).order_by(F('count_comment').desc(nulls_last=True)).filter(time_create__range=[request.GET.get("start"), request.GET.get("end")]), '------------------------------------------------')
|
# print(feed.values_list('user', 'comment').annotate(count_comment=Count('comment')).order_by(F('count_comment').desc(nulls_last=True)).filter(time_create__range=[request.GET.get("start"), request.GET.get("end")]), '------------------------------------------------')
|
||||||
|
|
||||||
return Response({'result':CountSerializer(visiting, many=True).data,
|
return Response({'result':CountSerializer(visiting, many=True).data,
|
||||||
|
'chart': indicators,
|
||||||
# 'today':CountSerializer(nowdate, many=True).data, .aggregate(res=Avg('rating'))
|
# 'today':CountSerializer(nowdate, many=True).data, .aggregate(res=Avg('rating'))
|
||||||
'feedback': {
|
'feedback': {
|
||||||
'feed': UserCommentSerializer(d, many=True).data,
|
'feed': UserCommentSerializer(d, many=True).data,
|
||||||
|
#
|
||||||
'criteria': list(rating.values('crit__name').annotate(ratings=Avg('rating'), name=F('crit__name'), ico=F('crit__ico'), color=F('crit__color')).values('ratings', 'name', 'ico', 'color')),
|
'criteria': list(rating.values('crit__name').annotate(ratings=Avg('rating'), name=F('crit__name'), ico=F('crit__ico'), color=F('crit__color')).values('ratings', 'name', 'ico', 'color')),
|
||||||
'data': {
|
'data': {
|
||||||
'score': {
|
'score': {
|
||||||
@@ -87,6 +118,7 @@ class Counter(ListAPIView):
|
|||||||
'previos': res.values('user').filter(visitdate__range=[new_date_start, new_date_end]).distinct().count()
|
'previos': res.values('user').filter(visitdate__range=[new_date_start, new_date_end]).distinct().count()
|
||||||
},
|
},
|
||||||
'indicators': {
|
'indicators': {
|
||||||
|
|
||||||
'crr': {
|
'crr': {
|
||||||
'title': "Удержание",
|
'title': "Удержание",
|
||||||
'abb': "(CRR)",
|
'abb': "(CRR)",
|
||||||
|
|||||||
Reference in new issue
Block a user