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

Bar Charts with larger scales have wider margins #331

Merged
merged 7 commits into from
Aug 1, 2023
9 changes: 6 additions & 3 deletions site/src/component/GradeDist/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,19 @@ export default class Chart extends React.Component<ChartProps> {
* @return a JSX block rendering the chart
*/
render() {
const data = this.getClassData()
const largeGraphScale = data.some((grade) => Object.values(grade).some((value) => value > 999));
KevinWu098 marked this conversation as resolved.
Show resolved Hide resolved

return <>
<ResponsiveBar
data={this.getClassData()}
data={data}
keys={['A', 'B', 'C', 'D', 'F', 'P', 'NP']}
indexBy='label'
margin={{
top: 50,
right: 30,
right: largeGraphScale ? 35: 30,
bottom: 50,
left: 30
left: largeGraphScale ? 35: 30,
}}
layout='vertical'
axisBottom={{
Expand Down