Skip to content
Snippets Groups Projects
Commit 4dc64a67 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

create dataset from filtered data, to avoid showing rows without data

parent ce7f6bd2
Branches
Tags
1 merge request!134Refactor
This commit is part of merge request !134. Comments created here will be created in the context of that merge request.
......@@ -116,15 +116,11 @@ function FundingSourcePage() {
const { filterSelection, setFilterSelection } = useContext(FilterSelectionContext);
const { data: fundingSourceData, years, nrens } = useData<FundingSource>('/api/funding/', setFilterSelection);
const fundingSourceDataset = createFundingSourceDataset(fundingSourceData);
const selectedData = fundingSourceData.filter(data =>
filterSelection.selectedYears.includes(data.year) && filterSelection.selectedNrens.includes(data.nren)
);
fundingSourceDataset.datasets.forEach(dataset => {
dataset.hidden = !filterSelection.selectedYears.includes(parseInt(dataset.stack));
});
const fundingSourceDataset = createFundingSourceDataset(selectedData);
// remove the datapoints and labels for the nrens that aren't selected
// unfortunately we cannot just hide them because graph.js doesn't want
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment