summaryrefslogtreecommitdiff
path: root/assets/js/src
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-06 21:34:57 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-06 21:34:57 -0400
commit08259d4f206438095308749b8cc2abbe629137da (patch)
treedb535ab6fdb7375a33444f3d796bb725469c36ef /assets/js/src
parent663a1c20e6ba0fbf65afcb43f0f48d34f21dcb53 (diff)
Add lead and cycle time for projects
Diffstat (limited to 'assets/js/src')
-rw-r--r--assets/js/src/analytic.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/assets/js/src/analytic.js b/assets/js/src/analytic.js
index 0375f0be..6ea08825 100644
--- a/assets/js/src/analytic.js
+++ b/assets/js/src/analytic.js
@@ -243,6 +243,51 @@
});
}
+ // Draw lead and cycle time for the project
+ function drawLeadAndCycleTime()
+ {
+ var metrics = $("#chart").data("metrics");
+ var cycle = [$("#chart").data("label-cycle")];
+ var lead = [$("#chart").data("label-lead")];
+ var categories = [];
+
+ var types = {};
+ types[$("#chart").data("label-cycle")] = 'area';
+ types[$("#chart").data("label-lead")] = 'area-spline';
+
+ var colors = {};
+ colors[$("#chart").data("label-lead")] = '#afb42b';
+ colors[$("#chart").data("label-cycle")] = '#4e342e';
+
+ for (var i = 0; i < metrics.length; i++) {
+ cycle.push(parseInt(metrics[i].avg_cycle_time));
+ lead.push(parseInt(metrics[i].avg_lead_time));
+ categories.push(metrics[i].day);
+ }
+
+ c3.generate({
+ data: {
+ columns: [
+ lead,
+ cycle
+ ],
+ types: types,
+ colors: colors
+ },
+ axis: {
+ x: {
+ type: 'category',
+ categories: categories
+ },
+ y: {
+ tick: {
+ format: formatDuration
+ }
+ }
+ }
+ });
+ }
+
function formatDuration(d)
{
if (d >= 86400) {
@@ -281,6 +326,9 @@
else if (Kanboard.Exists("analytic-task-time-column")) {
drawTaskTimeColumn();
}
+ else if (Kanboard.Exists("analytic-lead-cycle-time")) {
+ drawLeadAndCycleTime();
+ }
});
})();