[IMPAC-758] Date hidden in X-axis for current ratio and debt service widget#456
[IMPAC-758] Date hidden in X-axis for current ratio and debt service widget#456MAhsenArif wants to merge 3 commits intomaestrano:release/v1.6.9from
Conversation
…rom being shown on x Axis
xaun
left a comment
There was a problem hiding this comment.
Thanks for your PR @MAhsenArif. Just a few minor change suggestions, thanks.
| $scope.intervalsCount = 0 | ||
| $scope.isPnl = false | ||
| $scope.periodInfoContext = {} | ||
| $scope.allowXAxisLegend = true |
There was a problem hiding this comment.
No need to initialise the property here as well as in the w.initContext initializer, as it makes sense for it to stay hidden until it has been validated in the initContext block.. rather than for it to show, and then a few milliseconds later, for it to be hidden.
| $scope.calculatedNumerator = _.last(w.content.calculation.numerator.values) | ||
| $scope.calculatedDenominator = _.last(w.content.calculation.denominator.values) | ||
|
|
||
| $scope.allowWidgetLegend = -> |
There was a problem hiding this comment.
This method is not being used in the view, so it should not be bound to $scope.
| $scope.periodInfoContext.histParams = w.metadata.hist_parameters | ||
| $scope.periodInfoContext.accountingBehaviour = behaviour | ||
| getPrefix(behaviour).then((label)-> $scope.periodInfoContext.injectBefore = label) | ||
| $scope.allowXAxisLegend = $scope.allowWidgetLegend() |
There was a problem hiding this comment.
As this method is only being invoked here, I think we can just do this:
$scope.allowXAxisLegend = !_.includes(['accounts/ratios/current', 'accounts/ratios/debt_service'], w.endpoint)
This leverages Lodash, to shorten & add readability to the statement, and then we can remove the allowWidgetLegend method.
| <div class="history chart-container" ng-show="widget.isHistoryMode"> | ||
| <div impac-chart draw-trigger="::drawTrigger.promise" deferred="::chartDeferred"></div> | ||
| <div class="legend">{{ widget.content.layout.ratio }}</div> | ||
| <div ng-show="allowXAxisLegend" class="legend">{{ widget.content.layout.ratio }}</div> |
There was a problem hiding this comment.
Prefer ng-if over ng-show. ng-show is really only useful if you want to specifically want to keep an element in the DOM.
177bbae to
b85818a
Compare
|
Merged in #472 to fix conflicts |
No description provided.