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

Pie Chart no longer has -235px Margins (overflow) #334

Merged
merged 2 commits into from
Aug 29, 2023
Merged
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
21 changes: 13 additions & 8 deletions site/src/component/GradeDist/Pie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default class Pie extends React.Component<PieProps> {

render() {
return (
<div style={{ width: '100%' }}>
<div style={{ width: '100%', position: 'relative' }}>
<ResponsivePie<Slice>
data={this.getClassData()}
margin={{
Expand Down Expand Up @@ -173,13 +173,18 @@ export default class Pie extends React.Component<PieProps> {
</div>
)}
/>
<div style={{ display: 'flex', textAlign: 'center', margin: '-235px' }}>
<div style={{ margin: 'auto' }}>
{this.totalPNP == this.total ? <h3 className='pie-text'>Average Grade: {this.averagePNP}</h3> : null}
{this.totalPNP != this.total ? <h3 className='pie-text'>Average Grade: {this.averageGrade} ({this.averageGPA})</h3> : null}
<h3 className='pie-text' style={{ marginBottom: '6px' }}>Total Enrolled: <strong>{this.total}</strong></h3>
{this.totalPNP > 0 ? <small>{this.totalPNP} enrolled as P/NP</small> : null}
</div>
<div style={{
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
textAlign: 'center',
width: '100%'
}}>
{this.totalPNP == this.total ? <h3 className='pie-text'>Average Grade: {this.averagePNP}</h3> : null}
{this.totalPNP != this.total ? <h3 className='pie-text'>Average Grade: {this.averageGrade} ({this.averageGPA})</h3> : null}
<h3 className='pie-text' style={{ marginBottom: '6px' }}>Total Enrolled: <strong>{this.total}</strong></h3>
{this.totalPNP > 0 ? <small>{this.totalPNP} enrolled as P/NP</small> : null}
</div>
</div>
)
Expand Down