График

This commit is contained in:
iriska-gri committed 2024-01-22 12:06:10 +03:00
1 parent 78b5fbe7a6
commit 59c08f1297
5 files changed
+73 -13

No files matched your search

@@ -64,7 +64,7 @@ export default {
},
how: {
type: Text,
type: String,
default: ''
}
},
@@ -17,8 +17,10 @@ import {
} from 'chart.js'
import { Line } from 'vue-chartjs'
import * as chartConfig from './chartConfig.js'
import ChartDataLabels from 'chartjs-plugin-datalabels'
ChartJS.register(
ChartDataLabels,
CategoryScale,
LinearScale,
PointElement,
+60 -12
View File
@@ -139,12 +139,7 @@
<td class="text-center">{{ modelrating?val.week[0].size:val.week[1] }}</td>
<td class="text-center">{{ modelrating?val.year[0].size:val.year[1] }}</td>
</tr>
<tr v-for="(val, key) in countgrupp()" :key = key>
<td class="text-left">{{key}}</td>
<td class="text-center">{{ modelrating?val.now[0].size:val.now[1] }} </td>
<td class="text-center">{{ modelrating?val.week[0].size:val.week[1] }}</td>
<td class="text-center">{{ modelrating?val.year[0].size:val.year[1] }}</td>
</tr>
</tbody>
</v-table>
</v-col>
@@ -219,12 +214,20 @@ setup(){
datasets: [
{
label: 'Посещений всего',
backgroundColor: '#f87979',
data: []
backgroundColor: 'crimson',
borderColor: 'crimson',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
hidden: true
},
{
label: 'Уникальные посещения',
backgroundColor: '#f87975',
backgroundColor: 'teal',
borderColor: 'teal',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: []
}
]
@@ -235,6 +238,52 @@ setup(){
})
const options = {
plugins: {
// Change options for ALL labels of THIS CHART
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
}
@@ -262,16 +311,15 @@ setup(){
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)
// arrlines.value.labels = Object.keys(datas)
}