Добавить данные к графику
This commit is contained in:
1 parent
5119833fb7
commit
56a5f17857
4 files changed
+73
-32
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<template>
|
||||
|
||||
<v-card class="h-100">
|
||||
<line-graph :data="data" :options="options"/>
|
||||
</v-card>
|
||||
@@ -18,6 +19,10 @@ export default {
|
||||
dataLineChart: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
dataChart: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -52,16 +57,16 @@ export default {
|
||||
tooltips: true
|
||||
}
|
||||
,
|
||||
// {
|
||||
// label: 'CRR',
|
||||
// backgroundColor: 'blue',
|
||||
// borderColor: 'blue',
|
||||
// borderWidth: 3,
|
||||
// cubicInterpolationMode: 'monotone',
|
||||
// data: [],
|
||||
// customlabel: [],
|
||||
// tooltips: true
|
||||
// }
|
||||
{
|
||||
label: 'CRR',
|
||||
backgroundColor: 'blue',
|
||||
borderColor: 'blue',
|
||||
borderWidth: 3,
|
||||
cubicInterpolationMode: 'monotone',
|
||||
data: [],
|
||||
customlabel: [],
|
||||
tooltips: true
|
||||
}
|
||||
]
|
||||
}
|
||||
arrforline()
|
||||
@@ -135,7 +140,7 @@ export default {
|
||||
// }, {})
|
||||
|
||||
Object.entries(props.dataLineChart).forEach(e => {
|
||||
console.log(e,' e');
|
||||
// console.log(e,' e');
|
||||
const [key, value] = e
|
||||
arrlines.value.datasets[0].data.push(value.count)
|
||||
arrlines.value.datasets[1].data.push(value.unic.length)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</v-col>
|
||||
<v-col>
|
||||
|
||||
<line-chart :dataLineChart="dataLineChart"/>
|
||||
<line-chart :dataLineChart="dataLineChart" :dataChart="dataChart"/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
@@ -48,7 +48,7 @@
|
||||
<feedmodul
|
||||
:feedback="feedback"
|
||||
/>
|
||||
|
||||
<my-helper :pretext = dataChart />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
@@ -102,6 +102,7 @@ setup(){
|
||||
const dataActivusers = ref([])
|
||||
const dataAttendance = ref({})
|
||||
const dataIndicators = ref({})
|
||||
const dataChart = ref({})
|
||||
|
||||
const unicuser = ref([])
|
||||
|
||||
@@ -118,8 +119,7 @@ setup(){
|
||||
visiting.value = result.data.result
|
||||
feedback.value = result.data.feedback
|
||||
dataIndicators.value = result.data.indicators
|
||||
console.log(for_formulas.value, 'feedback');
|
||||
|
||||
dataChart.value = result.data.chart,
|
||||
|
||||
visitionreduce()
|
||||
funActiveUser()
|
||||
@@ -306,10 +306,13 @@ setup(){
|
||||
const visitionreduce = () => {
|
||||
|
||||
let lineCharts = {}
|
||||
|
||||
unicuser.value = []
|
||||
|
||||
|
||||
|
||||
pages_count.value.data= data_collection(visiting.value, lineCharts)
|
||||
|
||||
|
||||
dataLineChart.value = lineCharts
|
||||
|
||||
}
|
||||
@@ -344,6 +347,7 @@ setup(){
|
||||
for_formulas,
|
||||
dataAttendance,
|
||||
dataIndicators,
|
||||
dataChart,
|
||||
feedback
|
||||
// countgrupp,
|
||||
// activuser,
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<v-window-item value="document" class="h-100">
|
||||
<v-row no-gutters class="gap h-100 ">
|
||||
<v-col lg="6">
|
||||
<!-- <my-helper :pretext = safetyData /> -->
|
||||
<!---->
|
||||
<v-card class="h-100 flex-column d-flex gap">
|
||||
<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">
|
||||
|
||||
+47
-15
@@ -23,6 +23,7 @@ class Counter(ListAPIView):
|
||||
def get(self, request):
|
||||
|
||||
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))
|
||||
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()))
|
||||
visiting = res.filter(visitdate__gte=request.GET.get("start"))
|
||||
|
||||
|
||||
# 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
|
||||
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')
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
# 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()
|
||||
@@ -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")]), '------------------------------------------------')
|
||||
|
||||
return Response({'result':CountSerializer(visiting, many=True).data,
|
||||
'chart': indicators,
|
||||
# 'today':CountSerializer(nowdate, many=True).data, .aggregate(res=Avg('rating'))
|
||||
'feedback': {
|
||||
'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')),
|
||||
'data': {
|
||||
'score': {
|
||||
@@ -87,6 +118,7 @@ class Counter(ListAPIView):
|
||||
'previos': res.values('user').filter(visitdate__range=[new_date_start, new_date_end]).distinct().count()
|
||||
},
|
||||
'indicators': {
|
||||
|
||||
'crr': {
|
||||
'title': "Удержание",
|
||||
'abb': "(CRR)",
|
||||
|
||||
Reference in new issue
Block a user