Skip to content

Commit

Permalink
fix(BarChart & BulletChart): adjust y-axis label distribution (#6406)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas742 authored Sep 25, 2024
1 parent 6759403 commit a7f3284
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/charts/src/components/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ const BarChart = forwardRef<HTMLDivElement, BarChartProps>((props, ref) => {
dimensions.map((dimension, index) => {
return (
<YAxis
interval={dimension?.interval ?? (isBigDataSet ? 'preserveStart' : 0)}
interval={dimension?.interval ?? 'preserveStartEnd'}
minTickGap={isBigDataSet ? undefined : -10}
type="category"
key={dimension.reactKey}
dataKey={dimension.accessor}
Expand Down
4 changes: 3 additions & 1 deletion packages/charts/src/components/BulletChart/BulletChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ const BulletChart = forwardRef<HTMLDivElement, BulletChartProps>((props, ref) =>
let AxisComponent;
const axisProps: any = {

Check warning on line 305 in packages/charts/src/components/BulletChart/BulletChart.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
dataKey: dimension.accessor,
interval: dimension?.interval ?? (isBigDataSet ? 'preserveStart' : 0),
interval: dimension?.interval ?? (isBigDataSet ? 'preserveStartEnd' : 0),
tickLine: index < 1,
axisLine: index < 1,
allowDuplicatedCategory: index === 0
Expand All @@ -317,6 +317,8 @@ const BulletChart = forwardRef<HTMLDivElement, BulletChartProps>((props, ref) =>
axisProps.width = yAxisWidth;
AxisComponent = YAxis;
axisProps.orientation = isRTL ? 'right' : 'left';
axisProps.interval = 'preserveStartEnd';
axisProps.minTickGap = isBigDataSet ? undefined : -10;
} else {
axisProps.dataKey = dimension.accessor;
axisProps.tick = <XAxisTicks config={dimension} />;
Expand Down

0 comments on commit a7f3284

Please sign in to comment.