Skip to content

Commit

Permalink
feat: data additions for chart tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanoshadjipetrou committed Jun 12, 2024
1 parent 725f1d1 commit 03210d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/config/mapping/allocations/radial.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"tooltipItem": "geography.parent.parent.name",
"value": "value",
"countryCode": "geography/code",
"urlParams": "?$apply=filter(indicatorName eq 'Communicated Allocation - Reference Rate' AND financialDataSet eq 'CommunicatedAllocation_ReferenceRate'<filterString>)/groupby((activityArea/name),aggregate(actualAmount with sum as value))",
"urlParams": "?$apply=filter(indicatorName eq 'Communicated Allocation - Reference Rate' AND financialDataSet eq 'CommunicatedAllocation_ReferenceRate'<filterString>)/groupby((activityArea/name,geography/parent/parent/name),aggregate(actualAmount with sum as value))",
"urlParamsLocation": "?$apply=filter(indicatorName eq 'Communicated Allocation - Reference Rate' AND financialDataSet eq 'CommunicatedAllocation_ReferenceRate'<filterString>)/groupby((activityArea/name),aggregate(actualAmount with sum as value))",
"countriesCountUrlParams": "?$apply=filter(indicatorName eq 'Communicated Allocation - Reference Rate' AND financialDataSet eq 'CommunicatedAllocation_ReferenceRate'<filterString>)/groupby((geography/name))",
"colors": ["#0A2840", "#013E77", "#00B5AE", "#C3EDFD"]
}
5 changes: 4 additions & 1 deletion src/controllers/allocations.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ async function getAllocationsData(url: string) {
items: groupedByName[name].map((item: any) => ({
name: _.get(item, AllocationRadialFieldsMapping.tooltipItem, ''),
value: _.get(item, AllocationRadialFieldsMapping.value, 0),
percentage:
(_.get(item, AllocationRadialFieldsMapping.value, 0) / value) *
100,
})),
},
});
Expand Down Expand Up @@ -419,7 +422,7 @@ export class AllocationsController {
) {
let filterString = filterFinancialIndicators(
{...this.req.query, geographies: countryCode},
AllocationRadialFieldsMapping.urlParams,
AllocationRadialFieldsMapping.urlParamsLocation,
);

const url = `${urls.FINANCIAL_INDICATORS}/${filterString}`;
Expand Down

0 comments on commit 03210d9

Please sign in to comment.