diff --git a/seed/static/seed/js/controllers/inventory_reports_controller.js b/seed/static/seed/js/controllers/inventory_reports_controller.js index 1ea5495e57..d1b6db38ad 100644 --- a/seed/static/seed/js/controllers/inventory_reports_controller.js +++ b/seed/static/seed/js/controllers/inventory_reports_controller.js @@ -266,10 +266,10 @@ angular.module('BE.seed.controller.inventory_reports', []).controller('inventory const label = []; const labeltmp = $scope.chartData.chartData.filter((entry) => entry.id === ctx.raw.id); if (labeltmp.length > 0) { - label.push(`${$scope.yAxisSelectedItem.label}: ${ctx.formattedValue}`); + label.push(`${$scope.yAxisSelectedItem.label}: ${type=="bar"? ctx.label: ctx.parsed.x}`); // The x axis data is generated more programmatically than the y, so only // grab the `label` since the `axisLabel` has redundant unit information. - label.push(`${$scope.xAxisSelectedItem.label}: ${ctx.parsed.x}`); + label.push(`${$scope.xAxisSelectedItem.label}: ${type=="bar"? ctx.parsed.y: ctx.formattedValue}`); } return label; } @@ -395,8 +395,8 @@ angular.module('BE.seed.controller.inventory_reports', []).controller('inventory $scope.chart1Title = $translate.instant('X_VERSUS_Y', interpolationParams); $scope.chart2Title = $translate.instant('X_VERSUS_Y_AGGREGATED', interpolationParams); - $scope.scatterChart.options.scales.x.title.text = $scope.xAxisSelectedItem.label; - $scope.scatterChart.options.scales.y.title.text = $scope.yAxisSelectedItem.label; + $scope.scatterChart.options.scales.y.title.text = $scope.xAxisSelectedItem.label; + $scope.scatterChart.options.scales.x.title.text = $scope.yAxisSelectedItem.label; $scope.barChart.options.scales.y.title.text = $scope.xAxisSelectedItem.label; $scope.barChart.options.scales.x.title.text = $scope.yAxisSelectedItem.label; @@ -432,8 +432,8 @@ angular.module('BE.seed.controller.inventory_reports', []).controller('inventory The chart will update automatically as it's watching the chartData property on the scope. */ function getChartData() { - const xVar = $scope.xAxisSelectedItem.varName; - const yVar = $scope.yAxisSelectedItem.varName; + const yVar = $scope.xAxisSelectedItem.varName; + const xVar = $scope.yAxisSelectedItem.varName; $scope.chartIsLoading = true; inventory_reports_service