cbioportal-frontend
cbioportal-frontend copied to clipboard
on plots tab add sorting for barcharts
Fixes #10722
Describe changes proposed in this pull request:
I have created a dropdown field named 'Sort' which currently contains two options: 'Sort by Alphabet' and 'Sort by Count'. By default, 'Sort by Alphabet' is selected. I implemented the logic for 'Sort by Count' as follows:
i) I passed the 'sortOption' prop throughout the plot components. ii) In 'MultipleCategoryBarPlotUtils.ts', I added a case where if the 'sortOption' is 'sortByCount', it creates an array named 'totalSumArray'. This array stores fields defined by the interface:
interface TotalSumItem {
majorCategory: string;
sum: number;
minorCategory: { name: string; count: number; percentage: number.. }[];
}
Then, I sorted the above array with respect to 'sum', and finally returned the individually sorted array. I implemented the same for sorted labels.
Checks
- [ ] Has tests or has a separate issue that describes the types of test that should be created. If no test is included it should explicitly be mentioned in the PR why there is no test.
- [ ] The commit log is comprehensible. It follows 7 rules of great commit messages. For most PRs a single commit should suffice, in some cases multiple topical commits can be useful. During review it is ok to see tiny commits (e.g. Fix reviewer comments), but right before the code gets merged to master or rc branch, any such commits should be squashed since they are useless to the other developers. Definitely avoid merge commits, use rebase instead.
- [ ] Is this PR adding logic based on one or more clinical attributes? If yes, please make sure validation for this attribute is also present in the data validation / data loading layers (in backend repo) and documented in File-Formats Clinical data section!
Any screenshots or GIFs?
Deploy Preview for cbioportalfrontend ready!
Name | Link |
---|---|
Latest commit | ece5a45c22a0657c92e1abf1b34ffeaf1c51c713 |
Latest deploy log | https://app.netlify.com/sites/cbioportalfrontend/deploys/66307d5e564ec400082ec82f |
Deploy Preview | https://deploy-preview-4893--cbioportalfrontend.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
@gblaih I have made nearly all the changes you suggested. Could you please review them and merge the branch if everything looks good?
@SURAJ-SHARMA27 added a couple minor comments to be addressed but looks good overall. thanks!
@gblaih , I have made all the changes suggested. Could you review it once more?
@SURAJ-SHARMA27 have you had a chance to look at these comments?
@SURAJ-SHARMA27 have you had a chance to look at these comments?
Actually, my laptop's RAM was causing issues, which is why the repository was not running locally.