Skip to content

Commit

Permalink
✨ (discrete bar) thin zero line (#4372)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann authored Jan 3, 2025
1 parent 0fbc2ea commit daf1174
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ export class DiscreteBarChart
const { manager, yAxis, innerBounds } = this

const axisLineWidth = manager.isStaticAndSmall
? GRAPHER_AXIS_LINE_WIDTH_THICK
: GRAPHER_AXIS_LINE_WIDTH_DEFAULT
? 0.5 * GRAPHER_AXIS_LINE_WIDTH_THICK
: 0.5 * GRAPHER_AXIS_LINE_WIDTH_DEFAULT

return (
<>
Expand All @@ -512,6 +512,14 @@ export class DiscreteBarChart
horizontalAxis={yAxis}
bounds={innerBounds}
strokeWidth={axisLineWidth}
// if the chart doesn't have negative values, then we
// move the zero line a little to the left to avoid
// overlap with the bars
align={
this.hasNegative
? HorizontalAlign.center
: HorizontalAlign.right
}
/>
)}
{this.renderBars()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ export class StackedDiscreteBarChart
<HorizontalAxisZeroLine
horizontalAxis={yAxis}
bounds={innerBounds}
strokeWidth={axisLineWidth}
strokeWidth={0.5 * axisLineWidth}
// moves the zero line a little to the left to avoid
// overlap with the bars
align={HorizontalAlign.right}
Expand Down

0 comments on commit daf1174

Please sign in to comment.