From 8c07a0d03e64227c552f3b4530d3a1e1ba53402b Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 3 Sep 2016 20:39:13 -0400 Subject: Convert task distribution chart to Vue.js component --- .../js/components/chart-project-task-distribution.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 assets/js/components/chart-project-task-distribution.js (limited to 'assets/js/components/chart-project-task-distribution.js') 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: '
', + 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' + } + }); + } +}); -- cgit v1.2.3