summaryrefslogtreecommitdiff
path: root/assets/js/components/chart-project-task-distribution.js
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-09-03 20:39:13 -0400
committerFrederic Guillot <fred@kanboard.net>2016-09-03 20:39:13 -0400
commit8c07a0d03e64227c552f3b4530d3a1e1ba53402b (patch)
tree1d60285831f41beae2067fe55bd820affda6ebe3 /assets/js/components/chart-project-task-distribution.js
parent59fd3c366cd34cf1be3f20d44b424107c88c030b (diff)
Convert task distribution chart to Vue.js component
Diffstat (limited to 'assets/js/components/chart-project-task-distribution.js')
-rw-r--r--assets/js/components/chart-project-task-distribution.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/assets/js/components/chart-project-task-distribution.js b/assets/js/components/chart-project-task-distribution.js
new file mode 100644
index 00000000..b5d712ce
--- /dev/null
+++ b/assets/js/components/chart-project-task-distribution.js
@@ -0,0 +1,18 @@
+Vue.component('chart-project-task-distribution', {
+ props: ['metrics'],
+ template: '<div id="chart"></div>',
+ ready: function () {
+ var columns = [];
+
+ for (var i = 0; i < this.metrics.length; i++) {
+ columns.push([this.metrics[i].column_title, this.metrics[i].nb_tasks]);
+ }
+
+ c3.generate({
+ data: {
+ columns: columns,
+ type : 'donut'
+ }
+ });
+ }
+});