From 32bd8b64734340f58b1a270c825e87da85087223 Mon Sep 17 00:00:00 2001 From: kialam Date: Thu, 8 Nov 2018 09:15:54 -0500 Subject: [PATCH] Fix Dashboard hover-over action so it shows the correct info. - Refactor our Dashboard directive to display the dashboard graph's x-axis according to the new changes in NVD3 v1.8.1. See https://github.com/nvd3-community/nvd3/blob/gh-pages/examples/lineChart.html for reference. --- .../graphs/job-status/job-status-graph.directive.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/awx/ui/client/src/home/dashboard/graphs/job-status/job-status-graph.directive.js b/awx/ui/client/src/home/dashboard/graphs/job-status/job-status-graph.directive.js index fc45513f54..dd9f4c5969 100644 --- a/awx/ui/client/src/home/dashboard/graphs/job-status/job-status-graph.directive.js +++ b/awx/ui/client/src/home/dashboard/graphs/job-status/job-status-graph.directive.js @@ -91,7 +91,6 @@ function JobStatusGraph($window, adjustGraphSize, templateUrl, i18n, moment, gra }); job_status_chart - .x(function(d,i) { return i; }) .useInteractiveGuideline(true) //We want nice looking tooltips and a guideline! .showLegend(false) //Show the legend, allowing users to turn on/off line series. .showYAxis(true) //Show the y-axis @@ -104,15 +103,13 @@ function JobStatusGraph($window, adjustGraphSize, templateUrl, i18n, moment, gra job_status_chart.xAxis .axisLabel(i18n._("TIME"))//.showMaxMin(true) .tickFormat(function(d) { - const dx = graphData[0].values[d] && graphData[0].values[d].x || 0; - - if (!dx) { + if (d) { + const tickDate = new Date(Number(d + '000')); + return moment(tickDate).format(timeFormat); + } + else { return ''; } - - const tickDate = new Date(Number(dx + '000')); - - return moment(tickDate).format(timeFormat); }); job_status_chart.yAxis //Chart y-axis settings