Feat(Tags): transform graph_tags_comparison legend

This commit is contained in:
Bertrand Benjamin 2019-01-28 09:47:41 +01:00
parent ecf7db6a8f
commit bc7f771d25
2 changed files with 24 additions and 8 deletions

View File

@ -1,6 +1,16 @@
<template>
<div class="container">
<pie :chart-data="chartdata" :options="options" v-if="spendings[0] !== 0"></pie>
<div>
<div class="container">
<pie :chart-data="chartdata" :options="options" v-if="spendings[0] !== 0"></pie>
</div>
<div class="text-center">
<b-button-group size="sm">
<b-button v-for="tag in selected_tags"
:style="{'background-color': backgroundColor(tag)}">
{{ tag }}
</b-button>
</b-button-group>
</div>
</div>
</template>
@ -20,6 +30,7 @@ export default {
responsive: true,
maintainAspectRatio: false,
legend: {
display: false,
position: 'left'
}
}
@ -46,11 +57,7 @@ export default {
label: 'Dépenses',
data: this.spendings,
backgroundColor: this.selected_tags.map(t => {
if (this.tag(t)) {
return this.tag(t).color
} else {
return '#A9A9A9'
}
return this.backgroundColor(t)
})
}
]
@ -69,6 +76,13 @@ export default {
}
},
methods: {
backgroundColor (t) {
if (this.tag(t)) {
return this.tag(t).color
} else {
return '#A9A9A9'
}
}
}
}

View File

@ -20,8 +20,10 @@
</b-row>
</b-container>
<b-card-group deck class="mb-3" v-for="categorie in categories">
<b-card-group deck class="mb-3">
<div v-for="categorie in categories">
<card-categorie @click.native="set_categories_filter([categorie.name])" :categoriename="categorie.name"></card-categorie>
</div>
</b-card-group>
<tags-comparison></tags-comparison>