Skip to content

Commit

Permalink
Flip axis
Browse files Browse the repository at this point in the history
  • Loading branch information
haneslinger committed May 31, 2024
1 parent 2d8fb48 commit 020eca6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions seed/static/seed/js/controllers/inventory_reports_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ angular.module('BE.seed.controller.inventory_reports', []).controller('inventory
return ctx[0]?.raw.display_name;
},
label: (ctx) => [
`${$scope.xAxisSelectedItem.label}: ${type === 'bar' ? ctx.raw : ctx.parsed.x}`,
`${$scope.yAxisSelectedItem.label}: ${type === 'bar' ? ctx.label : ctx.parsed.y}`
`${$scope.xAxisSelectedItem.label}: ${type === 'bar' ? ctx.raw : ctx.parsed.y}`,
`${$scope.yAxisSelectedItem.label}: ${type === 'bar' ? ctx.label : ctx.parsed.x}`
]
}
}
Expand All @@ -246,12 +246,12 @@ angular.module('BE.seed.controller.inventory_reports', []).controller('inventory

$scope.scatterChart = createChart('chartNew', 'scatter', 'x', $scope.pointBackgroundColors);

$scope.barChart = createChart('aggChartNew', 'bar', 'y', $scope.aggPointBackgroundColors);
$scope.barChart = createChart('aggChartNew', 'bar', 'x', $scope.aggPointBackgroundColors);

// specific styling for bar chart
$scope.barChart.options.scales.x.ticks = { precision: 0 };
$scope.barChart.options.scales.y.type = 'category';
$scope.barChart.options.scales.y.ticks = {};
$scope.barChart.options.scales.y.ticks = { precision: 0 };
$scope.barChart.options.scales.x.type = 'category';
$scope.barChart.options.scales.x.ticks = {};

// specific styling for scatter chart
$scope.scatterChart.options.scales.x.suggestedMin = 0;
Expand Down Expand Up @@ -396,8 +396,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
Expand Down

0 comments on commit 020eca6

Please sign in to comment.