Skip to content

Commit

Permalink
add minor adjustments on y axis label to prevent overlapping
Browse files Browse the repository at this point in the history
  • Loading branch information
gdfreitas committed Oct 25, 2024
1 parent 4ff0f1b commit b0f1c12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/CentileChart/CentileChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@ function CentileChart({
<VictoryAxis
minDomain={0}
label={yAxisLabel(measurementMethod, false)}
axisLabelComponent={
<VictoryLabel
dx={0}
// adjust label margins relatively to font size of yAxis text to prevent overlapping
dy={(styles.yAxis.tickLabels.fontSize - 5) * -1}
style={styles.yAxis.axisLabel}
/>
}
style={styles.yAxis}
dependentAxis
/>
Expand Down
8 changes: 8 additions & 0 deletions src/SDSChart/SDSChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ const SDSChart: React.FC<SDSChartProps> = (
<VictoryAxis
domain={{ y: [newLowerY, newUpperY] }}
label={yAxisLabel(measurementMethod, true)}
axisLabelComponent={
<VictoryLabel
dx={0}
// adjust label margins relatively to font size of yAxis text to prevent overlapping
dy={(styles.yAxis.tickLabels.fontSize - 5) * -1}
style={styles.yAxis.axisLabel}
/>
}
tickValues={[
-5.33, -4.67, -4.0, -3.33, -2.67, -2.0, -1.33, -0.67, 0, 0.67, 1.33, 2.0, 2.67, 3.33,
4.0, 4.67, 5.33,
Expand Down

0 comments on commit b0f1c12

Please sign in to comment.