From 2ef18bdec6de1a7bc7e37e2f693a599bf34ef961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C3=B3jcik?= Date: Mon, 16 Jul 2018 10:48:30 +0200 Subject: [PATCH 1/2] Remove not needed dates in the large graph, and fix the scaleX when first series holds no values and second series does. --- .../monitoring/js/directives/ui.particular.largeGraph.js | 7 ++++--- .../app/modules/monitoring/views/endpoint_details.html | 3 --- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ServicePulse.Host/app/modules/monitoring/js/directives/ui.particular.largeGraph.js b/src/ServicePulse.Host/app/modules/monitoring/js/directives/ui.particular.largeGraph.js index eb49e674a1..2d4676441c 100644 --- a/src/ServicePulse.Host/app/modules/monitoring/js/directives/ui.particular.largeGraph.js +++ b/src/ServicePulse.Host/app/modules/monitoring/js/directives/ui.particular.largeGraph.js @@ -72,8 +72,7 @@ function(formatter) { return { restrict: 'E', - scope: { - dates: '=xaxisPoints', + scope: { firstDataSeries: '=firstDataSeries', secondDataSeries: '=secondDataSeries', isDurationGraph: '=isDurationGraph', @@ -111,8 +110,10 @@ var firstSeries = scope.firstDataSeries; var secondSeries = scope.secondDataSeries; + var amountOfValues = Math.max(firstSeries.points.length, secondSeries ? secondSeries.points.length : 0); + var scaleX = d3.scaleLinear() - .domain([0, firstSeries.points.length - 1]) + .domain([0, amountOfValues - 1]) .range([leftMargin, width]); chart.append('rect') diff --git a/src/ServicePulse.Host/app/modules/monitoring/views/endpoint_details.html b/src/ServicePulse.Host/app/modules/monitoring/views/endpoint_details.html index f198261689..2f9cd892b1 100644 --- a/src/ServicePulse.Host/app/modules/monitoring/views/endpoint_details.html +++ b/src/ServicePulse.Host/app/modules/monitoring/views/endpoint_details.html @@ -41,7 +41,6 @@

Date: Mon, 16 Jul 2018 10:50:29 +0200 Subject: [PATCH 2/2] Fixing the Y scaling to accomodate for the case when first series holds no values. --- .../monitoring/js/directives/ui.particular.largeGraph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ServicePulse.Host/app/modules/monitoring/js/directives/ui.particular.largeGraph.js b/src/ServicePulse.Host/app/modules/monitoring/js/directives/ui.particular.largeGraph.js index 2d4676441c..ffba901922 100644 --- a/src/ServicePulse.Host/app/modules/monitoring/js/directives/ui.particular.largeGraph.js +++ b/src/ServicePulse.Host/app/modules/monitoring/js/directives/ui.particular.largeGraph.js @@ -123,7 +123,7 @@ .attr('fill', '#F2F6F7'); var minimumYaxis = !isNaN(scope.minimumYaxis) ? Number(scope.minimumYaxis) : 10; - var max = Math.max(firstSeries.average, d3.max(firstSeries.points), minimumYaxis); + var max = Math.max(firstSeries.average, firstSeries.points.length > 0 ? d3.max(firstSeries.points) : 0, minimumYaxis); if (secondSeries && secondSeries.points.length > 0) { max = Math.max(max, secondSeries.average, d3.max(secondSeries.points));