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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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 366be8a
🔍 Latest deploy log https://app.netlify.com/sites/cbioportalfrontend/deploys/6762637dbab0b200082eb64f
😎 Deploy Preview https://deploy-preview-4951.cancerrevue.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 from c4893d4 to 1e659a4 Compare August 19, 2024 17:56
@olzhasmukayev olzhasmukayev force-pushed the feat/category-bar-chart branch 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 from dcf08bf to 3b5fffa Compare December 18, 2024 05:50
@olzhasmukayev olzhasmukayev force-pushed the feat/category-bar-chart branch from 3b5fffa to 14d9b89 Compare December 18, 2024 05:52
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.

3 participants