Feat: first doughnut chart with chartjs
This commit is contained in:
parent
b61d465a24
commit
0c2b8159d1
19
src/components/charjs_donut.vue
Normal file
19
src/components/charjs_donut.vue
Normal file
@ -0,0 +1,19 @@
|
||||
<script>
|
||||
import { Doughnut } from 'vue-chartjs'
|
||||
|
||||
export default {
|
||||
name: 'pie',
|
||||
extends: Doughnut,
|
||||
props: ['chartdata', 'options'],
|
||||
mounted () {
|
||||
this.renderChart(this.chartdata, this.options)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scope>
|
||||
#doughnut-chart {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
51
src/components/postes_comparison.vue
Normal file
51
src/components/postes_comparison.vue
Normal file
@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<pie :chartdata="data" :options="options"></pie>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pie from './charjs_donut'
|
||||
|
||||
export default {
|
||||
name: 'postesComparison',
|
||||
components: {
|
||||
'pie': pie
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
data: {
|
||||
labels: ["Africa", "Asia", "Europe", "Latin America", "North America"],
|
||||
datasets: [
|
||||
{
|
||||
label: "Population (millions)",
|
||||
backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"],
|
||||
data: [2478,5267,734,784,433]
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Predicted world population (millions) in 2050'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scope>
|
||||
.container {
|
||||
position: relative;
|
||||
height: 40vh;
|
||||
width: 80vw;
|
||||
}
|
||||
</style>
|
@ -21,6 +21,8 @@
|
||||
<box @click.native="set_poste('other')" postename="other"></box>
|
||||
</b-card-group>
|
||||
|
||||
<postes-comparison></postes-comparison>
|
||||
|
||||
<b-table striped hover :items="filtered_rows(poste.words, poste.invert)" :fields='fields'></b-table>
|
||||
</div>
|
||||
</template>
|
||||
@ -28,11 +30,13 @@
|
||||
<script>
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
import box from '../components/box'
|
||||
import postesComparison from '../components/postes_comparison'
|
||||
|
||||
export default {
|
||||
name: 'home',
|
||||
components: {
|
||||
box: box
|
||||
box: box,
|
||||
postesComparison: postesComparison
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user