From c924ce6ea6881fdc90da8ea02412bda1f45c6a26 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Tue, 4 Dec 2018 18:57:21 +0100 Subject: [PATCH] Feat: Use tag color in Doughnut chart --- src/components/tag_config.vue | 117 +++++++++++++++++++++++++++++ src/components/tags_comparison.vue | 17 ++++- 2 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 src/components/tag_config.vue diff --git a/src/components/tag_config.vue b/src/components/tag_config.vue new file mode 100644 index 0000000..cc6d44f --- /dev/null +++ b/src/components/tag_config.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/components/tags_comparison.vue b/src/components/tags_comparison.vue index b7af387..b1a87b8 100644 --- a/src/components/tags_comparison.vue +++ b/src/components/tags_comparison.vue @@ -26,7 +26,10 @@ export default { ], options: { responsive: true, - maintainAspectRatio: false + maintainAspectRatio: false, + legend: { + position: 'left' + } } } }, @@ -34,13 +37,23 @@ export default { ...mapGetters('datas', [ 'tag_filter_rows' ]), + ...mapGetters('config', [ + 'tag' + ]), chartdata () { return { labels: this.selected_tags, datasets: [ { label: 'Dépenses', - data: this.spendings + data: this.spendings, + backgroundColor: this.selected_tags.map(t => { + if (this.tag(t)) { + return this.tag(t).color + } else { + return '#A9A9A9' + } + }) } ] }