Skip to content

Commit

Permalink
Add maxBarThickness for chart.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jiji14 committed May 25, 2024
1 parent 084224e commit 8cf5fb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions www/js/components/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export type Props = {
showLegend?: boolean;
reverse?: boolean;
enableTooltip?: boolean;
maxBarThickness?: number;
};
const Chart = ({
records,
Expand All @@ -49,6 +50,7 @@ const Chart = ({
showLegend = true,
reverse = true,
enableTooltip = true,
maxBarThickness = 100,
}: Props) => {
const { colors } = useTheme();
const [numVisibleDatasets, setNumVisibleDatasets] = useState(1);
Expand All @@ -74,6 +76,7 @@ const Chart = ({
getColorForChartEl?.(chartRef.current, e, barCtx, 'border'),
borderWidth: borderWidth || 2,
borderRadius: 3,
maxBarThickness: maxBarThickness,
})),
};
}, [chartDatasets, getColorForLabel]);
Expand Down
1 change: 1 addition & 0 deletions www/js/metrics/SurveyTripCategoriesCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const SurveyTripCategoriesCard = ({ userMetrics, aggMetrics }: Props) => {
getColorForChartEl={(l) => (l === 'Response' ? colors.navy : colors.orange)}
showLegend={false}
reverse={false}
maxBarThickness={60}
/>
<LabelPanel first={t('main-metrics.response')} second={t('main-metrics.no-response')} />
</>
Expand Down

0 comments on commit 8cf5fb0

Please sign in to comment.