Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Categorical Bar Chart on Study View #4951

Closed

Conversation

olzhasmukayev
Copy link
Contributor

@olzhasmukayev olzhasmukayev commented Jul 25, 2024

Choose chart type:

image

Copy link

netlify bot commented Jul 25, 2024

Deploy Preview for cbioportalfrontend ready!

Name Link
🔨 Latest commit b2aed9a
🔍 Latest deploy log https://app.netlify.com/sites/cbioportalfrontend/deploys/678936556ead7f0008ebdff6
😎 Deploy Preview https://deploy-preview-4951.preview.cbioportal.org
📱 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.

@olzhasmukayev olzhasmukayev force-pushed the feat/category-bar-chart branch from 8f83fcc to c4893d4 Compare July 26, 2024 06:23
@@ -312,3 +324,18 @@ export const STUDY_VIEW_CONFIG: StudyViewConfig = _.assign(
studyViewFrontEnd,
(getServerConfig() || {}).study_view
);

export const chartChangeOptionsMap: ChangeChartOptionsMap = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this used?

uniqueKey: string,
data: ClinicalDataCount[] | string[]
): void {
const { totalCount, naCount } = (data as (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comments here to explain what's happening here. can also add comments below to describe the method of choosing which chart

@@ -414,6 +416,85 @@ export class ChartHeader extends React.Component<IChartHeaderProps, {}> {
);
}

if (
this.props.chartControls &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can simplify to this.props.chartControls?.showChartChangeOptions


@autobind
private onSelection(bars: { data: BarDatum[] }[]): void {
const dataBins = _.flatten(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when performing multiple array functions, lets chain multiple lodash functions like
_(bars) .function() .function() ...
lodash has a map function

const TILT_ANGLE = 30;

@observer
export default class CategoryBarChart
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm noticing some similarities with our existing BarChart component. can we look into maybe extending it or reusing that code to prevent duplicate code?

}
}

const onlyContainsNA = (element: BarDatum): boolean => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like said above, these functions are in BarChart as well. we could make export these functions to prevent duplication

import { VictoryLabel, Helpers } from 'victory';
import { Tooltip, OverlayTrigger } from 'react-bootstrap';

export class CategoryBarChartAxisLabel extends VictoryLabel {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above. i think we have very similar components with our BarChart component. it would be nice to reuse this somehow. lets look into this for all similarly related components

updateCurrentBinsValue() {
let newBins: number[] = [];
if (this.currentBinMethod === BinMethodOption.CUSTOM) {
newBins = _.sortBy(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lodash chaining here as well

@@ -1451,6 +1484,11 @@ export class ChartContainer extends React.Component<IChartContainerProps, {}> {
() => (this.newlyAdded = false),
STUDY_VIEW_CONFIG.thresholds.chartHighlight
);
} else if (this.chartChanged) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently when changing a chart type, the highlight doesn't go away. look into the mechanism behind this and figure out why

@inodb inodb changed the title feat: add category bar chart Add Categorical Bar Chart on Study View Aug 13, 2024
@inodb
Copy link
Member

inodb commented Aug 13, 2024

@olzhasmukayev Nice work! Can we enable it for Metastatic Sites as well?

image

@olzhasmukayev olzhasmukayev force-pushed the feat/category-bar-chart branch 2 times, most recently from 66fcf9a to 4a7e78b Compare August 19, 2024 19:03
@olzhasmukayev olzhasmukayev force-pushed the feat/category-bar-chart branch from b3116f6 to dcf08bf Compare September 12, 2024 13:06
@olzhasmukayev olzhasmukayev force-pushed the feat/category-bar-chart branch 2 times, most recently from 3b5fffa to 14d9b89 Compare December 18, 2024 05:52
@inodb inodb added the gsoc label Jan 3, 2025
arishta and others added 10 commits January 16, 2025 21:24
- in custom selection text box take inputs with commas, space or new line or all combined also
- add an example placeholder
Adds a condition to the link text where if all resources are of the same type, then rename the Files & Links tab to the resourceDefinition displayName
* fix log scale breaking box plot
* update screenshots

---------

Co-authored-by: Bryan Lai <[email protected]>
* Update screenshots

* Fix quick search test

* Update api clients and fix typing of new Clickhouse dependent code

* Add a wait for bin screenshot test
* Update api client

* resolve type complains
Nelliney and others added 5 commits January 16, 2025 21:25
* Fix: handle empty "Files and Links" tab in patient view

---------

Co-authored-by: alisman <[email protected]>
…oPortal#5084)

* Update logScalePossible for generic assay negative data

* make sure that return type is always boolean

* Add test for negative and positive data of type number
* Add ellipse for long label in Timeline chart with a tooltip when too truncated. Also add padding between end of label and arrow.

* fix: limit width of left bar
@olzhasmukayev olzhasmukayev force-pushed the feat/category-bar-chart branch from c76f0bc to 278fdf5 Compare January 16, 2025 16:26
olzhasmukayev and others added 3 commits January 16, 2025 21:32
* Update screenshots

* Fix quick search test

* Update api clients and fix typing of new Clickhouse dependent code

* Add a wait for bin screenshot test
* Update api client

* resolve type complains
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.