cbioportal-frontend icon indicating copy to clipboard operation
cbioportal-frontend copied to clipboard

on plots tab add sorting for barcharts

Open SURAJ-SHARMA27 opened this issue 10 months ago • 6 comments

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?

Screencast from 2024-04-16 15-48-09.webm

SURAJ-SHARMA27 avatar Apr 16 '24 11:04 SURAJ-SHARMA27

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...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Apr 16 '24 11:04 netlify[bot]

@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 avatar Apr 27 '24 05:04 SURAJ-SHARMA27

@SURAJ-SHARMA27 added a couple minor comments to be addressed but looks good overall. thanks!

gblaih avatar Apr 29 '24 20:04 gblaih

@gblaih , I have made all the changes suggested. Could you review it once more?

SURAJ-SHARMA27 avatar Apr 30 '24 05:04 SURAJ-SHARMA27

@SURAJ-SHARMA27 have you had a chance to look at these comments?

alisman avatar May 13 '24 14:05 alisman

@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.

SURAJ-SHARMA27 avatar May 22 '24 16:05 SURAJ-SHARMA27