mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 13:51:06 +03:30
ss
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div class="small">
|
||||
<pie-chart :chart-data="datacollection"></pie-chart>
|
||||
<bar-chart :chart-data="datacollection"></bar-chart>
|
||||
<button @click="fillData()">Randomize</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BarChart from '@/plugins/chart/BarChart.js'
|
||||
import PieChart from '@/plugins/chart/PieChart.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
BarChart,
|
||||
PieChart
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
datacollection: null
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.fillData()
|
||||
},
|
||||
methods: {
|
||||
fillData () {
|
||||
this.datacollection = {
|
||||
labels: [this.getRandomInt(), this.getRandomInt()],
|
||||
datasets: [
|
||||
{
|
||||
label: 'Data One',
|
||||
backgroundColor: ['#f87979', '#ccc'],
|
||||
data: [this.getRandomInt(), this.getRandomInt()]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
getRandomInt () {
|
||||
return Math.floor(Math.random() * (50 - 5 + 1)) + 5
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.small {
|
||||
max-width: 600px;
|
||||
margin: 150px auto;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user