График
This commit is contained in:
1 parent
78b5fbe7a6
commit
59c08f1297
5 files changed
+73
-13
No files matched your search
Generated
+9
@@ -13,6 +13,7 @@
|
||||
"@vuelidate/validators": "^2.0.3",
|
||||
"axios": "^1.4.0",
|
||||
"chart.js": "^4.4.1",
|
||||
"chartjs-plugin-datalabels": "^2.2.0",
|
||||
"date-fns": "^2.30.0",
|
||||
"express-vue": "^5.12.0",
|
||||
"moment": "^2.29.4",
|
||||
@@ -7364,6 +7365,14 @@
|
||||
"pnpm": ">=7"
|
||||
}
|
||||
},
|
||||
"node_modules/chartjs-plugin-datalabels": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/chartjs-plugin-datalabels/-/chartjs-plugin-datalabels-2.2.0.tgz",
|
||||
"integrity": "sha512-14ZU30lH7n89oq+A4bWaJPnAG8a7ZTk7dKf48YAzMvJjQtjrgg5Dpk9f+LbjCF6bpx3RAGTeL13IXpKQYyRvlw==",
|
||||
"peerDependencies": {
|
||||
"chart.js": ">=3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/chokidar": {
|
||||
"version": "3.5.3",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"@vuelidate/validators": "^2.0.3",
|
||||
"axios": "^1.4.0",
|
||||
"chart.js": "^4.4.1",
|
||||
"chartjs-plugin-datalabels": "^2.2.0",
|
||||
"date-fns": "^2.30.0",
|
||||
"express-vue": "^5.12.0",
|
||||
"moment": "^2.29.4",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user