Skip to content

Commit 7305c2c

Browse files
authored
Merge pull request #123 from gdfreitas/y-axis-overlapping
add minor adjustments on y axis label to prevent overlapping
2 parents e27fd71 + b0f1c12 commit 7305c2c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/CentileChart/CentileChart.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,14 @@ function CentileChart({
364364
<VictoryAxis
365365
minDomain={0}
366366
label={yAxisLabel(measurementMethod, false)}
367+
axisLabelComponent={
368+
<VictoryLabel
369+
dx={0}
370+
// adjust label margins relatively to font size of yAxis text to prevent overlapping
371+
dy={(styles.yAxis.tickLabels.fontSize - 5) * -1}
372+
style={styles.yAxis.axisLabel}
373+
/>
374+
}
367375
style={styles.yAxis}
368376
dependentAxis
369377
/>

src/SDSChart/SDSChart.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,14 @@ const SDSChart: React.FC<SDSChartProps> = (
327327
<VictoryAxis
328328
domain={{ y: [newLowerY, newUpperY] }}
329329
label={yAxisLabel(measurementMethod, true)}
330+
axisLabelComponent={
331+
<VictoryLabel
332+
dx={0}
333+
// adjust label margins relatively to font size of yAxis text to prevent overlapping
334+
dy={(styles.yAxis.tickLabels.fontSize - 5) * -1}
335+
style={styles.yAxis.axisLabel}
336+
/>
337+
}
330338
tickValues={[
331339
-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,
332340
4.0, 4.67, 5.33,

0 commit comments

Comments
 (0)