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

Always show label for pie chart when ratio is larger than 0.25 #4429

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/pages/studyView/charts/pieChart/PieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ export default class PieChart extends React.Component<IPieChartProps, {}>

@autobind
private label(d: ClinicalDataCountSummary) {
return d.count / this.totalCount > 0.5
// Always show label when ratio of pie is larger than 0.25
// If ratio of pie is less than 0.25, do check the max length we can show the text and the text length
// to decide if we should show the label or not
return d.count / this.totalCount > 0.25
? d.count.toLocaleString()
: this.maxLength(
d.count / this.totalCount,
Expand Down