summaryrefslogtreecommitdiff
path: root/assets/js/components
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-09-03 20:45:30 -0400
committerFrederic Guillot <fred@kanboard.net>2016-09-03 20:45:30 -0400
commitef8ddb59c94e24383531e52371b70b595dff8e24 (patch)
tree6fb3884ab6345a5c06a146cb9d3a40cc37c8119a /assets/js/components
parent8c07a0d03e64227c552f3b4530d3a1e1ba53402b (diff)
Convert user distribution chart to Vue.js component
Diffstat (limited to 'assets/js/components')
-rw-r--r--assets/js/components/chart-project-user-distribution.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/assets/js/components/chart-project-user-distribution.js b/assets/js/components/chart-project-user-distribution.js
new file mode 100644
index 00000000..a569e0be
--- /dev/null
+++ b/assets/js/components/chart-project-user-distribution.js
@@ -0,0 +1,18 @@
+Vue.component('chart-project-user-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].user, this.metrics[i].nb_tasks]);
+ }
+
+ c3.generate({
+ data: {
+ columns: columns,
+ type : 'donut'
+ }
+ });
+ }
+});